* libltdl/m4/libtool.m4 (_LT_PROG_FC): Undo commit - bad idea.
[libtool.git] / libtoolize.m4sh
blob3bab1459ba84531c1218068cf701447c15da5ac2
1 m4_define([_m4_divert(SCRIPT)], 100)
2 m4_divert_push([SCRIPT])#! /bin/sh
3 # @configure_input@
5 # libtoolize (GNU @PACKAGE@@TIMESTAMP@) @VERSION@
6 # Written by Gary V. Vaughan <gary@gnu.org>, 2003
8 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
9 # This is free software; see the source for copying conditions.  There is NO
10 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 # Libtoolize is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
17 # Libtoolize is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with libtoolize; see the file COPYING.  If not, a copy
24 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
25 # or obtained by writing to the Free Software Foundation, Inc.,
26 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 # Usage: $progname [OPTION]...
30 # Prepare a package to use libtool.
32 # -c, --copy            copy files rather than symlinking them
33 #     --debug           enable verbose shell tracing
34 # -n, --dry-run         print commands rather than running them
35 # -f, --force           replace existing files
36 # -i, --install         copy missing auxiliary files
37 #     --ltdl[=DIR]      install libltdl sources [default: libltdl]
38 #     --nonrecursive    prepare ltdl for non-recursive make
39 # -q, --quiet           work silently
40 #     --recursive       prepare ltdl for recursive make
41 #     --subproject      prepare ltdl to configure and build independently
42 # -v, --verbose         verbosely report processing
43 #     --version         print version information and exit
44 # -h, --help            print short or long help message
46 # You must `cd' to the top directory of your package before you run
47 # `$progname'.
49 # When reporting a bug, please describe a test case to reproduce it and
50 # include the following information:
52 #       host-triplet:   @host_triplet@
53 #       $progname:      (GNU @PACKAGE@@TIMESTAMP@) @VERSION@
54 #       automake:               $automake_version
55 #       autoconf:               $autoconf_version
57 # Report bugs to <bug-libtool@gnu.org>.
59 : ${TAR=tar}
61 PROGRAM=libtoolize
63 AS_SHELL_SANITIZE
64 $as_unset CDPATH
66 m4_include([getopt.m4sh])
68 M4SH_VERBATIM([[
69 # test EBCDIC or ASCII
70 case `echo X|tr X '\101'` in
71  A) # ASCII based system
72     # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
73   SP2NL='tr \040 \012'
74   NL2SP='tr \015\012 \040\040'
75   ;;
76  *) # EBCDIC based system
77   SP2NL='tr \100 \n'
78   NL2SP='tr \r\n \100\100'
79   ;;
80 esac
83 # Command line options:
84 opt_debug=:
85 opt_force=false
86 opt_install=false
87 opt_link=:
88 opt_ltdl=false
90 seen_autoconf=false
91 seen_libtool=false
92 seen_ltdl=false
94 # ltdl can be installed to be self-contained (subproject, the default);
95 # or to be configured by a parent project, either with a recursive or
96 # nonrecursive automake driven make:
97 ltdl_mode=
99 # Locations for important files:
100 prefix=@prefix@
101 datadir=@datadir@
102 pkgdatadir=@pkgdatadir@
103 pkgltdldir=@pkgdatadir@
104 aclocaldir=@aclocaldir@
105 auxdir=
106 macrodir=
107 ltdldir=
108 configure_ac=configure.in
111 # Parse options once, thoroughly.  This comes as soon as possible in
112 # the script to make things like `libtoolize --version' happen quickly.
114   # sed scripts:
115   my_sed_single_opt='1s/^\(..\).*$/\1/;q'
116   my_sed_single_rest='1s/^..\(.*\)$/\1/;q'
117   my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
118   my_sed_long_arg='1s/^--[^=]*=//'
120   while test "$#" -gt 0; do
121     opt="$1"
122     shift
123     case $opt in
124       --copy|-c)        opt_link=false ;;
126       --debug)          func_echo "enabling shell trace mode"
127                         opt_debug='set -x'
128                         $opt_debug
129                         ;;
131       --dry-run|-n)     if $opt_dry_run; then :; else
132                           opt_dry_run=:
133                           RM="$ECHO $RM"
134                           test -n "$LN_S" && LN_S="$ECHO $LN_S"
135                           CP="$ECHO $CP"
136                           MKDIR="$ECHO $MKDIR"
137                           TAR="$ECHO $TAR"
138                         fi
139                         ;;
141       --force|-f)       opt_force=: ;;
143       --install|-i)     opt_install=: ;;
145       --ltdl)           opt_ltdl=:
146                         if test "$#" -gt 0; then
147                           case $1 in
148                             -*) ;;
149                             *)  ltdldir=`$ECHO "X$1" | $Xsed -e 's,/*$,,'`
150                                 shift
151                                 ;;
152                           esac
153                         fi
154                         ;;
156       --nonrecursive|--non-recursive)
157                         ltdl_mode=nonrecursive
158                         ;;
160       --quiet|--automake|-q) # --automake is for 1.5 compatibility
161                         opt_quiet=:
162                         ;;
164       --recursive)      ltdl_mode=recursive ;;
166       --subproject)     ltdl_mode=subproject ;;
168       --verbose|-v)     opt_verbose=: ;;
170       # Separate optargs to long options:
171       --*=*)
172                         arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_arg"`
173                         opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_opt"`
174                         set dummy "$opt" "$arg" ${1+"$@"}
175                         shift
176                         ;;
178       # Separate optargs to short options:
179       #-X*)
180       #                 arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_rest"`
181       #                 opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_opt"`
182       #                 set dummy "$opt" "$arg" ${1+"$@"}
183       #                 shift
184       #                 ;;
186       # Separate non-argument short options:
187       -c*|-f*|-i*|-n*|-q*|-v*)
188                         rest=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_rest"`
189                         opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_opt"`
190                         set dummy "$opt" "-$rest" ${1+"$@"}
191                         shift
192                         ;;
194       -\?|-h)           func_usage                                      ;;
195       --help)           func_help                                       ;;
196       --version)        func_version                                    ;;
197       --)               break                                           ;;
198       -*)               func_fatal_help "unrecognized option \`$opt'"   ;;
199       *)                func_fatal_help "too many arguments"            ;;
200     esac
201   done
205 # func_copy srcfile destfile
206 # A wrapper for func_copy_cb that accepts arguments in the same order
207 # as the cp(1) shell command.
208 func_copy ()
210     $opt_debug
212     test -f "$1" || \
213       { func_error "\`$1' not copied:  not a regular file"; return 1; }
215     my_f1=`$ECHO "X$1" | $Xsed -e "$basename"`
217     if test -d "$2"; then
219       func_copy_cb "$my_f1" \
220         `$ECHO "X$1" | $Xsed -e "$dirname"` "$2"
222     else
224       # Supporting this would mean changing the timestamp:
225       test "X$my_f1" = X`$ECHO "X$2" | $Xsed -e "$basename"` \
226         || func_fatal_error "func_copy() cannot change filename on copy"
228       func_copy_cb "$my_f1" \
229         `$ECHO "X$1" | $Xsed -e "$dirname"` \
230         `$ECHO "X$2" | $Xsed -e "$dirname"`
232     fi
234     return $copy_return_status # set in func_copy_cb
238 # func_copy_cb filename srcdir destdir
239 # If option `--copy' was specified, or soft-linking SRCFILE to DESTFILE fails,
240 # then try to copy SRCFILE to DESTFILE (without changing the timestamp if
241 # possible).
242 func_copy_cb ()
244     $opt_debug
245     my_file="$1"
246     my_srcdir="$2"
247     my_destdir="$3"
248     copy_return_status=1
250     # Libtool is probably misinstalled if this happens:
251     test -f "$my_srcdir/$my_file" || 
252         func_fatal_error "\`$my_file' not found in \`$my_srcdir'"
254     case $opt_verbose in
255       false) my_copy_msg="file \`$my_destdir/$my_file'"     ;;
256       *)     my_copy_msg="file from \`$my_srcdir/$my_file'" ;;
257     esac
258     func_mkdir_p `$ECHO "X$my_destdir/$my_file" | $Xsed -e "$dirname"`
260     $RM "$my_destdir/$my_file"
261     if $opt_link; then
262       if test "$my_file" = "aclocal.m4"; then
263         if { ( cd "$my_srcdir" && $TAR chf - "$my_file" ) 2>/dev/null \
264              | ( umask 0 && cd "$my_destdir" && $TAR xf - ) >/dev/null 2>&1 ; }
265         then
266           $opt_quiet || func_echo "copying $my_copy_msg"
267           copy_return_status=0
268         fi
269       else
270         if $LN_S "$my_srcdir/$my_file" "$my_destdir/$my_file"; then
271           $opt_quiet || func_echo "linking $my_copy_msg"
272           copy_return_status=0
273         fi
274       fi
275     else
276       if { ( cd "$my_srcdir" && $TAR chf - "$my_file" ) 2>/dev/null \
277            | ( umask 0 && cd "$my_destdir" && $TAR xf - ) >/dev/null 2>&1; } \
278          && touch "$my_destdir/$my_file"; then
279         $opt_quiet || func_echo "copying $my_copy_msg"
280         copy_return_status=0
281       fi
282     fi
283     if test "$copy_return_status" != 0; then
284       func_error "can not copy \`$my_srcdir/$my_file' to \`$my_destdir/'"
285       exit_status=$EXIT_FAILURE
286     fi
290 # func_copy_some_files srcfile_spec srcdir destdir [copy_cb=func_copy_cb]
291 # Call COPY_CB for each regular file in SRCDIR named by the ':' delimited
292 # names in SRCFILE_SPEC.  The odd calling convention is needed to allow
293 # spaces in file and directory names.
294 func_copy_some_files ()
296     $opt_debug
297     my_srcfile_spec="$1"
298     my_srcdir="$2"
299     my_destdir="$3"
300     my_copy_cb="${4-func_copy_cb}"
302     my_save_IFS="$IFS"
303     IFS=:
304     for my_filename in $my_srcfile_spec; do
305       IFS="$my_save_IFS"
306       if test -f "$my_srcdir/$my_filename"; then
307         if test "X$my_copy_cb" = Xfunc_copy_cb; then
308           $opt_force || if test -f "$my_destdir/$my_filename"; then
309             $opt_quiet \
310               || func_error "\`$my_destdir/$my_filename' exists: use \`--force' to overwrite"
311             continue
312           fi
313         fi
314       else
315         func_fatal_error "\`$my_filename' not found in \`$my_srcdir'"
316       fi
318       $my_copy_cb "$my_filename" "$my_srcdir" "$my_destdir"
319     done
320     IFS="$my_save_IFS"
324 # func_fixup_Makefile srcfile srcdir destdir
325 func_fixup_Makefile ()
327     $opt_debug
328     my_filename="$1"
329     my_srcdir="$2"
330     my_destdir="$3"
331     my_fixup_non_subpackage_script="\
332       s,(LIBOBJS),(ltdl_LIBOBJS),g
333       s,(LTLIBOBJS),(ltdl_LTLIBOBJS),g
334       s,libltdl/configure.ac,,
335       s,libltdl/configure,,
336       s,libltdl/aclocal.m4,,
337       s,libltdl/config-h.in,,
338       s,libltdl/Makefile.am,,
339       s,libltdl/Makefile.in,,
340       /^[        ]*\\\\\$/d"
341     case $my_filename in
342       Makefile.am)
343         my_fixup_non_subpackage_script=`echo "$my_fixup_non_subpackage_script" | \
344                 sed 's,libltdl/,,'`
345         my_fixup_inc_paths_script= ;;
346       Makefile.inc)
347         repl=$ltdldir
348         repl_uscore=`$ECHO "X$repl" | $Xsed -e 's,[/.+-],_,g'`
349         my_fixup_inc_paths_script="\
350           s,libltdl_,@repl_uscore@_,
351           s,libltdl/,@repl@/,
352           s,: libltdl/,: @repl@/,
353           s, -Ilibltdl , -I@repl@ ,
354           s,\\\$(libltdl_,\$(@repl_uscore@_,
355           s,)/libltdl ,)/@repl@ ,
356           s,@repl_uscore@,${repl_uscore},g
357           s,@repl@,${repl},g"
358         ;;
359     esac
361     $RM "$my_destdir/$my_filename" 2>/dev/null
362     $opt_quiet || func_echo "creating file \`$my_destdir/$my_filename'"
363     if $opt_dry_run; then :;
364     else
365       $SED "$my_fixup_non_subpackage_script
366             $my_fixup_inc_paths_script" \
367         < "$my_srcdir/$my_filename" > "$my_destdir/$my_filename" ||
368         func_fatal_error "cannot create $my_destdir/$my_filename"
369     fi
372 # func_scan_files
373 # Scan configure.(ac|in) and aclocal.m4 (if present) for use of libltdl
374 # and libtool.  Possibly running some of these tools if necessary.
375 # Libtoolize affects the contents of aclocal.m4, and should be run before
376 # aclocal, so we can't use configure --trace which relies on a consistent
377 # configure.(ac|in) and aclocal.m4.
378 func_scan_files ()
380     $opt_debug
381     # Prefer configure.ac to configure.in
382     test -f configure.ac && configure_ac=configure.ac
383     test -f "$configure_ac" || configure_ac=
385     # Set local variables to reflect contents of configure.ac
386     my_sed_scan_configure_ac='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
387         /AC_INIT/ {
388             s,^.*$,seen_autoconf=:,
389             p
390         }
391         d'
392     test -z "$configure_ac" \
393         || eval `$SED "$my_sed_scan_configure_ac" "$configure_ac"`
395     $seen_autoconf || {
396         my_configure_ac=
397         test -n "$configure_ac" && my_configure_ac="$configure_ac: "
398         func_verbose "${my_configure_ac}not using Autoconf"
400         # Make sure ltdldir and ltdl_mode have sensible defaults
401         # since we return early here:
402         test -n "$ltdldir" || ltdldir=libltdl
403         test -n "$ltdl_mode" || ltdl_mode=subproject
405         return
406     }
408     # ---------------------------------------------------- #
409     # Probe macro usage in configure.ac and/or aclocal.m4. #
410     # ---------------------------------------------------- #
412     my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,
413         s,^.*AC_REQUIRE(.*$,,; s,^.*m4_require(.*$,,; s,^.*m4_define(.*$,,
414         s,^.*A[CU]_DEFUN(.*$,,; s,^.*m4_defun(.*$,,
415         /AC_CONFIG_AUX_DIR(/ {
416             s,^.*AC_CONFIG_AUX_DIR([[   ]*\([^])]*\).*$,ac_auxdir=\1,
417             p
418         }
419         /AC_CONFIG_MACRO_DIR(/ {
420             s,^.*AC_CONFIG_MACRO_DIR([[         ]*\([^])]*\).*$,ac_macrodir=\1,
421             p
422         }
423         /_LT_CONFIG_LTDL_DIR(/d
424         /LT_CONFIG_LTDL_DIR(/ {
425             s,^.*LT_CONFIG_LTDL_DIR([[   ]*\([^])]*\).*$,ac_ltdldir=\1,
426             p
427         }
428         /\@<:@A[CM]_PROG_LIBTOOL/d
429         /A[CM]_PROG_LIBTOOL/ {
430             s,^.*$,seen_libtool=:,
431             p
432         }
433         /the.*option into.*LT_INIT.*parameter/d
434         /\@<:@LT_INIT/d
435         /LT_INIT/                {
436             s,^.*$,seen_libtool=:,
437             p
438         }
439         /\@<:@LTDL_INIT/d
440         /LTDL_INIT/          {
441             s,^.*LTDL_INIT([[   ]*\([^])]*\).*$,ltdl_options="\1",
442             s,^.*LTDL_INIT[     ]*$,seen_ltdl=:,
443             p
444         }
445         /LT_WITH_LTDL/       {
446             s,^.*$,seen_ltdl=:,
447             p
448         }
449         /AC_LIB_LTDL/        {
450             s,^.*$,seen_ltdl=:,
451             p
452         }
453         /AC_WITH_LTDL/       {
454             s,^.*$,seen_ltdl=:,
455             p
456         }
457         d'
458     eval `cat aclocal.m4 "$configure_ac" 2>/dev/null | $SED "$my_sed_traces"`
461     # ----------------- #
462     # Validate ltdldir. #
463     # ----------------- #
465     ac_ltdldir=`$ECHO "X$ac_ltdldir" | $Xsed -e 's,/*$,,'`
467     # If $configure_ac contains AC_CONFIG_LTDL_DIR, check that its
468     # arguments were not given in terms of a shell variable!
469     case "$ac_ltdldir" in
470       *\$*)
471         func_fatal_error "can not handle variables in LT_CONFIG_LTDL_DIR"
472         ;;
473     esac
475     # If neither --ltdl nor LT_CONFIG_LTDL_DIR are specified, default to
476     # `libltdl'.  If both are specified, they must be the same.  Otherwise,
477     # take the one that is given! (If LT_CONFIG_LTDL_DIR is not specified
478     # we suggest adding it later in this code.)
479     case x$ac_ltdldir,x$ltdldir in
480       x,x)      ltdldir=libltdl         ;;
481       x*,x)     ltdldir=$ac_ltdldir     ;;
482       x,x*)     ltdldir=$ltdldir        ;;
483       *)
484         test x"$ac_ltdldir" = x"$ltdldir" || \
485             func_fatal_error "--ltdl='$ltdldir' does not match LT_CONFIG_LTDL_DIR($ac_ltdldir)"
486         ;;
487     esac
490     # ------------------- #
491     # Validate ltdl_mode. #
492     # ------------------- #
494     test -n "$ltdl_options" && seen_ltdl=:
496     # If $configure_ac contains LTDL_INIT, check that its
497     # arguments were not given in terms of a shell variable!
498     case "$ltdl_options" in
499       *\$*)
500         func_fatal_error "can not handle variables in LTDL_INIT"
501         ;;
502     esac
504     # Extract mode name from ltdl_options
505     # FIXME: Diagnose multiple conflicting modes in ltdl_options
506     ac_ltdl_mode=
507     case " $ltdl_options " in
508       *" nonrecursive "*)  ac_ltdl_mode=nonrecursive    ;;
509       *" recursive "*)     ac_ltdl_mode=recursive       ;;
510       *" subproject "*)    ac_ltdl_mode=subproject      ;;
511     esac
513     # If neither --ltdl nor an LTDL_INIT mode are specified, default to
514     # `subproject'.  If both are specified, they must be the same.  Otherwise,
515     # take the one that is given!
516     case x$ac_ltdl_mode,x$ltdl_mode in
517       x,x)      ltdl_mode=subproject    ;;
518       x*,x)     ltdl_mode=$ac_ltdl_mode ;;
519       x,x*)     ltdl_mode=$ltdl_mode    ;;
520       *)
521         test x"$ac_ltdl_mode" = x"$ltdl_mode" || \
522             func_fatal_error "--$ltdl_mode does not match LTDL_INIT($ac_ltdl_mode)"
523         ;;
524     esac
526     # ---------------- #
527     # Validate auxdir. #
528     # ---------------- #
530     if test -n "$ac_auxdir"; then
531       # If $configure_ac contains AC_CONFIG_AUX_DIR, check that it was
532       # not given in terms of a shell variable!
533       case "$ac_auxdir" in
534       *\$*)
535         func_fatal_error "can not handle variables in AC_CONFIG_AUX_DIR"
536         ;;
537       *)
538         auxdir=$ac_auxdir
539         ;;
540       esac
541     else
542       # Try to discover auxdir the same way it is discovered by configure.
543       # Note that we default to the current directory.
544       for dir in . .. ../..; do
545         if test -f "$dir/install-sh"; then
546           auxdir=$dir
547           break
548         elif test -f "$dir/install.sh"; then
549           auxdir="$dir"
550           break
551         fi
552       done
553     fi
555     # Just use the current directory if all else fails.
556     test -n "$auxdir" || auxdir=.
559     # ------------------------------ #
560     # Find local m4 macro directory. #
561     # ------------------------------ #
563     # If AC_CONFIG_MACRO_DIR turned nothing up, we hunt for ACLOCAL_AMFLAGS
564     # in `Makefile.am' for a `-I' argument.
566     my_sed_aclocal_flags='
567         /^[     ]*ACLOCAL_[A-Z_]*FLAGS[         ]*=/ {
568             s,^[^=]*=[  ]*\(.*\), \1,
569             q
570         }
571         d'
572     macrodir="$ac_macrodir"
573     if test ! -n "$macrodir" && test -f Makefile.am; then
574       my_macrodir_is_next=false
575       for arg in `$SED "$my_sed_aclocal_flags" Makefile.am`; do
576         if $my_macrodir_is_next; then
577           macrodir="$arg"
578           break
579         else
580           if test "X$arg" = "X-I"; then
581             my_macrodir_is_next=:
582           else
583             my_macrodir_is_next=false
584           fi
585         fi
586       done
587     fi
590 # func_included_files searchfile
591 # Output INCLUDEFILE if SEARCHFILE m4_includes it, else output SEARCHFILE.
592 func_included_files ()
594     $opt_debug
595     my_searchfile="$1"
597     my_include_regex=
598     my_sed_include='
599         /^m4_include(\[.*\])$/ {
600             s,^m4_include(\[\(.*\)\])$,\1,
601             p
602         }
603         d'
605     if test -f "$my_searchfile"; then
606       $ECHO "X$my_searchfile" | $Xsed
608       # Only recurse when we don't care if all the variables we use get
609       # trashed, since they are in global scope.
610       for my_filename in `$SED "$my_sed_include" "$my_searchfile"`; do
611         func_included_files $my_filename
612       done
613     fi
617 # func_serial filename [macro_regex]
618 # Output the value of the serial number comment in FILENAME, where the
619 # comment line must also match MACRO_REGEX, if given.
620 func_serial ()
622     $opt_debug
623     my_filename="$1"
624     my_macro_regex="$2"
625     my_sed_serial='
626         /^# serial [1-9][0-9.]*[        ]*'"$my_macro_regex"'[  ]*$/ {
627             s,^# serial \([1-9][0-9.]*\).*$,\1,
628             q
629         }
630         d'
632     # Search FILENAME and all the files it m4_includes for a serial number
633     # in the file that AC_DEFUNs MACRO_REGEX.
634     my_serial=
635     for my_file in `func_included_files "$my_filename"`; do
636       if test -z "$my_macro_regex" ||
637          test "$my_filename" = aclocal.m4 ||
638          test "$my_macro_regex" = `echo "$my_filename" | $SED "$basename"` ||
639          func_grep '^AC_DEFUN(\@<:@'"$my_macro_regex" "$my_file"
640       then
641         my_serial=`$SED -e "$my_sed_serial" "$my_file"`
642         break
643       fi
644     done
646     # If the file has no serial number, we assume it's ancient.
647     test -n "$my_serial" || my_serial=0
649     $ECHO $my_serial
653 # func_serial_max serial1 serial2
654 # Compare (possibly multi-part, '.' delimited) serial numbers, and
655 # return the largest in $func_serial_max_result.  If they are the
656 # same, func_serial_max_result will be empty.
657 func_serial_max ()
659     $opt_debug
660     my_serial1="$1"
661     my_serial2="$2"
663     my_sed_dot='s/\..*$//g'
664     my_sed_rest='s/^[0-9][1-9]*\.*//'
665     my_sed_digits='s/[^0-9.]//g'
667     # Incase they turn out to be the same, we'll set it to empty
668     func_serial_max_result=
670     test "X$1$2" = X`$ECHO "X$1$2" | $Xsed -e "$my_sed_digits"` || {
671       func_error "serial numbers \`$1' or \`$2' contain non-digit chars"
672       return
673     }
675     while test -n "$my_serial1$my_serial2"; do
676       my_serial1_part=`$ECHO "X$my_serial1" | $Xsed -e "$my_sed_dot"`
677       my_serial2_part=`$ECHO "X$my_serial2" | $Xsed -e "$my_sed_dot"`
679       test -z "$my_serial1_part$my_serial2_part" \
680         && break
682       test -z "$my_serial1_part" \
683         && { func_serial_max_result="$2"; break; }
685       test -z "$my_serial2_part" \
686         && { func_serial_max_result="$1"; break; }
688       test "$my_serial1_part" -gt "$my_serial2_part" \
689         && { func_serial_max_result="$1"; break; }
691       test "$my_serial2_part" -gt "$my_serial1_part" \
692         && { func_serial_max_result="$2"; break; }
694       my_serial1=`$ECHO "X$my_serial1" | $Xsed -e "$my_sed_rest"`
695       my_serial2=`$ECHO "X$my_serial2" | $Xsed -e "$my_sed_rest"`
696     done
700 # func_serial_update_check srcfile src_serial destfile dest_serial
701 # Unless SRC_SERIAL is newer than DEST_SERIAL set $func_serial_update_check
702 # to 'false'.
703 func_serial_update_check ()
705     $opt_debug
706     my_srcfile="$1"
707     my_src_serial="$2"
708     my_destfile="$3"
709     my_dest_serial="$4"
710     my_update_p=:
712     if test -f "$my_destfile"; then
713       test "X$my_src_serial" = "X0" && {
714         func_error "warning: no serial number on \`$my_srcfile', not copying."
715         return
716       }
718       # Determine whether the destination has an older serial.
719       func_serial_max "$my_src_serial" "$my_dest_serial"
720       test "X$my_src_serial" = "X$func_serial_max_result" || my_update_p=false
722       test "X$my_src_serial" = "X$func_serial_max_result" \
723         && func_verbose "\`$my_srcfile' is serial $my_src_serial, greater than $my_dest_serial in \`$my_destfile'"
725       if test "X$my_dest_serial" = "X$func_serial_max_result"; then
726         func_verbose "\`$my_srcfile' is serial $my_src_serial, less than $my_dest_serial in \`$my_destfile'"
727         $opt_force \
728           || func_error "\`$my_destfile' is newer: use \`--force' to overwrite"
729       fi
730     fi
732     func_serial_update_check_result="$my_update_p"
736 # func_serial_update filename srcdir destdir [macro_regex] [old_macro_regex]
737 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
738 # has a newer serial number, or DESTFILE does not yet exist, or the user
739 # specified `--force' at the command line.  If given, MACRO_REGEX or
740 # OLD_MACRO_REGEX must match any text after "# serial N" in both files.
741 func_serial_update ()
743     $opt_debug
744     my_filename="$1"
745     my_srcdir="$2"
746     my_destdir="$3"
747     my_macro_regex="$4"
748     my_old_macro_regex="$5"
750     my_serial_update_p=:
751     my_return_status=1
752     my_srcfile="$my_srcdir/$my_filename"
753     my_destfile="$my_destdir/$my_filename"
755     test -f "$my_srcfile" || func_fatal_error "\`$my_srcfile' does not exist."
757     if test -f "$my_destfile"; then
758       my_src_serial=`func_serial "$my_srcfile" "$my_macro_regex"`
759       my_dest_serial=`func_serial "$my_destfile" "$my_macro_regex"`
761       # Strictly, this libtoolize ought not to have to deal with ancient
762       # serial formats, but we accept them here to be complete:
763       test "X$my_src_serial" = "X0" &&
764         my_src_serial=`func_serial "$my_srcfile" "$my_old_macro_regex"`
766       test "X$my_dest_serial" = "X0" &&
767         my_dest_serial=`func_serial "$my_destfile" "$my_old_macro_regex"`
769       func_serial_update_check \
770         "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
771       my_serial_update_p="$func_serial_update_check_result"
772     fi
774     if $my_serial_update_p || $opt_force; then
775       func_copy "$my_srcfile" "$my_destfile"
776       my_return_status=$?
777     elif test "X$my_dest_serial" = "X$my_src_serial"; then
778       $opt_quiet \
779         || func_echo "\`$my_destfile' is already up to date."
780     fi
782     # Do this after the copy for hand maintained `aclocal.m4', incase
783     # it has `m4_include([DESTFILE])', so the copy effectively already
784     # updated `aclocal.m4'.
785     my_included_files=`func_included_files aclocal.m4`
786     case `echo " $my_included_files " | $NL2SP` in
788       # Skip included files:
789       *" $my_destfile "*) ;;
791       # Otherwise compare to aclocal.m4 serial number (func_serial
792       # returns 0 for older macro serial numbers before we provided
793       # serial tags, so the update message will be correctly given
794       # if aclocal.m4 contains an untagged --i.e older-- macro file):
795       *)
796         if test -f aclocal.m4; then
797           func_serial_max \
798               "$my_src_serial" `func_serial aclocal.m4 "$my_macro_regex"`
799           test "X$my_src_serial" = "X$func_serial_max_result" \
800               && func_echo "You should add the contents of \`$my_destfile' to \`aclocal.m4'."
801         fi
802         ;;
803     esac
804     return $my_return_status
808 # func_keyword_update filename srcdir destdir sed_script
809 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
810 # has a newer revision according to the serial number extracted by
811 # SED_SCRIPT, or DESTFILE does not yet exist, or the user specified
812 # `--force' at the command line.
813 func_keyword_update ()
815     $opt_debug
816     my_filename="$1"
817     my_srcdir="$2"
818     my_destdir="$3"
819     my_sed_script="$4"
821     my_srcfile="$my_srcdir/$my_filename"
822     my_destfile="$my_destdir/$my_filename"
824     my_keyword_update_p=:
826     test -f "$my_srcfile" || func_fatal_error "\`$my_srcfile' does not exist."
828     if test -f "$my_destfile"; then
829       my_src_serial=`$SED -e "$my_sed_script" "$my_srcfile"`
830       test -z "$my_src_serial" && {
831         func_error "warning: no serial number in \`$my_srcfile', not copying."
832         return
833       }
835       my_dest_serial=`$SED -e "$my_sed_script" "$my_destfile"`
836       test -n "$my_dest_serial" || my_dest_serial=0
838       func_serial_update_check \
839          "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
840       my_keyword_update_p="$func_serial_update_check_result"
841     fi
843     if $my_keyword_update_p || $opt_force; then
844       func_copy "$my_srcfile" "$my_destfile"
845     elif test "X$my_dest_serial" = "X$my_src_serial"; then
846       $opt_quiet \
847         || func_echo "\`$my_destfile' is already up to date."
848     fi
852 # func_ltmain_update filename srcdir destdir
853 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
854 # has a newer revision, or DESTFILE does not yet exist, or the user
855 # specified `--force' at the command line.
856 func_ltmain_update ()
858     $opt_debug
859     my_sed_ltmain='
860         /^package_revision='\''*[0-9][1-9.]*'\''*/ {
861             s,^package_revision='\''*\([0-9.]*\)'\''*[  ]*$,\1,
862             p
863         }
864         d'
866     func_keyword_update "$1" "$2" "$3" "$my_sed_ltmain"
868     return $my_return_status
872 # func_config_update filename srcdir destdir
873 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
874 # has a newer timestamp, or DESTFILE does not yet exist, or the user
875 # specified `--force' at the command line.
876 func_config_update ()
878     $opt_debug
879     my_sed_config='
880         /^timestamp='\''*[0-9][1-9-]*'\''*/ {
881             s,^timestamp='\''*\([0-9-]*\)'\''*,\1,
882             s/-/./g
883             p
884         }
885         d'
887     func_keyword_update "$1" "$2" "$3" "$my_sed_config"
889     return $my_return_status
893 # func_install_update filename srcdir destdir
894 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
895 # has a newer timestamp, or DESTFILE does not yet exist, or the user
896 # specified `--force' at the command line.
897 func_install_update ()
899     $opt_debug
900     my_sed_install='
901         /^scriptversion='\''*[0-9][1-9.-]*'\''*/ {
902             s,^scriptversion='\''*\([0-9.-]*\)'\''*,\1,
903             s/-/./g
904             p
905         }
906         d'
908     func_keyword_update "$1" "$2" "$3" "$my_sed_install"
910     return $my_return_status
914 # func_massage_aclocal_DATA [glob_exclude]
915 # @aclocal_DATA\@ is substituted as per its value in Makefile.am;
916 # this function massages it into a suitable format for func_copy_some_files.
917 func_massage_aclocal_DATA ()
919     $opt_debug
920     pkgmacro_files=     # GLOBAL VAR
922     my_glob_exclude="$1"
924     # Massage a value for pkgmacro_files from the value used in Makefile.am.
925     for my_filename in @aclocal_DATA@; do
926       my_filename=`$ECHO "X$my_filename" | $Xsed -e "$basename"`
928       # ignore excluded filenames
929       if test -n "$my_glob_exclude"; then
930         my_cont=false
931         eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac'
932         $my_cont && continue
933       fi
935       pkgmacro_files="$pkgmacro_files:$my_filename"
936     done
938     # strip spurious leading `:'
939     pkgmacro_files=`$ECHO "X$pkgmacro_files" | $Xsed -e 's,^:*,,'`
943 # func_install_pkgmacro_subproject
944 # Unless --quiet was passed, display a message. Then copy pkgmacro_files
945 # from libtool installation tree to subproject libltdl tree.
946 func_install_pkgmacro_subproject ()
948     $opt_debug
950     # Copy all the files from installed libltdl to this project, if the
951     # user specified a macrodir.
952     $opt_quiet || if test "x$macrodir" != "x$subproject_macrodir"; then
953       func_echo "putting macros in \`$subproject_macrodir'."
954     elif test -n "$subproject_macrodir"; then
955       func_echo "putting macros in AC_CONFIG_MACRO_DIR, \`$subproject_macrodir'."
956     fi
958     func_copy_some_files "argz.m4:libtool.m4:ltdl.m4:$pkgmacro_files" \
959       "$aclocaldir" "$subproject_macrodir"
963 # func_install_pkgmacro_parent
964 # Unless --quiet was passed, or AC_CONFIG_MACRO_DIR was not seen, display
965 # a message.  Then update appropriate macros if newer ones are available
966 # from the libtool installation tree.
967 func_install_pkgmacro_parent ()
969     $opt_debug
971     # Copy all the files from installed libltdl to this project, if the
972     # user specified a macrodir.
973     $opt_quiet || if test -n "$ac_macrodir"; then
974       func_echo "putting macros in AC_CONFIG_MACRO_DIR, \`$ac_macrodir'."
975     elif test -n "$macrodir"; then
976       func_echo "putting macros in \`$macrodir'."
977     fi
979     if $opt_ltdl; then
980       func_serial_update argz.m4 "$aclocaldir" "$macrodir" argz.m4
981     else
982       func_verbose "Not copying \`$macrodir/argz.m4', libltdl not used."
983     fi
985     func_serial_update  libtool.m4 "$aclocaldir" "$macrodir" \
986       LT_INIT 'A[CM]_PROG_LIBTOOL'
988     if $opt_ltdl; then
989       func_serial_update ltdl.m4 "$aclocaldir" "$macrodir" 'LTDL_INIT'
990     else
991       func_verbose "Not copying \`$macrodir/ltdl.m4', libltdl not used."
992     fi
994     my_save_IFS="$IFS"
995     IFS=:
996     for file in $pkgmacro_files; do
997       IFS="$my_save_IFS"
998       func_serial_update $file "$aclocaldir" "$macrodir" "$file"
999     done
1000     IFS="$my_save_IFS"
1004 # func_install_pkgmacro_files
1005 # Install copies of the libtool and libltdl m4 macros into this package.
1006 func_install_pkgmacro_files ()
1008     $opt_debug
1010     # argz.m4, libtool.m4 and ltdl.m4 are handled specially:
1011     func_massage_aclocal_DATA 'argz.m4|libtool.m4|ltdl.m4'
1013   # 1. Parent has separate macrodir to subproject ltdl:
1014     if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" &&
1015        test -n "$macrodir" && test "x$macrodir" != "x$subproject_macrodir"
1016     then
1017       func_install_pkgmacro_parent
1018       func_install_pkgmacro_subproject
1020   # 2. Parent shares macrodir with subproject ltdl:
1021     elif $opt_ltdl && test "x$ltdl_mode" = "xsubproject"
1022        # && test "x$macrodir" = "x$subproject_macrodir"
1023     then
1024       func_install_pkgmacro_subproject
1026   # 3. Not a subproject, but macrodir was specified in parent:
1027     elif test -n "$macrodir"; then
1028       func_install_pkgmacro_parent
1030   # 4. AC_CONFIG_MACRO_DIR was not specified:
1031     else
1032       func_verbose "AC_CONFIG_MACRO_DIR not defined, not copying libtool macros."
1033     fi
1037 # func_massage_pkgltdl_files [glob_exclude]
1038 # @pkgltdl_files\@ is substituted as per its value in Makefile.am; this
1039 # function massages it into a suitable format for func_copy_some_files.
1040 func_massage_pkgltdl_files ()
1042     $opt_debug
1043     pkgltdl_files=      # GLOBAL VAR
1045     my_glob_exclude="$1"
1047     # Massage a value for pkgltdl_files from the value used in Makefile.am
1048     for my_filename in @pkgltdl_files@; do
1050       # Strip surplus leading 'libltdl/':
1051       my_filename=`expr "X$my_filename" : 'Xlibltdl/\(.*\)'`
1053       # ignore excluded filenames
1054       if test -n "$my_glob_exclude"; then
1055         my_cont=false
1056         eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac'
1057         $my_cont && continue
1058       fi
1060       # ignore duplicates
1061       case :$pkgltdl_files: in
1062         *:$my_filename:*) ;;
1063         *) pkgltdl_files="$pkgltdl_files:$my_filename" ;;
1064       esac
1065     done
1067     # strip spurious leading `:'
1068     pkgltdl_files=`$ECHO "X$pkgltdl_files" | $Xsed -e 's,^:*,,'`
1072 # func_install_pkgltdl_files
1073 # Install copies of the libltdl files into this package.  Any auxiliary
1074 # or m4 macro files needed in the libltdl tree will also be copied by
1075 # func_install_pkgconfig_files and func_install_pkgmacro_files resp.
1076 func_install_pkgltdl_files ()
1078     $opt_debug
1079     $opt_ltdl || return
1081     # Copy all the files from installed libltdl to this project, if the
1082     # user specified `--ltdl'.
1083     $opt_quiet || if test -n "$ac_ltdldir"; then
1084       func_echo "putting libltdl files in LT_CONFIG_LTDL_DIR, \`$ac_ltdldir'."
1085     elif test -n "$ltdldir"; then
1086       func_echo "putting libltdl files in \`$ltdldir'."
1087     fi
1089     # These files are handled specially, depending on ltdl_mode:
1090     if test "x$ltdl_mode" = "xsubproject"; then
1091       func_massage_pkgltdl_files 'Makefile.inc'
1092     else
1093       func_massage_pkgltdl_files 'Makefile.am|Makefile.in*|aclocal.m4|config*'
1094     fi
1096     func_copy_some_files "$pkgltdl_files" "$pkgltdldir/libltdl" "$ltdldir"
1098     # For recursive ltdl modes, copy a suitable Makefile.{am,inc}:
1099     case $ltdl_mode in
1100       recursive)
1101         func_fixup_Makefile "Makefile.am" "$pkgltdldir/libltdl" "$ltdldir"
1102         ;;
1103       nonrecursive)
1104         func_fixup_Makefile "Makefile.inc" "$pkgltdldir/libltdl" "$ltdldir"
1105         ;;
1106     esac
1110 # func_massage_pkgconfig_files [glob_exclude]
1111 # @pkgconfig_files\@ is substituted as per its value in Makefile.am; this
1112 # function massages it into a suitable format for func_copy_some_files.
1113 func_massage_pkgconfig_files ()
1115     $opt_debug
1116     pkgconfig_files=    # GLOBAL VAR
1118     my_glob_exclude="$1"
1120     # Massage a value for pkgconfig_files from the value used in Makefile.am
1121     for my_filename in @pkgconfig_files@; do
1123       # ignore excluded filenames
1124       if test -n "$my_glob_exclude"; then
1125         my_cont=false
1126         eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac'
1127         $my_cont && continue
1128       fi
1130       # ignore duplicates
1131       case :$pkgconfig_files: in
1132         *:$my_filename:*) ;;
1133         *) pkgconfig_files="$pkgconfig_files:$my_filename" ;;
1134       esac
1135     done
1137     # strip spurious leading `:'
1138     pkgconfig_files=`$ECHO "X$pkgconfig_files" | $Xsed -e 's,^:*,,'`
1142 # func_install_pkgconfig_subproject
1143 # Unless --quiet was passed, display a message. Then copy pkgconfig_files
1144 # from libtool installation tree to subproject libltdl tree.
1145 func_install_pkgconfig_subproject ()
1147     $opt_debug
1149     # Copy all the files from installed libltdl to this project, if the
1150     # user specified an auxdir.
1151     $opt_quiet || if test "x$ac_auxdir" = "x$subproject_auxdir"; then
1152       func_echo "putting auxiliary files in AC_CONFIG_AUX_DIR, \`$subproject_auxdir'."
1153     elif test -n "$auxdir"; then
1154       func_echo "putting auxiliary files in \`$auxdir'."
1155     fi
1157     func_copy_some_files "$pkgconfig_files" "$pkgdatadir" "$ltdldir"
1161 # func_install_pkgconfig_parent
1162 # Unless --quiet was passed, or AC_CONFIG_AUX_DIR was not seen, display a
1163 # message.  Then update appropriate auxiliary files if newer ones are
1164 # available from the libtool installation tree.
1165 func_install_pkgconfig_parent ()
1167     $opt_debug
1169     # Copy all the files from installed libltdl to this project, if the
1170     # user specified an auxdir.
1171     $opt_quiet || if test -n "$ac_auxdir"; then
1172       func_echo "putting auxiliary files in AC_CONFIG_AUX_DIR, \`$ac_auxdir'."
1173     elif test -n "$auxdir" || test "x$ltdldir" = "x."; then
1174       func_echo "putting auxiliary files in \`$auxdir'."
1175     fi
1177     if $opt_install; then
1178       func_config_update config.guess "$pkgdatadir/config" "$auxdir"
1179       func_config_update config.sub   "$pkgdatadir/config" "$auxdir"
1180       func_install_update install-sh  "$pkgdatadir/config" "$auxdir"
1181     fi
1182     func_ltmain_update ltmain.sh "$pkgdatadir/config" "$auxdir"
1186 # func_install_pkgconfig_files
1187 # Install copies of the auxiliary files into this package according to
1188 # the whether libltdl is included as a subproject, and whether the parent
1189 # shares the AC_CONFIG_AUX_DIR setting.
1190 func_install_pkgconfig_files ()
1192     $opt_debug
1193     func_massage_pkgconfig_files
1195   # 1. Parent shares auxdir with subproject ltdl:
1196     if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" &&
1197        test "x$ac_auxdir" = "x$subproject_auxdir"
1198     then
1199       func_install_pkgconfig_subproject
1201   # 2. Parent has separate auxdir to subproject ltdl:
1202     elif $opt_ltdl && test "x$ltdl_mode" = "xsubproject"
1203        # && test "x$auxdir" != "x$subproject_auxdir" is implied
1204     then
1205       if $seen_autoconf; then
1206         func_install_pkgconfig_parent
1207       fi
1208       func_install_pkgconfig_subproject
1210   # 3. Not subproject, but AC_CONFIG_AUX_DIR was used in parent:
1211     elif test -n "$ac_auxdir" || test "x$auxdir" = "x."; then
1212       func_install_pkgconfig_parent
1214   # 4. AC_CONFIG_AUX_DIR was not specified:
1215     else
1216       func_verbose "AC_CONFIG_AUX_DIR not defined, not copying libtool auxiliary files."
1217     fi
1221 # func_nonemptydir_p dirvar
1222 # DIRVAR is the name of a variable to evaluate.  Unless DIRVAR names
1223 # a directory that exists and is non-empty abort with a diagnostic.
1224 func_nonemptydir_p ()
1226     $opt_debug
1227     my_dirvar="$1"
1228     my_dir=`eval echo "\\\$$my_dirvar"`
1230     # Is it a directory at all?
1231     test -d "$my_dir" \
1232       || func_fatal_error "\$$my_dirvar not a directory: \`$my_dir'"
1234     # check that the directories contents can be ls'ed
1235     test -n "`{ cd $my_dir && ls; } 2>/dev/null`" \
1236         || func_fatal_error "can not list files: \`$my_dir'"
1240 # func_check_macros
1241 # Sanity check macros from aclocal.m4 against installed versions.
1242 func_check_macros ()
1244     $opt_debug
1245     $opt_quiet && return
1246     $seen_autoconf || return
1248     ac_config_macro_dir_advised=false
1251     # Suggest modern idioms for storing autoconf macros:
1252     if test -z "$ac_macrodir$ltdldir"; then
1253       if test x"$macrodir" = x.; then
1254         func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([m4])' to $configure_ac and rerunning"
1255         func_echo " libtoolize, to keep the correct libtool macros in-tree."
1256       else
1257         func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([$macrodir])'to $configure.ac,"
1258         func_echo "and rerunning libtoolize."
1259       fi
1261     elif test -z "$macrodir"; then
1262       my_ac_config_macro_srcdir="$aclocaldir"
1263       if $opt_ltdl && test "$macrodir" != "$subproject_macrodir"; then
1264         my_ac_config_macro_srcdir="$subproject_macrodir"
1265       fi
1267       my_needed="libtool.m4 ltoptions.m4 ltversion.m4 ltsugar.m4 lt~obsolete.m4"
1268       $opt_ltdl && my_needed="$my_needed argz.m4 ltdl.m4"
1270       func_echo "You should add the contents of the following files to \`aclocal.m4':"
1271       for need in $my_needed; do
1272         func_echo "  \`$my_ac_config_macro_srcdir/$need'"
1273       done
1275       if test "$my_ac_config_macro_srcdir" != "$aclocaldir"; then
1276         func_echo "or else add \`AC_CONFIG_MACRO_DIR([$subproject_macrodir])' to $configure_ac."
1277         ac_config_macro_dir_advised=:
1278       fi
1279     fi
1281     $seen_libtool ||
1282       func_echo "Remember to add \`LT_INIT' to $configure_ac."
1284     # Suggest using LTDL_INIT if appropriate:
1285     $opt_ltdl && if test x$seen_ltdl != x:; then
1286       case $ltdl_mode in
1287         subproject) ltdl_init_args=""               ;;
1288         *)          ltdl_init_args="([$ltdl_mode])" ;;
1289       esac
1290       func_echo "Remember to add \`LTDL_INIT$ltdl_init_args' to $configure_ac."
1291     fi
1293     if $opt_ltdl; then
1294       # Remind the user to call LT_CONFIG_LTDL_DIR:
1295       test -n "$ac_ltdldir" ||
1296         func_echo "Remember to add \`LT_CONFIG_LTDL_DIR([$ltdldir])' to \`$configure_ac'."
1298       # For subproject mode, offer some suggestions for avoiding duplicate
1299       # files in a project that uses libltdl:
1300       if test "x$ltdl_mode" = "xsubproject"; then
1301         test "$subproject_auxdir" = "$auxdir" ||
1302           func_echo "Consider using \`AC_CONFIG_AUX_DIR([$subproject_auxdir])' in $configure_ac."
1303         $ac_config_macro_dir_advised || test "$subproject_macrodir" = "$macrodir" ||
1304           func_echo "Consider using \`AC_CONFIG_MACRO_DIR([$subproject_macrodir])' in $configure_ac."
1305       fi
1306     fi
1308     # Don't trace for this, we're just checking the user didn't invoke it
1309     # directly from configure.ac.
1310     $SED 's,dnl .*$,,; s,# .*$,,' "$configure_ac" | grep AC_PROG_RANLIB >/dev/null &&
1311       func_echo "\`AC_PROG_RANLIB' is rendered obsolete by \`LT_INIT'"
1313     # FIXME: Ensure ltmain.sh, libtool.m4 and ltdl.m4 are from the same release
1317 ## ----------- ##
1318 ##    Main.    ##
1319 ## ----------- ##
1322   rerun_aclocal=false
1324   # Allow the user to override the master libtoolize repository:
1325   if test -n "$_lt_pkgdatadir"; then
1326     pkgltdldir="$_lt_pkgdatadir"
1327     pkgdatadir="$_lt_pkgdatadir/libltdl"
1328     aclocaldir="$_lt_pkgdatadir/libltdl/m4"
1329   fi
1330   func_nonemptydir_p pkgltdldir
1331   func_nonemptydir_p pkgdatadir
1332   func_nonemptydir_p aclocaldir
1334   func_scan_files
1336   case $ltdldir in
1337   .) ltdlprefix= ;;
1338   *) ltdlprefix=$ltdldir/ ;;
1339   esac
1340   subproject_auxdir=${ltdlprefix}config
1341   subproject_macrodir=${ltdlprefix}m4
1343   # :::BE CAREFUL HERE:::
1344   # func_check_macros needs to check whether --ltdl was specified when
1345   # LTDL_INIT was not seen, so we can't just use one variable for both
1346   # conditions, or that check will be impossible.   No need to clutter the
1347   # rest of the code with '$opt_ltdl || $seen_ltdl' though, because we CAN
1348   # safely set opt_ltdl to true if LTDL_INIT was seen:
1349   $seen_ltdl && opt_ltdl=:
1351   func_install_pkgconfig_files
1352   func_install_pkgmacro_files
1353   func_install_pkgltdl_files
1355   func_check_macros
1358 exit $exit_status
1360 # Local Variables:
1361 # mode:shell-script
1362 # sh-indentation:2
1363 # End: