]> git.sur5r.net Git - openldap/blobdiff - build/ltmain.sh
cleanup
[openldap] / build / ltmain.sh
index 2e82203ecbe0692056d686cb276185e637e60dcd..eac9d2ced7048a25989c36d321683fbd020e1638 100755 (executable)
@@ -1,5 +1,7 @@
 # ltmain.sh - Provide generalized library-building support services.
 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
+# 
+# $OpenLDAP$
 #
 # Copyright (C) 1996-1999 Free Software Foundation, Inc.
 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
+# Portions Copyright 1998-2001 OpenLDAP Foundation.
+# This file is distributed with OpenLDAP Software, which contains a
+# configuration script generated by autoconf and is distributable
+# under the same distributions terms as OpenLDAP inself.
+# See the OpenLDAP COPYRIGHT and LICENSE file for details.
+
 # Check that we have a working $echo.
 if test "X$1" = X--no-reexec; then
   # Discard the --no-reexec flag, and continue.
@@ -54,8 +62,8 @@ modename="$progname"
 # Constants.
 PROGRAM=ltmain.sh
 PACKAGE=libtool
-VERSION=1.3.4-freebsd-ports
-TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
+VERSION=1.3.5+OpenLDAP
+TIMESTAMP=" (1.385.2.206 2000/10/02 14:18:00)"
 
 default_mode=
 help="Try \`$progname --help' for more information."
@@ -179,6 +187,16 @@ do
   --mode) prevopt="--mode" prev=mode ;;
   --mode=*) mode="$optarg" ;;
 
+  --only-shared)
+    build_libtool_libs=yes
+    build_old_libs=no
+    ;;
+
+  --only-static)
+    build_libtool_libs=no
+    build_old_libs=yes
+    ;;
+
   --quiet | --silent)
     show=:
     ;;
@@ -952,11 +970,7 @@ compiler."
          continue
          ;;
        release)
-         if test "$release_suffix" = all; then
-           release="$arg"
-         elif test "$release_suffix" = yes; then
-           release="-$arg"
-         fi
+         release="-$arg"
          prev=
          continue
          ;;
@@ -1009,7 +1023,6 @@ compiler."
        ;;
 
       -avoid-version)
-       build_old_libs=no
        avoid_version=yes
        continue
        ;;
@@ -1080,7 +1093,7 @@ compiler."
       -l*)
        if test "$arg" = "-lc"; then
          case "$host" in
-         *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+         *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | *-*-aix*)
            # These systems don't actually have c library (as such)
            continue
            ;;
@@ -1104,10 +1117,6 @@ compiler."
        deplibs="$deplibs $arg"
        ;;
 
-      -?thread)
-       deplibs="$deplibs $arg"
-       ;;
-
       -module)
        module=yes
        continue
@@ -1185,7 +1194,7 @@ compiler."
 
       *.o | *.obj | *.a | *.lib)
        # A standard object.
-       libobjs="$libobjs $arg"
+       objs="$objs $arg"
        ;;
 
       *.lo)
@@ -1620,6 +1629,12 @@ compiler."
        exit 1
       fi
 
+      # How the heck are we supposed to write a wrapper for a shared library?
+      if test -n "$link_against_libtool_libs"; then
+        $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
+        exit 1
+      fi
+
       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
        $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
       fi
@@ -1629,6 +1644,9 @@ compiler."
        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
       fi
       install_libdir="$2"
+      if test -n "$hardcode_default_flag"; then
+       eval linkopts=\"$linkopts$hardcode_default_flag\"
+      fi
 
       oldlibs=
       if test -z "$rpath"; then
@@ -1803,11 +1821,12 @@ compiler."
 
        dependency_libs="$deplibs"
        case "$host" in
-       *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
+       *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | *-*-aix*)
          # these systems don't actually have a c library (as such)!
          ;;
-       *-*-freebsd*)
-         # FreeBSD doesn't need this...
+        *-*-rhapsody*)
+         # rhapsody is a little odd...
+         deplibs="$deplibs -framework System"
          ;;
        *)
          # Add libc to deplibs on all other systems.
@@ -1816,94 +1835,6 @@ compiler."
        esac
       fi
 
-      if test -n "$rpath$xrpath"; then
-       # If the user specified any rpath flags, then add them.
-       for libdir in $rpath $xrpath; do
-         # This is the magic to use -rpath.
-         case "$compile_rpath " in
-         *" $libdir "*) ;;
-         *) compile_rpath="$compile_rpath $libdir" ;;
-         esac
-         case "$finalize_rpath " in
-         *" $libdir "*) ;;
-         *) finalize_rpath="$finalize_rpath $libdir" ;;
-         esac
-       done
-      fi
-
-      # Now hardcode the library paths
-      rpath=
-      hardcode_libdirs=
-      for libdir in $compile_rpath; do
-       if test -n "$hardcode_libdir_flag_spec"; then
-         if test -n "$hardcode_libdir_separator"; then
-           if test -z "$hardcode_libdirs"; then
-             hardcode_libdirs="$libdir"
-           else
-             # Just accumulate the unique libdirs.
-             case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
-             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-               ;;
-             *)
-               hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-               ;;
-             esac
-           fi
-         else
-           eval flag=\"$hardcode_libdir_flag_spec\"
-           rpath="$rpath $flag"
-         fi
-       elif test -n "$runpath_var"; then
-         case "$perm_rpath " in
-         *" $libdir "*) ;;
-         *) perm_rpath="$perm_rpath $libdir" ;;
-         esac
-       fi
-      done
-      # Substitute the hardcoded libdirs into the rpath.
-      if test -n "$hardcode_libdir_separator" &&
-        test -n "$hardcode_libdirs"; then
-       libdir="$hardcode_libdirs"
-       eval rpath=\" $hardcode_libdir_flag_spec\"
-      fi
-      compile_rpath="$rpath"
-
-      rpath=
-      hardcode_libdirs=
-      for libdir in $finalize_rpath; do
-       if test -n "$hardcode_libdir_flag_spec"; then
-         if test -n "$hardcode_libdir_separator"; then
-           if test -z "$hardcode_libdirs"; then
-             hardcode_libdirs="$libdir"
-           else
-             # Just accumulate the unique libdirs.
-             case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
-             *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-               ;;
-             *)
-               hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-               ;;
-             esac
-           fi
-         else
-           eval flag=\"$hardcode_libdir_flag_spec\"
-           rpath="$rpath $flag"
-         fi
-       elif test -n "$runpath_var"; then
-         case "$finalize_perm_rpath " in
-         *" $libdir "*) ;;
-         *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
-         esac
-       fi
-      done
-      # Substitute the hardcoded libdirs into the rpath.
-      if test -n "$hardcode_libdir_separator" &&
-        test -n "$hardcode_libdirs"; then
-       libdir="$hardcode_libdirs"
-       eval rpath=\" $hardcode_libdir_flag_spec\"
-      fi
-      finalize_rpath="$rpath"
-
       # Create the output directory, or remove our outputs if we need to.
       if test -d $output_objdir; then
        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
@@ -1919,11 +1850,7 @@ compiler."
 
       # Now set the variables for building old libraries.
       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
-       if test "$release_suffix" = all; then
-        oldlibs="$oldlibs $output_objdir/$libname$release.$libext"
-       else
-        oldlibs="$oldlibs $output_objdir/$libname.$libext"
-       fi
+       oldlibs="$oldlibs $output_objdir/$libname.$libext"
 
        # Transform .lo files to .o files.
        oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
@@ -2117,11 +2044,7 @@ EOF
              echo "*** \`nm' from GNU binutils and a full rebuild may help."
            fi
            if test "$build_old_libs" = no; then
-             if test "$release_suffix" = all; then
-               oldlibs="$output_objdir/$libname$release.$libext"
-             else
-               oldlibs="$output_objdir/$libname.$libext"
-             fi
+             oldlibs="$output_objdir/$libname.$libext"
              build_libtool_libs=module
              build_old_libs=yes
            else
@@ -2559,6 +2482,14 @@ EOF
       fi
       finalize_rpath="$rpath"
 
+      if test -z "$compile_rpath" -a -n "$hardcode_default_flag"; then
+       eval compile_rpath=\" $hardcode_default_flag\"
+      fi
+
+      if test -z "$finalize_rpath" -a -n "$hardcode_default_flag"; then
+       eval finalize_rpath=\" $hardcode_default_flag\"
+      fi
+
       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
       if test "X$output_objdir" = "X$output"; then
        output_objdir="$objdir"
@@ -2652,6 +2583,32 @@ extern \"C\" {
            fi
          fi
 
+       # Prepare the list of exported symbols
+       if test -z "$export_symbols"; then
+         if test "$always_export_symbols" = yes -a -n "$link_export_all"; then
+           eval link_export=\"$link_export_all\"
+         elif test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+           $show "generating symbol list for \`$output'"
+           export_symbols="$output_objdir/$output.exp"
+           $run $rm $export_symbols
+           libobjs="$objs"
+           eval cmds=\"$export_symbols_cmds\"
+           IFS="${IFS=         }"; save_ifs="$IFS"; IFS='~'
+           for cmd in $cmds; do
+             IFS="$save_ifs"
+             $show "$cmd"
+             $run eval "$cmd" || exit $?
+           done
+           IFS="$save_ifs"
+           if test -n "$export_symbols_regex"; then
+             $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+             $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+             $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+             $run eval '$mv "${export_symbols}T" "$export_symbols"'
+           fi
+         fi
+       fi
+
          for arg in $dlprefiles; do
            $show "extracting global C symbols from \`$arg'"
            name=`echo "$arg" | sed -e 's%^.*/%%'`
@@ -2729,7 +2686,7 @@ static const void *lt_preloaded_setup() {
          # linked before any other PIC object.  But we must not use
          # pic_flag when linking with -static.  The problem exists in
          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
-         *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)\r
+         *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
            case "$compile_command " in
            *" -static "*) ;;
            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
@@ -2768,10 +2725,15 @@ static const void *lt_preloaded_setup() {
        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
       fi
 
+      link_export_opt=
+      if test -n "$export_symbols" -o -n "$dlsyms"; then
+       eval link_export_opt=\"$link_export\"
+      fi
+
       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
        # Replace the output file specification.
        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
-       link_command="$compile_command$compile_rpath"
+       link_command="$compile_command$compile_rpath$link_export_opt"
 
        # We have no uninstalled library dependencies, so finalize right now.
        $show "$link_command"
@@ -2857,7 +2819,9 @@ static const void *lt_preloaded_setup() {
 
       # Replace the output file specification.
       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-      
+
+      link_command="$link_command$link_export_opt"
+
       # Delete the old output files.
       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
 
@@ -3037,13 +3001,21 @@ else
       # Run the actual program with our arguments.
 "
        case $host in
-       *-*-cygwin* | *-*-mingw | *-*-os2*)
          # win32 systems need to use the prog path for dll
          # lookup to work
+       *-*-cygwin*)
+         $echo >> $output "\
+      exec \$progdir/\$program \${1+\"\$@\"}
+"
+         ;;
+
+       # Backslashes separate directories on plain windows
+       *-*-mingw | *-*-os2*)
          $echo >> $output "\
       exec \$progdir\\\\\$program \${1+\"\$@\"}
 "
          ;;
+
        *)
          $echo >> $output "\
       # Export the path to the program.
@@ -3169,11 +3141,7 @@ fi\
     case "$output" in
     *.la)
       old_library=
-      if test "$release_suffix" = all; then
-        test "$build_old_libs" = yes && old_library="$libname$release.$libext"
-      else
-        test "$build_old_libs" = yes && old_library="$libname.$libext"
-      fi
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
       $show "creating $output"
 
       if test -n "$xrpath"; then
@@ -3462,12 +3430,10 @@ libdir='$install_libdir'\
        fi
 
        # Install the pseudo-library for information purposes.
-       if test "$install_ltlibs" = yes; then
-         name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-         instname="$dir/$name"i
-         $show "$install_prog $instname $destdir/$name"
-         $run eval "$install_prog $instname $destdir/$name" || exit $?
-       fi
+       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+       instname="$dir/$name"i
+       $show "$install_prog $instname $destdir/$name"
+       $run eval "$install_prog $instname $destdir/$name" || exit $?
 
        # Maybe install the static library, too.
        test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
@@ -3556,6 +3522,7 @@ libdir='$install_libdir'\
            fi
            libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
            if test -n "$libdir" && test ! -f "$libfile"; then
+             $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
              finalize=no
            fi
          done