Codebase list geos / fresh-releases/main
New upstream release. Debian Janitor 2 years ago
29 changed file(s) with 114 addition(s) and 11548 deletion(s). Raw diff Collapse all Expand all
415415 "/debian/"
416416 "/php/"
417417 "/.*build-.*/"
418 "cmake_install\\\\.cmake"
419 "/include/geos/version\\\\.h\$"
420 "/tools/geos-config\$"
421 "/tools/geos\\\\.pc\$"
418422 ${PROJECT_BINARY_DIR}
419423 )
420424
0 Changes in 3.10.1
1 2021-11-2
2
3 - Fixes/Improvements:
4 - Fix mistake in constants used to select WKB flavor in C API (GH489, Paul Ramsey)
5 - Fix crash when reducing precision on a LinearRing (#1135, Paul Ramsey)
6 - Fix GeoJSON crash on invalid input (GH498, Even Rouault)
7 - Use std::sqrt exclusively for Solaris build (Paul Ramsey)
8 - Fix mistaken version numbers in some parts of 3.10.0 (Paul Ramsey)
9
10
011 Changes in 3.10.0
112 2021-10-20
213
1313
1414 ## Build status
1515
16 | CI | Main | 3.9 | 3.8 | 3.7 |
17 | :---: | :--- | :--- | :--- | :--- |
18 | GitHub | [![github](https://github.com/libgeos/geos/workflows/CI/badge.svg?branchmain)](https://github.com/libgeos/geos/actions?query=workflow%3ACI) | [![github](https://github.com/libgeos/geos/workflows/CI/badge.svg?branch=3.9)](https://github.com/libgeos/geos/actions?query=workflow%3ACI) | [![github](https://github.com/libgeos/geos/workflows/CI/badge.svg?branch=3.8)](https://github.com/libgeos/geos/actions?query=workflow%3ACI) | [![github](https://github.com/libgeos/geos/workflows/CI/badge.svg?branch=3.7)](https://github.com/libgeos/geos/actions?query=workflow%3ACI) |
19 | GitLab CI | [![gitlab-ci](https://gitlab.com/geos/libgeos/badges/main/pipeline.svg)](https://gitlab.com/geos/libgeos/commits/master) | [![gitlab-ci](https://gitlab.com/geos/libgeos/badges/3.9/pipeline.svg)](https://gitlab.com/geos/libgeos/commits/3.9) | [![gitlab-ci](https://gitlab.com/geos/libgeos/badges/3.8/pipeline.svg)](https://gitlab.com/geos/libgeos/commits/3.8) | [![gitlab-ci](https://gitlab.com/geos/libgeos/badges/3.7/pipeline.svg)](https://gitlab.com/geos/libgeos/commits/3.7) |
20 | Debbie | [![debbie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Master)](https://debbie.postgis.net/view/GEOS/job/GEOS_Master/) | [![debbie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Branch_3.9)](https://debbie.postgis.net/view/GEOS/job/GEOS_Branch_3.9/) | [![debbie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Branch_3.8)](https://debbie.postgis.net/view/GEOS/job/GEOS_Branch_3.8/) | [![debbie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Branch_3.7)](https://debbie.postgis.net/view/GEOS/job/GEOS_Branch_3.7/) |
21 | Winnie | [![winnie](https://winnie.postgis.net:444/view/GEOS/job/GEOS_Master/badge/icon)](https://winnie.postgis.net:444/view/GEOS/job/GEOS_Master/) | [![winnie](https://winnie.postgis.net:444/view/GEOS/job/GEOS_Branch_3.9/badge/icon)](https://winnie.postgis.net:444/view/GEOS/job/GEOS_Branch_3.9/) | [![winnie](https://winnie.postgis.net:444/view/GEOS/job/GEOS_Branch_3.8/badge/icon)](https://winnie.postgis.net:444/view/GEOS/job/GEOS_Branch_3.8/) | [![winnie](https://winnie.postgis.net:444/view/GEOS/job/GEOS_Branch_3.7/badge/icon)](https://winnie.postgis.net:444/view/GEOS/job/GEOS_Branch_3.7/) |
22 | Dronie | [![dronie](https://dronie.osgeo.org/api/badges/geos/geos/status.svg?branch=main)](https://dronie.osgeo.org/geos/geos?branch=master) | [![dronie](https://dronie.osgeo.org/api/badges/geos/geos/status.svg?branch=3.9)](https://dronie.osgeo.org/geos/geos?branch=3.9) | [![dronie](https://dronie.osgeo.org/api/badges/geos/geos/status.svg?branch=3.8)](https://dronie.osgeo.org/geos/geos?branch=3.8) | [![dronie](https://dronie.osgeo.org/api/badges/geos/geos/status.svg?branch=3.7)](https://dronie.osgeo.org/geos/geos?branch=3.7) |
23 | AppVeyor | [![appveyor](https://ci.appveyor.com/api/projects/status/62aplwst722b89au/branch/main?svg=true)](https://ci.appveyor.com/project/dbaston/geos/branch/master) | [![appveyor](https://ci.appveyor.com/api/projects/status/62aplwst722b89au/branch/3.9?svg=true)](https://ci.appveyor.com/project/dbaston/geos/branch/3.9) | [![appveyor](https://ci.appveyor.com/api/projects/status/62aplwst722b89au/branch/3.8?svg=true)](https://ci.appveyor.com/project/dbaston/geos/branch/3.8) | [![appveyor](https://ci.appveyor.com/api/projects/status/62aplwst722b89au/branch/3.7?svg=true)](https://ci.appveyor.com/project/dbaston/geos/branch/3.7) |
24 | Bessie | [![bessie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=bessie&build=last:${params.reference=refs/heads/main})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=bessie) | [![bessie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=bessie&build=last:${params.reference=refs/heads/3.9})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=bessie) | [![bessie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=bessie&build=last:${params.reference=refs/heads/3.8})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=bessie) | [![bessie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=bessie&build=last:${params.reference=refs/heads/3.7})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=bessie) |
25 | Bessie32 | [![bessie32](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=bessie32&build=last:${params.reference=refs/heads/main})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=bessie32) |[![bessie32](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=bessie32&build=last:${params.reference=refs/heads/3.9})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=bessie32)| [![bessie32](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=bessie32&build=last:${params.reference=refs/heads/3.8})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=bessie32) | [![bessie32](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=bessie32&build=last:${params.reference=refs/heads/3.7})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=bessie32) |
26 | Berrie64 | [![berrie64](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=berrie64&build=last:${params.reference=refs/heads/main})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=berrie64) | [![berrie64](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=berrie64&build=last:${params.reference=refs/heads/3.9})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=berrie64) | [![berrie64](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=berrie64&build=last:${params.reference=refs/heads/3.8})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=berrie64) ||
27 | Berrie | [![berrie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=berrie&build=last:${params.reference=refs/heads/main})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=berrie) |[![berrie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=berrie&build=last:${params.reference=refs/heads/3.9})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=berrie)|[![berrie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=berrie&build=last:${params.reference=refs/heads/3.8})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=berrie)||
16 | CI | 3.10 |
17 | :---: | :--- |
18 | GitHub | [![github](https://github.com/libgeos/geos/workflows/CI/badge.svg?branch=3.10)](https://github.com/libgeos/geos/actions?query=workflow%3ACI) |
19 | Azure | [![Build Status](https://dev.azure.com/libgeos/geos/_apis/build/status/libgeos.geos?branchName=3.10)](https://dev.azure.com/libgeos/geos/_build/latest?definitionId=2&branchName=3.10) |
20 | GitLab CI | [![gitlab-ci](https://gitlab.com/geos/libgeos/badges/3.10/pipeline.svg)](https://gitlab.com/geos/libgeos/commits/3.10) |
21 | Debbie | [![debbie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Branch_3.10)](https://debbie.postgis.net/view/GEOS/job/GEOS_Branch_3.10/) |
22 | Winnie | [![winnie](https://winnie.postgis.net:444/view/GEOS/job/GEOS_Branch_3.10/badge/icon)](https://winnie.postgis.net:444/view/GEOS/job/GEOS_Branch_3.10/) |
23 | Dronie | [![dronie](https://dronie.osgeo.org/api/badges/geos/geos/status.svg?branch=3.10)](https://dronie.osgeo.org/geos/geos?branch=3.10) |
24 | AppVeyor | [![appveyor](https://ci.appveyor.com/api/projects/status/62aplwst722b89au/branch/3.10?svg=true)](https://ci.appveyor.com/project/dbaston/geos/branch/3.10) |
25 | Bessie | [![bessie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=bessie&build=last:${params.reference=refs/heads/3.10})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=bessie) |
26 | Bessie32 | [![bessie32](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=bessie32&build=last:${params.reference=refs/heads/3.10})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=bessie32)
27 | Berrie64 | [![berrie64](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=berrie64&build=last:${params.reference=refs/heads/3.10})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=berrie64) |
28 | Berrie | [![berrie](https://debbie.postgis.net/buildStatus/icon?job=GEOS_Worker_Run/label=berrie&build=last:${params.reference=refs/heads/3.10})](https://debbie.postgis.net/view/GEOS/job/GEOS_Worker_Run/label=berrie) |
2829
2930
3031 ## Build/install
11 # GEOS Versions
22 GEOS_VERSION_MAJOR=3
33 GEOS_VERSION_MINOR=10
4 GEOS_VERSION_PATCH=0
4 GEOS_VERSION_PATCH=1
55
66 # OPTIONS: "", "dev", "rc1" etc.
77 GEOS_PATCH_WORD=
+0
-44
bisect_script.sh less more
0 #!/bin/bash
1
2 # git bisect start
3 # git bisect good 6b153d67e24c36477faee2eb47e6f486b768cdc2
4 # git bisect bad df1fd770c96c1919f63e675f997157c1914d480e
5 # git bisect run ./bisect_script.sh
6 #
7 #
8 # 3.8 release 6b153d67e24c36477faee2eb47e6f486b768cdc2
9 # 3.9 release df1fd770c96c1919f63e675f997157c1914d480e
10 #
11
12 ROOT=`pwd`
13 BLD=$ROOT/../geos-git-build
14 LIB=$BLD/lib
15 TST=$ROOT/../geos-performance/_build
16 PERF=$TST/geos_perf
17 NM="Australia buffer"
18 CUTOFF=200
19
20 echo "--------"
21 echo "Running in $ROOT"
22
23 echo "Building in $BLD"
24 pushd $BLD
25 cmake -DCMAKE_BUILD_TYPE=Release ../geos-git
26 make
27 popd
28
29 echo "Running $PERF"
30 export DYLD_LIBRARY_PATH=$LIB
31 pushd $TST
32 TIME=`$PERF | grep "$NM" | cut -f5 -d,`
33 echo "Run time = $TIME"
34 popd
35
36 #if [ $TIME -lt $CUTOFF ]; then
37 if [ $(echo "$TIME < $CUTOFF" | bc -l) -eq 1 ]; then
38 # good
39 exit 0
40 else
41 # bad
42 exit 1
43 fi
+0
-160
cmake_install.cmake less more
0 # Install script for directory: /Users/pramsey/Code/geos-git
1
2 # Set the install prefix
3 if(NOT DEFINED CMAKE_INSTALL_PREFIX)
4 set(CMAKE_INSTALL_PREFIX "/usr/local")
5 endif()
6 string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
7
8 # Set the install configuration name.
9 if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
10 if(BUILD_TYPE)
11 string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
12 CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
13 else()
14 set(CMAKE_INSTALL_CONFIG_NAME "Release")
15 endif()
16 message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
17 endif()
18
19 # Set the component getting installed.
20 if(NOT CMAKE_INSTALL_COMPONENT)
21 if(COMPONENT)
22 message(STATUS "Install component: \"${COMPONENT}\"")
23 set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
24 else()
25 set(CMAKE_INSTALL_COMPONENT)
26 endif()
27 endif()
28
29 # Is this installation the result of a crosscompile?
30 if(NOT DEFINED CMAKE_CROSSCOMPILING)
31 set(CMAKE_CROSSCOMPILING "FALSE")
32 endif()
33
34 # Set default install directory permissions.
35 if(NOT DEFINED CMAKE_OBJDUMP)
36 set(CMAKE_OBJDUMP "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump")
37 endif()
38
39 if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
40 file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE SHARED_LIBRARY FILES "/Users/pramsey/Code/geos-git/lib/libgeos.3.10.0dev.dylib")
41 if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libgeos.3.10.0dev.dylib" AND
42 NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libgeos.3.10.0dev.dylib")
43 if(CMAKE_INSTALL_DO_STRIP)
44 execute_process(COMMAND "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip" -x "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libgeos.3.10.0dev.dylib")
45 endif()
46 endif()
47 endif()
48
49 if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
50 file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE SHARED_LIBRARY FILES "/Users/pramsey/Code/geos-git/lib/libgeos.dylib")
51 if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libgeos.dylib" AND
52 NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libgeos.dylib")
53 if(CMAKE_INSTALL_DO_STRIP)
54 execute_process(COMMAND "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip" -x "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libgeos.dylib")
55 endif()
56 endif()
57 endif()
58
59 if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
60 file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE SHARED_LIBRARY FILES
61 "/Users/pramsey/Code/geos-git/lib/libgeos_c.1.15.0.dylib"
62 "/Users/pramsey/Code/geos-git/lib/libgeos_c.1.dylib"
63 )
64 foreach(file
65 "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libgeos_c.1.15.0.dylib"
66 "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libgeos_c.1.dylib"
67 )
68 if(EXISTS "${file}" AND
69 NOT IS_SYMLINK "${file}")
70 execute_process(COMMAND /usr/bin/install_name_tool
71 -delete_rpath "/Users/pramsey/Code/geos-git/lib"
72 "${file}")
73 if(CMAKE_INSTALL_DO_STRIP)
74 execute_process(COMMAND "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip" -x "${file}")
75 endif()
76 endif()
77 endforeach()
78 endif()
79
80 if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
81 file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" TYPE SHARED_LIBRARY FILES "/Users/pramsey/Code/geos-git/lib/libgeos_c.dylib")
82 if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libgeos_c.dylib" AND
83 NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libgeos_c.dylib")
84 execute_process(COMMAND /usr/bin/install_name_tool
85 -delete_rpath "/Users/pramsey/Code/geos-git/lib"
86 "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libgeos_c.dylib")
87 if(CMAKE_INSTALL_DO_STRIP)
88 execute_process(COMMAND "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip" -x "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/libgeos_c.dylib")
89 endif()
90 endif()
91 endif()
92
93 if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
94 if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/cmake/GEOS/geos-targets.cmake")
95 file(DIFFERENT EXPORT_FILE_CHANGED FILES
96 "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/cmake/GEOS/geos-targets.cmake"
97 "/Users/pramsey/Code/geos-git/CMakeFiles/Export/lib/cmake/GEOS/geos-targets.cmake")
98 if(EXPORT_FILE_CHANGED)
99 file(GLOB OLD_CONFIG_FILES "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/cmake/GEOS/geos-targets-*.cmake")
100 if(OLD_CONFIG_FILES)
101 message(STATUS "Old export file \"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/cmake/GEOS/geos-targets.cmake\" will be replaced. Removing files [${OLD_CONFIG_FILES}].")
102 file(REMOVE ${OLD_CONFIG_FILES})
103 endif()
104 endif()
105 endif()
106 file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/GEOS" TYPE FILE FILES "/Users/pramsey/Code/geos-git/CMakeFiles/Export/lib/cmake/GEOS/geos-targets.cmake")
107 if("${CMAKE_INSTALL_CONFIG_NAME}" MATCHES "^([Rr][Ee][Ll][Ee][Aa][Ss][Ee])$")
108 file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/GEOS" TYPE FILE FILES "/Users/pramsey/Code/geos-git/CMakeFiles/Export/lib/cmake/GEOS/geos-targets-release.cmake")
109 endif()
110 endif()
111
112 if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
113 file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake/GEOS" TYPE FILE FILES
114 "/Users/pramsey/Code/geos-git/geos-config.cmake"
115 "/Users/pramsey/Code/geos-git/geos-config-version.cmake"
116 )
117 endif()
118
119 if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
120 file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/include" TYPE DIRECTORY FILES
121 "/Users/pramsey/Code/geos-git/include/geos"
122 "/Users/pramsey/Code/geos-git/include/geos"
123 FILES_MATCHING REGEX "/[^/]*\\.h$")
124 endif()
125
126 if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
127 file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/include" TYPE DIRECTORY FILES
128 "/Users/pramsey/Code/geos-git/include/geos"
129 "/Users/pramsey/Code/geos-git/include/geos"
130 FILES_MATCHING REGEX "/[^/]*\\.inl$")
131 endif()
132
133 if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
134 file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/include" TYPE FILE FILES "/Users/pramsey/Code/geos-git/capi/geos_c.h")
135 endif()
136
137 if(NOT CMAKE_INSTALL_LOCAL_ONLY)
138 # Include the install script for each subdirectory.
139 include("/Users/pramsey/Code/geos-git/include/cmake_install.cmake")
140 include("/Users/pramsey/Code/geos-git/src/cmake_install.cmake")
141 include("/Users/pramsey/Code/geos-git/capi/cmake_install.cmake")
142 include("/Users/pramsey/Code/geos-git/tests/cmake_install.cmake")
143 include("/Users/pramsey/Code/geos-git/benchmarks/cmake_install.cmake")
144 include("/Users/pramsey/Code/geos-git/util/cmake_install.cmake")
145 include("/Users/pramsey/Code/geos-git/doc/cmake_install.cmake")
146 include("/Users/pramsey/Code/geos-git/tools/cmake_install.cmake")
147
148 endif()
149
150 if(CMAKE_INSTALL_COMPONENT)
151 set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
152 else()
153 set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
154 endif()
155
156 string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
157 "${CMAKE_INSTALL_MANIFEST_FILES}")
158 file(WRITE "/Users/pramsey/Code/geos-git/${CMAKE_INSTALL_MANIFEST}"
159 "${CMAKE_INSTALL_MANIFEST_CONTENT}")
0 geos (3.10.1-1) UNRELEASED; urgency=low
1
2 * New upstream release.
3
4 -- Debian Janitor <janitor@jelmer.uk> Sat, 06 Nov 2021 15:21:01 -0000
5
06 geos (3.10.0-1) unstable; urgency=medium
17
28 * New upstream release.
4040 };
4141
4242 enum wkbFlavour {
43 wkbIso = 1,
44 wkbExtended = 2
43 wkbExtended = 1,
44 wkbIso = 2
4545 };
4646
4747 }
1818 #ifndef GEOS_TRIANGULATE_QUADEDGE_VERTEX_H
1919 #define GEOS_TRIANGULATE_QUADEDGE_VERTEX_H
2020
21 #include <math.h>
21 #include <cmath>
2222 #include <memory>
2323 #include <cstring>
2424
233233 inline double
234234 distance(const Vertex& v1, const Vertex& v2)
235235 {
236 return sqrt(pow(v2.getX() - v1.getX(), 2.0)
237 + pow(v2.getY() - v1.getY(), 2.0));
236 return std::sqrt(pow(v2.getX() - v1.getX(), 2.0) +
237 pow(v2.getY() - v1.getY(), 2.0));
238238 }
239239
240240 /**
2020 #ifndef GEOS_UTIL_H
2121 #define GEOS_UTIL_H
2222
23 //#include <geos/util/AssertionFailedException.h>
2423 #include <geos/util/GEOSException.h>
2524 #include <geos/util/IllegalArgumentException.h>
2625 #include <geos/util/TopologyException.h>
27 //#include <geos/util/UnsupportedOperationException.h>
28 //#include <geos/util/CoordinateArrayFilter.h>
29 //#include <geos/util/UniqueCoordinateArrayFilter.h>
3026 #include <geos/util/GeometricShapeFactory.h>
31 //#include <geos/util/math.h>
3227
3328 #include <memory>
3429 #include <type_traits>
+0
-37
include/geos/version.h less more
0 /**********************************************************************
1 *
2 * GEOS - Geometry Engine Open Source
3 * http://geos.osgeo.org
4 *
5 * Copyright (C) 2007 Refractions Research Inc.
6 *
7 * This is free software; you can redistribute and/or modify it under
8 * the terms of the GNU Lesser General Public Licence as published
9 * by the Free Software Foundation.
10 * See the COPYING file for more information.
11 *
12 **********************************************************************/
13 #ifndef GEOS_VERSION_H_INCLUDED
14 #define GEOS_VERSION_H_INCLUDED
15
16 #ifndef GEOS_VERSION_MAJOR
17 #define GEOS_VERSION_MAJOR 3
18 #endif
19
20 #ifndef GEOS_VERSION_MINOR
21 #define GEOS_VERSION_MINOR 10
22 #endif
23
24 #ifndef GEOS_VERSION_PATCH
25 #define GEOS_VERSION_PATCH 0dev
26 #endif
27
28 #ifndef GEOS_VERSION
29 #define GEOS_VERSION "3.10.0dev"
30 #endif
31
32 #ifndef GEOS_JTS_PORT
33 #define GEOS_JTS_PORT "1.17.0"
34 #endif
35
36 #endif // GEOS_VERSION_H_INCLUDED
+0
-11149
ltmain.sh less more
0 #! /bin/sh
1 ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
2 ## by inline-source v2014-01-03.01
3
4 # libtool (GNU libtool) 2.4.6
5 # Provide generalized library-building support services.
6 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7
8 # Copyright (C) 1996-2015 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.
11
12 # GNU Libtool 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.
16 #
17 # As a special exception to the GNU General Public License,
18 # if you distribute this file as part of a program or library that
19 # is built using GNU Libtool, you may include this file under the
20 # same distribution terms that you use for the rest of that program.
21 #
22 # GNU Libtool is distributed in the hope that it will be useful, but
23 # WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 # General Public License for more details.
26 #
27 # You should have received a copy of the GNU General Public License
28 # along with this program. If not, see <http://www.gnu.org/licenses/>.
29
30
31 PROGRAM=libtool
32 PACKAGE=libtool
33 VERSION=2.4.6
34 package_revision=2.4.6
35
36
37 ## ------ ##
38 ## Usage. ##
39 ## ------ ##
40
41 # Run './libtool --help' for help with using this script from the
42 # command line.
43
44
45 ## ------------------------------- ##
46 ## User overridable command paths. ##
47 ## ------------------------------- ##
48
49 # After configure completes, it has a better idea of some of the
50 # shell tools we need than the defaults used by the functions shared
51 # with bootstrap, so set those here where they can still be over-
52 # ridden by the user, but otherwise take precedence.
53
54 : ${AUTOCONF="autoconf"}
55 : ${AUTOMAKE="automake"}
56
57
58 ## -------------------------- ##
59 ## Source external libraries. ##
60 ## -------------------------- ##
61
62 # Much of our low-level functionality needs to be sourced from external
63 # libraries, which are installed to $pkgauxdir.
64
65 # Set a version string for this script.
66 scriptversion=2015-01-20.17; # UTC
67
68 # General shell script boiler plate, and helper functions.
69 # Written by Gary V. Vaughan, 2004
70
71 # Copyright (C) 2004-2015 Free Software Foundation, Inc.
72 # This is free software; see the source for copying conditions. There is NO
73 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
74
75 # This program is free software; you can redistribute it and/or modify
76 # it under the terms of the GNU General Public License as published by
77 # the Free Software Foundation; either version 3 of the License, or
78 # (at your option) any later version.
79
80 # As a special exception to the GNU General Public License, if you distribute
81 # this file as part of a program or library that is built using GNU Libtool,
82 # you may include this file under the same distribution terms that you use
83 # for the rest of that program.
84
85 # This program is distributed in the hope that it will be useful,
86 # but WITHOUT ANY WARRANTY; without even the implied warranty of
87 # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
88 # General Public License for more details.
89
90 # You should have received a copy of the GNU General Public License
91 # along with this program. If not, see <http://www.gnu.org/licenses/>.
92
93 # Please report bugs or propose patches to gary@gnu.org.
94
95
96 ## ------ ##
97 ## Usage. ##
98 ## ------ ##
99
100 # Evaluate this file near the top of your script to gain access to
101 # the functions and variables defined here:
102 #
103 # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
104 #
105 # If you need to override any of the default environment variable
106 # settings, do that before evaluating this file.
107
108
109 ## -------------------- ##
110 ## Shell normalisation. ##
111 ## -------------------- ##
112
113 # Some shells need a little help to be as Bourne compatible as possible.
114 # Before doing anything else, make sure all that help has been provided!
115
116 DUALCASE=1; export DUALCASE # for MKS sh
117 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
118 emulate sh
119 NULLCMD=:
120 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
121 # is contrary to our usage. Disable this feature.
122 alias -g '${1+"$@"}'='"$@"'
123 setopt NO_GLOB_SUBST
124 else
125 case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
126 fi
127
128 # NLS nuisances: We save the old values in case they are required later.
129 _G_user_locale=
130 _G_safe_locale=
131 for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
132 do
133 eval "if test set = \"\${$_G_var+set}\"; then
134 save_$_G_var=\$$_G_var
135 $_G_var=C
136 export $_G_var
137 _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
138 _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
139 fi"
140 done
141
142 # CDPATH.
143 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
144
145 # Make sure IFS has a sensible default
146 sp=' '
147 nl='
148 '
149 IFS="$sp $nl"
150
151 # There are apparently some retarded systems that use ';' as a PATH separator!
152 if test "${PATH_SEPARATOR+set}" != set; then
153 PATH_SEPARATOR=:
154 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
155 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
156 PATH_SEPARATOR=';'
157 }
158 fi
159
160
161
162 ## ------------------------- ##
163 ## Locate command utilities. ##
164 ## ------------------------- ##
165
166
167 # func_executable_p FILE
168 # ----------------------
169 # Check that FILE is an executable regular file.
170 func_executable_p ()
171 {
172 test -f "$1" && test -x "$1"
173 }
174
175
176 # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
177 # --------------------------------------------
178 # Search for either a program that responds to --version with output
179 # containing "GNU", or else returned by CHECK_FUNC otherwise, by
180 # trying all the directories in PATH with each of the elements of
181 # PROGS_LIST.
182 #
183 # CHECK_FUNC should accept the path to a candidate program, and
184 # set $func_check_prog_result if it truncates its output less than
185 # $_G_path_prog_max characters.
186 func_path_progs ()
187 {
188 _G_progs_list=$1
189 _G_check_func=$2
190 _G_PATH=${3-"$PATH"}
191
192 _G_path_prog_max=0
193 _G_path_prog_found=false
194 _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
195 for _G_dir in $_G_PATH; do
196 IFS=$_G_save_IFS
197 test -z "$_G_dir" && _G_dir=.
198 for _G_prog_name in $_G_progs_list; do
199 for _exeext in '' .EXE; do
200 _G_path_prog=$_G_dir/$_G_prog_name$_exeext
201 func_executable_p "$_G_path_prog" || continue
202 case `"$_G_path_prog" --version 2>&1` in
203 *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
204 *) $_G_check_func $_G_path_prog
205 func_path_progs_result=$func_check_prog_result
206 ;;
207 esac
208 $_G_path_prog_found && break 3
209 done
210 done
211 done
212 IFS=$_G_save_IFS
213 test -z "$func_path_progs_result" && {
214 echo "no acceptable sed could be found in \$PATH" >&2
215 exit 1
216 }
217 }
218
219
220 # We want to be able to use the functions in this file before configure
221 # has figured out where the best binaries are kept, which means we have
222 # to search for them ourselves - except when the results are already set
223 # where we skip the searches.
224
225 # Unless the user overrides by setting SED, search the path for either GNU
226 # sed, or the sed that truncates its output the least.
227 test -z "$SED" && {
228 _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
229 for _G_i in 1 2 3 4 5 6 7; do
230 _G_sed_script=$_G_sed_script$nl$_G_sed_script
231 done
232 echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
233 _G_sed_script=
234
235 func_check_prog_sed ()
236 {
237 _G_path_prog=$1
238
239 _G_count=0
240 printf 0123456789 >conftest.in
241 while :
242 do
243 cat conftest.in conftest.in >conftest.tmp
244 mv conftest.tmp conftest.in
245 cp conftest.in conftest.nl
246 echo '' >> conftest.nl
247 "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
248 diff conftest.out conftest.nl >/dev/null 2>&1 || break
249 _G_count=`expr $_G_count + 1`
250 if test "$_G_count" -gt "$_G_path_prog_max"; then
251 # Best one so far, save it but keep looking for a better one
252 func_check_prog_result=$_G_path_prog
253 _G_path_prog_max=$_G_count
254 fi
255 # 10*(2^10) chars as input seems more than enough
256 test 10 -lt "$_G_count" && break
257 done
258 rm -f conftest.in conftest.tmp conftest.nl conftest.out
259 }
260
261 func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
262 rm -f conftest.sed
263 SED=$func_path_progs_result
264 }
265
266
267 # Unless the user overrides by setting GREP, search the path for either GNU
268 # grep, or the grep that truncates its output the least.
269 test -z "$GREP" && {
270 func_check_prog_grep ()
271 {
272 _G_path_prog=$1
273
274 _G_count=0
275 _G_path_prog_max=0
276 printf 0123456789 >conftest.in
277 while :
278 do
279 cat conftest.in conftest.in >conftest.tmp
280 mv conftest.tmp conftest.in
281 cp conftest.in conftest.nl
282 echo 'GREP' >> conftest.nl
283 "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
284 diff conftest.out conftest.nl >/dev/null 2>&1 || break
285 _G_count=`expr $_G_count + 1`
286 if test "$_G_count" -gt "$_G_path_prog_max"; then
287 # Best one so far, save it but keep looking for a better one
288 func_check_prog_result=$_G_path_prog
289 _G_path_prog_max=$_G_count
290 fi
291 # 10*(2^10) chars as input seems more than enough
292 test 10 -lt "$_G_count" && break
293 done
294 rm -f conftest.in conftest.tmp conftest.nl conftest.out
295 }
296
297 func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
298 GREP=$func_path_progs_result
299 }
300
301
302 ## ------------------------------- ##
303 ## User overridable command paths. ##
304 ## ------------------------------- ##
305
306 # All uppercase variable names are used for environment variables. These
307 # variables can be overridden by the user before calling a script that
308 # uses them if a suitable command of that name is not already available
309 # in the command search PATH.
310
311 : ${CP="cp -f"}
312 : ${ECHO="printf %s\n"}
313 : ${EGREP="$GREP -E"}
314 : ${FGREP="$GREP -F"}
315 : ${LN_S="ln -s"}
316 : ${MAKE="make"}
317 : ${MKDIR="mkdir"}
318 : ${MV="mv -f"}
319 : ${RM="rm -f"}
320 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
321
322
323 ## -------------------- ##
324 ## Useful sed snippets. ##
325 ## -------------------- ##
326
327 sed_dirname='s|/[^/]*$||'
328 sed_basename='s|^.*/||'
329
330 # Sed substitution that helps us do robust quoting. It backslashifies
331 # metacharacters that are still active within double-quoted strings.
332 sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
333
334 # Same as above, but do not quote variable references.
335 sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
336
337 # Sed substitution that turns a string into a regex matching for the
338 # string literally.
339 sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
340
341 # Sed substitution that converts a w32 file name or path
342 # that contains forward slashes, into one that contains
343 # (escaped) backslashes. A very naive implementation.
344 sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
345
346 # Re-'\' parameter expansions in output of sed_double_quote_subst that
347 # were '\'-ed in input to the same. If an odd number of '\' preceded a
348 # '$' in input to sed_double_quote_subst, that '$' was protected from
349 # expansion. Since each input '\' is now two '\'s, look for any number
350 # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
351 _G_bs='\\'
352 _G_bs2='\\\\'
353 _G_bs4='\\\\\\\\'
354 _G_dollar='\$'
355 sed_double_backslash="\
356 s/$_G_bs4/&\\
357 /g
358 s/^$_G_bs2$_G_dollar/$_G_bs&/
359 s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
360 s/\n//g"
361
362
363 ## ----------------- ##
364 ## Global variables. ##
365 ## ----------------- ##
366
367 # Except for the global variables explicitly listed below, the following
368 # functions in the '^func_' namespace, and the '^require_' namespace
369 # variables initialised in the 'Resource management' section, sourcing
370 # this file will not pollute your global namespace with anything
371 # else. There's no portable way to scope variables in Bourne shell
372 # though, so actually running these functions will sometimes place
373 # results into a variable named after the function, and often use
374 # temporary variables in the '^_G_' namespace. If you are careful to
375 # avoid using those namespaces casually in your sourcing script, things
376 # should continue to work as you expect. And, of course, you can freely
377 # overwrite any of the functions or variables defined here before
378 # calling anything to customize them.
379
380 EXIT_SUCCESS=0
381 EXIT_FAILURE=1
382 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
383 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
384
385 # Allow overriding, eg assuming that you follow the convention of
386 # putting '$debug_cmd' at the start of all your functions, you can get
387 # bash to show function call trace with:
388 #
389 # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
390 debug_cmd=${debug_cmd-":"}
391 exit_cmd=:
392
393 # By convention, finish your script with:
394 #
395 # exit $exit_status
396 #
397 # so that you can set exit_status to non-zero if you want to indicate
398 # something went wrong during execution without actually bailing out at
399 # the point of failure.
400 exit_status=$EXIT_SUCCESS
401
402 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
403 # is ksh but when the shell is invoked as "sh" and the current value of
404 # the _XPG environment variable is not equal to 1 (one), the special
405 # positional parameter $0, within a function call, is the name of the
406 # function.
407 progpath=$0
408
409 # The name of this program.
410 progname=`$ECHO "$progpath" |$SED "$sed_basename"`
411
412 # Make sure we have an absolute progpath for reexecution:
413 case $progpath in
414 [\\/]*|[A-Za-z]:\\*) ;;
415 *[\\/]*)
416 progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
417 progdir=`cd "$progdir" && pwd`
418 progpath=$progdir/$progname
419 ;;
420 *)
421 _G_IFS=$IFS
422 IFS=${PATH_SEPARATOR-:}
423 for progdir in $PATH; do
424 IFS=$_G_IFS
425 test -x "$progdir/$progname" && break
426 done
427 IFS=$_G_IFS
428 test -n "$progdir" || progdir=`pwd`
429 progpath=$progdir/$progname
430 ;;
431 esac
432
433
434 ## ----------------- ##
435 ## Standard options. ##
436 ## ----------------- ##
437
438 # The following options affect the operation of the functions defined
439 # below, and should be set appropriately depending on run-time para-
440 # meters passed on the command line.
441
442 opt_dry_run=false
443 opt_quiet=false
444 opt_verbose=false
445
446 # Categories 'all' and 'none' are always available. Append any others
447 # you will pass as the first argument to func_warning from your own
448 # code.
449 warning_categories=
450
451 # By default, display warnings according to 'opt_warning_types'. Set
452 # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
453 # treat the next displayed warning as a fatal error.
454 warning_func=func_warn_and_continue
455
456 # Set to 'all' to display all warnings, 'none' to suppress all
457 # warnings, or a space delimited list of some subset of
458 # 'warning_categories' to display only the listed warnings.
459 opt_warning_types=all
460
461
462 ## -------------------- ##
463 ## Resource management. ##
464 ## -------------------- ##
465
466 # This section contains definitions for functions that each ensure a
467 # particular resource (a file, or a non-empty configuration variable for
468 # example) is available, and if appropriate to extract default values
469 # from pertinent package files. Call them using their associated
470 # 'require_*' variable to ensure that they are executed, at most, once.
471 #
472 # It's entirely deliberate that calling these functions can set
473 # variables that don't obey the namespace limitations obeyed by the rest
474 # of this file, in order that that they be as useful as possible to
475 # callers.
476
477
478 # require_term_colors
479 # -------------------
480 # Allow display of bold text on terminals that support it.
481 require_term_colors=func_require_term_colors
482 func_require_term_colors ()
483 {
484 $debug_cmd
485
486 test -t 1 && {
487 # COLORTERM and USE_ANSI_COLORS environment variables take
488 # precedence, because most terminfo databases neglect to describe
489 # whether color sequences are supported.
490 test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
491
492 if test 1 = "$USE_ANSI_COLORS"; then
493 # Standard ANSI escape sequences
494 tc_reset=''
495 tc_bold=''; tc_standout=''
496 tc_red=''; tc_green=''
497 tc_blue=''; tc_cyan=''
498 else
499 # Otherwise trust the terminfo database after all.
500 test -n "`tput sgr0 2>/dev/null`" && {
501 tc_reset=`tput sgr0`
502 test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
503 tc_standout=$tc_bold
504 test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
505 test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
506 test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
507 test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
508 test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
509 }
510 fi
511 }
512
513 require_term_colors=:
514 }
515
516
517 ## ----------------- ##
518 ## Function library. ##
519 ## ----------------- ##
520
521 # This section contains a variety of useful functions to call in your
522 # scripts. Take note of the portable wrappers for features provided by
523 # some modern shells, which will fall back to slower equivalents on
524 # less featureful shells.
525
526
527 # func_append VAR VALUE
528 # ---------------------
529 # Append VALUE onto the existing contents of VAR.
530
531 # We should try to minimise forks, especially on Windows where they are
532 # unreasonably slow, so skip the feature probes when bash or zsh are
533 # being used:
534 if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
535 : ${_G_HAVE_ARITH_OP="yes"}
536 : ${_G_HAVE_XSI_OPS="yes"}
537 # The += operator was introduced in bash 3.1
538 case $BASH_VERSION in
539 [12].* | 3.0 | 3.0*) ;;
540 *)
541 : ${_G_HAVE_PLUSEQ_OP="yes"}
542 ;;
543 esac
544 fi
545
546 # _G_HAVE_PLUSEQ_OP
547 # Can be empty, in which case the shell is probed, "yes" if += is
548 # useable or anything else if it does not work.
549 test -z "$_G_HAVE_PLUSEQ_OP" \
550 && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
551 && _G_HAVE_PLUSEQ_OP=yes
552
553 if test yes = "$_G_HAVE_PLUSEQ_OP"
554 then
555 # This is an XSI compatible shell, allowing a faster implementation...
556 eval 'func_append ()
557 {
558 $debug_cmd
559
560 eval "$1+=\$2"
561 }'
562 else
563 # ...otherwise fall back to using expr, which is often a shell builtin.
564 func_append ()
565 {
566 $debug_cmd
567
568 eval "$1=\$$1\$2"
569 }
570 fi
571
572
573 # func_append_quoted VAR VALUE
574 # ----------------------------
575 # Quote VALUE and append to the end of shell variable VAR, separated
576 # by a space.
577 if test yes = "$_G_HAVE_PLUSEQ_OP"; then
578 eval 'func_append_quoted ()
579 {
580 $debug_cmd
581
582 func_quote_for_eval "$2"
583 eval "$1+=\\ \$func_quote_for_eval_result"
584 }'
585 else
586 func_append_quoted ()
587 {
588 $debug_cmd
589
590 func_quote_for_eval "$2"
591 eval "$1=\$$1\\ \$func_quote_for_eval_result"
592 }
593 fi
594
595
596 # func_append_uniq VAR VALUE
597 # --------------------------
598 # Append unique VALUE onto the existing contents of VAR, assuming
599 # entries are delimited by the first character of VALUE. For example:
600 #
601 # func_append_uniq options " --another-option option-argument"
602 #
603 # will only append to $options if " --another-option option-argument "
604 # is not already present somewhere in $options already (note spaces at
605 # each end implied by leading space in second argument).
606 func_append_uniq ()
607 {
608 $debug_cmd
609
610 eval _G_current_value='`$ECHO $'$1'`'
611 _G_delim=`expr "$2" : '\(.\)'`
612
613 case $_G_delim$_G_current_value$_G_delim in
614 *"$2$_G_delim"*) ;;
615 *) func_append "$@" ;;
616 esac
617 }
618
619
620 # func_arith TERM...
621 # ------------------
622 # Set func_arith_result to the result of evaluating TERMs.
623 test -z "$_G_HAVE_ARITH_OP" \
624 && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
625 && _G_HAVE_ARITH_OP=yes
626
627 if test yes = "$_G_HAVE_ARITH_OP"; then
628 eval 'func_arith ()
629 {
630 $debug_cmd
631
632 func_arith_result=$(( $* ))
633 }'
634 else
635 func_arith ()
636 {
637 $debug_cmd
638
639 func_arith_result=`expr "$@"`
640 }
641 fi
642
643
644 # func_basename FILE
645 # ------------------
646 # Set func_basename_result to FILE with everything up to and including
647 # the last / stripped.
648 if test yes = "$_G_HAVE_XSI_OPS"; then
649 # If this shell supports suffix pattern removal, then use it to avoid
650 # forking. Hide the definitions single quotes in case the shell chokes
651 # on unsupported syntax...
652 _b='func_basename_result=${1##*/}'
653 _d='case $1 in
654 */*) func_dirname_result=${1%/*}$2 ;;
655 * ) func_dirname_result=$3 ;;
656 esac'
657
658 else
659 # ...otherwise fall back to using sed.
660 _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
661 _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
662 if test "X$func_dirname_result" = "X$1"; then
663 func_dirname_result=$3
664 else
665 func_append func_dirname_result "$2"
666 fi'
667 fi
668
669 eval 'func_basename ()
670 {
671 $debug_cmd
672
673 '"$_b"'
674 }'
675
676
677 # func_dirname FILE APPEND NONDIR_REPLACEMENT
678 # -------------------------------------------
679 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
680 # otherwise set result to NONDIR_REPLACEMENT.
681 eval 'func_dirname ()
682 {
683 $debug_cmd
684
685 '"$_d"'
686 }'
687
688
689 # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
690 # --------------------------------------------------------
691 # Perform func_basename and func_dirname in a single function
692 # call:
693 # dirname: Compute the dirname of FILE. If nonempty,
694 # add APPEND to the result, otherwise set result
695 # to NONDIR_REPLACEMENT.
696 # value returned in "$func_dirname_result"
697 # basename: Compute filename of FILE.
698 # value retuned in "$func_basename_result"
699 # For efficiency, we do not delegate to the functions above but instead
700 # duplicate the functionality here.
701 eval 'func_dirname_and_basename ()
702 {
703 $debug_cmd
704
705 '"$_b"'
706 '"$_d"'
707 }'
708
709
710 # func_echo ARG...
711 # ----------------
712 # Echo program name prefixed message.
713 func_echo ()
714 {
715 $debug_cmd
716
717 _G_message=$*
718
719 func_echo_IFS=$IFS
720 IFS=$nl
721 for _G_line in $_G_message; do
722 IFS=$func_echo_IFS
723 $ECHO "$progname: $_G_line"
724 done
725 IFS=$func_echo_IFS
726 }
727
728
729 # func_echo_all ARG...
730 # --------------------
731 # Invoke $ECHO with all args, space-separated.
732 func_echo_all ()
733 {
734 $ECHO "$*"
735 }
736
737
738 # func_echo_infix_1 INFIX ARG...
739 # ------------------------------
740 # Echo program name, followed by INFIX on the first line, with any
741 # additional lines not showing INFIX.
742 func_echo_infix_1 ()
743 {
744 $debug_cmd
745
746 $require_term_colors
747
748 _G_infix=$1; shift
749 _G_indent=$_G_infix
750 _G_prefix="$progname: $_G_infix: "
751 _G_message=$*
752
753 # Strip color escape sequences before counting printable length
754 for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
755 do
756 test -n "$_G_tc" && {
757 _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
758 _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
759 }
760 done
761 _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
762
763 func_echo_infix_1_IFS=$IFS
764 IFS=$nl
765 for _G_line in $_G_message; do
766 IFS=$func_echo_infix_1_IFS
767 $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
768 _G_prefix=$_G_indent
769 done
770 IFS=$func_echo_infix_1_IFS
771 }
772
773
774 # func_error ARG...
775 # -----------------
776 # Echo program name prefixed message to standard error.
777 func_error ()
778 {
779 $debug_cmd
780
781 $require_term_colors
782
783 func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
784 }
785
786
787 # func_fatal_error ARG...
788 # -----------------------
789 # Echo program name prefixed message to standard error, and exit.
790 func_fatal_error ()
791 {
792 $debug_cmd
793
794 func_error "$*"
795 exit $EXIT_FAILURE
796 }
797
798
799 # func_grep EXPRESSION FILENAME
800 # -----------------------------
801 # Check whether EXPRESSION matches any line of FILENAME, without output.
802 func_grep ()
803 {
804 $debug_cmd
805
806 $GREP "$1" "$2" >/dev/null 2>&1
807 }
808
809
810 # func_len STRING
811 # ---------------
812 # Set func_len_result to the length of STRING. STRING may not
813 # start with a hyphen.
814 test -z "$_G_HAVE_XSI_OPS" \
815 && (eval 'x=a/b/c;
816 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
817 && _G_HAVE_XSI_OPS=yes
818
819 if test yes = "$_G_HAVE_XSI_OPS"; then
820 eval 'func_len ()
821 {
822 $debug_cmd
823
824 func_len_result=${#1}
825 }'
826 else
827 func_len ()
828 {
829 $debug_cmd
830
831 func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
832 }
833 fi
834
835
836 # func_mkdir_p DIRECTORY-PATH
837 # ---------------------------
838 # Make sure the entire path to DIRECTORY-PATH is available.
839 func_mkdir_p ()
840 {
841 $debug_cmd
842
843 _G_directory_path=$1
844 _G_dir_list=
845
846 if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
847
848 # Protect directory names starting with '-'
849 case $_G_directory_path in
850 -*) _G_directory_path=./$_G_directory_path ;;
851 esac
852
853 # While some portion of DIR does not yet exist...
854 while test ! -d "$_G_directory_path"; do
855 # ...make a list in topmost first order. Use a colon delimited
856 # list incase some portion of path contains whitespace.
857 _G_dir_list=$_G_directory_path:$_G_dir_list
858
859 # If the last portion added has no slash in it, the list is done
860 case $_G_directory_path in */*) ;; *) break ;; esac
861
862 # ...otherwise throw away the child directory and loop
863 _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
864 done
865 _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
866
867 func_mkdir_p_IFS=$IFS; IFS=:
868 for _G_dir in $_G_dir_list; do
869 IFS=$func_mkdir_p_IFS
870 # mkdir can fail with a 'File exist' error if two processes
871 # try to create one of the directories concurrently. Don't
872 # stop in that case!
873 $MKDIR "$_G_dir" 2>/dev/null || :
874 done
875 IFS=$func_mkdir_p_IFS
876
877 # Bail out if we (or some other process) failed to create a directory.
878 test -d "$_G_directory_path" || \
879 func_fatal_error "Failed to create '$1'"
880 fi
881 }
882
883
884 # func_mktempdir [BASENAME]
885 # -------------------------
886 # Make a temporary directory that won't clash with other running
887 # libtool processes, and avoids race conditions if possible. If
888 # given, BASENAME is the basename for that directory.
889 func_mktempdir ()
890 {
891 $debug_cmd
892
893 _G_template=${TMPDIR-/tmp}/${1-$progname}
894
895 if test : = "$opt_dry_run"; then
896 # Return a directory name, but don't create it in dry-run mode
897 _G_tmpdir=$_G_template-$$
898 else
899
900 # If mktemp works, use that first and foremost
901 _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
902
903 if test ! -d "$_G_tmpdir"; then
904 # Failing that, at least try and use $RANDOM to avoid a race
905 _G_tmpdir=$_G_template-${RANDOM-0}$$
906
907 func_mktempdir_umask=`umask`
908 umask 0077
909 $MKDIR "$_G_tmpdir"
910 umask $func_mktempdir_umask
911 fi
912
913 # If we're not in dry-run mode, bomb out on failure
914 test -d "$_G_tmpdir" || \
915 func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
916 fi
917
918 $ECHO "$_G_tmpdir"
919 }
920
921
922 # func_normal_abspath PATH
923 # ------------------------
924 # Remove doubled-up and trailing slashes, "." path components,
925 # and cancel out any ".." path components in PATH after making
926 # it an absolute path.
927 func_normal_abspath ()
928 {
929 $debug_cmd
930
931 # These SED scripts presuppose an absolute path with a trailing slash.
932 _G_pathcar='s|^/\([^/]*\).*$|\1|'
933 _G_pathcdr='s|^/[^/]*||'
934 _G_removedotparts=':dotsl
935 s|/\./|/|g
936 t dotsl
937 s|/\.$|/|'
938 _G_collapseslashes='s|/\{1,\}|/|g'
939 _G_finalslash='s|/*$|/|'
940
941 # Start from root dir and reassemble the path.
942 func_normal_abspath_result=
943 func_normal_abspath_tpath=$1
944 func_normal_abspath_altnamespace=
945 case $func_normal_abspath_tpath in
946 "")
947 # Empty path, that just means $cwd.
948 func_stripname '' '/' "`pwd`"
949 func_normal_abspath_result=$func_stripname_result
950 return
951 ;;
952 # The next three entries are used to spot a run of precisely
953 # two leading slashes without using negated character classes;
954 # we take advantage of case's first-match behaviour.
955 ///*)
956 # Unusual form of absolute path, do nothing.
957 ;;
958 //*)
959 # Not necessarily an ordinary path; POSIX reserves leading '//'
960 # and for example Cygwin uses it to access remote file shares
961 # over CIFS/SMB, so we conserve a leading double slash if found.
962 func_normal_abspath_altnamespace=/
963 ;;
964 /*)
965 # Absolute path, do nothing.
966 ;;
967 *)
968 # Relative path, prepend $cwd.
969 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
970 ;;
971 esac
972
973 # Cancel out all the simple stuff to save iterations. We also want
974 # the path to end with a slash for ease of parsing, so make sure
975 # there is one (and only one) here.
976 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
977 -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
978 while :; do
979 # Processed it all yet?
980 if test / = "$func_normal_abspath_tpath"; then
981 # If we ascended to the root using ".." the result may be empty now.
982 if test -z "$func_normal_abspath_result"; then
983 func_normal_abspath_result=/
984 fi
985 break
986 fi
987 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
988 -e "$_G_pathcar"`
989 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
990 -e "$_G_pathcdr"`
991 # Figure out what to do with it
992 case $func_normal_abspath_tcomponent in
993 "")
994 # Trailing empty path component, ignore it.
995 ;;
996 ..)
997 # Parent dir; strip last assembled component from result.
998 func_dirname "$func_normal_abspath_result"
999 func_normal_abspath_result=$func_dirname_result
1000 ;;
1001 *)
1002 # Actual path component, append it.
1003 func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
1004 ;;
1005 esac
1006 done
1007 # Restore leading double-slash if one was found on entry.
1008 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
1009 }
1010
1011
1012 # func_notquiet ARG...
1013 # --------------------
1014 # Echo program name prefixed message only when not in quiet mode.
1015 func_notquiet ()
1016 {
1017 $debug_cmd
1018
1019 $opt_quiet || func_echo ${1+"$@"}
1020
1021 # A bug in bash halts the script if the last line of a function
1022 # fails when set -e is in force, so we need another command to
1023 # work around that:
1024 :
1025 }
1026
1027
1028 # func_relative_path SRCDIR DSTDIR
1029 # --------------------------------
1030 # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
1031 func_relative_path ()
1032 {
1033 $debug_cmd
1034
1035 func_relative_path_result=
1036 func_normal_abspath "$1"
1037 func_relative_path_tlibdir=$func_normal_abspath_result
1038 func_normal_abspath "$2"
1039 func_relative_path_tbindir=$func_normal_abspath_result
1040
1041 # Ascend the tree starting from libdir
1042 while :; do
1043 # check if we have found a prefix of bindir
1044 case $func_relative_path_tbindir in
1045 $func_relative_path_tlibdir)
1046 # found an exact match
1047 func_relative_path_tcancelled=
1048 break
1049 ;;
1050 $func_relative_path_tlibdir*)
1051 # found a matching prefix
1052 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
1053 func_relative_path_tcancelled=$func_stripname_result
1054 if test -z "$func_relative_path_result"; then
1055 func_relative_path_result=.
1056 fi
1057 break
1058 ;;
1059 *)
1060 func_dirname $func_relative_path_tlibdir
1061 func_relative_path_tlibdir=$func_dirname_result
1062 if test -z "$func_relative_path_tlibdir"; then
1063 # Have to descend all the way to the root!
1064 func_relative_path_result=../$func_relative_path_result
1065 func_relative_path_tcancelled=$func_relative_path_tbindir
1066 break
1067 fi
1068 func_relative_path_result=../$func_relative_path_result
1069 ;;
1070 esac
1071 done
1072
1073 # Now calculate path; take care to avoid doubling-up slashes.
1074 func_stripname '' '/' "$func_relative_path_result"
1075 func_relative_path_result=$func_stripname_result
1076 func_stripname '/' '/' "$func_relative_path_tcancelled"
1077 if test -n "$func_stripname_result"; then
1078 func_append func_relative_path_result "/$func_stripname_result"
1079 fi
1080
1081 # Normalisation. If bindir is libdir, return '.' else relative path.
1082 if test -n "$func_relative_path_result"; then
1083 func_stripname './' '' "$func_relative_path_result"
1084 func_relative_path_result=$func_stripname_result
1085 fi
1086
1087 test -n "$func_relative_path_result" || func_relative_path_result=.
1088
1089 :
1090 }
1091
1092
1093 # func_quote_for_eval ARG...
1094 # --------------------------
1095 # Aesthetically quote ARGs to be evaled later.
1096 # This function returns two values:
1097 # i) func_quote_for_eval_result
1098 # double-quoted, suitable for a subsequent eval
1099 # ii) func_quote_for_eval_unquoted_result
1100 # has all characters that are still active within double
1101 # quotes backslashified.
1102 func_quote_for_eval ()
1103 {
1104 $debug_cmd
1105
1106 func_quote_for_eval_unquoted_result=
1107 func_quote_for_eval_result=
1108 while test 0 -lt $#; do
1109 case $1 in
1110 *[\\\`\"\$]*)
1111 _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
1112 *)
1113 _G_unquoted_arg=$1 ;;
1114 esac
1115 if test -n "$func_quote_for_eval_unquoted_result"; then
1116 func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
1117 else
1118 func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
1119 fi
1120
1121 case $_G_unquoted_arg in
1122 # Double-quote args containing shell metacharacters to delay
1123 # word splitting, command substitution and variable expansion
1124 # for a subsequent eval.
1125 # Many Bourne shells cannot handle close brackets correctly
1126 # in scan sets, so we specify it separately.
1127 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1128 _G_quoted_arg=\"$_G_unquoted_arg\"
1129 ;;
1130 *)
1131 _G_quoted_arg=$_G_unquoted_arg
1132 ;;
1133 esac
1134
1135 if test -n "$func_quote_for_eval_result"; then
1136 func_append func_quote_for_eval_result " $_G_quoted_arg"
1137 else
1138 func_append func_quote_for_eval_result "$_G_quoted_arg"
1139 fi
1140 shift
1141 done
1142 }
1143
1144
1145 # func_quote_for_expand ARG
1146 # -------------------------
1147 # Aesthetically quote ARG to be evaled later; same as above,
1148 # but do not quote variable references.
1149 func_quote_for_expand ()
1150 {
1151 $debug_cmd
1152
1153 case $1 in
1154 *[\\\`\"]*)
1155 _G_arg=`$ECHO "$1" | $SED \
1156 -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
1157 *)
1158 _G_arg=$1 ;;
1159 esac
1160
1161 case $_G_arg in
1162 # Double-quote args containing shell metacharacters to delay
1163 # word splitting and command substitution for a subsequent eval.
1164 # Many Bourne shells cannot handle close brackets correctly
1165 # in scan sets, so we specify it separately.
1166 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1167 _G_arg=\"$_G_arg\"
1168 ;;
1169 esac
1170
1171 func_quote_for_expand_result=$_G_arg
1172 }
1173
1174
1175 # func_stripname PREFIX SUFFIX NAME
1176 # ---------------------------------
1177 # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
1178 # PREFIX and SUFFIX must not contain globbing or regex special
1179 # characters, hashes, percent signs, but SUFFIX may contain a leading
1180 # dot (in which case that matches only a dot).
1181 if test yes = "$_G_HAVE_XSI_OPS"; then
1182 eval 'func_stripname ()
1183 {
1184 $debug_cmd
1185
1186 # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
1187 # positional parameters, so assign one to ordinary variable first.
1188 func_stripname_result=$3
1189 func_stripname_result=${func_stripname_result#"$1"}
1190 func_stripname_result=${func_stripname_result%"$2"}
1191 }'
1192 else
1193 func_stripname ()
1194 {
1195 $debug_cmd
1196
1197 case $2 in
1198 .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
1199 *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
1200 esac
1201 }
1202 fi
1203
1204
1205 # func_show_eval CMD [FAIL_EXP]
1206 # -----------------------------
1207 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1208 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1209 # is given, then evaluate it.
1210 func_show_eval ()
1211 {
1212 $debug_cmd
1213
1214 _G_cmd=$1
1215 _G_fail_exp=${2-':'}
1216
1217 func_quote_for_expand "$_G_cmd"
1218 eval "func_notquiet $func_quote_for_expand_result"
1219
1220 $opt_dry_run || {
1221 eval "$_G_cmd"
1222 _G_status=$?
1223 if test 0 -ne "$_G_status"; then
1224 eval "(exit $_G_status); $_G_fail_exp"
1225 fi
1226 }
1227 }
1228
1229
1230 # func_show_eval_locale CMD [FAIL_EXP]
1231 # ------------------------------------
1232 # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
1233 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
1234 # is given, then evaluate it. Use the saved locale for evaluation.
1235 func_show_eval_locale ()
1236 {
1237 $debug_cmd
1238
1239 _G_cmd=$1
1240 _G_fail_exp=${2-':'}
1241
1242 $opt_quiet || {
1243 func_quote_for_expand "$_G_cmd"
1244 eval "func_echo $func_quote_for_expand_result"
1245 }
1246
1247 $opt_dry_run || {
1248 eval "$_G_user_locale
1249 $_G_cmd"
1250 _G_status=$?
1251 eval "$_G_safe_locale"
1252 if test 0 -ne "$_G_status"; then
1253 eval "(exit $_G_status); $_G_fail_exp"
1254 fi
1255 }
1256 }
1257
1258
1259 # func_tr_sh
1260 # ----------
1261 # Turn $1 into a string suitable for a shell variable name.
1262 # Result is stored in $func_tr_sh_result. All characters
1263 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
1264 # if $1 begins with a digit, a '_' is prepended as well.
1265 func_tr_sh ()
1266 {
1267 $debug_cmd
1268
1269 case $1 in
1270 [0-9]* | *[!a-zA-Z0-9_]*)
1271 func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
1272 ;;
1273 * )
1274 func_tr_sh_result=$1
1275 ;;
1276 esac
1277 }
1278
1279
1280 # func_verbose ARG...
1281 # -------------------
1282 # Echo program name prefixed message in verbose mode only.
1283 func_verbose ()
1284 {
1285 $debug_cmd
1286
1287 $opt_verbose && func_echo "$*"
1288
1289 :
1290 }
1291
1292
1293 # func_warn_and_continue ARG...
1294 # -----------------------------
1295 # Echo program name prefixed warning message to standard error.
1296 func_warn_and_continue ()
1297 {
1298 $debug_cmd
1299
1300 $require_term_colors
1301
1302 func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
1303 }
1304
1305
1306 # func_warning CATEGORY ARG...
1307 # ----------------------------
1308 # Echo program name prefixed warning message to standard error. Warning
1309 # messages can be filtered according to CATEGORY, where this function
1310 # elides messages where CATEGORY is not listed in the global variable
1311 # 'opt_warning_types'.
1312 func_warning ()
1313 {
1314 $debug_cmd
1315
1316 # CATEGORY must be in the warning_categories list!
1317 case " $warning_categories " in
1318 *" $1 "*) ;;
1319 *) func_internal_error "invalid warning category '$1'" ;;
1320 esac
1321
1322 _G_category=$1
1323 shift
1324
1325 case " $opt_warning_types " in
1326 *" $_G_category "*) $warning_func ${1+"$@"} ;;
1327 esac
1328 }
1329
1330
1331 # func_sort_ver VER1 VER2
1332 # -----------------------
1333 # 'sort -V' is not generally available.
1334 # Note this deviates from the version comparison in automake
1335 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
1336 # but this should suffice as we won't be specifying old
1337 # version formats or redundant trailing .0 in bootstrap.conf.
1338 # If we did want full compatibility then we should probably
1339 # use m4_version_compare from autoconf.
1340 func_sort_ver ()
1341 {
1342 $debug_cmd
1343
1344 printf '%s\n%s\n' "$1" "$2" \
1345 | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
1346 }
1347
1348 # func_lt_ver PREV CURR
1349 # ---------------------
1350 # Return true if PREV and CURR are in the correct order according to
1351 # func_sort_ver, otherwise false. Use it like this:
1352 #
1353 # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
1354 func_lt_ver ()
1355 {
1356 $debug_cmd
1357
1358 test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
1359 }
1360
1361
1362 # Local variables:
1363 # mode: shell-script
1364 # sh-indentation: 2
1365 # eval: (add-hook 'before-save-hook 'time-stamp)
1366 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1367 # time-stamp-time-zone: "UTC"
1368 # End:
1369 #! /bin/sh
1370
1371 # Set a version string for this script.
1372 scriptversion=2014-01-07.03; # UTC
1373
1374 # A portable, pluggable option parser for Bourne shell.
1375 # Written by Gary V. Vaughan, 2010
1376
1377 # Copyright (C) 2010-2015 Free Software Foundation, Inc.
1378 # This is free software; see the source for copying conditions. There is NO
1379 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1380
1381 # This program is free software: you can redistribute it and/or modify
1382 # it under the terms of the GNU General Public License as published by
1383 # the Free Software Foundation, either version 3 of the License, or
1384 # (at your option) any later version.
1385
1386 # This program is distributed in the hope that it will be useful,
1387 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1388 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1389 # GNU General Public License for more details.
1390
1391 # You should have received a copy of the GNU General Public License
1392 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1393
1394 # Please report bugs or propose patches to gary@gnu.org.
1395
1396
1397 ## ------ ##
1398 ## Usage. ##
1399 ## ------ ##
1400
1401 # This file is a library for parsing options in your shell scripts along
1402 # with assorted other useful supporting features that you can make use
1403 # of too.
1404 #
1405 # For the simplest scripts you might need only:
1406 #
1407 # #!/bin/sh
1408 # . relative/path/to/funclib.sh
1409 # . relative/path/to/options-parser
1410 # scriptversion=1.0
1411 # func_options ${1+"$@"}
1412 # eval set dummy "$func_options_result"; shift
1413 # ...rest of your script...
1414 #
1415 # In order for the '--version' option to work, you will need to have a
1416 # suitably formatted comment like the one at the top of this file
1417 # starting with '# Written by ' and ending with '# warranty; '.
1418 #
1419 # For '-h' and '--help' to work, you will also need a one line
1420 # description of your script's purpose in a comment directly above the
1421 # '# Written by ' line, like the one at the top of this file.
1422 #
1423 # The default options also support '--debug', which will turn on shell
1424 # execution tracing (see the comment above debug_cmd below for another
1425 # use), and '--verbose' and the func_verbose function to allow your script
1426 # to display verbose messages only when your user has specified
1427 # '--verbose'.
1428 #
1429 # After sourcing this file, you can plug processing for additional
1430 # options by amending the variables from the 'Configuration' section
1431 # below, and following the instructions in the 'Option parsing'
1432 # section further down.
1433
1434 ## -------------- ##
1435 ## Configuration. ##
1436 ## -------------- ##
1437
1438 # You should override these variables in your script after sourcing this
1439 # file so that they reflect the customisations you have added to the
1440 # option parser.
1441
1442 # The usage line for option parsing errors and the start of '-h' and
1443 # '--help' output messages. You can embed shell variables for delayed
1444 # expansion at the time the message is displayed, but you will need to
1445 # quote other shell meta-characters carefully to prevent them being
1446 # expanded when the contents are evaled.
1447 usage='$progpath [OPTION]...'
1448
1449 # Short help message in response to '-h' and '--help'. Add to this or
1450 # override it after sourcing this library to reflect the full set of
1451 # options your script accepts.
1452 usage_message="\
1453 --debug enable verbose shell tracing
1454 -W, --warnings=CATEGORY
1455 report the warnings falling in CATEGORY [all]
1456 -v, --verbose verbosely report processing
1457 --version print version information and exit
1458 -h, --help print short or long help message and exit
1459 "
1460
1461 # Additional text appended to 'usage_message' in response to '--help'.
1462 long_help_message="
1463 Warning categories include:
1464 'all' show all warnings
1465 'none' turn off all the warnings
1466 'error' warnings are treated as fatal errors"
1467
1468 # Help message printed before fatal option parsing errors.
1469 fatal_help="Try '\$progname --help' for more information."
1470
1471
1472
1473 ## ------------------------- ##
1474 ## Hook function management. ##
1475 ## ------------------------- ##
1476
1477 # This section contains functions for adding, removing, and running hooks
1478 # to the main code. A hook is just a named list of of function, that can
1479 # be run in order later on.
1480
1481 # func_hookable FUNC_NAME
1482 # -----------------------
1483 # Declare that FUNC_NAME will run hooks added with
1484 # 'func_add_hook FUNC_NAME ...'.
1485 func_hookable ()
1486 {
1487 $debug_cmd
1488
1489 func_append hookable_fns " $1"
1490 }
1491
1492
1493 # func_add_hook FUNC_NAME HOOK_FUNC
1494 # ---------------------------------
1495 # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
1496 # first have been declared "hookable" by a call to 'func_hookable'.
1497 func_add_hook ()
1498 {
1499 $debug_cmd
1500
1501 case " $hookable_fns " in
1502 *" $1 "*) ;;
1503 *) func_fatal_error "'$1' does not accept hook functions." ;;
1504 esac
1505
1506 eval func_append ${1}_hooks '" $2"'
1507 }
1508
1509
1510 # func_remove_hook FUNC_NAME HOOK_FUNC
1511 # ------------------------------------
1512 # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
1513 func_remove_hook ()
1514 {
1515 $debug_cmd
1516
1517 eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
1518 }
1519
1520
1521 # func_run_hooks FUNC_NAME [ARG]...
1522 # ---------------------------------
1523 # Run all hook functions registered to FUNC_NAME.
1524 # It is assumed that the list of hook functions contains nothing more
1525 # than a whitespace-delimited list of legal shell function names, and
1526 # no effort is wasted trying to catch shell meta-characters or preserve
1527 # whitespace.
1528 func_run_hooks ()
1529 {
1530 $debug_cmd
1531
1532 case " $hookable_fns " in
1533 *" $1 "*) ;;
1534 *) func_fatal_error "'$1' does not support hook funcions.n" ;;
1535 esac
1536
1537 eval _G_hook_fns=\$$1_hooks; shift
1538
1539 for _G_hook in $_G_hook_fns; do
1540 eval $_G_hook '"$@"'
1541
1542 # store returned options list back into positional
1543 # parameters for next 'cmd' execution.
1544 eval _G_hook_result=\$${_G_hook}_result
1545 eval set dummy "$_G_hook_result"; shift
1546 done
1547
1548 func_quote_for_eval ${1+"$@"}
1549 func_run_hooks_result=$func_quote_for_eval_result
1550 }
1551
1552
1553
1554 ## --------------- ##
1555 ## Option parsing. ##
1556 ## --------------- ##
1557
1558 # In order to add your own option parsing hooks, you must accept the
1559 # full positional parameter list in your hook function, remove any
1560 # options that you action, and then pass back the remaining unprocessed
1561 # options in '<hooked_function_name>_result', escaped suitably for
1562 # 'eval'. Like this:
1563 #
1564 # my_options_prep ()
1565 # {
1566 # $debug_cmd
1567 #
1568 # # Extend the existing usage message.
1569 # usage_message=$usage_message'
1570 # -s, --silent don'\''t print informational messages
1571 # '
1572 #
1573 # func_quote_for_eval ${1+"$@"}
1574 # my_options_prep_result=$func_quote_for_eval_result
1575 # }
1576 # func_add_hook func_options_prep my_options_prep
1577 #
1578 #
1579 # my_silent_option ()
1580 # {
1581 # $debug_cmd
1582 #
1583 # # Note that for efficiency, we parse as many options as we can
1584 # # recognise in a loop before passing the remainder back to the
1585 # # caller on the first unrecognised argument we encounter.
1586 # while test $# -gt 0; do
1587 # opt=$1; shift
1588 # case $opt in
1589 # --silent|-s) opt_silent=: ;;
1590 # # Separate non-argument short options:
1591 # -s*) func_split_short_opt "$_G_opt"
1592 # set dummy "$func_split_short_opt_name" \
1593 # "-$func_split_short_opt_arg" ${1+"$@"}
1594 # shift
1595 # ;;
1596 # *) set dummy "$_G_opt" "$*"; shift; break ;;
1597 # esac
1598 # done
1599 #
1600 # func_quote_for_eval ${1+"$@"}
1601 # my_silent_option_result=$func_quote_for_eval_result
1602 # }
1603 # func_add_hook func_parse_options my_silent_option
1604 #
1605 #
1606 # my_option_validation ()
1607 # {
1608 # $debug_cmd
1609 #
1610 # $opt_silent && $opt_verbose && func_fatal_help "\
1611 # '--silent' and '--verbose' options are mutually exclusive."
1612 #
1613 # func_quote_for_eval ${1+"$@"}
1614 # my_option_validation_result=$func_quote_for_eval_result
1615 # }
1616 # func_add_hook func_validate_options my_option_validation
1617 #
1618 # You'll alse need to manually amend $usage_message to reflect the extra
1619 # options you parse. It's preferable to append if you can, so that
1620 # multiple option parsing hooks can be added safely.
1621
1622
1623 # func_options [ARG]...
1624 # ---------------------
1625 # All the functions called inside func_options are hookable. See the
1626 # individual implementations for details.
1627 func_hookable func_options
1628 func_options ()
1629 {
1630 $debug_cmd
1631
1632 func_options_prep ${1+"$@"}
1633 eval func_parse_options \
1634 ${func_options_prep_result+"$func_options_prep_result"}
1635 eval func_validate_options \
1636 ${func_parse_options_result+"$func_parse_options_result"}
1637
1638 eval func_run_hooks func_options \
1639 ${func_validate_options_result+"$func_validate_options_result"}
1640
1641 # save modified positional parameters for caller
1642 func_options_result=$func_run_hooks_result
1643 }
1644
1645
1646 # func_options_prep [ARG]...
1647 # --------------------------
1648 # All initialisations required before starting the option parse loop.
1649 # Note that when calling hook functions, we pass through the list of
1650 # positional parameters. If a hook function modifies that list, and
1651 # needs to propogate that back to rest of this script, then the complete
1652 # modified list must be put in 'func_run_hooks_result' before
1653 # returning.
1654 func_hookable func_options_prep
1655 func_options_prep ()
1656 {
1657 $debug_cmd
1658
1659 # Option defaults:
1660 opt_verbose=false
1661 opt_warning_types=
1662
1663 func_run_hooks func_options_prep ${1+"$@"}
1664
1665 # save modified positional parameters for caller
1666 func_options_prep_result=$func_run_hooks_result
1667 }
1668
1669
1670 # func_parse_options [ARG]...
1671 # ---------------------------
1672 # The main option parsing loop.
1673 func_hookable func_parse_options
1674 func_parse_options ()
1675 {
1676 $debug_cmd
1677
1678 func_parse_options_result=
1679
1680 # this just eases exit handling
1681 while test $# -gt 0; do
1682 # Defer to hook functions for initial option parsing, so they
1683 # get priority in the event of reusing an option name.
1684 func_run_hooks func_parse_options ${1+"$@"}
1685
1686 # Adjust func_parse_options positional parameters to match
1687 eval set dummy "$func_run_hooks_result"; shift
1688
1689 # Break out of the loop if we already parsed every option.
1690 test $# -gt 0 || break
1691
1692 _G_opt=$1
1693 shift
1694 case $_G_opt in
1695 --debug|-x) debug_cmd='set -x'
1696 func_echo "enabling shell trace mode"
1697 $debug_cmd
1698 ;;
1699
1700 --no-warnings|--no-warning|--no-warn)
1701 set dummy --warnings none ${1+"$@"}
1702 shift
1703 ;;
1704
1705 --warnings|--warning|-W)
1706 test $# = 0 && func_missing_arg $_G_opt && break
1707 case " $warning_categories $1" in
1708 *" $1 "*)
1709 # trailing space prevents matching last $1 above
1710 func_append_uniq opt_warning_types " $1"
1711 ;;
1712 *all)
1713 opt_warning_types=$warning_categories
1714 ;;
1715 *none)
1716 opt_warning_types=none
1717 warning_func=:
1718 ;;
1719 *error)
1720 opt_warning_types=$warning_categories
1721 warning_func=func_fatal_error
1722 ;;
1723 *)
1724 func_fatal_error \
1725 "unsupported warning category: '$1'"
1726 ;;
1727 esac
1728 shift
1729 ;;
1730
1731 --verbose|-v) opt_verbose=: ;;
1732 --version) func_version ;;
1733 -\?|-h) func_usage ;;
1734 --help) func_help ;;
1735
1736 # Separate optargs to long options (plugins may need this):
1737 --*=*) func_split_equals "$_G_opt"
1738 set dummy "$func_split_equals_lhs" \
1739 "$func_split_equals_rhs" ${1+"$@"}
1740 shift
1741 ;;
1742
1743 # Separate optargs to short options:
1744 -W*)
1745 func_split_short_opt "$_G_opt"
1746 set dummy "$func_split_short_opt_name" \
1747 "$func_split_short_opt_arg" ${1+"$@"}
1748 shift
1749 ;;
1750
1751 # Separate non-argument short options:
1752 -\?*|-h*|-v*|-x*)
1753 func_split_short_opt "$_G_opt"
1754 set dummy "$func_split_short_opt_name" \
1755 "-$func_split_short_opt_arg" ${1+"$@"}
1756 shift
1757 ;;
1758
1759 --) break ;;
1760 -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
1761 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
1762 esac
1763 done
1764
1765 # save modified positional parameters for caller
1766 func_quote_for_eval ${1+"$@"}
1767 func_parse_options_result=$func_quote_for_eval_result
1768 }
1769
1770
1771 # func_validate_options [ARG]...
1772 # ------------------------------
1773 # Perform any sanity checks on option settings and/or unconsumed
1774 # arguments.
1775 func_hookable func_validate_options
1776 func_validate_options ()
1777 {
1778 $debug_cmd
1779
1780 # Display all warnings if -W was not given.
1781 test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
1782
1783 func_run_hooks func_validate_options ${1+"$@"}
1784
1785 # Bail if the options were screwed!
1786 $exit_cmd $EXIT_FAILURE
1787
1788 # save modified positional parameters for caller
1789 func_validate_options_result=$func_run_hooks_result
1790 }
1791
1792
1793
1794 ## ----------------- ##
1795 ## Helper functions. ##
1796 ## ----------------- ##
1797
1798 # This section contains the helper functions used by the rest of the
1799 # hookable option parser framework in ascii-betical order.
1800
1801
1802 # func_fatal_help ARG...
1803 # ----------------------
1804 # Echo program name prefixed message to standard error, followed by
1805 # a help hint, and exit.
1806 func_fatal_help ()
1807 {
1808 $debug_cmd
1809
1810 eval \$ECHO \""Usage: $usage"\"
1811 eval \$ECHO \""$fatal_help"\"
1812 func_error ${1+"$@"}
1813 exit $EXIT_FAILURE
1814 }
1815
1816
1817 # func_help
1818 # ---------
1819 # Echo long help message to standard output and exit.
1820 func_help ()
1821 {
1822 $debug_cmd
1823
1824 func_usage_message
1825 $ECHO "$long_help_message"
1826 exit 0
1827 }
1828
1829
1830 # func_missing_arg ARGNAME
1831 # ------------------------
1832 # Echo program name prefixed message to standard error and set global
1833 # exit_cmd.
1834 func_missing_arg ()
1835 {
1836 $debug_cmd
1837
1838 func_error "Missing argument for '$1'."
1839 exit_cmd=exit
1840 }
1841
1842
1843 # func_split_equals STRING
1844 # ------------------------
1845 # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
1846 # splitting STRING at the '=' sign.
1847 test -z "$_G_HAVE_XSI_OPS" \
1848 && (eval 'x=a/b/c;
1849 test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
1850 && _G_HAVE_XSI_OPS=yes
1851
1852 if test yes = "$_G_HAVE_XSI_OPS"
1853 then
1854 # This is an XSI compatible shell, allowing a faster implementation...
1855 eval 'func_split_equals ()
1856 {
1857 $debug_cmd
1858
1859 func_split_equals_lhs=${1%%=*}
1860 func_split_equals_rhs=${1#*=}
1861 test "x$func_split_equals_lhs" = "x$1" \
1862 && func_split_equals_rhs=
1863 }'
1864 else
1865 # ...otherwise fall back to using expr, which is often a shell builtin.
1866 func_split_equals ()
1867 {
1868 $debug_cmd
1869
1870 func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
1871 func_split_equals_rhs=
1872 test "x$func_split_equals_lhs" = "x$1" \
1873 || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
1874 }
1875 fi #func_split_equals
1876
1877
1878 # func_split_short_opt SHORTOPT
1879 # -----------------------------
1880 # Set func_split_short_opt_name and func_split_short_opt_arg shell
1881 # variables after splitting SHORTOPT after the 2nd character.
1882 if test yes = "$_G_HAVE_XSI_OPS"
1883 then
1884 # This is an XSI compatible shell, allowing a faster implementation...
1885 eval 'func_split_short_opt ()
1886 {
1887 $debug_cmd
1888
1889 func_split_short_opt_arg=${1#??}
1890 func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
1891 }'
1892 else
1893 # ...otherwise fall back to using expr, which is often a shell builtin.
1894 func_split_short_opt ()
1895 {
1896 $debug_cmd
1897
1898 func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
1899 func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
1900 }
1901 fi #func_split_short_opt
1902
1903
1904 # func_usage
1905 # ----------
1906 # Echo short help message to standard output and exit.
1907 func_usage ()
1908 {
1909 $debug_cmd
1910
1911 func_usage_message
1912 $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
1913 exit 0
1914 }
1915
1916
1917 # func_usage_message
1918 # ------------------
1919 # Echo short help message to standard output.
1920 func_usage_message ()
1921 {
1922 $debug_cmd
1923
1924 eval \$ECHO \""Usage: $usage"\"
1925 echo
1926 $SED -n 's|^# ||
1927 /^Written by/{
1928 x;p;x
1929 }
1930 h
1931 /^Written by/q' < "$progpath"
1932 echo
1933 eval \$ECHO \""$usage_message"\"
1934 }
1935
1936
1937 # func_version
1938 # ------------
1939 # Echo version message to standard output and exit.
1940 func_version ()
1941 {
1942 $debug_cmd
1943
1944 printf '%s\n' "$progname $scriptversion"
1945 $SED -n '
1946 /(C)/!b go
1947 :more
1948 /\./!{
1949 N
1950 s|\n# | |
1951 b more
1952 }
1953 :go
1954 /^# Written by /,/# warranty; / {
1955 s|^# ||
1956 s|^# *$||
1957 s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
1958 p
1959 }
1960 /^# Written by / {
1961 s|^# ||
1962 p
1963 }
1964 /^warranty; /q' < "$progpath"
1965
1966 exit $?
1967 }
1968
1969
1970 # Local variables:
1971 # mode: shell-script
1972 # sh-indentation: 2
1973 # eval: (add-hook 'before-save-hook 'time-stamp)
1974 # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1975 # time-stamp-time-zone: "UTC"
1976 # End:
1977
1978 # Set a version string.
1979 scriptversion='(GNU libtool) 2.4.6'
1980
1981
1982 # func_echo ARG...
1983 # ----------------
1984 # Libtool also displays the current mode in messages, so override
1985 # funclib.sh func_echo with this custom definition.
1986 func_echo ()
1987 {
1988 $debug_cmd
1989
1990 _G_message=$*
1991
1992 func_echo_IFS=$IFS
1993 IFS=$nl
1994 for _G_line in $_G_message; do
1995 IFS=$func_echo_IFS
1996 $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
1997 done
1998 IFS=$func_echo_IFS
1999 }
2000
2001
2002 # func_warning ARG...
2003 # -------------------
2004 # Libtool warnings are not categorized, so override funclib.sh
2005 # func_warning with this simpler definition.
2006 func_warning ()
2007 {
2008 $debug_cmd
2009
2010 $warning_func ${1+"$@"}
2011 }
2012
2013
2014 ## ---------------- ##
2015 ## Options parsing. ##
2016 ## ---------------- ##
2017
2018 # Hook in the functions to make sure our own options are parsed during
2019 # the option parsing loop.
2020
2021 usage='$progpath [OPTION]... [MODE-ARG]...'
2022
2023 # Short help message in response to '-h'.
2024 usage_message="Options:
2025 --config show all configuration variables
2026 --debug enable verbose shell tracing
2027 -n, --dry-run display commands without modifying any files
2028 --features display basic configuration information and exit
2029 --mode=MODE use operation mode MODE
2030 --no-warnings equivalent to '-Wnone'
2031 --preserve-dup-deps don't remove duplicate dependency libraries
2032 --quiet, --silent don't print informational messages
2033 --tag=TAG use configuration variables from tag TAG
2034 -v, --verbose print more informational messages than default
2035 --version print version information
2036 -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
2037 -h, --help, --help-all print short, long, or detailed help message
2038 "
2039
2040 # Additional text appended to 'usage_message' in response to '--help'.
2041 func_help ()
2042 {
2043 $debug_cmd
2044
2045 func_usage_message
2046 $ECHO "$long_help_message
2047
2048 MODE must be one of the following:
2049
2050 clean remove files from the build directory
2051 compile compile a source file into a libtool object
2052 execute automatically set library path, then run a program
2053 finish complete the installation of libtool libraries
2054 install install libraries or executables
2055 link create a library or an executable
2056 uninstall remove libraries from an installed directory
2057
2058 MODE-ARGS vary depending on the MODE. When passed as first option,
2059 '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
2060 Try '$progname --help --mode=MODE' for a more detailed description of MODE.
2061
2062 When reporting a bug, please describe a test case to reproduce it and
2063 include the following information:
2064
2065 host-triplet: $host
2066 shell: $SHELL
2067 compiler: $LTCC
2068 compiler flags: $LTCFLAGS
2069 linker: $LD (gnu? $with_gnu_ld)
2070 version: $progname (GNU libtool) 2.4.6
2071 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2072 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2073
2074 Report bugs to <bug-libtool@gnu.org>.
2075 GNU libtool home page: <http://www.gnu.org/software/libtool/>.
2076 General help using GNU software: <http://www.gnu.org/gethelp/>."
2077 exit 0
2078 }
2079
2080
2081 # func_lo2o OBJECT-NAME
2082 # ---------------------
2083 # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
2084 # object suffix.
2085
2086 lo2o=s/\\.lo\$/.$objext/
2087 o2lo=s/\\.$objext\$/.lo/
2088
2089 if test yes = "$_G_HAVE_XSI_OPS"; then
2090 eval 'func_lo2o ()
2091 {
2092 case $1 in
2093 *.lo) func_lo2o_result=${1%.lo}.$objext ;;
2094 * ) func_lo2o_result=$1 ;;
2095 esac
2096 }'
2097
2098 # func_xform LIBOBJ-OR-SOURCE
2099 # ---------------------------
2100 # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
2101 # suffix to a '.lo' libtool-object suffix.
2102 eval 'func_xform ()
2103 {
2104 func_xform_result=${1%.*}.lo
2105 }'
2106 else
2107 # ...otherwise fall back to using sed.
2108 func_lo2o ()
2109 {
2110 func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
2111 }
2112
2113 func_xform ()
2114 {
2115 func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
2116 }
2117 fi
2118
2119
2120 # func_fatal_configuration ARG...
2121 # -------------------------------
2122 # Echo program name prefixed message to standard error, followed by
2123 # a configuration failure hint, and exit.
2124 func_fatal_configuration ()
2125 {
2126 func__fatal_error ${1+"$@"} \
2127 "See the $PACKAGE documentation for more information." \
2128 "Fatal configuration error."
2129 }
2130
2131
2132 # func_config
2133 # -----------
2134 # Display the configuration for all the tags in this script.
2135 func_config ()
2136 {
2137 re_begincf='^# ### BEGIN LIBTOOL'
2138 re_endcf='^# ### END LIBTOOL'
2139
2140 # Default configuration.
2141 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2142
2143 # Now print the configurations for the tags.
2144 for tagname in $taglist; do
2145 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2146 done
2147
2148 exit $?
2149 }
2150
2151
2152 # func_features
2153 # -------------
2154 # Display the features supported by this script.
2155 func_features ()
2156 {
2157 echo "host: $host"
2158 if test yes = "$build_libtool_libs"; then
2159 echo "enable shared libraries"
2160 else
2161 echo "disable shared libraries"
2162 fi
2163 if test yes = "$build_old_libs"; then
2164 echo "enable static libraries"
2165 else
2166 echo "disable static libraries"
2167 fi
2168
2169 exit $?
2170 }
2171
2172
2173 # func_enable_tag TAGNAME
2174 # -----------------------
2175 # Verify that TAGNAME is valid, and either flag an error and exit, or
2176 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
2177 # variable here.
2178 func_enable_tag ()
2179 {
2180 # Global variable:
2181 tagname=$1
2182
2183 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
2184 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
2185 sed_extractcf=/$re_begincf/,/$re_endcf/p
2186
2187 # Validate tagname.
2188 case $tagname in
2189 *[!-_A-Za-z0-9,/]*)
2190 func_fatal_error "invalid tag name: $tagname"
2191 ;;
2192 esac
2193
2194 # Don't test for the "default" C tag, as we know it's
2195 # there but not specially marked.
2196 case $tagname in
2197 CC) ;;
2198 *)
2199 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
2200 taglist="$taglist $tagname"
2201
2202 # Evaluate the configuration. Be careful to quote the path
2203 # and the sed script, to avoid splitting on whitespace, but
2204 # also don't use non-portable quotes within backquotes within
2205 # quotes we have to do it in 2 steps:
2206 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
2207 eval "$extractedcf"
2208 else
2209 func_error "ignoring unknown tag $tagname"
2210 fi
2211 ;;
2212 esac
2213 }
2214
2215
2216 # func_check_version_match
2217 # ------------------------
2218 # Ensure that we are using m4 macros, and libtool script from the same
2219 # release of libtool.
2220 func_check_version_match ()
2221 {
2222 if test "$package_revision" != "$macro_revision"; then
2223 if test "$VERSION" != "$macro_version"; then
2224 if test -z "$macro_version"; then
2225 cat >&2 <<_LT_EOF
2226 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2227 $progname: definition of this LT_INIT comes from an older release.
2228 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2229 $progname: and run autoconf again.
2230 _LT_EOF
2231 else
2232 cat >&2 <<_LT_EOF
2233 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
2234 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
2235 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
2236 $progname: and run autoconf again.
2237 _LT_EOF
2238 fi
2239 else
2240 cat >&2 <<_LT_EOF
2241 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
2242 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
2243 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
2244 $progname: of $PACKAGE $VERSION and run autoconf again.
2245 _LT_EOF
2246 fi
2247
2248 exit $EXIT_MISMATCH
2249 fi
2250 }
2251
2252
2253 # libtool_options_prep [ARG]...
2254 # -----------------------------
2255 # Preparation for options parsed by libtool.
2256 libtool_options_prep ()
2257 {
2258 $debug_mode
2259
2260 # Option defaults:
2261 opt_config=false
2262 opt_dlopen=
2263 opt_dry_run=false
2264 opt_help=false
2265 opt_mode=
2266 opt_preserve_dup_deps=false
2267 opt_quiet=false
2268
2269 nonopt=
2270 preserve_args=
2271
2272 # Shorthand for --mode=foo, only valid as the first argument
2273 case $1 in
2274 clean|clea|cle|cl)
2275 shift; set dummy --mode clean ${1+"$@"}; shift
2276 ;;
2277 compile|compil|compi|comp|com|co|c)
2278 shift; set dummy --mode compile ${1+"$@"}; shift
2279 ;;
2280 execute|execut|execu|exec|exe|ex|e)
2281 shift; set dummy --mode execute ${1+"$@"}; shift
2282 ;;
2283 finish|finis|fini|fin|fi|f)
2284 shift; set dummy --mode finish ${1+"$@"}; shift
2285 ;;
2286 install|instal|insta|inst|ins|in|i)
2287 shift; set dummy --mode install ${1+"$@"}; shift
2288 ;;
2289 link|lin|li|l)
2290 shift; set dummy --mode link ${1+"$@"}; shift
2291 ;;
2292 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2293 shift; set dummy --mode uninstall ${1+"$@"}; shift
2294 ;;
2295 esac
2296
2297 # Pass back the list of options.
2298 func_quote_for_eval ${1+"$@"}
2299 libtool_options_prep_result=$func_quote_for_eval_result
2300 }
2301 func_add_hook func_options_prep libtool_options_prep
2302
2303
2304 # libtool_parse_options [ARG]...
2305 # ---------------------------------
2306 # Provide handling for libtool specific options.
2307 libtool_parse_options ()
2308 {
2309 $debug_cmd
2310
2311 # Perform our own loop to consume as many options as possible in
2312 # each iteration.
2313 while test $# -gt 0; do
2314 _G_opt=$1
2315 shift
2316 case $_G_opt in
2317 --dry-run|--dryrun|-n)
2318 opt_dry_run=:
2319 ;;
2320
2321 --config) func_config ;;
2322
2323 --dlopen|-dlopen)
2324 opt_dlopen="${opt_dlopen+$opt_dlopen
2325 }$1"
2326 shift
2327 ;;
2328
2329 --preserve-dup-deps)
2330 opt_preserve_dup_deps=: ;;
2331
2332 --features) func_features ;;
2333
2334 --finish) set dummy --mode finish ${1+"$@"}; shift ;;
2335
2336 --help) opt_help=: ;;
2337
2338 --help-all) opt_help=': help-all' ;;
2339
2340 --mode) test $# = 0 && func_missing_arg $_G_opt && break
2341 opt_mode=$1
2342 case $1 in
2343 # Valid mode arguments:
2344 clean|compile|execute|finish|install|link|relink|uninstall) ;;
2345
2346 # Catch anything else as an error
2347 *) func_error "invalid argument for $_G_opt"
2348 exit_cmd=exit
2349 break
2350 ;;
2351 esac
2352 shift
2353 ;;
2354
2355 --no-silent|--no-quiet)
2356 opt_quiet=false
2357 func_append preserve_args " $_G_opt"
2358 ;;
2359
2360 --no-warnings|--no-warning|--no-warn)
2361 opt_warning=false
2362 func_append preserve_args " $_G_opt"
2363 ;;
2364
2365 --no-verbose)
2366 opt_verbose=false
2367 func_append preserve_args " $_G_opt"
2368 ;;
2369
2370 --silent|--quiet)
2371 opt_quiet=:
2372 opt_verbose=false
2373 func_append preserve_args " $_G_opt"
2374 ;;
2375
2376 --tag) test $# = 0 && func_missing_arg $_G_opt && break
2377 opt_tag=$1
2378 func_append preserve_args " $_G_opt $1"
2379 func_enable_tag "$1"
2380 shift
2381 ;;
2382
2383 --verbose|-v) opt_quiet=false
2384 opt_verbose=:
2385 func_append preserve_args " $_G_opt"
2386 ;;
2387
2388 # An option not handled by this hook function:
2389 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2390 esac
2391 done
2392
2393
2394 # save modified positional parameters for caller
2395 func_quote_for_eval ${1+"$@"}
2396 libtool_parse_options_result=$func_quote_for_eval_result
2397 }
2398 func_add_hook func_parse_options libtool_parse_options
2399
2400
2401
2402 # libtool_validate_options [ARG]...
2403 # ---------------------------------
2404 # Perform any sanity checks on option settings and/or unconsumed
2405 # arguments.
2406 libtool_validate_options ()
2407 {
2408 # save first non-option argument
2409 if test 0 -lt $#; then
2410 nonopt=$1
2411 shift
2412 fi
2413
2414 # preserve --debug
2415 test : = "$debug_cmd" || func_append preserve_args " --debug"
2416
2417 case $host in
2418 # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
2419 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
2420 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
2421 # don't eliminate duplications in $postdeps and $predeps
2422 opt_duplicate_compiler_generated_deps=:
2423 ;;
2424 *)
2425 opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
2426 ;;
2427 esac
2428
2429 $opt_help || {
2430 # Sanity checks first:
2431 func_check_version_match
2432
2433 test yes != "$build_libtool_libs" \
2434 && test yes != "$build_old_libs" \
2435 && func_fatal_configuration "not configured to build any kind of library"
2436
2437 # Darwin sucks
2438 eval std_shrext=\"$shrext_cmds\"
2439
2440 # Only execute mode is allowed to have -dlopen flags.
2441 if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
2442 func_error "unrecognized option '-dlopen'"
2443 $ECHO "$help" 1>&2
2444 exit $EXIT_FAILURE
2445 fi
2446
2447 # Change the help message to a mode-specific one.
2448 generic_help=$help
2449 help="Try '$progname --help --mode=$opt_mode' for more information."
2450 }
2451
2452 # Pass back the unparsed argument list
2453 func_quote_for_eval ${1+"$@"}
2454 libtool_validate_options_result=$func_quote_for_eval_result
2455 }
2456 func_add_hook func_validate_options libtool_validate_options
2457
2458
2459 # Process options as early as possible so that --help and --version
2460 # can return quickly.
2461 func_options ${1+"$@"}
2462 eval set dummy "$func_options_result"; shift
2463
2464
2465
2466 ## ----------- ##
2467 ## Main. ##
2468 ## ----------- ##
2469
2470 magic='%%%MAGIC variable%%%'
2471 magic_exe='%%%MAGIC EXE variable%%%'
2472
2473 # Global variables.
2474 extracted_archives=
2475 extracted_serial=0
2476
2477 # If this variable is set in any of the actions, the command in it
2478 # will be execed at the end. This prevents here-documents from being
2479 # left over by shells.
2480 exec_cmd=
2481
2482
2483 # A function that is used when there is no print builtin or printf.
2484 func_fallback_echo ()
2485 {
2486 eval 'cat <<_LTECHO_EOF
2487 $1
2488 _LTECHO_EOF'
2489 }
2490
2491 # func_generated_by_libtool
2492 # True iff stdin has been generated by Libtool. This function is only
2493 # a basic sanity check; it will hardly flush out determined imposters.
2494 func_generated_by_libtool_p ()
2495 {
2496 $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
2497 }
2498
2499 # func_lalib_p file
2500 # True iff FILE is a libtool '.la' library or '.lo' object file.
2501 # This function is only a basic sanity check; it will hardly flush out
2502 # determined imposters.
2503 func_lalib_p ()
2504 {
2505 test -f "$1" &&
2506 $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
2507 }
2508
2509 # func_lalib_unsafe_p file
2510 # True iff FILE is a libtool '.la' library or '.lo' object file.
2511 # This function implements the same check as func_lalib_p without
2512 # resorting to external programs. To this end, it redirects stdin and
2513 # closes it afterwards, without saving the original file descriptor.
2514 # As a safety measure, use it only where a negative result would be
2515 # fatal anyway. Works if 'file' does not exist.
2516 func_lalib_unsafe_p ()
2517 {
2518 lalib_p=no
2519 if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
2520 for lalib_p_l in 1 2 3 4
2521 do
2522 read lalib_p_line
2523 case $lalib_p_line in
2524 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
2525 esac
2526 done
2527 exec 0<&5 5<&-
2528 fi
2529 test yes = "$lalib_p"
2530 }
2531
2532 # func_ltwrapper_script_p file
2533 # True iff FILE is a libtool wrapper script
2534 # This function is only a basic sanity check; it will hardly flush out
2535 # determined imposters.
2536 func_ltwrapper_script_p ()
2537 {
2538 test -f "$1" &&
2539 $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
2540 }
2541
2542 # func_ltwrapper_executable_p file
2543 # True iff FILE is a libtool wrapper executable
2544 # This function is only a basic sanity check; it will hardly flush out
2545 # determined imposters.
2546 func_ltwrapper_executable_p ()
2547 {
2548 func_ltwrapper_exec_suffix=
2549 case $1 in
2550 *.exe) ;;
2551 *) func_ltwrapper_exec_suffix=.exe ;;
2552 esac
2553 $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
2554 }
2555
2556 # func_ltwrapper_scriptname file
2557 # Assumes file is an ltwrapper_executable
2558 # uses $file to determine the appropriate filename for a
2559 # temporary ltwrapper_script.
2560 func_ltwrapper_scriptname ()
2561 {
2562 func_dirname_and_basename "$1" "" "."
2563 func_stripname '' '.exe' "$func_basename_result"
2564 func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
2565 }
2566
2567 # func_ltwrapper_p file
2568 # True iff FILE is a libtool wrapper script or wrapper executable
2569 # This function is only a basic sanity check; it will hardly flush out
2570 # determined imposters.
2571 func_ltwrapper_p ()
2572 {
2573 func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
2574 }
2575
2576
2577 # func_execute_cmds commands fail_cmd
2578 # Execute tilde-delimited COMMANDS.
2579 # If FAIL_CMD is given, eval that upon failure.
2580 # FAIL_CMD may read-access the current command in variable CMD!
2581 func_execute_cmds ()
2582 {
2583 $debug_cmd
2584
2585 save_ifs=$IFS; IFS='~'
2586 for cmd in $1; do
2587 IFS=$sp$nl
2588 eval cmd=\"$cmd\"
2589 IFS=$save_ifs
2590 func_show_eval "$cmd" "${2-:}"
2591 done
2592 IFS=$save_ifs
2593 }
2594
2595
2596 # func_source file
2597 # Source FILE, adding directory component if necessary.
2598 # Note that it is not necessary on cygwin/mingw to append a dot to
2599 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
2600 # behavior happens only for exec(3), not for open(2)! Also, sourcing
2601 # 'FILE.' does not work on cygwin managed mounts.
2602 func_source ()
2603 {
2604 $debug_cmd
2605
2606 case $1 in
2607 */* | *\\*) . "$1" ;;
2608 *) . "./$1" ;;
2609 esac
2610 }
2611
2612
2613 # func_resolve_sysroot PATH
2614 # Replace a leading = in PATH with a sysroot. Store the result into
2615 # func_resolve_sysroot_result
2616 func_resolve_sysroot ()
2617 {
2618 func_resolve_sysroot_result=$1
2619 case $func_resolve_sysroot_result in
2620 =*)
2621 func_stripname '=' '' "$func_resolve_sysroot_result"
2622 func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
2623 ;;
2624 esac
2625 }
2626
2627 # func_replace_sysroot PATH
2628 # If PATH begins with the sysroot, replace it with = and
2629 # store the result into func_replace_sysroot_result.
2630 func_replace_sysroot ()
2631 {
2632 case $lt_sysroot:$1 in
2633 ?*:"$lt_sysroot"*)
2634 func_stripname "$lt_sysroot" '' "$1"
2635 func_replace_sysroot_result='='$func_stripname_result
2636 ;;
2637 *)
2638 # Including no sysroot.
2639 func_replace_sysroot_result=$1
2640 ;;
2641 esac
2642 }
2643
2644 # func_infer_tag arg
2645 # Infer tagged configuration to use if any are available and
2646 # if one wasn't chosen via the "--tag" command line option.
2647 # Only attempt this if the compiler in the base compile
2648 # command doesn't match the default compiler.
2649 # arg is usually of the form 'gcc ...'
2650 func_infer_tag ()
2651 {
2652 $debug_cmd
2653
2654 if test -n "$available_tags" && test -z "$tagname"; then
2655 CC_quoted=
2656 for arg in $CC; do
2657 func_append_quoted CC_quoted "$arg"
2658 done
2659 CC_expanded=`func_echo_all $CC`
2660 CC_quoted_expanded=`func_echo_all $CC_quoted`
2661 case $@ in
2662 # Blanks in the command may have been stripped by the calling shell,
2663 # but not from the CC environment variable when configure was run.
2664 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2665 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
2666 # Blanks at the start of $base_compile will cause this to fail
2667 # if we don't check for them as well.
2668 *)
2669 for z in $available_tags; do
2670 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
2671 # Evaluate the configuration.
2672 eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
2673 CC_quoted=
2674 for arg in $CC; do
2675 # Double-quote args containing other shell metacharacters.
2676 func_append_quoted CC_quoted "$arg"
2677 done
2678 CC_expanded=`func_echo_all $CC`
2679 CC_quoted_expanded=`func_echo_all $CC_quoted`
2680 case "$@ " in
2681 " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
2682 " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
2683 # The compiler in the base compile command matches
2684 # the one in the tagged configuration.
2685 # Assume this is the tagged configuration we want.
2686 tagname=$z
2687 break
2688 ;;
2689 esac
2690 fi
2691 done
2692 # If $tagname still isn't set, then no tagged configuration
2693 # was found and let the user know that the "--tag" command
2694 # line option must be used.
2695 if test -z "$tagname"; then
2696 func_echo "unable to infer tagged configuration"
2697 func_fatal_error "specify a tag with '--tag'"
2698 # else
2699 # func_verbose "using $tagname tagged configuration"
2700 fi
2701 ;;
2702 esac
2703 fi
2704 }
2705
2706
2707
2708 # func_write_libtool_object output_name pic_name nonpic_name
2709 # Create a libtool object file (analogous to a ".la" file),
2710 # but don't create it if we're doing a dry run.
2711 func_write_libtool_object ()
2712 {
2713 write_libobj=$1
2714 if test yes = "$build_libtool_libs"; then
2715 write_lobj=\'$2\'
2716 else
2717 write_lobj=none
2718 fi
2719
2720 if test yes = "$build_old_libs"; then
2721 write_oldobj=\'$3\'
2722 else
2723 write_oldobj=none
2724 fi
2725
2726 $opt_dry_run || {
2727 cat >${write_libobj}T <<EOF
2728 # $write_libobj - a libtool object file
2729 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
2730 #
2731 # Please DO NOT delete this file!
2732 # It is necessary for linking the library.
2733
2734 # Name of the PIC object.
2735 pic_object=$write_lobj
2736
2737 # Name of the non-PIC object
2738 non_pic_object=$write_oldobj
2739
2740 EOF
2741 $MV "${write_libobj}T" "$write_libobj"
2742 }
2743 }
2744
2745
2746 ##################################################
2747 # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
2748 ##################################################
2749
2750 # func_convert_core_file_wine_to_w32 ARG
2751 # Helper function used by file name conversion functions when $build is *nix,
2752 # and $host is mingw, cygwin, or some other w32 environment. Relies on a
2753 # correctly configured wine environment available, with the winepath program
2754 # in $build's $PATH.
2755 #
2756 # ARG is the $build file name to be converted to w32 format.
2757 # Result is available in $func_convert_core_file_wine_to_w32_result, and will
2758 # be empty on error (or when ARG is empty)
2759 func_convert_core_file_wine_to_w32 ()
2760 {
2761 $debug_cmd
2762
2763 func_convert_core_file_wine_to_w32_result=$1
2764 if test -n "$1"; then
2765 # Unfortunately, winepath does not exit with a non-zero error code, so we
2766 # are forced to check the contents of stdout. On the other hand, if the
2767 # command is not found, the shell will set an exit code of 127 and print
2768 # *an error message* to stdout. So we must check for both error code of
2769 # zero AND non-empty stdout, which explains the odd construction:
2770 func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
2771 if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
2772 func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
2773 $SED -e "$sed_naive_backslashify"`
2774 else
2775 func_convert_core_file_wine_to_w32_result=
2776 fi
2777 fi
2778 }
2779 # end: func_convert_core_file_wine_to_w32
2780
2781
2782 # func_convert_core_path_wine_to_w32 ARG
2783 # Helper function used by path conversion functions when $build is *nix, and
2784 # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
2785 # configured wine environment available, with the winepath program in $build's
2786 # $PATH. Assumes ARG has no leading or trailing path separator characters.
2787 #
2788 # ARG is path to be converted from $build format to win32.
2789 # Result is available in $func_convert_core_path_wine_to_w32_result.
2790 # Unconvertible file (directory) names in ARG are skipped; if no directory names
2791 # are convertible, then the result may be empty.
2792 func_convert_core_path_wine_to_w32 ()
2793 {
2794 $debug_cmd
2795
2796 # unfortunately, winepath doesn't convert paths, only file names
2797 func_convert_core_path_wine_to_w32_result=
2798 if test -n "$1"; then
2799 oldIFS=$IFS
2800 IFS=:
2801 for func_convert_core_path_wine_to_w32_f in $1; do
2802 IFS=$oldIFS
2803 func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
2804 if test -n "$func_convert_core_file_wine_to_w32_result"; then
2805 if test -z "$func_convert_core_path_wine_to_w32_result"; then
2806 func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
2807 else
2808 func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
2809 fi
2810 fi
2811 done
2812 IFS=$oldIFS
2813 fi
2814 }
2815 # end: func_convert_core_path_wine_to_w32
2816
2817
2818 # func_cygpath ARGS...
2819 # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
2820 # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
2821 # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
2822 # (2), returns the Cygwin file name or path in func_cygpath_result (input
2823 # file name or path is assumed to be in w32 format, as previously converted
2824 # from $build's *nix or MSYS format). In case (3), returns the w32 file name
2825 # or path in func_cygpath_result (input file name or path is assumed to be in
2826 # Cygwin format). Returns an empty string on error.
2827 #
2828 # ARGS are passed to cygpath, with the last one being the file name or path to
2829 # be converted.
2830 #
2831 # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
2832 # environment variable; do not put it in $PATH.
2833 func_cygpath ()
2834 {
2835 $debug_cmd
2836
2837 if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
2838 func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
2839 if test "$?" -ne 0; then
2840 # on failure, ensure result is empty
2841 func_cygpath_result=
2842 fi
2843 else
2844 func_cygpath_result=
2845 func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
2846 fi
2847 }
2848 #end: func_cygpath
2849
2850
2851 # func_convert_core_msys_to_w32 ARG
2852 # Convert file name or path ARG from MSYS format to w32 format. Return
2853 # result in func_convert_core_msys_to_w32_result.
2854 func_convert_core_msys_to_w32 ()
2855 {
2856 $debug_cmd
2857
2858 # awkward: cmd appends spaces to result
2859 func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
2860 $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
2861 }
2862 #end: func_convert_core_msys_to_w32
2863
2864
2865 # func_convert_file_check ARG1 ARG2
2866 # Verify that ARG1 (a file name in $build format) was converted to $host
2867 # format in ARG2. Otherwise, emit an error message, but continue (resetting
2868 # func_to_host_file_result to ARG1).
2869 func_convert_file_check ()
2870 {
2871 $debug_cmd
2872
2873 if test -z "$2" && test -n "$1"; then
2874 func_error "Could not determine host file name corresponding to"
2875 func_error " '$1'"
2876 func_error "Continuing, but uninstalled executables may not work."
2877 # Fallback:
2878 func_to_host_file_result=$1
2879 fi
2880 }
2881 # end func_convert_file_check
2882
2883
2884 # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
2885 # Verify that FROM_PATH (a path in $build format) was converted to $host
2886 # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
2887 # func_to_host_file_result to a simplistic fallback value (see below).
2888 func_convert_path_check ()
2889 {
2890 $debug_cmd
2891
2892 if test -z "$4" && test -n "$3"; then
2893 func_error "Could not determine the host path corresponding to"
2894 func_error " '$3'"
2895 func_error "Continuing, but uninstalled executables may not work."
2896 # Fallback. This is a deliberately simplistic "conversion" and
2897 # should not be "improved". See libtool.info.
2898 if test "x$1" != "x$2"; then
2899 lt_replace_pathsep_chars="s|$1|$2|g"
2900 func_to_host_path_result=`echo "$3" |
2901 $SED -e "$lt_replace_pathsep_chars"`
2902 else
2903 func_to_host_path_result=$3
2904 fi
2905 fi
2906 }
2907 # end func_convert_path_check
2908
2909
2910 # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
2911 # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
2912 # and appending REPL if ORIG matches BACKPAT.
2913 func_convert_path_front_back_pathsep ()
2914 {
2915 $debug_cmd
2916
2917 case $4 in
2918 $1 ) func_to_host_path_result=$3$func_to_host_path_result
2919 ;;
2920 esac
2921 case $4 in
2922 $2 ) func_append func_to_host_path_result "$3"
2923 ;;
2924 esac
2925 }
2926 # end func_convert_path_front_back_pathsep
2927
2928
2929 ##################################################
2930 # $build to $host FILE NAME CONVERSION FUNCTIONS #
2931 ##################################################
2932 # invoked via '$to_host_file_cmd ARG'
2933 #
2934 # In each case, ARG is the path to be converted from $build to $host format.
2935 # Result will be available in $func_to_host_file_result.
2936
2937
2938 # func_to_host_file ARG
2939 # Converts the file name ARG from $build format to $host format. Return result
2940 # in func_to_host_file_result.
2941 func_to_host_file ()
2942 {
2943 $debug_cmd
2944
2945 $to_host_file_cmd "$1"
2946 }
2947 # end func_to_host_file
2948
2949
2950 # func_to_tool_file ARG LAZY
2951 # converts the file name ARG from $build format to toolchain format. Return
2952 # result in func_to_tool_file_result. If the conversion in use is listed
2953 # in (the comma separated) LAZY, no conversion takes place.
2954 func_to_tool_file ()
2955 {
2956 $debug_cmd
2957
2958 case ,$2, in
2959 *,"$to_tool_file_cmd",*)
2960 func_to_tool_file_result=$1
2961 ;;
2962 *)
2963 $to_tool_file_cmd "$1"
2964 func_to_tool_file_result=$func_to_host_file_result
2965 ;;
2966 esac
2967 }
2968 # end func_to_tool_file
2969
2970
2971 # func_convert_file_noop ARG
2972 # Copy ARG to func_to_host_file_result.
2973 func_convert_file_noop ()
2974 {
2975 func_to_host_file_result=$1
2976 }
2977 # end func_convert_file_noop
2978
2979
2980 # func_convert_file_msys_to_w32 ARG
2981 # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
2982 # conversion to w32 is not available inside the cwrapper. Returns result in
2983 # func_to_host_file_result.
2984 func_convert_file_msys_to_w32 ()
2985 {
2986 $debug_cmd
2987
2988 func_to_host_file_result=$1
2989 if test -n "$1"; then
2990 func_convert_core_msys_to_w32 "$1"
2991 func_to_host_file_result=$func_convert_core_msys_to_w32_result
2992 fi
2993 func_convert_file_check "$1" "$func_to_host_file_result"
2994 }
2995 # end func_convert_file_msys_to_w32
2996
2997
2998 # func_convert_file_cygwin_to_w32 ARG
2999 # Convert file name ARG from Cygwin to w32 format. Returns result in
3000 # func_to_host_file_result.
3001 func_convert_file_cygwin_to_w32 ()
3002 {
3003 $debug_cmd
3004
3005 func_to_host_file_result=$1
3006 if test -n "$1"; then
3007 # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
3008 # LT_CYGPATH in this case.
3009 func_to_host_file_result=`cygpath -m "$1"`
3010 fi
3011 func_convert_file_check "$1" "$func_to_host_file_result"
3012 }
3013 # end func_convert_file_cygwin_to_w32
3014
3015
3016 # func_convert_file_nix_to_w32 ARG
3017 # Convert file name ARG from *nix to w32 format. Requires a wine environment
3018 # and a working winepath. Returns result in func_to_host_file_result.
3019 func_convert_file_nix_to_w32 ()
3020 {
3021 $debug_cmd
3022
3023 func_to_host_file_result=$1
3024 if test -n "$1"; then
3025 func_convert_core_file_wine_to_w32 "$1"
3026 func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
3027 fi
3028 func_convert_file_check "$1" "$func_to_host_file_result"
3029 }
3030 # end func_convert_file_nix_to_w32
3031
3032
3033 # func_convert_file_msys_to_cygwin ARG
3034 # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3035 # Returns result in func_to_host_file_result.
3036 func_convert_file_msys_to_cygwin ()
3037 {
3038 $debug_cmd
3039
3040 func_to_host_file_result=$1
3041 if test -n "$1"; then
3042 func_convert_core_msys_to_w32 "$1"
3043 func_cygpath -u "$func_convert_core_msys_to_w32_result"
3044 func_to_host_file_result=$func_cygpath_result
3045 fi
3046 func_convert_file_check "$1" "$func_to_host_file_result"
3047 }
3048 # end func_convert_file_msys_to_cygwin
3049
3050
3051 # func_convert_file_nix_to_cygwin ARG
3052 # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
3053 # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
3054 # in func_to_host_file_result.
3055 func_convert_file_nix_to_cygwin ()
3056 {
3057 $debug_cmd
3058
3059 func_to_host_file_result=$1
3060 if test -n "$1"; then
3061 # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
3062 func_convert_core_file_wine_to_w32 "$1"
3063 func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
3064 func_to_host_file_result=$func_cygpath_result
3065 fi
3066 func_convert_file_check "$1" "$func_to_host_file_result"
3067 }
3068 # end func_convert_file_nix_to_cygwin
3069
3070
3071 #############################################
3072 # $build to $host PATH CONVERSION FUNCTIONS #
3073 #############################################
3074 # invoked via '$to_host_path_cmd ARG'
3075 #
3076 # In each case, ARG is the path to be converted from $build to $host format.
3077 # The result will be available in $func_to_host_path_result.
3078 #
3079 # Path separators are also converted from $build format to $host format. If
3080 # ARG begins or ends with a path separator character, it is preserved (but
3081 # converted to $host format) on output.
3082 #
3083 # All path conversion functions are named using the following convention:
3084 # file name conversion function : func_convert_file_X_to_Y ()
3085 # path conversion function : func_convert_path_X_to_Y ()
3086 # where, for any given $build/$host combination the 'X_to_Y' value is the
3087 # same. If conversion functions are added for new $build/$host combinations,
3088 # the two new functions must follow this pattern, or func_init_to_host_path_cmd
3089 # will break.
3090
3091
3092 # func_init_to_host_path_cmd
3093 # Ensures that function "pointer" variable $to_host_path_cmd is set to the
3094 # appropriate value, based on the value of $to_host_file_cmd.
3095 to_host_path_cmd=
3096 func_init_to_host_path_cmd ()
3097 {
3098 $debug_cmd
3099
3100 if test -z "$to_host_path_cmd"; then
3101 func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
3102 to_host_path_cmd=func_convert_path_$func_stripname_result
3103 fi
3104 }
3105
3106
3107 # func_to_host_path ARG
3108 # Converts the path ARG from $build format to $host format. Return result
3109 # in func_to_host_path_result.
3110 func_to_host_path ()
3111 {
3112 $debug_cmd
3113
3114 func_init_to_host_path_cmd
3115 $to_host_path_cmd "$1"
3116 }
3117 # end func_to_host_path
3118
3119
3120 # func_convert_path_noop ARG
3121 # Copy ARG to func_to_host_path_result.
3122 func_convert_path_noop ()
3123 {
3124 func_to_host_path_result=$1
3125 }
3126 # end func_convert_path_noop
3127
3128
3129 # func_convert_path_msys_to_w32 ARG
3130 # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
3131 # conversion to w32 is not available inside the cwrapper. Returns result in
3132 # func_to_host_path_result.
3133 func_convert_path_msys_to_w32 ()
3134 {
3135 $debug_cmd
3136
3137 func_to_host_path_result=$1
3138 if test -n "$1"; then
3139 # Remove leading and trailing path separator characters from ARG. MSYS
3140 # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
3141 # and winepath ignores them completely.
3142 func_stripname : : "$1"
3143 func_to_host_path_tmp1=$func_stripname_result
3144 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3145 func_to_host_path_result=$func_convert_core_msys_to_w32_result
3146 func_convert_path_check : ";" \
3147 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3148 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3149 fi
3150 }
3151 # end func_convert_path_msys_to_w32
3152
3153
3154 # func_convert_path_cygwin_to_w32 ARG
3155 # Convert path ARG from Cygwin to w32 format. Returns result in
3156 # func_to_host_file_result.
3157 func_convert_path_cygwin_to_w32 ()
3158 {
3159 $debug_cmd
3160
3161 func_to_host_path_result=$1
3162 if test -n "$1"; then
3163 # See func_convert_path_msys_to_w32:
3164 func_stripname : : "$1"
3165 func_to_host_path_tmp1=$func_stripname_result
3166 func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
3167 func_convert_path_check : ";" \
3168 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3169 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3170 fi
3171 }
3172 # end func_convert_path_cygwin_to_w32
3173
3174
3175 # func_convert_path_nix_to_w32 ARG
3176 # Convert path ARG from *nix to w32 format. Requires a wine environment and
3177 # a working winepath. Returns result in func_to_host_file_result.
3178 func_convert_path_nix_to_w32 ()
3179 {
3180 $debug_cmd
3181
3182 func_to_host_path_result=$1
3183 if test -n "$1"; then
3184 # See func_convert_path_msys_to_w32:
3185 func_stripname : : "$1"
3186 func_to_host_path_tmp1=$func_stripname_result
3187 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3188 func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
3189 func_convert_path_check : ";" \
3190 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3191 func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
3192 fi
3193 }
3194 # end func_convert_path_nix_to_w32
3195
3196
3197 # func_convert_path_msys_to_cygwin ARG
3198 # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
3199 # Returns result in func_to_host_file_result.
3200 func_convert_path_msys_to_cygwin ()
3201 {
3202 $debug_cmd
3203
3204 func_to_host_path_result=$1
3205 if test -n "$1"; then
3206 # See func_convert_path_msys_to_w32:
3207 func_stripname : : "$1"
3208 func_to_host_path_tmp1=$func_stripname_result
3209 func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
3210 func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
3211 func_to_host_path_result=$func_cygpath_result
3212 func_convert_path_check : : \
3213 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3214 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3215 fi
3216 }
3217 # end func_convert_path_msys_to_cygwin
3218
3219
3220 # func_convert_path_nix_to_cygwin ARG
3221 # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
3222 # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
3223 # func_to_host_file_result.
3224 func_convert_path_nix_to_cygwin ()
3225 {
3226 $debug_cmd
3227
3228 func_to_host_path_result=$1
3229 if test -n "$1"; then
3230 # Remove leading and trailing path separator characters from
3231 # ARG. msys behavior is inconsistent here, cygpath turns them
3232 # into '.;' and ';.', and winepath ignores them completely.
3233 func_stripname : : "$1"
3234 func_to_host_path_tmp1=$func_stripname_result
3235 func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
3236 func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
3237 func_to_host_path_result=$func_cygpath_result
3238 func_convert_path_check : : \
3239 "$func_to_host_path_tmp1" "$func_to_host_path_result"
3240 func_convert_path_front_back_pathsep ":*" "*:" : "$1"
3241 fi
3242 }
3243 # end func_convert_path_nix_to_cygwin
3244
3245
3246 # func_dll_def_p FILE
3247 # True iff FILE is a Windows DLL '.def' file.
3248 # Keep in sync with _LT_DLL_DEF_P in libtool.m4
3249 func_dll_def_p ()
3250 {
3251 $debug_cmd
3252
3253 func_dll_def_p_tmp=`$SED -n \
3254 -e 's/^[ ]*//' \
3255 -e '/^\(;.*\)*$/d' \
3256 -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
3257 -e q \
3258 "$1"`
3259 test DEF = "$func_dll_def_p_tmp"
3260 }
3261
3262
3263 # func_mode_compile arg...
3264 func_mode_compile ()
3265 {
3266 $debug_cmd
3267
3268 # Get the compilation command and the source file.
3269 base_compile=
3270 srcfile=$nonopt # always keep a non-empty value in "srcfile"
3271 suppress_opt=yes
3272 suppress_output=
3273 arg_mode=normal
3274 libobj=
3275 later=
3276 pie_flag=
3277
3278 for arg
3279 do
3280 case $arg_mode in
3281 arg )
3282 # do not "continue". Instead, add this to base_compile
3283 lastarg=$arg
3284 arg_mode=normal
3285 ;;
3286
3287 target )
3288 libobj=$arg
3289 arg_mode=normal
3290 continue
3291 ;;
3292
3293 normal )
3294 # Accept any command-line options.
3295 case $arg in
3296 -o)
3297 test -n "$libobj" && \
3298 func_fatal_error "you cannot specify '-o' more than once"
3299 arg_mode=target
3300 continue
3301 ;;
3302
3303 -pie | -fpie | -fPIE)
3304 func_append pie_flag " $arg"
3305 continue
3306 ;;
3307
3308 -shared | -static | -prefer-pic | -prefer-non-pic)
3309 func_append later " $arg"
3310 continue
3311 ;;
3312
3313 -no-suppress)
3314 suppress_opt=no
3315 continue
3316 ;;
3317
3318 -Xcompiler)
3319 arg_mode=arg # the next one goes into the "base_compile" arg list
3320 continue # The current "srcfile" will either be retained or
3321 ;; # replaced later. I would guess that would be a bug.
3322
3323 -Wc,*)
3324 func_stripname '-Wc,' '' "$arg"
3325 args=$func_stripname_result
3326 lastarg=
3327 save_ifs=$IFS; IFS=,
3328 for arg in $args; do
3329 IFS=$save_ifs
3330 func_append_quoted lastarg "$arg"
3331 done
3332 IFS=$save_ifs
3333 func_stripname ' ' '' "$lastarg"
3334 lastarg=$func_stripname_result
3335
3336 # Add the arguments to base_compile.
3337 func_append base_compile " $lastarg"
3338 continue
3339 ;;
3340
3341 *)
3342 # Accept the current argument as the source file.
3343 # The previous "srcfile" becomes the current argument.
3344 #
3345 lastarg=$srcfile
3346 srcfile=$arg
3347 ;;
3348 esac # case $arg
3349 ;;
3350 esac # case $arg_mode
3351
3352 # Aesthetically quote the previous argument.
3353 func_append_quoted base_compile "$lastarg"
3354 done # for arg
3355
3356 case $arg_mode in
3357 arg)
3358 func_fatal_error "you must specify an argument for -Xcompile"
3359 ;;
3360 target)
3361 func_fatal_error "you must specify a target with '-o'"
3362 ;;
3363 *)
3364 # Get the name of the library object.
3365 test -z "$libobj" && {
3366 func_basename "$srcfile"
3367 libobj=$func_basename_result
3368 }
3369 ;;
3370 esac
3371
3372 # Recognize several different file suffixes.
3373 # If the user specifies -o file.o, it is replaced with file.lo
3374 case $libobj in
3375 *.[cCFSifmso] | \
3376 *.ada | *.adb | *.ads | *.asm | \
3377 *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
3378 *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
3379 func_xform "$libobj"
3380 libobj=$func_xform_result
3381 ;;
3382 esac
3383
3384 case $libobj in
3385 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
3386 *)
3387 func_fatal_error "cannot determine name of library object from '$libobj'"
3388 ;;
3389 esac
3390
3391 func_infer_tag $base_compile
3392
3393 for arg in $later; do
3394 case $arg in
3395 -shared)
3396 test yes = "$build_libtool_libs" \
3397 || func_fatal_configuration "cannot build a shared library"
3398 build_old_libs=no
3399 continue
3400 ;;
3401
3402 -static)
3403 build_libtool_libs=no
3404 build_old_libs=yes
3405 continue
3406 ;;
3407
3408 -prefer-pic)
3409 pic_mode=yes
3410 continue
3411 ;;
3412
3413 -prefer-non-pic)
3414 pic_mode=no
3415 continue
3416 ;;
3417 esac
3418 done
3419
3420 func_quote_for_eval "$libobj"
3421 test "X$libobj" != "X$func_quote_for_eval_result" \
3422 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3423 && func_warning "libobj name '$libobj' may not contain shell special characters."
3424 func_dirname_and_basename "$obj" "/" ""
3425 objname=$func_basename_result
3426 xdir=$func_dirname_result
3427 lobj=$xdir$objdir/$objname
3428
3429 test -z "$base_compile" && \
3430 func_fatal_help "you must specify a compilation command"
3431
3432 # Delete any leftover library objects.
3433 if test yes = "$build_old_libs"; then
3434 removelist="$obj $lobj $libobj ${libobj}T"
3435 else
3436 removelist="$lobj $libobj ${libobj}T"
3437 fi
3438
3439 # On Cygwin there's no "real" PIC flag so we must build both object types
3440 case $host_os in
3441 cygwin* | mingw* | pw32* | os2* | cegcc*)
3442 pic_mode=default
3443 ;;
3444 esac
3445 if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
3446 # non-PIC code in shared libraries is not supported
3447 pic_mode=default
3448 fi
3449
3450 # Calculate the filename of the output object if compiler does
3451 # not support -o with -c
3452 if test no = "$compiler_c_o"; then
3453 output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
3454 lockfile=$output_obj.lock
3455 else
3456 output_obj=
3457 need_locks=no
3458 lockfile=
3459 fi
3460
3461 # Lock this critical section if it is needed
3462 # We use this script file to make the link, it avoids creating a new file
3463 if test yes = "$need_locks"; then
3464 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
3465 func_echo "Waiting for $lockfile to be removed"
3466 sleep 2
3467 done
3468 elif test warn = "$need_locks"; then
3469 if test -f "$lockfile"; then
3470 $ECHO "\
3471 *** ERROR, $lockfile exists and contains:
3472 `cat $lockfile 2>/dev/null`
3473
3474 This indicates that another process is trying to use the same
3475 temporary object file, and libtool could not work around it because
3476 your compiler does not support '-c' and '-o' together. If you
3477 repeat this compilation, it may succeed, by chance, but you had better
3478 avoid parallel builds (make -j) in this platform, or get a better
3479 compiler."
3480
3481 $opt_dry_run || $RM $removelist
3482 exit $EXIT_FAILURE
3483 fi
3484 func_append removelist " $output_obj"
3485 $ECHO "$srcfile" > "$lockfile"
3486 fi
3487
3488 $opt_dry_run || $RM $removelist
3489 func_append removelist " $lockfile"
3490 trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
3491
3492 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
3493 srcfile=$func_to_tool_file_result
3494 func_quote_for_eval "$srcfile"
3495 qsrcfile=$func_quote_for_eval_result
3496
3497 # Only build a PIC object if we are building libtool libraries.
3498 if test yes = "$build_libtool_libs"; then
3499 # Without this assignment, base_compile gets emptied.
3500 fbsd_hideous_sh_bug=$base_compile
3501
3502 if test no != "$pic_mode"; then
3503 command="$base_compile $qsrcfile $pic_flag"
3504 else
3505 # Don't build PIC code
3506 command="$base_compile $qsrcfile"
3507 fi
3508
3509 func_mkdir_p "$xdir$objdir"
3510
3511 if test -z "$output_obj"; then
3512 # Place PIC objects in $objdir
3513 func_append command " -o $lobj"
3514 fi
3515
3516 func_show_eval_locale "$command" \
3517 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
3518
3519 if test warn = "$need_locks" &&
3520 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3521 $ECHO "\
3522 *** ERROR, $lockfile contains:
3523 `cat $lockfile 2>/dev/null`
3524
3525 but it should contain:
3526 $srcfile
3527
3528 This indicates that another process is trying to use the same
3529 temporary object file, and libtool could not work around it because
3530 your compiler does not support '-c' and '-o' together. If you
3531 repeat this compilation, it may succeed, by chance, but you had better
3532 avoid parallel builds (make -j) in this platform, or get a better
3533 compiler."
3534
3535 $opt_dry_run || $RM $removelist
3536 exit $EXIT_FAILURE
3537 fi
3538
3539 # Just move the object if needed, then go on to compile the next one
3540 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
3541 func_show_eval '$MV "$output_obj" "$lobj"' \
3542 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3543 fi
3544
3545 # Allow error messages only from the first compilation.
3546 if test yes = "$suppress_opt"; then
3547 suppress_output=' >/dev/null 2>&1'
3548 fi
3549 fi
3550
3551 # Only build a position-dependent object if we build old libraries.
3552 if test yes = "$build_old_libs"; then
3553 if test yes != "$pic_mode"; then
3554 # Don't build PIC code
3555 command="$base_compile $qsrcfile$pie_flag"
3556 else
3557 command="$base_compile $qsrcfile $pic_flag"
3558 fi
3559 if test yes = "$compiler_c_o"; then
3560 func_append command " -o $obj"
3561 fi
3562
3563 # Suppress compiler output if we already did a PIC compilation.
3564 func_append command "$suppress_output"
3565 func_show_eval_locale "$command" \
3566 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
3567
3568 if test warn = "$need_locks" &&
3569 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
3570 $ECHO "\
3571 *** ERROR, $lockfile contains:
3572 `cat $lockfile 2>/dev/null`
3573
3574 but it should contain:
3575 $srcfile
3576
3577 This indicates that another process is trying to use the same
3578 temporary object file, and libtool could not work around it because
3579 your compiler does not support '-c' and '-o' together. If you
3580 repeat this compilation, it may succeed, by chance, but you had better
3581 avoid parallel builds (make -j) in this platform, or get a better
3582 compiler."
3583
3584 $opt_dry_run || $RM $removelist
3585 exit $EXIT_FAILURE
3586 fi
3587
3588 # Just move the object if needed
3589 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
3590 func_show_eval '$MV "$output_obj" "$obj"' \
3591 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
3592 fi
3593 fi
3594
3595 $opt_dry_run || {
3596 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
3597
3598 # Unlock the critical section if it was locked
3599 if test no != "$need_locks"; then
3600 removelist=$lockfile
3601 $RM "$lockfile"
3602 fi
3603 }
3604
3605 exit $EXIT_SUCCESS
3606 }
3607
3608 $opt_help || {
3609 test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
3610 }
3611
3612 func_mode_help ()
3613 {
3614 # We need to display help for each of the modes.
3615 case $opt_mode in
3616 "")
3617 # Generic help is extracted from the usage comments
3618 # at the start of this file.
3619 func_help
3620 ;;
3621
3622 clean)
3623 $ECHO \
3624 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
3625
3626 Remove files from the build directory.
3627
3628 RM is the name of the program to use to delete files associated with each FILE
3629 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
3630 to RM.
3631
3632 If FILE is a libtool library, object or program, all the files associated
3633 with it are deleted. Otherwise, only FILE itself is deleted using RM."
3634 ;;
3635
3636 compile)
3637 $ECHO \
3638 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
3639
3640 Compile a source file into a libtool library object.
3641
3642 This mode accepts the following additional options:
3643
3644 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
3645 -no-suppress do not suppress compiler output for multiple passes
3646 -prefer-pic try to build PIC objects only
3647 -prefer-non-pic try to build non-PIC objects only
3648 -shared do not build a '.o' file suitable for static linking
3649 -static only build a '.o' file suitable for static linking
3650 -Wc,FLAG pass FLAG directly to the compiler
3651
3652 COMPILE-COMMAND is a command to be used in creating a 'standard' object file
3653 from the given SOURCEFILE.
3654
3655 The output file name is determined by removing the directory component from
3656 SOURCEFILE, then substituting the C source code suffix '.c' with the
3657 library object suffix, '.lo'."
3658 ;;
3659
3660 execute)
3661 $ECHO \
3662 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
3663
3664 Automatically set library path, then run a program.
3665
3666 This mode accepts the following additional options:
3667
3668 -dlopen FILE add the directory containing FILE to the library path
3669
3670 This mode sets the library path environment variable according to '-dlopen'
3671 flags.
3672
3673 If any of the ARGS are libtool executable wrappers, then they are translated
3674 into their corresponding uninstalled binary, and any of their required library
3675 directories are added to the library path.
3676
3677 Then, COMMAND is executed, with ARGS as arguments."
3678 ;;
3679
3680 finish)
3681 $ECHO \
3682 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
3683
3684 Complete the installation of libtool libraries.
3685
3686 Each LIBDIR is a directory that contains libtool libraries.
3687
3688 The commands that this mode executes may require superuser privileges. Use
3689 the '--dry-run' option if you just want to see what would be executed."
3690 ;;
3691
3692 install)
3693 $ECHO \
3694 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
3695
3696 Install executables or libraries.
3697
3698 INSTALL-COMMAND is the installation command. The first component should be
3699 either the 'install' or 'cp' program.
3700
3701 The following components of INSTALL-COMMAND are treated specially:
3702
3703 -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
3704
3705 The rest of the components are interpreted as arguments to that command (only
3706 BSD-compatible install options are recognized)."
3707 ;;
3708
3709 link)
3710 $ECHO \
3711 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
3712
3713 Link object files or libraries together to form another library, or to
3714 create an executable program.
3715
3716 LINK-COMMAND is a command using the C compiler that you would use to create
3717 a program from several object files.
3718
3719 The following components of LINK-COMMAND are treated specially:
3720
3721 -all-static do not do any dynamic linking at all
3722 -avoid-version do not add a version suffix if possible
3723 -bindir BINDIR specify path to binaries directory (for systems where
3724 libraries must be found in the PATH setting at runtime)
3725 -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
3726 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
3727 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
3728 -export-symbols SYMFILE
3729 try to export only the symbols listed in SYMFILE
3730 -export-symbols-regex REGEX
3731 try to export only the symbols matching REGEX
3732 -LLIBDIR search LIBDIR for required installed libraries
3733 -lNAME OUTPUT-FILE requires the installed library libNAME
3734 -module build a library that can dlopened
3735 -no-fast-install disable the fast-install mode
3736 -no-install link a not-installable executable
3737 -no-undefined declare that a library does not refer to external symbols
3738 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
3739 -objectlist FILE use a list of object files found in FILE to specify objects
3740 -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
3741 -precious-files-regex REGEX
3742 don't remove output files matching REGEX
3743 -release RELEASE specify package release information
3744 -rpath LIBDIR the created library will eventually be installed in LIBDIR
3745 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
3746 -shared only do dynamic linking of libtool libraries
3747 -shrext SUFFIX override the standard shared library file extension
3748 -static do not do any dynamic linking of uninstalled libtool libraries
3749 -static-libtool-libs
3750 do not do any dynamic linking of libtool libraries
3751 -version-info CURRENT[:REVISION[:AGE]]
3752 specify library version info [each variable defaults to 0]
3753 -weak LIBNAME declare that the target provides the LIBNAME interface
3754 -Wc,FLAG
3755 -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
3756 -Wl,FLAG
3757 -Xlinker FLAG pass linker-specific FLAG directly to the linker
3758 -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
3759
3760 All other options (arguments beginning with '-') are ignored.
3761
3762 Every other argument is treated as a filename. Files ending in '.la' are
3763 treated as uninstalled libtool libraries, other files are standard or library
3764 object files.
3765
3766 If the OUTPUT-FILE ends in '.la', then a libtool library is created,
3767 only library objects ('.lo' files) may be specified, and '-rpath' is
3768 required, except when creating a convenience library.
3769
3770 If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
3771 using 'ar' and 'ranlib', or on Windows using 'lib'.
3772
3773 If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
3774 is created, otherwise an executable program is created."
3775 ;;
3776
3777 uninstall)
3778 $ECHO \
3779 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
3780
3781 Remove libraries from an installation directory.
3782
3783 RM is the name of the program to use to delete files associated with each FILE
3784 (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
3785 to RM.
3786
3787 If FILE is a libtool library, all the files associated with it are deleted.
3788 Otherwise, only FILE itself is deleted using RM."
3789 ;;
3790
3791 *)
3792 func_fatal_help "invalid operation mode '$opt_mode'"
3793 ;;
3794 esac
3795
3796 echo
3797 $ECHO "Try '$progname --help' for more information about other modes."
3798 }
3799
3800 # Now that we've collected a possible --mode arg, show help if necessary
3801 if $opt_help; then
3802 if test : = "$opt_help"; then
3803 func_mode_help
3804 else
3805 {
3806 func_help noexit
3807 for opt_mode in compile link execute install finish uninstall clean; do
3808 func_mode_help
3809 done
3810 } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
3811 {
3812 func_help noexit
3813 for opt_mode in compile link execute install finish uninstall clean; do
3814 echo
3815 func_mode_help
3816 done
3817 } |
3818 $SED '1d
3819 /^When reporting/,/^Report/{
3820 H
3821 d
3822 }
3823 $x
3824 /information about other modes/d
3825 /more detailed .*MODE/d
3826 s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
3827 fi
3828 exit $?
3829 fi
3830
3831
3832 # func_mode_execute arg...
3833 func_mode_execute ()
3834 {
3835 $debug_cmd
3836
3837 # The first argument is the command name.
3838 cmd=$nonopt
3839 test -z "$cmd" && \
3840 func_fatal_help "you must specify a COMMAND"
3841
3842 # Handle -dlopen flags immediately.
3843 for file in $opt_dlopen; do
3844 test -f "$file" \
3845 || func_fatal_help "'$file' is not a file"
3846
3847 dir=
3848 case $file in
3849 *.la)
3850 func_resolve_sysroot "$file"
3851 file=$func_resolve_sysroot_result
3852
3853 # Check to see that this really is a libtool archive.
3854 func_lalib_unsafe_p "$file" \
3855 || func_fatal_help "'$lib' is not a valid libtool archive"
3856
3857 # Read the libtool library.
3858 dlname=
3859 library_names=
3860 func_source "$file"
3861
3862 # Skip this library if it cannot be dlopened.
3863 if test -z "$dlname"; then
3864 # Warn if it was a shared library.
3865 test -n "$library_names" && \
3866 func_warning "'$file' was not linked with '-export-dynamic'"
3867 continue
3868 fi
3869
3870 func_dirname "$file" "" "."
3871 dir=$func_dirname_result
3872
3873 if test -f "$dir/$objdir/$dlname"; then
3874 func_append dir "/$objdir"
3875 else
3876 if test ! -f "$dir/$dlname"; then
3877 func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
3878 fi
3879 fi
3880 ;;
3881
3882 *.lo)
3883 # Just add the directory containing the .lo file.
3884 func_dirname "$file" "" "."
3885 dir=$func_dirname_result
3886 ;;
3887
3888 *)
3889 func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
3890 continue
3891 ;;
3892 esac
3893
3894 # Get the absolute pathname.
3895 absdir=`cd "$dir" && pwd`
3896 test -n "$absdir" && dir=$absdir
3897
3898 # Now add the directory to shlibpath_var.
3899 if eval "test -z \"\$$shlibpath_var\""; then
3900 eval "$shlibpath_var=\"\$dir\""
3901 else
3902 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
3903 fi
3904 done
3905
3906 # This variable tells wrapper scripts just to set shlibpath_var
3907 # rather than running their programs.
3908 libtool_execute_magic=$magic
3909
3910 # Check if any of the arguments is a wrapper script.
3911 args=
3912 for file
3913 do
3914 case $file in
3915 -* | *.la | *.lo ) ;;
3916 *)
3917 # Do a test to see if this is really a libtool program.
3918 if func_ltwrapper_script_p "$file"; then
3919 func_source "$file"
3920 # Transform arg to wrapped name.
3921 file=$progdir/$program
3922 elif func_ltwrapper_executable_p "$file"; then
3923 func_ltwrapper_scriptname "$file"
3924 func_source "$func_ltwrapper_scriptname_result"
3925 # Transform arg to wrapped name.
3926 file=$progdir/$program
3927 fi
3928 ;;
3929 esac
3930 # Quote arguments (to preserve shell metacharacters).
3931 func_append_quoted args "$file"
3932 done
3933
3934 if $opt_dry_run; then
3935 # Display what would be done.
3936 if test -n "$shlibpath_var"; then
3937 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
3938 echo "export $shlibpath_var"
3939 fi
3940 $ECHO "$cmd$args"
3941 exit $EXIT_SUCCESS
3942 else
3943 if test -n "$shlibpath_var"; then
3944 # Export the shlibpath_var.
3945 eval "export $shlibpath_var"
3946 fi
3947
3948 # Restore saved environment variables
3949 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
3950 do
3951 eval "if test \"\${save_$lt_var+set}\" = set; then
3952 $lt_var=\$save_$lt_var; export $lt_var
3953 else
3954 $lt_unset $lt_var
3955 fi"
3956 done
3957
3958 # Now prepare to actually exec the command.
3959 exec_cmd=\$cmd$args
3960 fi
3961 }
3962
3963 test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
3964
3965
3966 # func_mode_finish arg...
3967 func_mode_finish ()
3968 {
3969 $debug_cmd
3970
3971 libs=
3972 libdirs=
3973 admincmds=
3974
3975 for opt in "$nonopt" ${1+"$@"}
3976 do
3977 if test -d "$opt"; then
3978 func_append libdirs " $opt"
3979
3980 elif test -f "$opt"; then
3981 if func_lalib_unsafe_p "$opt"; then
3982 func_append libs " $opt"
3983 else
3984 func_warning "'$opt' is not a valid libtool archive"
3985 fi
3986
3987 else
3988 func_fatal_error "invalid argument '$opt'"
3989 fi
3990 done
3991
3992 if test -n "$libs"; then
3993 if test -n "$lt_sysroot"; then
3994 sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
3995 sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
3996 else
3997 sysroot_cmd=
3998 fi
3999
4000 # Remove sysroot references
4001 if $opt_dry_run; then
4002 for lib in $libs; do
4003 echo "removing references to $lt_sysroot and '=' prefixes from $lib"
4004 done
4005 else
4006 tmpdir=`func_mktempdir`
4007 for lib in $libs; do
4008 $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
4009 > $tmpdir/tmp-la
4010 mv -f $tmpdir/tmp-la $lib
4011 done
4012 ${RM}r "$tmpdir"
4013 fi
4014 fi
4015
4016 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4017 for libdir in $libdirs; do
4018 if test -n "$finish_cmds"; then
4019 # Do each command in the finish commands.
4020 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
4021 '"$cmd"'"'
4022 fi
4023 if test -n "$finish_eval"; then
4024 # Do the single finish_eval.
4025 eval cmds=\"$finish_eval\"
4026 $opt_dry_run || eval "$cmds" || func_append admincmds "
4027 $cmds"
4028 fi
4029 done
4030 fi
4031
4032 # Exit here if they wanted silent mode.
4033 $opt_quiet && exit $EXIT_SUCCESS
4034
4035 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4036 echo "----------------------------------------------------------------------"
4037 echo "Libraries have been installed in:"
4038 for libdir in $libdirs; do
4039 $ECHO " $libdir"
4040 done
4041 echo
4042 echo "If you ever happen to want to link against installed libraries"
4043 echo "in a given directory, LIBDIR, you must either use libtool, and"
4044 echo "specify the full pathname of the library, or use the '-LLIBDIR'"
4045 echo "flag during linking and do at least one of the following:"
4046 if test -n "$shlibpath_var"; then
4047 echo " - add LIBDIR to the '$shlibpath_var' environment variable"
4048 echo " during execution"
4049 fi
4050 if test -n "$runpath_var"; then
4051 echo " - add LIBDIR to the '$runpath_var' environment variable"
4052 echo " during linking"
4053 fi
4054 if test -n "$hardcode_libdir_flag_spec"; then
4055 libdir=LIBDIR
4056 eval flag=\"$hardcode_libdir_flag_spec\"
4057
4058 $ECHO " - use the '$flag' linker flag"
4059 fi
4060 if test -n "$admincmds"; then
4061 $ECHO " - have your system administrator run these commands:$admincmds"
4062 fi
4063 if test -f /etc/ld.so.conf; then
4064 echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
4065 fi
4066 echo
4067
4068 echo "See any operating system documentation about shared libraries for"
4069 case $host in
4070 solaris2.[6789]|solaris2.1[0-9])
4071 echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
4072 echo "pages."
4073 ;;
4074 *)
4075 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4076 ;;
4077 esac
4078 echo "----------------------------------------------------------------------"
4079 fi
4080 exit $EXIT_SUCCESS
4081 }
4082
4083 test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
4084
4085
4086 # func_mode_install arg...
4087 func_mode_install ()
4088 {
4089 $debug_cmd
4090
4091 # There may be an optional sh(1) argument at the beginning of
4092 # install_prog (especially on Windows NT).
4093 if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
4094 # Allow the use of GNU shtool's install command.
4095 case $nonopt in *shtool*) :;; *) false;; esac
4096 then
4097 # Aesthetically quote it.
4098 func_quote_for_eval "$nonopt"
4099 install_prog="$func_quote_for_eval_result "
4100 arg=$1
4101 shift
4102 else
4103 install_prog=
4104 arg=$nonopt
4105 fi
4106
4107 # The real first argument should be the name of the installation program.
4108 # Aesthetically quote it.
4109 func_quote_for_eval "$arg"
4110 func_append install_prog "$func_quote_for_eval_result"
4111 install_shared_prog=$install_prog
4112 case " $install_prog " in
4113 *[\\\ /]cp\ *) install_cp=: ;;
4114 *) install_cp=false ;;
4115 esac
4116
4117 # We need to accept at least all the BSD install flags.
4118 dest=
4119 files=
4120 opts=
4121 prev=
4122 install_type=
4123 isdir=false
4124 stripme=
4125 no_mode=:
4126 for arg
4127 do
4128 arg2=
4129 if test -n "$dest"; then
4130 func_append files " $dest"
4131 dest=$arg
4132 continue
4133 fi
4134
4135 case $arg in
4136 -d) isdir=: ;;
4137 -f)
4138 if $install_cp; then :; else
4139 prev=$arg
4140 fi
4141 ;;
4142 -g | -m | -o)
4143 prev=$arg
4144 ;;
4145 -s)
4146 stripme=" -s"
4147 continue
4148 ;;
4149 -*)
4150 ;;
4151 *)
4152 # If the previous option needed an argument, then skip it.
4153 if test -n "$prev"; then
4154 if test X-m = "X$prev" && test -n "$install_override_mode"; then
4155 arg2=$install_override_mode
4156 no_mode=false
4157 fi
4158 prev=
4159 else
4160 dest=$arg
4161 continue
4162 fi
4163 ;;
4164 esac
4165
4166 # Aesthetically quote the argument.
4167 func_quote_for_eval "$arg"
4168 func_append install_prog " $func_quote_for_eval_result"
4169 if test -n "$arg2"; then
4170 func_quote_for_eval "$arg2"
4171 fi
4172 func_append install_shared_prog " $func_quote_for_eval_result"
4173 done
4174
4175 test -z "$install_prog" && \
4176 func_fatal_help "you must specify an install program"
4177
4178 test -n "$prev" && \
4179 func_fatal_help "the '$prev' option requires an argument"
4180
4181 if test -n "$install_override_mode" && $no_mode; then
4182 if $install_cp; then :; else
4183 func_quote_for_eval "$install_override_mode"
4184 func_append install_shared_prog " -m $func_quote_for_eval_result"
4185 fi
4186 fi
4187
4188 if test -z "$files"; then
4189 if test -z "$dest"; then
4190 func_fatal_help "no file or destination specified"
4191 else
4192 func_fatal_help "you must specify a destination"
4193 fi
4194 fi
4195
4196 # Strip any trailing slash from the destination.
4197 func_stripname '' '/' "$dest"
4198 dest=$func_stripname_result
4199
4200 # Check to see that the destination is a directory.
4201 test -d "$dest" && isdir=:
4202 if $isdir; then
4203 destdir=$dest
4204 destname=
4205 else
4206 func_dirname_and_basename "$dest" "" "."
4207 destdir=$func_dirname_result
4208 destname=$func_basename_result
4209
4210 # Not a directory, so check to see that there is only one file specified.
4211 set dummy $files; shift
4212 test "$#" -gt 1 && \
4213 func_fatal_help "'$dest' is not a directory"
4214 fi
4215 case $destdir in
4216 [\\/]* | [A-Za-z]:[\\/]*) ;;
4217 *)
4218 for file in $files; do
4219 case $file in
4220 *.lo) ;;
4221 *)
4222 func_fatal_help "'$destdir' must be an absolute directory name"
4223 ;;
4224 esac
4225 done
4226 ;;
4227 esac
4228
4229 # This variable tells wrapper scripts just to set variables rather
4230 # than running their programs.
4231 libtool_install_magic=$magic
4232
4233 staticlibs=
4234 future_libdirs=
4235 current_libdirs=
4236 for file in $files; do
4237
4238 # Do each installation.
4239 case $file in
4240 *.$libext)
4241 # Do the static libraries later.
4242 func_append staticlibs " $file"
4243 ;;
4244
4245 *.la)
4246 func_resolve_sysroot "$file"
4247 file=$func_resolve_sysroot_result
4248
4249 # Check to see that this really is a libtool archive.
4250 func_lalib_unsafe_p "$file" \
4251 || func_fatal_help "'$file' is not a valid libtool archive"
4252
4253 library_names=
4254 old_library=
4255 relink_command=
4256 func_source "$file"
4257
4258 # Add the libdir to current_libdirs if it is the destination.
4259 if test "X$destdir" = "X$libdir"; then
4260 case "$current_libdirs " in
4261 *" $libdir "*) ;;
4262 *) func_append current_libdirs " $libdir" ;;
4263 esac
4264 else
4265 # Note the libdir as a future libdir.
4266 case "$future_libdirs " in
4267 *" $libdir "*) ;;
4268 *) func_append future_libdirs " $libdir" ;;
4269 esac
4270 fi
4271
4272 func_dirname "$file" "/" ""
4273 dir=$func_dirname_result
4274 func_append dir "$objdir"
4275
4276 if test -n "$relink_command"; then
4277 # Determine the prefix the user has applied to our future dir.
4278 inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
4279
4280 # Don't allow the user to place us outside of our expected
4281 # location b/c this prevents finding dependent libraries that
4282 # are installed to the same prefix.
4283 # At present, this check doesn't affect windows .dll's that
4284 # are installed into $libdir/../bin (currently, that works fine)
4285 # but it's something to keep an eye on.
4286 test "$inst_prefix_dir" = "$destdir" && \
4287 func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
4288
4289 if test -n "$inst_prefix_dir"; then
4290 # Stick the inst_prefix_dir data into the link command.
4291 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4292 else
4293 relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
4294 fi
4295
4296 func_warning "relinking '$file'"
4297 func_show_eval "$relink_command" \
4298 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
4299 fi
4300
4301 # See the names of the shared library.
4302 set dummy $library_names; shift
4303 if test -n "$1"; then
4304 realname=$1
4305 shift
4306
4307 srcname=$realname
4308 test -n "$relink_command" && srcname=${realname}T
4309
4310 # Install the shared library and build the symlinks.
4311 func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
4312 'exit $?'
4313 tstripme=$stripme
4314 case $host_os in
4315 cygwin* | mingw* | pw32* | cegcc*)
4316 case $realname in
4317 *.dll.a)
4318 tstripme=
4319 ;;
4320 esac
4321 ;;
4322 os2*)
4323 case $realname in
4324 *_dll.a)
4325 tstripme=
4326 ;;
4327 esac
4328 ;;
4329 esac
4330 if test -n "$tstripme" && test -n "$striplib"; then
4331 func_show_eval "$striplib $destdir/$realname" 'exit $?'
4332 fi
4333
4334 if test "$#" -gt 0; then
4335 # Delete the old symlinks, and create new ones.
4336 # Try 'ln -sf' first, because the 'ln' binary might depend on
4337 # the symlink we replace! Solaris /bin/ln does not understand -f,
4338 # so we also need to try rm && ln -s.
4339 for linkname
4340 do
4341 test "$linkname" != "$realname" \
4342 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
4343 done
4344 fi
4345
4346 # Do each command in the postinstall commands.
4347 lib=$destdir/$realname
4348 func_execute_cmds "$postinstall_cmds" 'exit $?'
4349 fi
4350
4351 # Install the pseudo-library for information purposes.
4352 func_basename "$file"
4353 name=$func_basename_result
4354 instname=$dir/${name}i
4355 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
4356
4357 # Maybe install the static library, too.
4358 test -n "$old_library" && func_append staticlibs " $dir/$old_library"
4359 ;;
4360
4361 *.lo)
4362 # Install (i.e. copy) a libtool object.
4363
4364 # Figure out destination file name, if it wasn't already specified.
4365 if test -n "$destname"; then
4366 destfile=$destdir/$destname
4367 else
4368 func_basename "$file"
4369 destfile=$func_basename_result
4370 destfile=$destdir/$destfile
4371 fi
4372
4373 # Deduce the name of the destination old-style object file.
4374 case $destfile in
4375 *.lo)
4376 func_lo2o "$destfile"
4377 staticdest=$func_lo2o_result
4378 ;;
4379 *.$objext)
4380 staticdest=$destfile
4381 destfile=
4382 ;;
4383 *)
4384 func_fatal_help "cannot copy a libtool object to '$destfile'"
4385 ;;
4386 esac
4387
4388 # Install the libtool object if requested.
4389 test -n "$destfile" && \
4390 func_show_eval "$install_prog $file $destfile" 'exit $?'
4391
4392 # Install the old object if enabled.
4393 if test yes = "$build_old_libs"; then
4394 # Deduce the name of the old-style object file.
4395 func_lo2o "$file"
4396 staticobj=$func_lo2o_result
4397 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
4398 fi
4399 exit $EXIT_SUCCESS
4400 ;;
4401
4402 *)
4403 # Figure out destination file name, if it wasn't already specified.
4404 if test -n "$destname"; then
4405 destfile=$destdir/$destname
4406 else
4407 func_basename "$file"
4408 destfile=$func_basename_result
4409 destfile=$destdir/$destfile
4410 fi
4411
4412 # If the file is missing, and there is a .exe on the end, strip it
4413 # because it is most likely a libtool script we actually want to
4414 # install
4415 stripped_ext=
4416 case $file in
4417 *.exe)
4418 if test ! -f "$file"; then
4419 func_stripname '' '.exe' "$file"
4420 file=$func_stripname_result
4421 stripped_ext=.exe
4422 fi
4423 ;;
4424 esac
4425
4426 # Do a test to see if this is really a libtool program.
4427 case $host in
4428 *cygwin* | *mingw*)
4429 if func_ltwrapper_executable_p "$file"; then
4430 func_ltwrapper_scriptname "$file"
4431 wrapper=$func_ltwrapper_scriptname_result
4432 else
4433 func_stripname '' '.exe' "$file"
4434 wrapper=$func_stripname_result
4435 fi
4436 ;;
4437 *)
4438 wrapper=$file
4439 ;;
4440 esac
4441 if func_ltwrapper_script_p "$wrapper"; then
4442 notinst_deplibs=
4443 relink_command=
4444
4445 func_source "$wrapper"
4446
4447 # Check the variables that should have been set.
4448 test -z "$generated_by_libtool_version" && \
4449 func_fatal_error "invalid libtool wrapper script '$wrapper'"
4450
4451 finalize=:
4452 for lib in $notinst_deplibs; do
4453 # Check to see that each library is installed.
4454 libdir=
4455 if test -f "$lib"; then
4456 func_source "$lib"
4457 fi
4458 libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
4459 if test -n "$libdir" && test ! -f "$libfile"; then
4460 func_warning "'$lib' has not been installed in '$libdir'"
4461 finalize=false
4462 fi
4463 done
4464
4465 relink_command=
4466 func_source "$wrapper"
4467
4468 outputname=
4469 if test no = "$fast_install" && test -n "$relink_command"; then
4470 $opt_dry_run || {
4471 if $finalize; then
4472 tmpdir=`func_mktempdir`
4473 func_basename "$file$stripped_ext"
4474 file=$func_basename_result
4475 outputname=$tmpdir/$file
4476 # Replace the output file specification.
4477 relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4478
4479 $opt_quiet || {
4480 func_quote_for_expand "$relink_command"
4481 eval "func_echo $func_quote_for_expand_result"
4482 }
4483 if eval "$relink_command"; then :
4484 else
4485 func_error "error: relink '$file' with the above command before installing it"
4486 $opt_dry_run || ${RM}r "$tmpdir"
4487 continue
4488 fi
4489 file=$outputname
4490 else
4491 func_warning "cannot relink '$file'"
4492 fi
4493 }
4494 else
4495 # Install the binary that we compiled earlier.
4496 file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
4497 fi
4498 fi
4499
4500 # remove .exe since cygwin /usr/bin/install will append another
4501 # one anyway
4502 case $install_prog,$host in
4503 */usr/bin/install*,*cygwin*)
4504 case $file:$destfile in
4505 *.exe:*.exe)
4506 # this is ok
4507 ;;
4508 *.exe:*)
4509 destfile=$destfile.exe
4510 ;;
4511 *:*.exe)
4512 func_stripname '' '.exe' "$destfile"
4513 destfile=$func_stripname_result
4514 ;;
4515 esac
4516 ;;
4517 esac
4518 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
4519 $opt_dry_run || if test -n "$outputname"; then
4520 ${RM}r "$tmpdir"
4521 fi
4522 ;;
4523 esac
4524 done
4525
4526 for file in $staticlibs; do
4527 func_basename "$file"
4528 name=$func_basename_result
4529
4530 # Set up the ranlib parameters.
4531 oldlib=$destdir/$name
4532 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
4533 tool_oldlib=$func_to_tool_file_result
4534
4535 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
4536
4537 if test -n "$stripme" && test -n "$old_striplib"; then
4538 func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
4539 fi
4540
4541 # Do each command in the postinstall commands.
4542 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
4543 done
4544
4545 test -n "$future_libdirs" && \
4546 func_warning "remember to run '$progname --finish$future_libdirs'"
4547
4548 if test -n "$current_libdirs"; then
4549 # Maybe just do a dry run.
4550 $opt_dry_run && current_libdirs=" -n$current_libdirs"
4551 exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
4552 else
4553 exit $EXIT_SUCCESS
4554 fi
4555 }
4556
4557 test install = "$opt_mode" && func_mode_install ${1+"$@"}
4558
4559
4560 # func_generate_dlsyms outputname originator pic_p
4561 # Extract symbols from dlprefiles and create ${outputname}S.o with
4562 # a dlpreopen symbol table.
4563 func_generate_dlsyms ()
4564 {
4565 $debug_cmd
4566
4567 my_outputname=$1
4568 my_originator=$2
4569 my_pic_p=${3-false}
4570 my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
4571 my_dlsyms=
4572
4573 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
4574 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4575 my_dlsyms=${my_outputname}S.c
4576 else
4577 func_error "not configured to extract global symbols from dlpreopened files"
4578 fi
4579 fi
4580
4581 if test -n "$my_dlsyms"; then
4582 case $my_dlsyms in
4583 "") ;;
4584 *.c)
4585 # Discover the nlist of each of the dlfiles.
4586 nlist=$output_objdir/$my_outputname.nm
4587
4588 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
4589
4590 # Parse the name list into a source file.
4591 func_verbose "creating $output_objdir/$my_dlsyms"
4592
4593 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
4594 /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
4595 /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
4596
4597 #ifdef __cplusplus
4598 extern \"C\" {
4599 #endif
4600
4601 #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
4602 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
4603 #endif
4604
4605 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
4606 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
4607 /* DATA imports from DLLs on WIN32 can't be const, because runtime
4608 relocations are performed -- see ld's documentation on pseudo-relocs. */
4609 # define LT_DLSYM_CONST
4610 #elif defined __osf__
4611 /* This system does not cope well with relocations in const data. */
4612 # define LT_DLSYM_CONST
4613 #else
4614 # define LT_DLSYM_CONST const
4615 #endif
4616
4617 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
4618
4619 /* External symbol declarations for the compiler. */\
4620 "
4621
4622 if test yes = "$dlself"; then
4623 func_verbose "generating symbol list for '$output'"
4624
4625 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
4626
4627 # Add our own program objects to the symbol list.
4628 progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
4629 for progfile in $progfiles; do
4630 func_to_tool_file "$progfile" func_convert_file_msys_to_w32
4631 func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
4632 $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
4633 done
4634
4635 if test -n "$exclude_expsyms"; then
4636 $opt_dry_run || {
4637 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4638 eval '$MV "$nlist"T "$nlist"'
4639 }
4640 fi
4641
4642 if test -n "$export_symbols_regex"; then
4643 $opt_dry_run || {
4644 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4645 eval '$MV "$nlist"T "$nlist"'
4646 }
4647 fi
4648
4649 # Prepare the list of exported symbols
4650 if test -z "$export_symbols"; then
4651 export_symbols=$output_objdir/$outputname.exp
4652 $opt_dry_run || {
4653 $RM $export_symbols
4654 eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4655 case $host in
4656 *cygwin* | *mingw* | *cegcc* )
4657 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4658 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4659 ;;
4660 esac
4661 }
4662 else
4663 $opt_dry_run || {
4664 eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4665 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4666 eval '$MV "$nlist"T "$nlist"'
4667 case $host in
4668 *cygwin* | *mingw* | *cegcc* )
4669 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4670 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4671 ;;
4672 esac
4673 }
4674 fi
4675 fi
4676
4677 for dlprefile in $dlprefiles; do
4678 func_verbose "extracting global C symbols from '$dlprefile'"
4679 func_basename "$dlprefile"
4680 name=$func_basename_result
4681 case $host in
4682 *cygwin* | *mingw* | *cegcc* )
4683 # if an import library, we need to obtain dlname
4684 if func_win32_import_lib_p "$dlprefile"; then
4685 func_tr_sh "$dlprefile"
4686 eval "curr_lafile=\$libfile_$func_tr_sh_result"
4687 dlprefile_dlbasename=
4688 if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
4689 # Use subshell, to avoid clobbering current variable values
4690 dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
4691 if test -n "$dlprefile_dlname"; then
4692 func_basename "$dlprefile_dlname"
4693 dlprefile_dlbasename=$func_basename_result
4694 else
4695 # no lafile. user explicitly requested -dlpreopen <import library>.
4696 $sharedlib_from_linklib_cmd "$dlprefile"
4697 dlprefile_dlbasename=$sharedlib_from_linklib_result
4698 fi
4699 fi
4700 $opt_dry_run || {
4701 if test -n "$dlprefile_dlbasename"; then
4702 eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
4703 else
4704 func_warning "Could not compute DLL name from $name"
4705 eval '$ECHO ": $name " >> "$nlist"'
4706 fi
4707 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4708 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
4709 $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
4710 }
4711 else # not an import lib
4712 $opt_dry_run || {
4713 eval '$ECHO ": $name " >> "$nlist"'
4714 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4715 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4716 }
4717 fi
4718 ;;
4719 *)
4720 $opt_dry_run || {
4721 eval '$ECHO ": $name " >> "$nlist"'
4722 func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
4723 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
4724 }
4725 ;;
4726 esac
4727 done
4728
4729 $opt_dry_run || {
4730 # Make sure we have at least an empty file.
4731 test -f "$nlist" || : > "$nlist"
4732
4733 if test -n "$exclude_expsyms"; then
4734 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4735 $MV "$nlist"T "$nlist"
4736 fi
4737
4738 # Try sorting and uniquifying the output.
4739 if $GREP -v "^: " < "$nlist" |
4740 if sort -k 3 </dev/null >/dev/null 2>&1; then
4741 sort -k 3
4742 else
4743 sort +2
4744 fi |
4745 uniq > "$nlist"S; then
4746 :
4747 else
4748 $GREP -v "^: " < "$nlist" > "$nlist"S
4749 fi
4750
4751 if test -f "$nlist"S; then
4752 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
4753 else
4754 echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
4755 fi
4756
4757 func_show_eval '$RM "${nlist}I"'
4758 if test -n "$global_symbol_to_import"; then
4759 eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
4760 fi
4761
4762 echo >> "$output_objdir/$my_dlsyms" "\
4763
4764 /* The mapping between symbol names and symbols. */
4765 typedef struct {
4766 const char *name;
4767 void *address;
4768 } lt_dlsymlist;
4769 extern LT_DLSYM_CONST lt_dlsymlist
4770 lt_${my_prefix}_LTX_preloaded_symbols[];\
4771 "
4772
4773 if test -s "$nlist"I; then
4774 echo >> "$output_objdir/$my_dlsyms" "\
4775 static void lt_syminit(void)
4776 {
4777 LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
4778 for (; symbol->name; ++symbol)
4779 {"
4780 $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
4781 echo >> "$output_objdir/$my_dlsyms" "\
4782 }
4783 }"
4784 fi
4785 echo >> "$output_objdir/$my_dlsyms" "\
4786 LT_DLSYM_CONST lt_dlsymlist
4787 lt_${my_prefix}_LTX_preloaded_symbols[] =
4788 { {\"$my_originator\", (void *) 0},"
4789
4790 if test -s "$nlist"I; then
4791 echo >> "$output_objdir/$my_dlsyms" "\
4792 {\"@INIT@\", (void *) &lt_syminit},"
4793 fi
4794
4795 case $need_lib_prefix in
4796 no)
4797 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
4798 ;;
4799 *)
4800 eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
4801 ;;
4802 esac
4803 echo >> "$output_objdir/$my_dlsyms" "\
4804 {0, (void *) 0}
4805 };
4806
4807 /* This works around a problem in FreeBSD linker */
4808 #ifdef FREEBSD_WORKAROUND
4809 static const void *lt_preloaded_setup() {
4810 return lt_${my_prefix}_LTX_preloaded_symbols;
4811 }
4812 #endif
4813
4814 #ifdef __cplusplus
4815 }
4816 #endif\
4817 "
4818 } # !$opt_dry_run
4819
4820 pic_flag_for_symtable=
4821 case "$compile_command " in
4822 *" -static "*) ;;
4823 *)
4824 case $host in
4825 # compiling the symbol table file with pic_flag works around
4826 # a FreeBSD bug that causes programs to crash when -lm is
4827 # linked before any other PIC object. But we must not use
4828 # pic_flag when linking with -static. The problem exists in
4829 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4830 *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4831 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
4832 *-*-hpux*)
4833 pic_flag_for_symtable=" $pic_flag" ;;
4834 *)
4835 $my_pic_p && pic_flag_for_symtable=" $pic_flag"
4836 ;;
4837 esac
4838 ;;
4839 esac
4840 symtab_cflags=
4841 for arg in $LTCFLAGS; do
4842 case $arg in
4843 -pie | -fpie | -fPIE) ;;
4844 *) func_append symtab_cflags " $arg" ;;
4845 esac
4846 done
4847
4848 # Now compile the dynamic symbol file.
4849 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
4850
4851 # Clean up the generated files.
4852 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
4853
4854 # Transform the symbol file into the correct name.
4855 symfileobj=$output_objdir/${my_outputname}S.$objext
4856 case $host in
4857 *cygwin* | *mingw* | *cegcc* )
4858 if test -f "$output_objdir/$my_outputname.def"; then
4859 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
4860 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
4861 else
4862 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4863 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4864 fi
4865 ;;
4866 *)
4867 compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4868 finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
4869 ;;
4870 esac
4871 ;;
4872 *)
4873 func_fatal_error "unknown suffix for '$my_dlsyms'"
4874 ;;
4875 esac
4876 else
4877 # We keep going just in case the user didn't refer to
4878 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4879 # really was required.
4880
4881 # Nullify the symbol file.
4882 compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
4883 finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
4884 fi
4885 }
4886
4887 # func_cygming_gnu_implib_p ARG
4888 # This predicate returns with zero status (TRUE) if
4889 # ARG is a GNU/binutils-style import library. Returns
4890 # with nonzero status (FALSE) otherwise.
4891 func_cygming_gnu_implib_p ()
4892 {
4893 $debug_cmd
4894
4895 func_to_tool_file "$1" func_convert_file_msys_to_w32
4896 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
4897 test -n "$func_cygming_gnu_implib_tmp"
4898 }
4899
4900 # func_cygming_ms_implib_p ARG
4901 # This predicate returns with zero status (TRUE) if
4902 # ARG is an MS-style import library. Returns
4903 # with nonzero status (FALSE) otherwise.
4904 func_cygming_ms_implib_p ()
4905 {
4906 $debug_cmd
4907
4908 func_to_tool_file "$1" func_convert_file_msys_to_w32
4909 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
4910 test -n "$func_cygming_ms_implib_tmp"
4911 }
4912
4913 # func_win32_libid arg
4914 # return the library type of file 'arg'
4915 #
4916 # Need a lot of goo to handle *both* DLLs and import libs
4917 # Has to be a shell function in order to 'eat' the argument
4918 # that is supplied when $file_magic_command is called.
4919 # Despite the name, also deal with 64 bit binaries.
4920 func_win32_libid ()
4921 {
4922 $debug_cmd
4923
4924 win32_libid_type=unknown
4925 win32_fileres=`file -L $1 2>/dev/null`
4926 case $win32_fileres in
4927 *ar\ archive\ import\ library*) # definitely import
4928 win32_libid_type="x86 archive import"
4929 ;;
4930 *ar\ archive*) # could be an import, or static
4931 # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
4932 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
4933 $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
4934 case $nm_interface in
4935 "MS dumpbin")
4936 if func_cygming_ms_implib_p "$1" ||
4937 func_cygming_gnu_implib_p "$1"
4938 then
4939 win32_nmres=import
4940 else
4941 win32_nmres=
4942 fi
4943 ;;
4944 *)
4945 func_to_tool_file "$1" func_convert_file_msys_to_w32
4946 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
4947 $SED -n -e '
4948 1,100{
4949 / I /{
4950 s|.*|import|
4951 p
4952 q
4953 }
4954 }'`
4955 ;;
4956 esac
4957 case $win32_nmres in
4958 import*) win32_libid_type="x86 archive import";;
4959 *) win32_libid_type="x86 archive static";;
4960 esac
4961 fi
4962 ;;
4963 *DLL*)
4964 win32_libid_type="x86 DLL"
4965 ;;
4966 *executable*) # but shell scripts are "executable" too...
4967 case $win32_fileres in
4968 *MS\ Windows\ PE\ Intel*)
4969 win32_libid_type="x86 DLL"
4970 ;;
4971 esac
4972 ;;
4973 esac
4974 $ECHO "$win32_libid_type"
4975 }
4976
4977 # func_cygming_dll_for_implib ARG
4978 #
4979 # Platform-specific function to extract the
4980 # name of the DLL associated with the specified
4981 # import library ARG.
4982 # Invoked by eval'ing the libtool variable
4983 # $sharedlib_from_linklib_cmd
4984 # Result is available in the variable
4985 # $sharedlib_from_linklib_result
4986 func_cygming_dll_for_implib ()
4987 {
4988 $debug_cmd
4989
4990 sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
4991 }
4992
4993 # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
4994 #
4995 # The is the core of a fallback implementation of a
4996 # platform-specific function to extract the name of the
4997 # DLL associated with the specified import library LIBNAME.
4998 #
4999 # SECTION_NAME is either .idata$6 or .idata$7, depending
5000 # on the platform and compiler that created the implib.
5001 #
5002 # Echos the name of the DLL associated with the
5003 # specified import library.
5004 func_cygming_dll_for_implib_fallback_core ()
5005 {
5006 $debug_cmd
5007
5008 match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
5009 $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
5010 $SED '/^Contents of section '"$match_literal"':/{
5011 # Place marker at beginning of archive member dllname section
5012 s/.*/====MARK====/
5013 p
5014 d
5015 }
5016 # These lines can sometimes be longer than 43 characters, but
5017 # are always uninteresting
5018 /:[ ]*file format pe[i]\{,1\}-/d
5019 /^In archive [^:]*:/d
5020 # Ensure marker is printed
5021 /^====MARK====/p
5022 # Remove all lines with less than 43 characters
5023 /^.\{43\}/!d
5024 # From remaining lines, remove first 43 characters
5025 s/^.\{43\}//' |
5026 $SED -n '
5027 # Join marker and all lines until next marker into a single line
5028 /^====MARK====/ b para
5029 H
5030 $ b para
5031 b
5032 :para
5033 x
5034 s/\n//g
5035 # Remove the marker
5036 s/^====MARK====//
5037 # Remove trailing dots and whitespace
5038 s/[\. \t]*$//
5039 # Print
5040 /./p' |
5041 # we now have a list, one entry per line, of the stringified
5042 # contents of the appropriate section of all members of the
5043 # archive that possess that section. Heuristic: eliminate
5044 # all those that have a first or second character that is
5045 # a '.' (that is, objdump's representation of an unprintable
5046 # character.) This should work for all archives with less than
5047 # 0x302f exports -- but will fail for DLLs whose name actually
5048 # begins with a literal '.' or a single character followed by
5049 # a '.'.
5050 #
5051 # Of those that remain, print the first one.
5052 $SED -e '/^\./d;/^.\./d;q'
5053 }
5054
5055 # func_cygming_dll_for_implib_fallback ARG
5056 # Platform-specific function to extract the
5057 # name of the DLL associated with the specified
5058 # import library ARG.
5059 #
5060 # This fallback implementation is for use when $DLLTOOL
5061 # does not support the --identify-strict option.
5062 # Invoked by eval'ing the libtool variable
5063 # $sharedlib_from_linklib_cmd
5064 # Result is available in the variable
5065 # $sharedlib_from_linklib_result
5066 func_cygming_dll_for_implib_fallback ()
5067 {
5068 $debug_cmd
5069
5070 if func_cygming_gnu_implib_p "$1"; then
5071 # binutils import library
5072 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
5073 elif func_cygming_ms_implib_p "$1"; then
5074 # ms-generated import library
5075 sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
5076 else
5077 # unknown
5078 sharedlib_from_linklib_result=
5079 fi
5080 }
5081
5082
5083 # func_extract_an_archive dir oldlib
5084 func_extract_an_archive ()
5085 {
5086 $debug_cmd
5087
5088 f_ex_an_ar_dir=$1; shift
5089 f_ex_an_ar_oldlib=$1
5090 if test yes = "$lock_old_archive_extraction"; then
5091 lockfile=$f_ex_an_ar_oldlib.lock
5092 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
5093 func_echo "Waiting for $lockfile to be removed"
5094 sleep 2
5095 done
5096 fi
5097 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
5098 'stat=$?; rm -f "$lockfile"; exit $stat'
5099 if test yes = "$lock_old_archive_extraction"; then
5100 $opt_dry_run || rm -f "$lockfile"
5101 fi
5102 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
5103 :
5104 else
5105 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
5106 fi
5107 }
5108
5109
5110 # func_extract_archives gentop oldlib ...
5111 func_extract_archives ()
5112 {
5113 $debug_cmd
5114
5115 my_gentop=$1; shift
5116 my_oldlibs=${1+"$@"}
5117 my_oldobjs=
5118 my_xlib=
5119 my_xabs=
5120 my_xdir=
5121
5122 for my_xlib in $my_oldlibs; do
5123 # Extract the objects.
5124 case $my_xlib in
5125 [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
5126 *) my_xabs=`pwd`"/$my_xlib" ;;
5127 esac
5128 func_basename "$my_xlib"
5129 my_xlib=$func_basename_result
5130 my_xlib_u=$my_xlib
5131 while :; do
5132 case " $extracted_archives " in
5133 *" $my_xlib_u "*)
5134 func_arith $extracted_serial + 1
5135 extracted_serial=$func_arith_result
5136 my_xlib_u=lt$extracted_serial-$my_xlib ;;
5137 *) break ;;
5138 esac
5139 done
5140 extracted_archives="$extracted_archives $my_xlib_u"
5141 my_xdir=$my_gentop/$my_xlib_u
5142
5143 func_mkdir_p "$my_xdir"
5144
5145 case $host in
5146 *-darwin*)
5147 func_verbose "Extracting $my_xabs"
5148 # Do not bother doing anything if just a dry run
5149 $opt_dry_run || {
5150 darwin_orig_dir=`pwd`
5151 cd $my_xdir || exit $?
5152 darwin_archive=$my_xabs
5153 darwin_curdir=`pwd`
5154 func_basename "$darwin_archive"
5155 darwin_base_archive=$func_basename_result
5156 darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
5157 if test -n "$darwin_arches"; then
5158 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
5159 darwin_arch=
5160 func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
5161 for darwin_arch in $darwin_arches; do
5162 func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
5163 $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
5164 cd "unfat-$$/$darwin_base_archive-$darwin_arch"
5165 func_extract_an_archive "`pwd`" "$darwin_base_archive"
5166 cd "$darwin_curdir"
5167 $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
5168 done # $darwin_arches
5169 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
5170 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
5171 darwin_file=
5172 darwin_files=
5173 for darwin_file in $darwin_filelist; do
5174 darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
5175 $LIPO -create -output "$darwin_file" $darwin_files
5176 done # $darwin_filelist
5177 $RM -rf unfat-$$
5178 cd "$darwin_orig_dir"
5179 else
5180 cd $darwin_orig_dir
5181 func_extract_an_archive "$my_xdir" "$my_xabs"
5182 fi # $darwin_arches
5183 } # !$opt_dry_run
5184 ;;
5185 *)
5186 func_extract_an_archive "$my_xdir" "$my_xabs"
5187 ;;
5188 esac
5189 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
5190 done
5191
5192 func_extract_archives_result=$my_oldobjs
5193 }
5194
5195
5196 # func_emit_wrapper [arg=no]
5197 #
5198 # Emit a libtool wrapper script on stdout.
5199 # Don't directly open a file because we may want to
5200 # incorporate the script contents within a cygwin/mingw
5201 # wrapper executable. Must ONLY be called from within
5202 # func_mode_link because it depends on a number of variables
5203 # set therein.
5204 #
5205 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
5206 # variable will take. If 'yes', then the emitted script
5207 # will assume that the directory where it is stored is
5208 # the $objdir directory. This is a cygwin/mingw-specific
5209 # behavior.
5210 func_emit_wrapper ()
5211 {
5212 func_emit_wrapper_arg1=${1-no}
5213
5214 $ECHO "\
5215 #! $SHELL
5216
5217 # $output - temporary wrapper script for $objdir/$outputname
5218 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5219 #
5220 # The $output program cannot be directly executed until all the libtool
5221 # libraries that it depends on are installed.
5222 #
5223 # This wrapper script should never be moved out of the build directory.
5224 # If it is, it will not operate correctly.
5225
5226 # Sed substitution that helps us do robust quoting. It backslashifies
5227 # metacharacters that are still active within double-quoted strings.
5228 sed_quote_subst='$sed_quote_subst'
5229
5230 # Be Bourne compatible
5231 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5232 emulate sh
5233 NULLCMD=:
5234 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5235 # is contrary to our usage. Disable this feature.
5236 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5237 setopt NO_GLOB_SUBST
5238 else
5239 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5240 fi
5241 BIN_SH=xpg4; export BIN_SH # for Tru64
5242 DUALCASE=1; export DUALCASE # for MKS sh
5243
5244 # The HP-UX ksh and POSIX shell print the target directory to stdout
5245 # if CDPATH is set.
5246 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5247
5248 relink_command=\"$relink_command\"
5249
5250 # This environment variable determines our operation mode.
5251 if test \"\$libtool_install_magic\" = \"$magic\"; then
5252 # install mode needs the following variables:
5253 generated_by_libtool_version='$macro_version'
5254 notinst_deplibs='$notinst_deplibs'
5255 else
5256 # When we are sourced in execute mode, \$file and \$ECHO are already set.
5257 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5258 file=\"\$0\""
5259
5260 qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
5261 $ECHO "\
5262
5263 # A function that is used when there is no print builtin or printf.
5264 func_fallback_echo ()
5265 {
5266 eval 'cat <<_LTECHO_EOF
5267 \$1
5268 _LTECHO_EOF'
5269 }
5270 ECHO=\"$qECHO\"
5271 fi
5272
5273 # Very basic option parsing. These options are (a) specific to
5274 # the libtool wrapper, (b) are identical between the wrapper
5275 # /script/ and the wrapper /executable/ that is used only on
5276 # windows platforms, and (c) all begin with the string "--lt-"
5277 # (application programs are unlikely to have options that match
5278 # this pattern).
5279 #
5280 # There are only two supported options: --lt-debug and
5281 # --lt-dump-script. There is, deliberately, no --lt-help.
5282 #
5283 # The first argument to this parsing function should be the
5284 # script's $0 value, followed by "$@".
5285 lt_option_debug=
5286 func_parse_lt_options ()
5287 {
5288 lt_script_arg0=\$0
5289 shift
5290 for lt_opt
5291 do
5292 case \"\$lt_opt\" in
5293 --lt-debug) lt_option_debug=1 ;;
5294 --lt-dump-script)
5295 lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
5296 test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
5297 lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
5298 cat \"\$lt_dump_D/\$lt_dump_F\"
5299 exit 0
5300 ;;
5301 --lt-*)
5302 \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
5303 exit 1
5304 ;;
5305 esac
5306 done
5307
5308 # Print the debug banner immediately:
5309 if test -n \"\$lt_option_debug\"; then
5310 echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
5311 fi
5312 }
5313
5314 # Used when --lt-debug. Prints its arguments to stdout
5315 # (redirection is the responsibility of the caller)
5316 func_lt_dump_args ()
5317 {
5318 lt_dump_args_N=1;
5319 for lt_arg
5320 do
5321 \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
5322 lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
5323 done
5324 }
5325
5326 # Core function for launching the target application
5327 func_exec_program_core ()
5328 {
5329 "
5330 case $host in
5331 # Backslashes separate directories on plain windows
5332 *-*-mingw | *-*-os2* | *-cegcc*)
5333 $ECHO "\
5334 if test -n \"\$lt_option_debug\"; then
5335 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
5336 func_lt_dump_args \${1+\"\$@\"} 1>&2
5337 fi
5338 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5339 "
5340 ;;
5341
5342 *)
5343 $ECHO "\
5344 if test -n \"\$lt_option_debug\"; then
5345 \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
5346 func_lt_dump_args \${1+\"\$@\"} 1>&2
5347 fi
5348 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5349 "
5350 ;;
5351 esac
5352 $ECHO "\
5353 \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
5354 exit 1
5355 }
5356
5357 # A function to encapsulate launching the target application
5358 # Strips options in the --lt-* namespace from \$@ and
5359 # launches target application with the remaining arguments.
5360 func_exec_program ()
5361 {
5362 case \" \$* \" in
5363 *\\ --lt-*)
5364 for lt_wr_arg
5365 do
5366 case \$lt_wr_arg in
5367 --lt-*) ;;
5368 *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
5369 esac
5370 shift
5371 done ;;
5372 esac
5373 func_exec_program_core \${1+\"\$@\"}
5374 }
5375
5376 # Parse options
5377 func_parse_lt_options \"\$0\" \${1+\"\$@\"}
5378
5379 # Find the directory that this script lives in.
5380 thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
5381 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5382
5383 # Follow symbolic links until we get to the real thisdir.
5384 file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
5385 while test -n \"\$file\"; do
5386 destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
5387
5388 # If there was a directory component, then change thisdir.
5389 if test \"x\$destdir\" != \"x\$file\"; then
5390 case \"\$destdir\" in
5391 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5392 *) thisdir=\"\$thisdir/\$destdir\" ;;
5393 esac
5394 fi
5395
5396 file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
5397 file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
5398 done
5399
5400 # Usually 'no', except on cygwin/mingw when embedded into
5401 # the cwrapper.
5402 WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
5403 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
5404 # special case for '.'
5405 if test \"\$thisdir\" = \".\"; then
5406 thisdir=\`pwd\`
5407 fi
5408 # remove .libs from thisdir
5409 case \"\$thisdir\" in
5410 *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
5411 $objdir ) thisdir=. ;;
5412 esac
5413 fi
5414
5415 # Try to get the absolute directory name.
5416 absdir=\`cd \"\$thisdir\" && pwd\`
5417 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5418 "
5419
5420 if test yes = "$fast_install"; then
5421 $ECHO "\
5422 program=lt-'$outputname'$exeext
5423 progdir=\"\$thisdir/$objdir\"
5424
5425 if test ! -f \"\$progdir/\$program\" ||
5426 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
5427 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5428
5429 file=\"\$\$-\$program\"
5430
5431 if test ! -d \"\$progdir\"; then
5432 $MKDIR \"\$progdir\"
5433 else
5434 $RM \"\$progdir/\$file\"
5435 fi"
5436
5437 $ECHO "\
5438
5439 # relink executable if necessary
5440 if test -n \"\$relink_command\"; then
5441 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5442 else
5443 \$ECHO \"\$relink_command_output\" >&2
5444 $RM \"\$progdir/\$file\"
5445 exit 1
5446 fi
5447 fi
5448
5449 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5450 { $RM \"\$progdir/\$program\";
5451 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5452 $RM \"\$progdir/\$file\"
5453 fi"
5454 else
5455 $ECHO "\
5456 program='$outputname'
5457 progdir=\"\$thisdir/$objdir\"
5458 "
5459 fi
5460
5461 $ECHO "\
5462
5463 if test -f \"\$progdir/\$program\"; then"
5464
5465 # fixup the dll searchpath if we need to.
5466 #
5467 # Fix the DLL searchpath if we need to. Do this before prepending
5468 # to shlibpath, because on Windows, both are PATH and uninstalled
5469 # libraries must come first.
5470 if test -n "$dllsearchpath"; then
5471 $ECHO "\
5472 # Add the dll search path components to the executable PATH
5473 PATH=$dllsearchpath:\$PATH
5474 "
5475 fi
5476
5477 # Export our shlibpath_var if we have one.
5478 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5479 $ECHO "\
5480 # Add our own library path to $shlibpath_var
5481 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5482
5483 # Some systems cannot cope with colon-terminated $shlibpath_var
5484 # The second colon is a workaround for a bug in BeOS R4 sed
5485 $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
5486
5487 export $shlibpath_var
5488 "
5489 fi
5490
5491 $ECHO "\
5492 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5493 # Run the actual program with our arguments.
5494 func_exec_program \${1+\"\$@\"}
5495 fi
5496 else
5497 # The program doesn't exist.
5498 \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
5499 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
5500 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
5501 exit 1
5502 fi
5503 fi\
5504 "
5505 }
5506
5507
5508 # func_emit_cwrapperexe_src
5509 # emit the source code for a wrapper executable on stdout
5510 # Must ONLY be called from within func_mode_link because
5511 # it depends on a number of variable set therein.
5512 func_emit_cwrapperexe_src ()
5513 {
5514 cat <<EOF
5515
5516 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
5517 Generated by $PROGRAM (GNU $PACKAGE) $VERSION
5518
5519 The $output program cannot be directly executed until all the libtool
5520 libraries that it depends on are installed.
5521
5522 This wrapper executable should never be moved out of the build directory.
5523 If it is, it will not operate correctly.
5524 */
5525 EOF
5526 cat <<"EOF"
5527 #ifdef _MSC_VER
5528 # define _CRT_SECURE_NO_DEPRECATE 1
5529 #endif
5530 #include <stdio.h>
5531 #include <stdlib.h>
5532 #ifdef _MSC_VER
5533 # include <direct.h>
5534 # include <process.h>
5535 # include <io.h>
5536 #else
5537 # include <unistd.h>
5538 # include <stdint.h>
5539 # ifdef __CYGWIN__
5540 # include <io.h>
5541 # endif
5542 #endif
5543 #include <malloc.h>
5544 #include <stdarg.h>
5545 #include <assert.h>
5546 #include <string.h>
5547 #include <ctype.h>
5548 #include <errno.h>
5549 #include <fcntl.h>
5550 #include <sys/stat.h>
5551
5552 #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
5553
5554 /* declarations of non-ANSI functions */
5555 #if defined __MINGW32__
5556 # ifdef __STRICT_ANSI__
5557 int _putenv (const char *);
5558 # endif
5559 #elif defined __CYGWIN__
5560 # ifdef __STRICT_ANSI__
5561 char *realpath (const char *, char *);
5562 int putenv (char *);
5563 int setenv (const char *, const char *, int);
5564 # endif
5565 /* #elif defined other_platform || defined ... */
5566 #endif
5567
5568 /* portability defines, excluding path handling macros */
5569 #if defined _MSC_VER
5570 # define setmode _setmode
5571 # define stat _stat
5572 # define chmod _chmod
5573 # define getcwd _getcwd
5574 # define putenv _putenv
5575 # define S_IXUSR _S_IEXEC
5576 #elif defined __MINGW32__
5577 # define setmode _setmode
5578 # define stat _stat
5579 # define chmod _chmod
5580 # define getcwd _getcwd
5581 # define putenv _putenv
5582 #elif defined __CYGWIN__
5583 # define HAVE_SETENV
5584 # define FOPEN_WB "wb"
5585 /* #elif defined other platforms ... */
5586 #endif
5587
5588 #if defined PATH_MAX
5589 # define LT_PATHMAX PATH_MAX
5590 #elif defined MAXPATHLEN
5591 # define LT_PATHMAX MAXPATHLEN
5592 #else
5593 # define LT_PATHMAX 1024
5594 #endif
5595
5596 #ifndef S_IXOTH
5597 # define S_IXOTH 0
5598 #endif
5599 #ifndef S_IXGRP
5600 # define S_IXGRP 0
5601 #endif
5602
5603 /* path handling portability macros */
5604 #ifndef DIR_SEPARATOR
5605 # define DIR_SEPARATOR '/'
5606 # define PATH_SEPARATOR ':'
5607 #endif
5608
5609 #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
5610 defined __OS2__
5611 # define HAVE_DOS_BASED_FILE_SYSTEM
5612 # define FOPEN_WB "wb"
5613 # ifndef DIR_SEPARATOR_2
5614 # define DIR_SEPARATOR_2 '\\'
5615 # endif
5616 # ifndef PATH_SEPARATOR_2
5617 # define PATH_SEPARATOR_2 ';'
5618 # endif
5619 #endif
5620
5621 #ifndef DIR_SEPARATOR_2
5622 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5623 #else /* DIR_SEPARATOR_2 */
5624 # define IS_DIR_SEPARATOR(ch) \
5625 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5626 #endif /* DIR_SEPARATOR_2 */
5627
5628 #ifndef PATH_SEPARATOR_2
5629 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5630 #else /* PATH_SEPARATOR_2 */
5631 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5632 #endif /* PATH_SEPARATOR_2 */
5633
5634 #ifndef FOPEN_WB
5635 # define FOPEN_WB "w"
5636 #endif
5637 #ifndef _O_BINARY
5638 # define _O_BINARY 0
5639 #endif
5640
5641 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5642 #define XFREE(stale) do { \
5643 if (stale) { free (stale); stale = 0; } \
5644 } while (0)
5645
5646 #if defined LT_DEBUGWRAPPER
5647 static int lt_debug = 1;
5648 #else
5649 static int lt_debug = 0;
5650 #endif
5651
5652 const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
5653
5654 void *xmalloc (size_t num);
5655 char *xstrdup (const char *string);
5656 const char *base_name (const char *name);
5657 char *find_executable (const char *wrapper);
5658 char *chase_symlinks (const char *pathspec);
5659 int make_executable (const char *path);
5660 int check_executable (const char *path);
5661 char *strendzap (char *str, const char *pat);
5662 void lt_debugprintf (const char *file, int line, const char *fmt, ...);
5663 void lt_fatal (const char *file, int line, const char *message, ...);
5664 static const char *nonnull (const char *s);
5665 static const char *nonempty (const char *s);
5666 void lt_setenv (const char *name, const char *value);
5667 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
5668 void lt_update_exe_path (const char *name, const char *value);
5669 void lt_update_lib_path (const char *name, const char *value);
5670 char **prepare_spawn (char **argv);
5671 void lt_dump_script (FILE *f);
5672 EOF
5673
5674 cat <<EOF
5675 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
5676 # define externally_visible volatile
5677 #else
5678 # define externally_visible __attribute__((externally_visible)) volatile
5679 #endif
5680 externally_visible const char * MAGIC_EXE = "$magic_exe";
5681 const char * LIB_PATH_VARNAME = "$shlibpath_var";
5682 EOF
5683
5684 if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5685 func_to_host_path "$temp_rpath"
5686 cat <<EOF
5687 const char * LIB_PATH_VALUE = "$func_to_host_path_result";
5688 EOF
5689 else
5690 cat <<"EOF"
5691 const char * LIB_PATH_VALUE = "";
5692 EOF
5693 fi
5694
5695 if test -n "$dllsearchpath"; then
5696 func_to_host_path "$dllsearchpath:"
5697 cat <<EOF
5698 const char * EXE_PATH_VARNAME = "PATH";
5699 const char * EXE_PATH_VALUE = "$func_to_host_path_result";
5700 EOF
5701 else
5702 cat <<"EOF"
5703 const char * EXE_PATH_VARNAME = "";
5704 const char * EXE_PATH_VALUE = "";
5705 EOF
5706 fi
5707
5708 if test yes = "$fast_install"; then
5709 cat <<EOF
5710 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
5711 EOF
5712 else
5713 cat <<EOF
5714 const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
5715 EOF
5716 fi
5717
5718
5719 cat <<"EOF"
5720
5721 #define LTWRAPPER_OPTION_PREFIX "--lt-"
5722
5723 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
5724 static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
5725 static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
5726
5727 int
5728 main (int argc, char *argv[])
5729 {
5730 char **newargz;
5731 int newargc;
5732 char *tmp_pathspec;
5733 char *actual_cwrapper_path;
5734 char *actual_cwrapper_name;
5735 char *target_name;
5736 char *lt_argv_zero;
5737 int rval = 127;
5738
5739 int i;
5740
5741 program_name = (char *) xstrdup (base_name (argv[0]));
5742 newargz = XMALLOC (char *, (size_t) argc + 1);
5743
5744 /* very simple arg parsing; don't want to rely on getopt
5745 * also, copy all non cwrapper options to newargz, except
5746 * argz[0], which is handled differently
5747 */
5748 newargc=0;
5749 for (i = 1; i < argc; i++)
5750 {
5751 if (STREQ (argv[i], dumpscript_opt))
5752 {
5753 EOF
5754 case $host in
5755 *mingw* | *cygwin* )
5756 # make stdout use "unix" line endings
5757 echo " setmode(1,_O_BINARY);"
5758 ;;
5759 esac
5760
5761 cat <<"EOF"
5762 lt_dump_script (stdout);
5763 return 0;
5764 }
5765 if (STREQ (argv[i], debug_opt))
5766 {
5767 lt_debug = 1;
5768 continue;
5769 }
5770 if (STREQ (argv[i], ltwrapper_option_prefix))
5771 {
5772 /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
5773 namespace, but it is not one of the ones we know about and
5774 have already dealt with, above (inluding dump-script), then
5775 report an error. Otherwise, targets might begin to believe
5776 they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
5777 namespace. The first time any user complains about this, we'll
5778 need to make LTWRAPPER_OPTION_PREFIX a configure-time option
5779 or a configure.ac-settable value.
5780 */
5781 lt_fatal (__FILE__, __LINE__,
5782 "unrecognized %s option: '%s'",
5783 ltwrapper_option_prefix, argv[i]);
5784 }
5785 /* otherwise ... */
5786 newargz[++newargc] = xstrdup (argv[i]);
5787 }
5788 newargz[++newargc] = NULL;
5789
5790 EOF
5791 cat <<EOF
5792 /* The GNU banner must be the first non-error debug message */
5793 lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
5794 EOF
5795 cat <<"EOF"
5796 lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
5797 lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
5798
5799 tmp_pathspec = find_executable (argv[0]);
5800 if (tmp_pathspec == NULL)
5801 lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
5802 lt_debugprintf (__FILE__, __LINE__,
5803 "(main) found exe (before symlink chase) at: %s\n",
5804 tmp_pathspec);
5805
5806 actual_cwrapper_path = chase_symlinks (tmp_pathspec);
5807 lt_debugprintf (__FILE__, __LINE__,
5808 "(main) found exe (after symlink chase) at: %s\n",
5809 actual_cwrapper_path);
5810 XFREE (tmp_pathspec);
5811
5812 actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
5813 strendzap (actual_cwrapper_path, actual_cwrapper_name);
5814
5815 /* wrapper name transforms */
5816 strendzap (actual_cwrapper_name, ".exe");
5817 tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
5818 XFREE (actual_cwrapper_name);
5819 actual_cwrapper_name = tmp_pathspec;
5820 tmp_pathspec = 0;
5821
5822 /* target_name transforms -- use actual target program name; might have lt- prefix */
5823 target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
5824 strendzap (target_name, ".exe");
5825 tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
5826 XFREE (target_name);
5827 target_name = tmp_pathspec;
5828 tmp_pathspec = 0;
5829
5830 lt_debugprintf (__FILE__, __LINE__,
5831 "(main) libtool target name: %s\n",
5832 target_name);
5833 EOF
5834
5835 cat <<EOF
5836 newargz[0] =
5837 XMALLOC (char, (strlen (actual_cwrapper_path) +
5838 strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
5839 strcpy (newargz[0], actual_cwrapper_path);
5840 strcat (newargz[0], "$objdir");
5841 strcat (newargz[0], "/");
5842 EOF
5843
5844 cat <<"EOF"
5845 /* stop here, and copy so we don't have to do this twice */
5846 tmp_pathspec = xstrdup (newargz[0]);
5847
5848 /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
5849 strcat (newargz[0], actual_cwrapper_name);
5850
5851 /* DO want the lt- prefix here if it exists, so use target_name */
5852 lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
5853 XFREE (tmp_pathspec);
5854 tmp_pathspec = NULL;
5855 EOF
5856
5857 case $host_os in
5858 mingw*)
5859 cat <<"EOF"
5860 {
5861 char* p;
5862 while ((p = strchr (newargz[0], '\\')) != NULL)
5863 {
5864 *p = '/';
5865 }
5866 while ((p = strchr (lt_argv_zero, '\\')) != NULL)
5867 {
5868 *p = '/';
5869 }
5870 }
5871 EOF
5872 ;;
5873 esac
5874
5875 cat <<"EOF"
5876 XFREE (target_name);
5877 XFREE (actual_cwrapper_path);
5878 XFREE (actual_cwrapper_name);
5879
5880 lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
5881 lt_setenv ("DUALCASE", "1"); /* for MSK sh */
5882 /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
5883 be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
5884 because on Windows, both *_VARNAMEs are PATH but uninstalled
5885 libraries must come first. */
5886 lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
5887 lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
5888
5889 lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
5890 nonnull (lt_argv_zero));
5891 for (i = 0; i < newargc; i++)
5892 {
5893 lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
5894 i, nonnull (newargz[i]));
5895 }
5896
5897 EOF
5898
5899 case $host_os in
5900 mingw*)
5901 cat <<"EOF"
5902 /* execv doesn't actually work on mingw as expected on unix */
5903 newargz = prepare_spawn (newargz);
5904 rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
5905 if (rval == -1)
5906 {
5907 /* failed to start process */
5908 lt_debugprintf (__FILE__, __LINE__,
5909 "(main) failed to launch target \"%s\": %s\n",
5910 lt_argv_zero, nonnull (strerror (errno)));
5911 return 127;
5912 }
5913 return rval;
5914 EOF
5915 ;;
5916 *)
5917 cat <<"EOF"
5918 execv (lt_argv_zero, newargz);
5919 return rval; /* =127, but avoids unused variable warning */
5920 EOF
5921 ;;
5922 esac
5923
5924 cat <<"EOF"
5925 }
5926
5927 void *
5928 xmalloc (size_t num)
5929 {
5930 void *p = (void *) malloc (num);
5931 if (!p)
5932 lt_fatal (__FILE__, __LINE__, "memory exhausted");
5933
5934 return p;
5935 }
5936
5937 char *
5938 xstrdup (const char *string)
5939 {
5940 return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
5941 string) : NULL;
5942 }
5943
5944 const char *
5945 base_name (const char *name)
5946 {
5947 const char *base;
5948
5949 #if defined HAVE_DOS_BASED_FILE_SYSTEM
5950 /* Skip over the disk name in MSDOS pathnames. */
5951 if (isalpha ((unsigned char) name[0]) && name[1] == ':')
5952 name += 2;
5953 #endif
5954
5955 for (base = name; *name; name++)
5956 if (IS_DIR_SEPARATOR (*name))
5957 base = name + 1;
5958 return base;
5959 }
5960
5961 int
5962 check_executable (const char *path)
5963 {
5964 struct stat st;
5965
5966 lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
5967 nonempty (path));
5968 if ((!path) || (!*path))
5969 return 0;
5970
5971 if ((stat (path, &st) >= 0)
5972 && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
5973 return 1;
5974 else
5975 return 0;
5976 }
5977
5978 int
5979 make_executable (const char *path)
5980 {
5981 int rval = 0;
5982 struct stat st;
5983
5984 lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
5985 nonempty (path));
5986 if ((!path) || (!*path))
5987 return 0;
5988
5989 if (stat (path, &st) >= 0)
5990 {
5991 rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
5992 }
5993 return rval;
5994 }
5995
5996 /* Searches for the full path of the wrapper. Returns
5997 newly allocated full path name if found, NULL otherwise
5998 Does not chase symlinks, even on platforms that support them.
5999 */
6000 char *
6001 find_executable (const char *wrapper)
6002 {
6003 int has_slash = 0;
6004 const char *p;
6005 const char *p_next;
6006 /* static buffer for getcwd */
6007 char tmp[LT_PATHMAX + 1];
6008 size_t tmp_len;
6009 char *concat_name;
6010
6011 lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
6012 nonempty (wrapper));
6013
6014 if ((wrapper == NULL) || (*wrapper == '\0'))
6015 return NULL;
6016
6017 /* Absolute path? */
6018 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6019 if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
6020 {
6021 concat_name = xstrdup (wrapper);
6022 if (check_executable (concat_name))
6023 return concat_name;
6024 XFREE (concat_name);
6025 }
6026 else
6027 {
6028 #endif
6029 if (IS_DIR_SEPARATOR (wrapper[0]))
6030 {
6031 concat_name = xstrdup (wrapper);
6032 if (check_executable (concat_name))
6033 return concat_name;
6034 XFREE (concat_name);
6035 }
6036 #if defined HAVE_DOS_BASED_FILE_SYSTEM
6037 }
6038 #endif
6039
6040 for (p = wrapper; *p; p++)
6041 if (*p == '/')
6042 {
6043 has_slash = 1;
6044 break;
6045 }
6046 if (!has_slash)
6047 {
6048 /* no slashes; search PATH */
6049 const char *path = getenv ("PATH");
6050 if (path != NULL)
6051 {
6052 for (p = path; *p; p = p_next)
6053 {
6054 const char *q;
6055 size_t p_len;
6056 for (q = p; *q; q++)
6057 if (IS_PATH_SEPARATOR (*q))
6058 break;
6059 p_len = (size_t) (q - p);
6060 p_next = (*q == '\0' ? q : q + 1);
6061 if (p_len == 0)
6062 {
6063 /* empty path: current directory */
6064 if (getcwd (tmp, LT_PATHMAX) == NULL)
6065 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6066 nonnull (strerror (errno)));
6067 tmp_len = strlen (tmp);
6068 concat_name =
6069 XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6070 memcpy (concat_name, tmp, tmp_len);
6071 concat_name[tmp_len] = '/';
6072 strcpy (concat_name + tmp_len + 1, wrapper);
6073 }
6074 else
6075 {
6076 concat_name =
6077 XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
6078 memcpy (concat_name, p, p_len);
6079 concat_name[p_len] = '/';
6080 strcpy (concat_name + p_len + 1, wrapper);
6081 }
6082 if (check_executable (concat_name))
6083 return concat_name;
6084 XFREE (concat_name);
6085 }
6086 }
6087 /* not found in PATH; assume curdir */
6088 }
6089 /* Relative path | not found in path: prepend cwd */
6090 if (getcwd (tmp, LT_PATHMAX) == NULL)
6091 lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
6092 nonnull (strerror (errno)));
6093 tmp_len = strlen (tmp);
6094 concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
6095 memcpy (concat_name, tmp, tmp_len);
6096 concat_name[tmp_len] = '/';
6097 strcpy (concat_name + tmp_len + 1, wrapper);
6098
6099 if (check_executable (concat_name))
6100 return concat_name;
6101 XFREE (concat_name);
6102 return NULL;
6103 }
6104
6105 char *
6106 chase_symlinks (const char *pathspec)
6107 {
6108 #ifndef S_ISLNK
6109 return xstrdup (pathspec);
6110 #else
6111 char buf[LT_PATHMAX];
6112 struct stat s;
6113 char *tmp_pathspec = xstrdup (pathspec);
6114 char *p;
6115 int has_symlinks = 0;
6116 while (strlen (tmp_pathspec) && !has_symlinks)
6117 {
6118 lt_debugprintf (__FILE__, __LINE__,
6119 "checking path component for symlinks: %s\n",
6120 tmp_pathspec);
6121 if (lstat (tmp_pathspec, &s) == 0)
6122 {
6123 if (S_ISLNK (s.st_mode) != 0)
6124 {
6125 has_symlinks = 1;
6126 break;
6127 }
6128
6129 /* search backwards for last DIR_SEPARATOR */
6130 p = tmp_pathspec + strlen (tmp_pathspec) - 1;
6131 while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6132 p--;
6133 if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
6134 {
6135 /* no more DIR_SEPARATORS left */
6136 break;
6137 }
6138 *p = '\0';
6139 }
6140 else
6141 {
6142 lt_fatal (__FILE__, __LINE__,
6143 "error accessing file \"%s\": %s",
6144 tmp_pathspec, nonnull (strerror (errno)));
6145 }
6146 }
6147 XFREE (tmp_pathspec);
6148
6149 if (!has_symlinks)
6150 {
6151 return xstrdup (pathspec);
6152 }
6153
6154 tmp_pathspec = realpath (pathspec, buf);
6155 if (tmp_pathspec == 0)
6156 {
6157 lt_fatal (__FILE__, __LINE__,
6158 "could not follow symlinks for %s", pathspec);
6159 }
6160 return xstrdup (tmp_pathspec);
6161 #endif
6162 }
6163
6164 char *
6165 strendzap (char *str, const char *pat)
6166 {
6167 size_t len, patlen;
6168
6169 assert (str != NULL);
6170 assert (pat != NULL);
6171
6172 len = strlen (str);
6173 patlen = strlen (pat);
6174
6175 if (patlen <= len)
6176 {
6177 str += len - patlen;
6178 if (STREQ (str, pat))
6179 *str = '\0';
6180 }
6181 return str;
6182 }
6183
6184 void
6185 lt_debugprintf (const char *file, int line, const char *fmt, ...)
6186 {
6187 va_list args;
6188 if (lt_debug)
6189 {
6190 (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
6191 va_start (args, fmt);
6192 (void) vfprintf (stderr, fmt, args);
6193 va_end (args);
6194 }
6195 }
6196
6197 static void
6198 lt_error_core (int exit_status, const char *file,
6199 int line, const char *mode,
6200 const char *message, va_list ap)
6201 {
6202 fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
6203 vfprintf (stderr, message, ap);
6204 fprintf (stderr, ".\n");
6205
6206 if (exit_status >= 0)
6207 exit (exit_status);
6208 }
6209
6210 void
6211 lt_fatal (const char *file, int line, const char *message, ...)
6212 {
6213 va_list ap;
6214 va_start (ap, message);
6215 lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
6216 va_end (ap);
6217 }
6218
6219 static const char *
6220 nonnull (const char *s)
6221 {
6222 return s ? s : "(null)";
6223 }
6224
6225 static const char *
6226 nonempty (const char *s)
6227 {
6228 return (s && !*s) ? "(empty)" : nonnull (s);
6229 }
6230
6231 void
6232 lt_setenv (const char *name, const char *value)
6233 {
6234 lt_debugprintf (__FILE__, __LINE__,
6235 "(lt_setenv) setting '%s' to '%s'\n",
6236 nonnull (name), nonnull (value));
6237 {
6238 #ifdef HAVE_SETENV
6239 /* always make a copy, for consistency with !HAVE_SETENV */
6240 char *str = xstrdup (value);
6241 setenv (name, str, 1);
6242 #else
6243 size_t len = strlen (name) + 1 + strlen (value) + 1;
6244 char *str = XMALLOC (char, len);
6245 sprintf (str, "%s=%s", name, value);
6246 if (putenv (str) != EXIT_SUCCESS)
6247 {
6248 XFREE (str);
6249 }
6250 #endif
6251 }
6252 }
6253
6254 char *
6255 lt_extend_str (const char *orig_value, const char *add, int to_end)
6256 {
6257 char *new_value;
6258 if (orig_value && *orig_value)
6259 {
6260 size_t orig_value_len = strlen (orig_value);
6261 size_t add_len = strlen (add);
6262 new_value = XMALLOC (char, add_len + orig_value_len + 1);
6263 if (to_end)
6264 {
6265 strcpy (new_value, orig_value);
6266 strcpy (new_value + orig_value_len, add);
6267 }
6268 else
6269 {
6270 strcpy (new_value, add);
6271 strcpy (new_value + add_len, orig_value);
6272 }
6273 }
6274 else
6275 {
6276 new_value = xstrdup (add);
6277 }
6278 return new_value;
6279 }
6280
6281 void
6282 lt_update_exe_path (const char *name, const char *value)
6283 {
6284 lt_debugprintf (__FILE__, __LINE__,
6285 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
6286 nonnull (name), nonnull (value));
6287
6288 if (name && *name && value && *value)
6289 {
6290 char *new_value = lt_extend_str (getenv (name), value, 0);
6291 /* some systems can't cope with a ':'-terminated path #' */
6292 size_t len = strlen (new_value);
6293 while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
6294 {
6295 new_value[--len] = '\0';
6296 }
6297 lt_setenv (name, new_value);
6298 XFREE (new_value);
6299 }
6300 }
6301
6302 void
6303 lt_update_lib_path (const char *name, const char *value)
6304 {
6305 lt_debugprintf (__FILE__, __LINE__,
6306 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
6307 nonnull (name), nonnull (value));
6308
6309 if (name && *name && value && *value)
6310 {
6311 char *new_value = lt_extend_str (getenv (name), value, 0);
6312 lt_setenv (name, new_value);
6313 XFREE (new_value);
6314 }
6315 }
6316
6317 EOF
6318 case $host_os in
6319 mingw*)
6320 cat <<"EOF"
6321
6322 /* Prepares an argument vector before calling spawn().
6323 Note that spawn() does not by itself call the command interpreter
6324 (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
6325 ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
6326 GetVersionEx(&v);
6327 v.dwPlatformId == VER_PLATFORM_WIN32_NT;
6328 }) ? "cmd.exe" : "command.com").
6329 Instead it simply concatenates the arguments, separated by ' ', and calls
6330 CreateProcess(). We must quote the arguments since Win32 CreateProcess()
6331 interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
6332 special way:
6333 - Space and tab are interpreted as delimiters. They are not treated as
6334 delimiters if they are surrounded by double quotes: "...".
6335 - Unescaped double quotes are removed from the input. Their only effect is
6336 that within double quotes, space and tab are treated like normal
6337 characters.
6338 - Backslashes not followed by double quotes are not special.
6339 - But 2*n+1 backslashes followed by a double quote become
6340 n backslashes followed by a double quote (n >= 0):
6341 \" -> "
6342 \\\" -> \"
6343 \\\\\" -> \\"
6344 */
6345 #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
6346 #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
6347 char **
6348 prepare_spawn (char **argv)
6349 {
6350 size_t argc;
6351 char **new_argv;
6352 size_t i;
6353
6354 /* Count number of arguments. */
6355 for (argc = 0; argv[argc] != NULL; argc++)
6356 ;
6357
6358 /* Allocate new argument vector. */
6359 new_argv = XMALLOC (char *, argc + 1);
6360
6361 /* Put quoted arguments into the new argument vector. */
6362 for (i = 0; i < argc; i++)
6363 {
6364 const char *string = argv[i];
6365
6366 if (string[0] == '\0')
6367 new_argv[i] = xstrdup ("\"\"");
6368 else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
6369 {
6370 int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
6371 size_t length;
6372 unsigned int backslashes;
6373 const char *s;
6374 char *quoted_string;
6375 char *p;
6376
6377 length = 0;
6378 backslashes = 0;
6379 if (quote_around)
6380 length++;
6381 for (s = string; *s != '\0'; s++)
6382 {
6383 char c = *s;
6384 if (c == '"')
6385 length += backslashes + 1;
6386 length++;
6387 if (c == '\\')
6388 backslashes++;
6389 else
6390 backslashes = 0;
6391 }
6392 if (quote_around)
6393 length += backslashes + 1;
6394
6395 quoted_string = XMALLOC (char, length + 1);
6396
6397 p = quoted_string;
6398 backslashes = 0;
6399 if (quote_around)
6400 *p++ = '"';
6401 for (s = string; *s != '\0'; s++)
6402 {
6403 char c = *s;
6404 if (c == '"')
6405 {
6406 unsigned int j;
6407 for (j = backslashes + 1; j > 0; j--)
6408 *p++ = '\\';
6409 }
6410 *p++ = c;
6411 if (c == '\\')
6412 backslashes++;
6413 else
6414 backslashes = 0;
6415 }
6416 if (quote_around)
6417 {
6418 unsigned int j;
6419 for (j = backslashes; j > 0; j--)
6420 *p++ = '\\';
6421 *p++ = '"';
6422 }
6423 *p = '\0';
6424
6425 new_argv[i] = quoted_string;
6426 }
6427 else
6428 new_argv[i] = (char *) string;
6429 }
6430 new_argv[argc] = NULL;
6431
6432 return new_argv;
6433 }
6434 EOF
6435 ;;
6436 esac
6437
6438 cat <<"EOF"
6439 void lt_dump_script (FILE* f)
6440 {
6441 EOF
6442 func_emit_wrapper yes |
6443 $SED -n -e '
6444 s/^\(.\{79\}\)\(..*\)/\1\
6445 \2/
6446 h
6447 s/\([\\"]\)/\\\1/g
6448 s/$/\\n/
6449 s/\([^\n]*\).*/ fputs ("\1", f);/p
6450 g
6451 D'
6452 cat <<"EOF"
6453 }
6454 EOF
6455 }
6456 # end: func_emit_cwrapperexe_src
6457
6458 # func_win32_import_lib_p ARG
6459 # True if ARG is an import lib, as indicated by $file_magic_cmd
6460 func_win32_import_lib_p ()
6461 {
6462 $debug_cmd
6463
6464 case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
6465 *import*) : ;;
6466 *) false ;;
6467 esac
6468 }
6469
6470 # func_suncc_cstd_abi
6471 # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
6472 # Several compiler flags select an ABI that is incompatible with the
6473 # Cstd library. Avoid specifying it if any are in CXXFLAGS.
6474 func_suncc_cstd_abi ()
6475 {
6476 $debug_cmd
6477
6478 case " $compile_command " in
6479 *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
6480 suncc_use_cstd_abi=no
6481 ;;
6482 *)
6483 suncc_use_cstd_abi=yes
6484 ;;
6485 esac
6486 }
6487
6488 # func_mode_link arg...
6489 func_mode_link ()
6490 {
6491 $debug_cmd
6492
6493 case $host in
6494 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6495 # It is impossible to link a dll without this setting, and
6496 # we shouldn't force the makefile maintainer to figure out
6497 # what system we are compiling for in order to pass an extra
6498 # flag for every libtool invocation.
6499 # allow_undefined=no
6500
6501 # FIXME: Unfortunately, there are problems with the above when trying
6502 # to make a dll that has undefined symbols, in which case not
6503 # even a static library is built. For now, we need to specify
6504 # -no-undefined on the libtool link line when we can be certain
6505 # that all symbols are satisfied, otherwise we get a static library.
6506 allow_undefined=yes
6507 ;;
6508 *)
6509 allow_undefined=yes
6510 ;;
6511 esac
6512 libtool_args=$nonopt
6513 base_compile="$nonopt $@"
6514 compile_command=$nonopt
6515 finalize_command=$nonopt
6516
6517 compile_rpath=
6518 finalize_rpath=
6519 compile_shlibpath=
6520 finalize_shlibpath=
6521 convenience=
6522 old_convenience=
6523 deplibs=
6524 old_deplibs=
6525 compiler_flags=
6526 linker_flags=
6527 dllsearchpath=
6528 lib_search_path=`pwd`
6529 inst_prefix_dir=
6530 new_inherited_linker_flags=
6531
6532 avoid_version=no
6533 bindir=
6534 dlfiles=
6535 dlprefiles=
6536 dlself=no
6537 export_dynamic=no
6538 export_symbols=
6539 export_symbols_regex=
6540 generated=
6541 libobjs=
6542 ltlibs=
6543 module=no
6544 no_install=no
6545 objs=
6546 os2dllname=
6547 non_pic_objects=
6548 precious_files_regex=
6549 prefer_static_libs=no
6550 preload=false
6551 prev=
6552 prevarg=
6553 release=
6554 rpath=
6555 xrpath=
6556 perm_rpath=
6557 temp_rpath=
6558 thread_safe=no
6559 vinfo=
6560 vinfo_number=no
6561 weak_libs=
6562 single_module=$wl-single_module
6563 func_infer_tag $base_compile
6564
6565 # We need to know -static, to get the right output filenames.
6566 for arg
6567 do
6568 case $arg in
6569 -shared)
6570 test yes != "$build_libtool_libs" \
6571 && func_fatal_configuration "cannot build a shared library"
6572 build_old_libs=no
6573 break
6574 ;;
6575 -all-static | -static | -static-libtool-libs)
6576 case $arg in
6577 -all-static)
6578 if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
6579 func_warning "complete static linking is impossible in this configuration"
6580 fi
6581 if test -n "$link_static_flag"; then
6582 dlopen_self=$dlopen_self_static
6583 fi
6584 prefer_static_libs=yes
6585 ;;
6586 -static)
6587 if test -z "$pic_flag" && test -n "$link_static_flag"; then
6588 dlopen_self=$dlopen_self_static
6589 fi
6590 prefer_static_libs=built
6591 ;;
6592 -static-libtool-libs)
6593 if test -z "$pic_flag" && test -n "$link_static_flag"; then
6594 dlopen_self=$dlopen_self_static
6595 fi
6596 prefer_static_libs=yes
6597 ;;
6598 esac
6599 build_libtool_libs=no
6600 build_old_libs=yes
6601 break
6602 ;;
6603 esac
6604 done
6605
6606 # See if our shared archives depend on static archives.
6607 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
6608
6609 # Go through the arguments, transforming them on the way.
6610 while test "$#" -gt 0; do
6611 arg=$1
6612 shift
6613 func_quote_for_eval "$arg"
6614 qarg=$func_quote_for_eval_unquoted_result
6615 func_append libtool_args " $func_quote_for_eval_result"
6616
6617 # If the previous option needs an argument, assign it.
6618 if test -n "$prev"; then
6619 case $prev in
6620 output)
6621 func_append compile_command " @OUTPUT@"
6622 func_append finalize_command " @OUTPUT@"
6623 ;;
6624 esac
6625
6626 case $prev in
6627 bindir)
6628 bindir=$arg
6629 prev=
6630 continue
6631 ;;
6632 dlfiles|dlprefiles)
6633 $preload || {
6634 # Add the symbol object into the linking commands.
6635 func_append compile_command " @SYMFILE@"
6636 func_append finalize_command " @SYMFILE@"
6637 preload=:
6638 }
6639 case $arg in
6640 *.la | *.lo) ;; # We handle these cases below.
6641 force)
6642 if test no = "$dlself"; then
6643 dlself=needless
6644 export_dynamic=yes
6645 fi
6646 prev=
6647 continue
6648 ;;
6649 self)
6650 if test dlprefiles = "$prev"; then
6651 dlself=yes
6652 elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
6653 dlself=yes
6654 else
6655 dlself=needless
6656 export_dynamic=yes
6657 fi
6658 prev=
6659 continue
6660 ;;
6661 *)
6662 if test dlfiles = "$prev"; then
6663 func_append dlfiles " $arg"
6664 else
6665 func_append dlprefiles " $arg"
6666 fi
6667 prev=
6668 continue
6669 ;;
6670 esac
6671 ;;
6672 expsyms)
6673 export_symbols=$arg
6674 test -f "$arg" \
6675 || func_fatal_error "symbol file '$arg' does not exist"
6676 prev=
6677 continue
6678 ;;
6679 expsyms_regex)
6680 export_symbols_regex=$arg
6681 prev=
6682 continue
6683 ;;
6684 framework)
6685 case $host in
6686 *-*-darwin*)
6687 case "$deplibs " in
6688 *" $qarg.ltframework "*) ;;
6689 *) func_append deplibs " $qarg.ltframework" # this is fixed later
6690 ;;
6691 esac
6692 ;;
6693 esac
6694 prev=
6695 continue
6696 ;;
6697 inst_prefix)
6698 inst_prefix_dir=$arg
6699 prev=
6700 continue
6701 ;;
6702 mllvm)
6703 # Clang does not use LLVM to link, so we can simply discard any
6704 # '-mllvm $arg' options when doing the link step.
6705 prev=
6706 continue
6707 ;;
6708 objectlist)
6709 if test -f "$arg"; then
6710 save_arg=$arg
6711 moreargs=
6712 for fil in `cat "$save_arg"`
6713 do
6714 # func_append moreargs " $fil"
6715 arg=$fil
6716 # A libtool-controlled object.
6717
6718 # Check to see that this really is a libtool object.
6719 if func_lalib_unsafe_p "$arg"; then
6720 pic_object=
6721 non_pic_object=
6722
6723 # Read the .lo file
6724 func_source "$arg"
6725
6726 if test -z "$pic_object" ||
6727 test -z "$non_pic_object" ||
6728 test none = "$pic_object" &&
6729 test none = "$non_pic_object"; then
6730 func_fatal_error "cannot find name of object for '$arg'"
6731 fi
6732
6733 # Extract subdirectory from the argument.
6734 func_dirname "$arg" "/" ""
6735 xdir=$func_dirname_result
6736
6737 if test none != "$pic_object"; then
6738 # Prepend the subdirectory the object is found in.
6739 pic_object=$xdir$pic_object
6740
6741 if test dlfiles = "$prev"; then
6742 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
6743 func_append dlfiles " $pic_object"
6744 prev=
6745 continue
6746 else
6747 # If libtool objects are unsupported, then we need to preload.
6748 prev=dlprefiles
6749 fi
6750 fi
6751
6752 # CHECK ME: I think I busted this. -Ossama
6753 if test dlprefiles = "$prev"; then
6754 # Preload the old-style object.
6755 func_append dlprefiles " $pic_object"
6756 prev=
6757 fi
6758
6759 # A PIC object.
6760 func_append libobjs " $pic_object"
6761 arg=$pic_object
6762 fi
6763
6764 # Non-PIC object.
6765 if test none != "$non_pic_object"; then
6766 # Prepend the subdirectory the object is found in.
6767 non_pic_object=$xdir$non_pic_object
6768
6769 # A standard non-PIC object
6770 func_append non_pic_objects " $non_pic_object"
6771 if test -z "$pic_object" || test none = "$pic_object"; then
6772 arg=$non_pic_object
6773 fi
6774 else
6775 # If the PIC object exists, use it instead.
6776 # $xdir was prepended to $pic_object above.
6777 non_pic_object=$pic_object
6778 func_append non_pic_objects " $non_pic_object"
6779 fi
6780 else
6781 # Only an error if not doing a dry-run.
6782 if $opt_dry_run; then
6783 # Extract subdirectory from the argument.
6784 func_dirname "$arg" "/" ""
6785 xdir=$func_dirname_result
6786
6787 func_lo2o "$arg"
6788 pic_object=$xdir$objdir/$func_lo2o_result
6789 non_pic_object=$xdir$func_lo2o_result
6790 func_append libobjs " $pic_object"
6791 func_append non_pic_objects " $non_pic_object"
6792 else
6793 func_fatal_error "'$arg' is not a valid libtool object"
6794 fi
6795 fi
6796 done
6797 else
6798 func_fatal_error "link input file '$arg' does not exist"
6799 fi
6800 arg=$save_arg
6801 prev=
6802 continue
6803 ;;
6804 os2dllname)
6805 os2dllname=$arg
6806 prev=
6807 continue
6808 ;;
6809 precious_regex)
6810 precious_files_regex=$arg
6811 prev=
6812 continue
6813 ;;
6814 release)
6815 release=-$arg
6816 prev=
6817 continue
6818 ;;
6819 rpath | xrpath)
6820 # We need an absolute path.
6821 case $arg in
6822 [\\/]* | [A-Za-z]:[\\/]*) ;;
6823 *)
6824 func_fatal_error "only absolute run-paths are allowed"
6825 ;;
6826 esac
6827 if test rpath = "$prev"; then
6828 case "$rpath " in
6829 *" $arg "*) ;;
6830 *) func_append rpath " $arg" ;;
6831 esac
6832 else
6833 case "$xrpath " in
6834 *" $arg "*) ;;
6835 *) func_append xrpath " $arg" ;;
6836 esac
6837 fi
6838 prev=
6839 continue
6840 ;;
6841 shrext)
6842 shrext_cmds=$arg
6843 prev=
6844 continue
6845 ;;
6846 weak)
6847 func_append weak_libs " $arg"
6848 prev=
6849 continue
6850 ;;
6851 xcclinker)
6852 func_append linker_flags " $qarg"
6853 func_append compiler_flags " $qarg"
6854 prev=
6855 func_append compile_command " $qarg"
6856 func_append finalize_command " $qarg"
6857 continue
6858 ;;
6859 xcompiler)
6860 func_append compiler_flags " $qarg"
6861 prev=
6862 func_append compile_command " $qarg"
6863 func_append finalize_command " $qarg"
6864 continue
6865 ;;
6866 xlinker)
6867 func_append linker_flags " $qarg"
6868 func_append compiler_flags " $wl$qarg"
6869 prev=
6870 func_append compile_command " $wl$qarg"
6871 func_append finalize_command " $wl$qarg"
6872 continue
6873 ;;
6874 *)
6875 eval "$prev=\"\$arg\""
6876 prev=
6877 continue
6878 ;;
6879 esac
6880 fi # test -n "$prev"
6881
6882 prevarg=$arg
6883
6884 case $arg in
6885 -all-static)
6886 if test -n "$link_static_flag"; then
6887 # See comment for -static flag below, for more details.
6888 func_append compile_command " $link_static_flag"
6889 func_append finalize_command " $link_static_flag"
6890 fi
6891 continue
6892 ;;
6893
6894 -allow-undefined)
6895 # FIXME: remove this flag sometime in the future.
6896 func_fatal_error "'-allow-undefined' must not be used because it is the default"
6897 ;;
6898
6899 -avoid-version)
6900 avoid_version=yes
6901 continue
6902 ;;
6903
6904 -bindir)
6905 prev=bindir
6906 continue
6907 ;;
6908
6909 -dlopen)
6910 prev=dlfiles
6911 continue
6912 ;;
6913
6914 -dlpreopen)
6915 prev=dlprefiles
6916 continue
6917 ;;
6918
6919 -export-dynamic)
6920 export_dynamic=yes
6921 continue
6922 ;;
6923
6924 -export-symbols | -export-symbols-regex)
6925 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
6926 func_fatal_error "more than one -exported-symbols argument is not allowed"
6927 fi
6928 if test X-export-symbols = "X$arg"; then
6929 prev=expsyms
6930 else
6931 prev=expsyms_regex
6932 fi
6933 continue
6934 ;;
6935
6936 -framework)
6937 prev=framework
6938 continue
6939 ;;
6940
6941 -inst-prefix-dir)
6942 prev=inst_prefix
6943 continue
6944 ;;
6945
6946 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
6947 # so, if we see these flags be careful not to treat them like -L
6948 -L[A-Z][A-Z]*:*)
6949 case $with_gcc/$host in
6950 no/*-*-irix* | /*-*-irix*)
6951 func_append compile_command " $arg"
6952 func_append finalize_command " $arg"
6953 ;;
6954 esac
6955 continue
6956 ;;
6957
6958 -L*)
6959 func_stripname "-L" '' "$arg"
6960 if test -z "$func_stripname_result"; then
6961 if test "$#" -gt 0; then
6962 func_fatal_error "require no space between '-L' and '$1'"
6963 else
6964 func_fatal_error "need path for '-L' option"
6965 fi
6966 fi
6967 func_resolve_sysroot "$func_stripname_result"
6968 dir=$func_resolve_sysroot_result
6969 # We need an absolute path.
6970 case $dir in
6971 [\\/]* | [A-Za-z]:[\\/]*) ;;
6972 *)
6973 absdir=`cd "$dir" && pwd`
6974 test -z "$absdir" && \
6975 func_fatal_error "cannot determine absolute directory name of '$dir'"
6976 dir=$absdir
6977 ;;
6978 esac
6979 case "$deplibs " in
6980 *" -L$dir "* | *" $arg "*)
6981 # Will only happen for absolute or sysroot arguments
6982 ;;
6983 *)
6984 # Preserve sysroot, but never include relative directories
6985 case $dir in
6986 [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
6987 *) func_append deplibs " -L$dir" ;;
6988 esac
6989 func_append lib_search_path " $dir"
6990 ;;
6991 esac
6992 case $host in
6993 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
6994 testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
6995 case :$dllsearchpath: in
6996 *":$dir:"*) ;;
6997 ::) dllsearchpath=$dir;;
6998 *) func_append dllsearchpath ":$dir";;
6999 esac
7000 case :$dllsearchpath: in
7001 *":$testbindir:"*) ;;
7002 ::) dllsearchpath=$testbindir;;
7003 *) func_append dllsearchpath ":$testbindir";;
7004 esac
7005 ;;
7006 esac
7007 continue
7008 ;;
7009
7010 -l*)
7011 if test X-lc = "X$arg" || test X-lm = "X$arg"; then
7012 case $host in
7013 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
7014 # These systems don't actually have a C or math library (as such)
7015 continue
7016 ;;
7017 *-*-os2*)
7018 # These systems don't actually have a C library (as such)
7019 test X-lc = "X$arg" && continue
7020 ;;
7021 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7022 # Do not include libc due to us having libc/libc_r.
7023 test X-lc = "X$arg" && continue
7024 ;;
7025 *-*-rhapsody* | *-*-darwin1.[012])
7026 # Rhapsody C and math libraries are in the System framework
7027 func_append deplibs " System.ltframework"
7028 continue
7029 ;;
7030 *-*-sco3.2v5* | *-*-sco5v6*)
7031 # Causes problems with __ctype
7032 test X-lc = "X$arg" && continue
7033 ;;
7034 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
7035 # Compiler inserts libc in the correct place for threads to work
7036 test X-lc = "X$arg" && continue
7037 ;;
7038 esac
7039 elif test X-lc_r = "X$arg"; then
7040 case $host in
7041 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7042 # Do not include libc_r directly, use -pthread flag.
7043 continue
7044 ;;
7045 esac
7046 fi
7047 func_append deplibs " $arg"
7048 continue
7049 ;;
7050
7051 -mllvm)
7052 prev=mllvm
7053 continue
7054 ;;
7055
7056 -module)
7057 module=yes
7058 continue
7059 ;;
7060
7061 # Tru64 UNIX uses -model [arg] to determine the layout of C++
7062 # classes, name mangling, and exception handling.
7063 # Darwin uses the -arch flag to determine output architecture.
7064 -model|-arch|-isysroot|--sysroot)
7065 func_append compiler_flags " $arg"
7066 func_append compile_command " $arg"
7067 func_append finalize_command " $arg"
7068 prev=xcompiler
7069 continue
7070 ;;
7071
7072 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7073 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7074 func_append compiler_flags " $arg"
7075 func_append compile_command " $arg"
7076 func_append finalize_command " $arg"
7077 case "$new_inherited_linker_flags " in
7078 *" $arg "*) ;;
7079 * ) func_append new_inherited_linker_flags " $arg" ;;
7080 esac
7081 continue
7082 ;;
7083
7084 -multi_module)
7085 single_module=$wl-multi_module
7086 continue
7087 ;;
7088
7089 -no-fast-install)
7090 fast_install=no
7091 continue
7092 ;;
7093
7094 -no-install)
7095 case $host in
7096 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
7097 # The PATH hackery in wrapper scripts is required on Windows
7098 # and Darwin in order for the loader to find any dlls it needs.
7099 func_warning "'-no-install' is ignored for $host"
7100 func_warning "assuming '-no-fast-install' instead"
7101 fast_install=no
7102 ;;
7103 *) no_install=yes ;;
7104 esac
7105 continue
7106 ;;
7107
7108 -no-undefined)
7109 allow_undefined=no
7110 continue
7111 ;;
7112
7113 -objectlist)
7114 prev=objectlist
7115 continue
7116 ;;
7117
7118 -os2dllname)
7119 prev=os2dllname
7120 continue
7121 ;;
7122
7123 -o) prev=output ;;
7124
7125 -precious-files-regex)
7126 prev=precious_regex
7127 continue
7128 ;;
7129
7130 -release)
7131 prev=release
7132 continue
7133 ;;
7134
7135 -rpath)
7136 prev=rpath
7137 continue
7138 ;;
7139
7140 -R)
7141 prev=xrpath
7142 continue
7143 ;;
7144
7145 -R*)
7146 func_stripname '-R' '' "$arg"
7147 dir=$func_stripname_result
7148 # We need an absolute path.
7149 case $dir in
7150 [\\/]* | [A-Za-z]:[\\/]*) ;;
7151 =*)
7152 func_stripname '=' '' "$dir"
7153 dir=$lt_sysroot$func_stripname_result
7154 ;;
7155 *)
7156 func_fatal_error "only absolute run-paths are allowed"
7157 ;;
7158 esac
7159 case "$xrpath " in
7160 *" $dir "*) ;;
7161 *) func_append xrpath " $dir" ;;
7162 esac
7163 continue
7164 ;;
7165
7166 -shared)
7167 # The effects of -shared are defined in a previous loop.
7168 continue
7169 ;;
7170
7171 -shrext)
7172 prev=shrext
7173 continue
7174 ;;
7175
7176 -static | -static-libtool-libs)
7177 # The effects of -static are defined in a previous loop.
7178 # We used to do the same as -all-static on platforms that
7179 # didn't have a PIC flag, but the assumption that the effects
7180 # would be equivalent was wrong. It would break on at least
7181 # Digital Unix and AIX.
7182 continue
7183 ;;
7184
7185 -thread-safe)
7186 thread_safe=yes
7187 continue
7188 ;;
7189
7190 -version-info)
7191 prev=vinfo
7192 continue
7193 ;;
7194
7195 -version-number)
7196 prev=vinfo
7197 vinfo_number=yes
7198 continue
7199 ;;
7200
7201 -weak)
7202 prev=weak
7203 continue
7204 ;;
7205
7206 -Wc,*)
7207 func_stripname '-Wc,' '' "$arg"
7208 args=$func_stripname_result
7209 arg=
7210 save_ifs=$IFS; IFS=,
7211 for flag in $args; do
7212 IFS=$save_ifs
7213 func_quote_for_eval "$flag"
7214 func_append arg " $func_quote_for_eval_result"
7215 func_append compiler_flags " $func_quote_for_eval_result"
7216 done
7217 IFS=$save_ifs
7218 func_stripname ' ' '' "$arg"
7219 arg=$func_stripname_result
7220 ;;
7221
7222 -Wl,*)
7223 func_stripname '-Wl,' '' "$arg"
7224 args=$func_stripname_result
7225 arg=
7226 save_ifs=$IFS; IFS=,
7227 for flag in $args; do
7228 IFS=$save_ifs
7229 func_quote_for_eval "$flag"
7230 func_append arg " $wl$func_quote_for_eval_result"
7231 func_append compiler_flags " $wl$func_quote_for_eval_result"
7232 func_append linker_flags " $func_quote_for_eval_result"
7233 done
7234 IFS=$save_ifs
7235 func_stripname ' ' '' "$arg"
7236 arg=$func_stripname_result
7237 ;;
7238
7239 -Xcompiler)
7240 prev=xcompiler
7241 continue
7242 ;;
7243
7244 -Xlinker)
7245 prev=xlinker
7246 continue
7247 ;;
7248
7249 -XCClinker)
7250 prev=xcclinker
7251 continue
7252 ;;
7253
7254 # -msg_* for osf cc
7255 -msg_*)
7256 func_quote_for_eval "$arg"
7257 arg=$func_quote_for_eval_result
7258 ;;
7259
7260 # Flags to be passed through unchanged, with rationale:
7261 # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
7262 # -r[0-9][0-9]* specify processor for the SGI compiler
7263 # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
7264 # +DA*, +DD* enable 64-bit mode for the HP compiler
7265 # -q* compiler args for the IBM compiler
7266 # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
7267 # -F/path path to uninstalled frameworks, gcc on darwin
7268 # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
7269 # -fstack-protector* stack protector flags for GCC
7270 # @file GCC response files
7271 # -tp=* Portland pgcc target processor selection
7272 # --sysroot=* for sysroot support
7273 # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
7274 # -stdlib=* select c++ std lib with clang
7275 # -fsanitize=* Clang memory and address sanitizer
7276 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7277 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7278 -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
7279 -fsanitize=*)
7280 func_quote_for_eval "$arg"
7281 arg=$func_quote_for_eval_result
7282 func_append compile_command " $arg"
7283 func_append finalize_command " $arg"
7284 func_append compiler_flags " $arg"
7285 continue
7286 ;;
7287
7288 -Z*)
7289 if test os2 = "`expr $host : '.*\(os2\)'`"; then
7290 # OS/2 uses -Zxxx to specify OS/2-specific options
7291 compiler_flags="$compiler_flags $arg"
7292 func_append compile_command " $arg"
7293 func_append finalize_command " $arg"
7294 case $arg in
7295 -Zlinker | -Zstack)
7296 prev=xcompiler
7297 ;;
7298 esac
7299 continue
7300 else
7301 # Otherwise treat like 'Some other compiler flag' below
7302 func_quote_for_eval "$arg"
7303 arg=$func_quote_for_eval_result
7304 fi
7305 ;;
7306
7307 # Some other compiler flag.
7308 -* | +*)
7309 func_quote_for_eval "$arg"
7310 arg=$func_quote_for_eval_result
7311 ;;
7312
7313 *.$objext)
7314 # A standard object.
7315 func_append objs " $arg"
7316 ;;
7317
7318 *.lo)
7319 # A libtool-controlled object.
7320
7321 # Check to see that this really is a libtool object.
7322 if func_lalib_unsafe_p "$arg"; then
7323 pic_object=
7324 non_pic_object=
7325
7326 # Read the .lo file
7327 func_source "$arg"
7328
7329 if test -z "$pic_object" ||
7330 test -z "$non_pic_object" ||
7331 test none = "$pic_object" &&
7332 test none = "$non_pic_object"; then
7333 func_fatal_error "cannot find name of object for '$arg'"
7334 fi
7335
7336 # Extract subdirectory from the argument.
7337 func_dirname "$arg" "/" ""
7338 xdir=$func_dirname_result
7339
7340 test none = "$pic_object" || {
7341 # Prepend the subdirectory the object is found in.
7342 pic_object=$xdir$pic_object
7343
7344 if test dlfiles = "$prev"; then
7345 if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
7346 func_append dlfiles " $pic_object"
7347 prev=
7348 continue
7349 else
7350 # If libtool objects are unsupported, then we need to preload.
7351 prev=dlprefiles
7352 fi
7353 fi
7354
7355 # CHECK ME: I think I busted this. -Ossama
7356 if test dlprefiles = "$prev"; then
7357 # Preload the old-style object.
7358 func_append dlprefiles " $pic_object"
7359 prev=
7360 fi
7361
7362 # A PIC object.
7363 func_append libobjs " $pic_object"
7364 arg=$pic_object
7365 }
7366
7367 # Non-PIC object.
7368 if test none != "$non_pic_object"; then
7369 # Prepend the subdirectory the object is found in.
7370 non_pic_object=$xdir$non_pic_object
7371
7372 # A standard non-PIC object
7373 func_append non_pic_objects " $non_pic_object"
7374 if test -z "$pic_object" || test none = "$pic_object"; then
7375 arg=$non_pic_object
7376 fi
7377 else
7378 # If the PIC object exists, use it instead.
7379 # $xdir was prepended to $pic_object above.
7380 non_pic_object=$pic_object
7381 func_append non_pic_objects " $non_pic_object"
7382 fi
7383 else
7384 # Only an error if not doing a dry-run.
7385 if $opt_dry_run; then
7386 # Extract subdirectory from the argument.
7387 func_dirname "$arg" "/" ""
7388 xdir=$func_dirname_result
7389
7390 func_lo2o "$arg"
7391 pic_object=$xdir$objdir/$func_lo2o_result
7392 non_pic_object=$xdir$func_lo2o_result
7393 func_append libobjs " $pic_object"
7394 func_append non_pic_objects " $non_pic_object"
7395 else
7396 func_fatal_error "'$arg' is not a valid libtool object"
7397 fi
7398 fi
7399 ;;
7400
7401 *.$libext)
7402 # An archive.
7403 func_append deplibs " $arg"
7404 func_append old_deplibs " $arg"
7405 continue
7406 ;;
7407
7408 *.la)
7409 # A libtool-controlled library.
7410
7411 func_resolve_sysroot "$arg"
7412 if test dlfiles = "$prev"; then
7413 # This library was specified with -dlopen.
7414 func_append dlfiles " $func_resolve_sysroot_result"
7415 prev=
7416 elif test dlprefiles = "$prev"; then
7417 # The library was specified with -dlpreopen.
7418 func_append dlprefiles " $func_resolve_sysroot_result"
7419 prev=
7420 else
7421 func_append deplibs " $func_resolve_sysroot_result"
7422 fi
7423 continue
7424 ;;
7425
7426 # Some other compiler argument.
7427 *)
7428 # Unknown arguments in both finalize_command and compile_command need
7429 # to be aesthetically quoted because they are evaled later.
7430 func_quote_for_eval "$arg"
7431 arg=$func_quote_for_eval_result
7432 ;;
7433 esac # arg
7434
7435 # Now actually substitute the argument into the commands.
7436 if test -n "$arg"; then
7437 func_append compile_command " $arg"
7438 func_append finalize_command " $arg"
7439 fi
7440 done # argument parsing loop
7441
7442 test -n "$prev" && \
7443 func_fatal_help "the '$prevarg' option requires an argument"
7444
7445 if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
7446 eval arg=\"$export_dynamic_flag_spec\"
7447 func_append compile_command " $arg"
7448 func_append finalize_command " $arg"
7449 fi
7450
7451 oldlibs=
7452 # calculate the name of the file, without its directory
7453 func_basename "$output"
7454 outputname=$func_basename_result
7455 libobjs_save=$libobjs
7456
7457 if test -n "$shlibpath_var"; then
7458 # get the directories listed in $shlibpath_var
7459 eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
7460 else
7461 shlib_search_path=
7462 fi
7463 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
7464 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
7465
7466 # Definition is injected by LT_CONFIG during libtool generation.
7467 func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
7468
7469 func_dirname "$output" "/" ""
7470 output_objdir=$func_dirname_result$objdir
7471 func_to_tool_file "$output_objdir/"
7472 tool_output_objdir=$func_to_tool_file_result
7473 # Create the object directory.
7474 func_mkdir_p "$output_objdir"
7475
7476 # Determine the type of output
7477 case $output in
7478 "")
7479 func_fatal_help "you must specify an output file"
7480 ;;
7481 *.$libext) linkmode=oldlib ;;
7482 *.lo | *.$objext) linkmode=obj ;;
7483 *.la) linkmode=lib ;;
7484 *) linkmode=prog ;; # Anything else should be a program.
7485 esac
7486
7487 specialdeplibs=
7488
7489 libs=
7490 # Find all interdependent deplibs by searching for libraries
7491 # that are linked more than once (e.g. -la -lb -la)
7492 for deplib in $deplibs; do
7493 if $opt_preserve_dup_deps; then
7494 case "$libs " in
7495 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7496 esac
7497 fi
7498 func_append libs " $deplib"
7499 done
7500
7501 if test lib = "$linkmode"; then
7502 libs="$predeps $libs $compiler_lib_search_path $postdeps"
7503
7504 # Compute libraries that are listed more than once in $predeps
7505 # $postdeps and mark them as special (i.e., whose duplicates are
7506 # not to be eliminated).
7507 pre_post_deps=
7508 if $opt_duplicate_compiler_generated_deps; then
7509 for pre_post_dep in $predeps $postdeps; do
7510 case "$pre_post_deps " in
7511 *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
7512 esac
7513 func_append pre_post_deps " $pre_post_dep"
7514 done
7515 fi
7516 pre_post_deps=
7517 fi
7518
7519 deplibs=
7520 newdependency_libs=
7521 newlib_search_path=
7522 need_relink=no # whether we're linking any uninstalled libtool libraries
7523 notinst_deplibs= # not-installed libtool libraries
7524 notinst_path= # paths that contain not-installed libtool libraries
7525
7526 case $linkmode in
7527 lib)
7528 passes="conv dlpreopen link"
7529 for file in $dlfiles $dlprefiles; do
7530 case $file in
7531 *.la) ;;
7532 *)
7533 func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
7534 ;;
7535 esac
7536 done
7537 ;;
7538 prog)
7539 compile_deplibs=
7540 finalize_deplibs=
7541 alldeplibs=false
7542 newdlfiles=
7543 newdlprefiles=
7544 passes="conv scan dlopen dlpreopen link"
7545 ;;
7546 *) passes="conv"
7547 ;;
7548 esac
7549
7550 for pass in $passes; do
7551 # The preopen pass in lib mode reverses $deplibs; put it back here
7552 # so that -L comes before libs that need it for instance...
7553 if test lib,link = "$linkmode,$pass"; then
7554 ## FIXME: Find the place where the list is rebuilt in the wrong
7555 ## order, and fix it there properly
7556 tmp_deplibs=
7557 for deplib in $deplibs; do
7558 tmp_deplibs="$deplib $tmp_deplibs"
7559 done
7560 deplibs=$tmp_deplibs
7561 fi
7562
7563 if test lib,link = "$linkmode,$pass" ||
7564 test prog,scan = "$linkmode,$pass"; then
7565 libs=$deplibs
7566 deplibs=
7567 fi
7568 if test prog = "$linkmode"; then
7569 case $pass in
7570 dlopen) libs=$dlfiles ;;
7571 dlpreopen) libs=$dlprefiles ;;
7572 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
7573 esac
7574 fi
7575 if test lib,dlpreopen = "$linkmode,$pass"; then
7576 # Collect and forward deplibs of preopened libtool libs
7577 for lib in $dlprefiles; do
7578 # Ignore non-libtool-libs
7579 dependency_libs=
7580 func_resolve_sysroot "$lib"
7581 case $lib in
7582 *.la) func_source "$func_resolve_sysroot_result" ;;
7583 esac
7584
7585 # Collect preopened libtool deplibs, except any this library
7586 # has declared as weak libs
7587 for deplib in $dependency_libs; do
7588 func_basename "$deplib"
7589 deplib_base=$func_basename_result
7590 case " $weak_libs " in
7591 *" $deplib_base "*) ;;
7592 *) func_append deplibs " $deplib" ;;
7593 esac
7594 done
7595 done
7596 libs=$dlprefiles
7597 fi
7598 if test dlopen = "$pass"; then
7599 # Collect dlpreopened libraries
7600 save_deplibs=$deplibs
7601 deplibs=
7602 fi
7603
7604 for deplib in $libs; do
7605 lib=
7606 found=false
7607 case $deplib in
7608 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7609 |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7610 if test prog,link = "$linkmode,$pass"; then
7611 compile_deplibs="$deplib $compile_deplibs"
7612 finalize_deplibs="$deplib $finalize_deplibs"
7613 else
7614 func_append compiler_flags " $deplib"
7615 if test lib = "$linkmode"; then
7616 case "$new_inherited_linker_flags " in
7617 *" $deplib "*) ;;
7618 * ) func_append new_inherited_linker_flags " $deplib" ;;
7619 esac
7620 fi
7621 fi
7622 continue
7623 ;;
7624 -l*)
7625 if test lib != "$linkmode" && test prog != "$linkmode"; then
7626 func_warning "'-l' is ignored for archives/objects"
7627 continue
7628 fi
7629 func_stripname '-l' '' "$deplib"
7630 name=$func_stripname_result
7631 if test lib = "$linkmode"; then
7632 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
7633 else
7634 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
7635 fi
7636 for searchdir in $searchdirs; do
7637 for search_ext in .la $std_shrext .so .a; do
7638 # Search the libtool library
7639 lib=$searchdir/lib$name$search_ext
7640 if test -f "$lib"; then
7641 if test .la = "$search_ext"; then
7642 found=:
7643 else
7644 found=false
7645 fi
7646 break 2
7647 fi
7648 done
7649 done
7650 if $found; then
7651 # deplib is a libtool library
7652 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
7653 # We need to do some special things here, and not later.
7654 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
7655 case " $predeps $postdeps " in
7656 *" $deplib "*)
7657 if func_lalib_p "$lib"; then
7658 library_names=
7659 old_library=
7660 func_source "$lib"
7661 for l in $old_library $library_names; do
7662 ll=$l
7663 done
7664 if test "X$ll" = "X$old_library"; then # only static version available
7665 found=false
7666 func_dirname "$lib" "" "."
7667 ladir=$func_dirname_result
7668 lib=$ladir/$old_library
7669 if test prog,link = "$linkmode,$pass"; then
7670 compile_deplibs="$deplib $compile_deplibs"
7671 finalize_deplibs="$deplib $finalize_deplibs"
7672 else
7673 deplibs="$deplib $deplibs"
7674 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7675 fi
7676 continue
7677 fi
7678 fi
7679 ;;
7680 *) ;;
7681 esac
7682 fi
7683 else
7684 # deplib doesn't seem to be a libtool library
7685 if test prog,link = "$linkmode,$pass"; then
7686 compile_deplibs="$deplib $compile_deplibs"
7687 finalize_deplibs="$deplib $finalize_deplibs"
7688 else
7689 deplibs="$deplib $deplibs"
7690 test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
7691 fi
7692 continue
7693 fi
7694 ;; # -l
7695 *.ltframework)
7696 if test prog,link = "$linkmode,$pass"; then
7697 compile_deplibs="$deplib $compile_deplibs"
7698 finalize_deplibs="$deplib $finalize_deplibs"
7699 else
7700 deplibs="$deplib $deplibs"
7701 if test lib = "$linkmode"; then
7702 case "$new_inherited_linker_flags " in
7703 *" $deplib "*) ;;
7704 * ) func_append new_inherited_linker_flags " $deplib" ;;
7705 esac
7706 fi
7707 fi
7708 continue
7709 ;;
7710 -L*)
7711 case $linkmode in
7712 lib)
7713 deplibs="$deplib $deplibs"
7714 test conv = "$pass" && continue
7715 newdependency_libs="$deplib $newdependency_libs"
7716 func_stripname '-L' '' "$deplib"
7717 func_resolve_sysroot "$func_stripname_result"
7718 func_append newlib_search_path " $func_resolve_sysroot_result"
7719 ;;
7720 prog)
7721 if test conv = "$pass"; then
7722 deplibs="$deplib $deplibs"
7723 continue
7724 fi
7725 if test scan = "$pass"; then
7726 deplibs="$deplib $deplibs"
7727 else
7728 compile_deplibs="$deplib $compile_deplibs"
7729 finalize_deplibs="$deplib $finalize_deplibs"
7730 fi
7731 func_stripname '-L' '' "$deplib"
7732 func_resolve_sysroot "$func_stripname_result"
7733 func_append newlib_search_path " $func_resolve_sysroot_result"
7734 ;;
7735 *)
7736 func_warning "'-L' is ignored for archives/objects"
7737 ;;
7738 esac # linkmode
7739 continue
7740 ;; # -L
7741 -R*)
7742 if test link = "$pass"; then
7743 func_stripname '-R' '' "$deplib"
7744 func_resolve_sysroot "$func_stripname_result"
7745 dir=$func_resolve_sysroot_result
7746 # Make sure the xrpath contains only unique directories.
7747 case "$xrpath " in
7748 *" $dir "*) ;;
7749 *) func_append xrpath " $dir" ;;
7750 esac
7751 fi
7752 deplibs="$deplib $deplibs"
7753 continue
7754 ;;
7755 *.la)
7756 func_resolve_sysroot "$deplib"
7757 lib=$func_resolve_sysroot_result
7758 ;;
7759 *.$libext)
7760 if test conv = "$pass"; then
7761 deplibs="$deplib $deplibs"
7762 continue
7763 fi
7764 case $linkmode in
7765 lib)
7766 # Linking convenience modules into shared libraries is allowed,
7767 # but linking other static libraries is non-portable.
7768 case " $dlpreconveniencelibs " in
7769 *" $deplib "*) ;;
7770 *)
7771 valid_a_lib=false
7772 case $deplibs_check_method in
7773 match_pattern*)
7774 set dummy $deplibs_check_method; shift
7775 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
7776 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
7777 | $EGREP "$match_pattern_regex" > /dev/null; then
7778 valid_a_lib=:
7779 fi
7780 ;;
7781 pass_all)
7782 valid_a_lib=:
7783 ;;
7784 esac
7785 if $valid_a_lib; then
7786 echo
7787 $ECHO "*** Warning: Linking the shared library $output against the"
7788 $ECHO "*** static library $deplib is not portable!"
7789 deplibs="$deplib $deplibs"
7790 else
7791 echo
7792 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
7793 echo "*** I have the capability to make that library automatically link in when"
7794 echo "*** you link to this library. But I can only do this if you have a"
7795 echo "*** shared version of the library, which you do not appear to have"
7796 echo "*** because the file extensions .$libext of this argument makes me believe"
7797 echo "*** that it is just a static archive that I should not use here."
7798 fi
7799 ;;
7800 esac
7801 continue
7802 ;;
7803 prog)
7804 if test link != "$pass"; then
7805 deplibs="$deplib $deplibs"
7806 else
7807 compile_deplibs="$deplib $compile_deplibs"
7808 finalize_deplibs="$deplib $finalize_deplibs"
7809 fi
7810 continue
7811 ;;
7812 esac # linkmode
7813 ;; # *.$libext
7814 *.lo | *.$objext)
7815 if test conv = "$pass"; then
7816 deplibs="$deplib $deplibs"
7817 elif test prog = "$linkmode"; then
7818 if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
7819 # If there is no dlopen support or we're linking statically,
7820 # we need to preload.
7821 func_append newdlprefiles " $deplib"
7822 compile_deplibs="$deplib $compile_deplibs"
7823 finalize_deplibs="$deplib $finalize_deplibs"
7824 else
7825 func_append newdlfiles " $deplib"
7826 fi
7827 fi
7828 continue
7829 ;;
7830 %DEPLIBS%)
7831 alldeplibs=:
7832 continue
7833 ;;
7834 esac # case $deplib
7835
7836 $found || test -f "$lib" \
7837 || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
7838
7839 # Check to see that this really is a libtool archive.
7840 func_lalib_unsafe_p "$lib" \
7841 || func_fatal_error "'$lib' is not a valid libtool archive"
7842
7843 func_dirname "$lib" "" "."
7844 ladir=$func_dirname_result
7845
7846 dlname=
7847 dlopen=
7848 dlpreopen=
7849 libdir=
7850 library_names=
7851 old_library=
7852 inherited_linker_flags=
7853 # If the library was installed with an old release of libtool,
7854 # it will not redefine variables installed, or shouldnotlink
7855 installed=yes
7856 shouldnotlink=no
7857 avoidtemprpath=
7858
7859
7860 # Read the .la file
7861 func_source "$lib"
7862
7863 # Convert "-framework foo" to "foo.ltframework"
7864 if test -n "$inherited_linker_flags"; then
7865 tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
7866 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
7867 case " $new_inherited_linker_flags " in
7868 *" $tmp_inherited_linker_flag "*) ;;
7869 *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
7870 esac
7871 done
7872 fi
7873 dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
7874 if test lib,link = "$linkmode,$pass" ||
7875 test prog,scan = "$linkmode,$pass" ||
7876 { test prog != "$linkmode" && test lib != "$linkmode"; }; then
7877 test -n "$dlopen" && func_append dlfiles " $dlopen"
7878 test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
7879 fi
7880
7881 if test conv = "$pass"; then
7882 # Only check for convenience libraries
7883 deplibs="$lib $deplibs"
7884 if test -z "$libdir"; then
7885 if test -z "$old_library"; then
7886 func_fatal_error "cannot find name of link library for '$lib'"
7887 fi
7888 # It is a libtool convenience library, so add in its objects.
7889 func_append convenience " $ladir/$objdir/$old_library"
7890 func_append old_convenience " $ladir/$objdir/$old_library"
7891 elif test prog != "$linkmode" && test lib != "$linkmode"; then
7892 func_fatal_error "'$lib' is not a convenience library"
7893 fi
7894 tmp_libs=
7895 for deplib in $dependency_libs; do
7896 deplibs="$deplib $deplibs"
7897 if $opt_preserve_dup_deps; then
7898 case "$tmp_libs " in
7899 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
7900 esac
7901 fi
7902 func_append tmp_libs " $deplib"
7903 done
7904 continue
7905 fi # $pass = conv
7906
7907
7908 # Get the name of the library we link against.
7909 linklib=
7910 if test -n "$old_library" &&
7911 { test yes = "$prefer_static_libs" ||
7912 test built,no = "$prefer_static_libs,$installed"; }; then
7913 linklib=$old_library
7914 else
7915 for l in $old_library $library_names; do
7916 linklib=$l
7917 done
7918 fi
7919 if test -z "$linklib"; then
7920 func_fatal_error "cannot find name of link library for '$lib'"
7921 fi
7922
7923 # This library was specified with -dlopen.
7924 if test dlopen = "$pass"; then
7925 test -z "$libdir" \
7926 && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
7927 if test -z "$dlname" ||
7928 test yes != "$dlopen_support" ||
7929 test no = "$build_libtool_libs"
7930 then
7931 # If there is no dlname, no dlopen support or we're linking
7932 # statically, we need to preload. We also need to preload any
7933 # dependent libraries so libltdl's deplib preloader doesn't
7934 # bomb out in the load deplibs phase.
7935 func_append dlprefiles " $lib $dependency_libs"
7936 else
7937 func_append newdlfiles " $lib"
7938 fi
7939 continue
7940 fi # $pass = dlopen
7941
7942 # We need an absolute path.
7943 case $ladir in
7944 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
7945 *)
7946 abs_ladir=`cd "$ladir" && pwd`
7947 if test -z "$abs_ladir"; then
7948 func_warning "cannot determine absolute directory name of '$ladir'"
7949 func_warning "passing it literally to the linker, although it might fail"
7950 abs_ladir=$ladir
7951 fi
7952 ;;
7953 esac
7954 func_basename "$lib"
7955 laname=$func_basename_result
7956
7957 # Find the relevant object directory and library name.
7958 if test yes = "$installed"; then
7959 if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
7960 func_warning "library '$lib' was moved."
7961 dir=$ladir
7962 absdir=$abs_ladir
7963 libdir=$abs_ladir
7964 else
7965 dir=$lt_sysroot$libdir
7966 absdir=$lt_sysroot$libdir
7967 fi
7968 test yes = "$hardcode_automatic" && avoidtemprpath=yes
7969 else
7970 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
7971 dir=$ladir
7972 absdir=$abs_ladir
7973 # Remove this search path later
7974 func_append notinst_path " $abs_ladir"
7975 else
7976 dir=$ladir/$objdir
7977 absdir=$abs_ladir/$objdir
7978 # Remove this search path later
7979 func_append notinst_path " $abs_ladir"
7980 fi
7981 fi # $installed = yes
7982 func_stripname 'lib' '.la' "$laname"
7983 name=$func_stripname_result
7984
7985 # This library was specified with -dlpreopen.
7986 if test dlpreopen = "$pass"; then
7987 if test -z "$libdir" && test prog = "$linkmode"; then
7988 func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
7989 fi
7990 case $host in
7991 # special handling for platforms with PE-DLLs.
7992 *cygwin* | *mingw* | *cegcc* )
7993 # Linker will automatically link against shared library if both
7994 # static and shared are present. Therefore, ensure we extract
7995 # symbols from the import library if a shared library is present
7996 # (otherwise, the dlopen module name will be incorrect). We do
7997 # this by putting the import library name into $newdlprefiles.
7998 # We recover the dlopen module name by 'saving' the la file
7999 # name in a special purpose variable, and (later) extracting the
8000 # dlname from the la file.
8001 if test -n "$dlname"; then
8002 func_tr_sh "$dir/$linklib"
8003 eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
8004 func_append newdlprefiles " $dir/$linklib"
8005 else
8006 func_append newdlprefiles " $dir/$old_library"
8007 # Keep a list of preopened convenience libraries to check
8008 # that they are being used correctly in the link pass.
8009 test -z "$libdir" && \
8010 func_append dlpreconveniencelibs " $dir/$old_library"
8011 fi
8012 ;;
8013 * )
8014 # Prefer using a static library (so that no silly _DYNAMIC symbols
8015 # are required to link).
8016 if test -n "$old_library"; then
8017 func_append newdlprefiles " $dir/$old_library"
8018 # Keep a list of preopened convenience libraries to check
8019 # that they are being used correctly in the link pass.
8020 test -z "$libdir" && \
8021 func_append dlpreconveniencelibs " $dir/$old_library"
8022 # Otherwise, use the dlname, so that lt_dlopen finds it.
8023 elif test -n "$dlname"; then
8024 func_append newdlprefiles " $dir/$dlname"
8025 else
8026 func_append newdlprefiles " $dir/$linklib"
8027 fi
8028 ;;
8029 esac
8030 fi # $pass = dlpreopen
8031
8032 if test -z "$libdir"; then
8033 # Link the convenience library
8034 if test lib = "$linkmode"; then
8035 deplibs="$dir/$old_library $deplibs"
8036 elif test prog,link = "$linkmode,$pass"; then
8037 compile_deplibs="$dir/$old_library $compile_deplibs"
8038 finalize_deplibs="$dir/$old_library $finalize_deplibs"
8039 else
8040 deplibs="$lib $deplibs" # used for prog,scan pass
8041 fi
8042 continue
8043 fi
8044
8045
8046 if test prog = "$linkmode" && test link != "$pass"; then
8047 func_append newlib_search_path " $ladir"
8048 deplibs="$lib $deplibs"
8049
8050 linkalldeplibs=false
8051 if test no != "$link_all_deplibs" || test -z "$library_names" ||
8052 test no = "$build_libtool_libs"; then
8053 linkalldeplibs=:
8054 fi
8055
8056 tmp_libs=
8057 for deplib in $dependency_libs; do
8058 case $deplib in
8059 -L*) func_stripname '-L' '' "$deplib"
8060 func_resolve_sysroot "$func_stripname_result"
8061 func_append newlib_search_path " $func_resolve_sysroot_result"
8062 ;;
8063 esac
8064 # Need to link against all dependency_libs?
8065 if $linkalldeplibs; then
8066 deplibs="$deplib $deplibs"
8067 else
8068 # Need to hardcode shared library paths
8069 # or/and link against static libraries
8070 newdependency_libs="$deplib $newdependency_libs"
8071 fi
8072 if $opt_preserve_dup_deps; then
8073 case "$tmp_libs " in
8074 *" $deplib "*) func_append specialdeplibs " $deplib" ;;
8075 esac
8076 fi
8077 func_append tmp_libs " $deplib"
8078 done # for deplib
8079 continue
8080 fi # $linkmode = prog...
8081
8082 if test prog,link = "$linkmode,$pass"; then
8083 if test -n "$library_names" &&
8084 { { test no = "$prefer_static_libs" ||
8085 test built,yes = "$prefer_static_libs,$installed"; } ||
8086 test -z "$old_library"; }; then
8087 # We need to hardcode the library path
8088 if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
8089 # Make sure the rpath contains only unique directories.
8090 case $temp_rpath: in
8091 *"$absdir:"*) ;;
8092 *) func_append temp_rpath "$absdir:" ;;
8093 esac
8094 fi
8095
8096 # Hardcode the library path.
8097 # Skip directories that are in the system default run-time
8098 # search path.
8099 case " $sys_lib_dlsearch_path " in
8100 *" $absdir "*) ;;
8101 *)
8102 case "$compile_rpath " in
8103 *" $absdir "*) ;;
8104 *) func_append compile_rpath " $absdir" ;;
8105 esac
8106 ;;
8107 esac
8108 case " $sys_lib_dlsearch_path " in
8109 *" $libdir "*) ;;
8110 *)
8111 case "$finalize_rpath " in
8112 *" $libdir "*) ;;
8113 *) func_append finalize_rpath " $libdir" ;;
8114 esac
8115 ;;
8116 esac
8117 fi # $linkmode,$pass = prog,link...
8118
8119 if $alldeplibs &&
8120 { test pass_all = "$deplibs_check_method" ||
8121 { test yes = "$build_libtool_libs" &&
8122 test -n "$library_names"; }; }; then
8123 # We only need to search for static libraries
8124 continue
8125 fi
8126 fi
8127
8128 link_static=no # Whether the deplib will be linked statically
8129 use_static_libs=$prefer_static_libs
8130 if test built = "$use_static_libs" && test yes = "$installed"; then
8131 use_static_libs=no
8132 fi
8133 if test -n "$library_names" &&
8134 { test no = "$use_static_libs" || test -z "$old_library"; }; then
8135 case $host in
8136 *cygwin* | *mingw* | *cegcc* | *os2*)
8137 # No point in relinking DLLs because paths are not encoded
8138 func_append notinst_deplibs " $lib"
8139 need_relink=no
8140 ;;
8141 *)
8142 if test no = "$installed"; then
8143 func_append notinst_deplibs " $lib"
8144 need_relink=yes
8145 fi
8146 ;;
8147 esac
8148 # This is a shared library
8149
8150 # Warn about portability, can't link against -module's on some
8151 # systems (darwin). Don't bleat about dlopened modules though!
8152 dlopenmodule=
8153 for dlpremoduletest in $dlprefiles; do
8154 if test "X$dlpremoduletest" = "X$lib"; then
8155 dlopenmodule=$dlpremoduletest
8156 break
8157 fi
8158 done
8159 if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
8160 echo
8161 if test prog = "$linkmode"; then
8162 $ECHO "*** Warning: Linking the executable $output against the loadable module"
8163 else
8164 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
8165 fi
8166 $ECHO "*** $linklib is not portable!"
8167 fi
8168 if test lib = "$linkmode" &&
8169 test yes = "$hardcode_into_libs"; then
8170 # Hardcode the library path.
8171 # Skip directories that are in the system default run-time
8172 # search path.
8173 case " $sys_lib_dlsearch_path " in
8174 *" $absdir "*) ;;
8175 *)
8176 case "$compile_rpath " in
8177 *" $absdir "*) ;;
8178 *) func_append compile_rpath " $absdir" ;;
8179 esac
8180 ;;
8181 esac
8182 case " $sys_lib_dlsearch_path " in
8183 *" $libdir "*) ;;
8184 *)
8185 case "$finalize_rpath " in
8186 *" $libdir "*) ;;
8187 *) func_append finalize_rpath " $libdir" ;;
8188 esac
8189 ;;
8190 esac
8191 fi
8192
8193 if test -n "$old_archive_from_expsyms_cmds"; then
8194 # figure out the soname
8195 set dummy $library_names
8196 shift
8197 realname=$1
8198 shift
8199 libname=`eval "\\$ECHO \"$libname_spec\""`
8200 # use dlname if we got it. it's perfectly good, no?
8201 if test -n "$dlname"; then
8202 soname=$dlname
8203 elif test -n "$soname_spec"; then
8204 # bleh windows
8205 case $host in
8206 *cygwin* | mingw* | *cegcc* | *os2*)
8207 func_arith $current - $age
8208 major=$func_arith_result
8209 versuffix=-$major
8210 ;;
8211 esac
8212 eval soname=\"$soname_spec\"
8213 else
8214 soname=$realname
8215 fi
8216
8217 # Make a new name for the extract_expsyms_cmds to use
8218 soroot=$soname
8219 func_basename "$soroot"
8220 soname=$func_basename_result
8221 func_stripname 'lib' '.dll' "$soname"
8222 newlib=libimp-$func_stripname_result.a
8223
8224 # If the library has no export list, then create one now
8225 if test -f "$output_objdir/$soname-def"; then :
8226 else
8227 func_verbose "extracting exported symbol list from '$soname'"
8228 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
8229 fi
8230
8231 # Create $newlib
8232 if test -f "$output_objdir/$newlib"; then :; else
8233 func_verbose "generating import library for '$soname'"
8234 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
8235 fi
8236 # make sure the library variables are pointing to the new library
8237 dir=$output_objdir
8238 linklib=$newlib
8239 fi # test -n "$old_archive_from_expsyms_cmds"
8240
8241 if test prog = "$linkmode" || test relink != "$opt_mode"; then
8242 add_shlibpath=
8243 add_dir=
8244 add=
8245 lib_linked=yes
8246 case $hardcode_action in
8247 immediate | unsupported)
8248 if test no = "$hardcode_direct"; then
8249 add=$dir/$linklib
8250 case $host in
8251 *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
8252 *-*-sysv4*uw2*) add_dir=-L$dir ;;
8253 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
8254 *-*-unixware7*) add_dir=-L$dir ;;
8255 *-*-darwin* )
8256 # if the lib is a (non-dlopened) module then we cannot
8257 # link against it, someone is ignoring the earlier warnings
8258 if /usr/bin/file -L $add 2> /dev/null |
8259 $GREP ": [^:]* bundle" >/dev/null; then
8260 if test "X$dlopenmodule" != "X$lib"; then
8261 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
8262 if test -z "$old_library"; then
8263 echo
8264 echo "*** And there doesn't seem to be a static archive available"
8265 echo "*** The link will probably fail, sorry"
8266 else
8267 add=$dir/$old_library
8268 fi
8269 elif test -n "$old_library"; then
8270 add=$dir/$old_library
8271 fi
8272 fi
8273 esac
8274 elif test no = "$hardcode_minus_L"; then
8275 case $host in
8276 *-*-sunos*) add_shlibpath=$dir ;;
8277 esac
8278 add_dir=-L$dir
8279 add=-l$name
8280 elif test no = "$hardcode_shlibpath_var"; then
8281 add_shlibpath=$dir
8282 add=-l$name
8283 else
8284 lib_linked=no
8285 fi
8286 ;;
8287 relink)
8288 if test yes = "$hardcode_direct" &&
8289 test no = "$hardcode_direct_absolute"; then
8290 add=$dir/$linklib
8291 elif test yes = "$hardcode_minus_L"; then
8292 add_dir=-L$absdir
8293 # Try looking first in the location we're being installed to.
8294 if test -n "$inst_prefix_dir"; then
8295 case $libdir in
8296 [\\/]*)
8297 func_append add_dir " -L$inst_prefix_dir$libdir"
8298 ;;
8299 esac
8300 fi
8301 add=-l$name
8302 elif test yes = "$hardcode_shlibpath_var"; then
8303 add_shlibpath=$dir
8304 add=-l$name
8305 else
8306 lib_linked=no
8307 fi
8308 ;;
8309 *) lib_linked=no ;;
8310 esac
8311
8312 if test yes != "$lib_linked"; then
8313 func_fatal_configuration "unsupported hardcode properties"
8314 fi
8315
8316 if test -n "$add_shlibpath"; then
8317 case :$compile_shlibpath: in
8318 *":$add_shlibpath:"*) ;;
8319 *) func_append compile_shlibpath "$add_shlibpath:" ;;
8320 esac
8321 fi
8322 if test prog = "$linkmode"; then
8323 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
8324 test -n "$add" && compile_deplibs="$add $compile_deplibs"
8325 else
8326 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8327 test -n "$add" && deplibs="$add $deplibs"
8328 if test yes != "$hardcode_direct" &&
8329 test yes != "$hardcode_minus_L" &&
8330 test yes = "$hardcode_shlibpath_var"; then
8331 case :$finalize_shlibpath: in
8332 *":$libdir:"*) ;;
8333 *) func_append finalize_shlibpath "$libdir:" ;;
8334 esac
8335 fi
8336 fi
8337 fi
8338
8339 if test prog = "$linkmode" || test relink = "$opt_mode"; then
8340 add_shlibpath=
8341 add_dir=
8342 add=
8343 # Finalize command for both is simple: just hardcode it.
8344 if test yes = "$hardcode_direct" &&
8345 test no = "$hardcode_direct_absolute"; then
8346 add=$libdir/$linklib
8347 elif test yes = "$hardcode_minus_L"; then
8348 add_dir=-L$libdir
8349 add=-l$name
8350 elif test yes = "$hardcode_shlibpath_var"; then
8351 case :$finalize_shlibpath: in
8352 *":$libdir:"*) ;;
8353 *) func_append finalize_shlibpath "$libdir:" ;;
8354 esac
8355 add=-l$name
8356 elif test yes = "$hardcode_automatic"; then
8357 if test -n "$inst_prefix_dir" &&
8358 test -f "$inst_prefix_dir$libdir/$linklib"; then
8359 add=$inst_prefix_dir$libdir/$linklib
8360 else
8361 add=$libdir/$linklib
8362 fi
8363 else
8364 # We cannot seem to hardcode it, guess we'll fake it.
8365 add_dir=-L$libdir
8366 # Try looking first in the location we're being installed to.
8367 if test -n "$inst_prefix_dir"; then
8368 case $libdir in
8369 [\\/]*)
8370 func_append add_dir " -L$inst_prefix_dir$libdir"
8371 ;;
8372 esac
8373 fi
8374 add=-l$name
8375 fi
8376
8377 if test prog = "$linkmode"; then
8378 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
8379 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
8380 else
8381 test -n "$add_dir" && deplibs="$add_dir $deplibs"
8382 test -n "$add" && deplibs="$add $deplibs"
8383 fi
8384 fi
8385 elif test prog = "$linkmode"; then
8386 # Here we assume that one of hardcode_direct or hardcode_minus_L
8387 # is not unsupported. This is valid on all known static and
8388 # shared platforms.
8389 if test unsupported != "$hardcode_direct"; then
8390 test -n "$old_library" && linklib=$old_library
8391 compile_deplibs="$dir/$linklib $compile_deplibs"
8392 finalize_deplibs="$dir/$linklib $finalize_deplibs"
8393 else
8394 compile_deplibs="-l$name -L$dir $compile_deplibs"
8395 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
8396 fi
8397 elif test yes = "$build_libtool_libs"; then
8398 # Not a shared library
8399 if test pass_all != "$deplibs_check_method"; then
8400 # We're trying link a shared library against a static one
8401 # but the system doesn't support it.
8402
8403 # Just print a warning and add the library to dependency_libs so
8404 # that the program can be linked against the static library.
8405 echo
8406 $ECHO "*** Warning: This system cannot link to static lib archive $lib."
8407 echo "*** I have the capability to make that library automatically link in when"
8408 echo "*** you link to this library. But I can only do this if you have a"
8409 echo "*** shared version of the library, which you do not appear to have."
8410 if test yes = "$module"; then
8411 echo "*** But as you try to build a module library, libtool will still create "
8412 echo "*** a static module, that should work as long as the dlopening application"
8413 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
8414 if test -z "$global_symbol_pipe"; then
8415 echo
8416 echo "*** However, this would only work if libtool was able to extract symbol"
8417 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
8418 echo "*** not find such a program. So, this module is probably useless."
8419 echo "*** 'nm' from GNU binutils and a full rebuild may help."
8420 fi
8421 if test no = "$build_old_libs"; then
8422 build_libtool_libs=module
8423 build_old_libs=yes
8424 else
8425 build_libtool_libs=no
8426 fi
8427 fi
8428 else
8429 deplibs="$dir/$old_library $deplibs"
8430 link_static=yes
8431 fi
8432 fi # link shared/static library?
8433
8434 if test lib = "$linkmode"; then
8435 if test -n "$dependency_libs" &&
8436 { test yes != "$hardcode_into_libs" ||
8437 test yes = "$build_old_libs" ||
8438 test yes = "$link_static"; }; then
8439 # Extract -R from dependency_libs
8440 temp_deplibs=
8441 for libdir in $dependency_libs; do
8442 case $libdir in
8443 -R*) func_stripname '-R' '' "$libdir"
8444 temp_xrpath=$func_stripname_result
8445 case " $xrpath " in
8446 *" $temp_xrpath "*) ;;
8447 *) func_append xrpath " $temp_xrpath";;
8448 esac;;
8449 *) func_append temp_deplibs " $libdir";;
8450 esac
8451 done
8452 dependency_libs=$temp_deplibs
8453 fi
8454
8455 func_append newlib_search_path " $absdir"
8456 # Link against this library
8457 test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
8458 # ... and its dependency_libs
8459 tmp_libs=
8460 for deplib in $dependency_libs; do
8461 newdependency_libs="$deplib $newdependency_libs"
8462 case $deplib in
8463 -L*) func_stripname '-L' '' "$deplib"
8464 func_resolve_sysroot "$func_stripname_result";;
8465 *) func_resolve_sysroot "$deplib" ;;
8466 esac
8467 if $opt_preserve_dup_deps; then
8468 case "$tmp_libs " in
8469 *" $func_resolve_sysroot_result "*)
8470 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
8471 esac
8472 fi
8473 func_append tmp_libs " $func_resolve_sysroot_result"
8474 done
8475
8476 if test no != "$link_all_deplibs"; then
8477 # Add the search paths of all dependency libraries
8478 for deplib in $dependency_libs; do
8479 path=
8480 case $deplib in
8481 -L*) path=$deplib ;;
8482 *.la)
8483 func_resolve_sysroot "$deplib"
8484 deplib=$func_resolve_sysroot_result
8485 func_dirname "$deplib" "" "."
8486 dir=$func_dirname_result
8487 # We need an absolute path.
8488 case $dir in
8489 [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
8490 *)
8491 absdir=`cd "$dir" && pwd`
8492 if test -z "$absdir"; then
8493 func_warning "cannot determine absolute directory name of '$dir'"
8494 absdir=$dir
8495 fi
8496 ;;
8497 esac
8498 if $GREP "^installed=no" $deplib > /dev/null; then
8499 case $host in
8500 *-*-darwin*)
8501 depdepl=
8502 eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
8503 if test -n "$deplibrary_names"; then
8504 for tmp in $deplibrary_names; do
8505 depdepl=$tmp
8506 done
8507 if test -f "$absdir/$objdir/$depdepl"; then
8508 depdepl=$absdir/$objdir/$depdepl
8509 darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8510 if test -z "$darwin_install_name"; then
8511 darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
8512 fi
8513 func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
8514 func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
8515 path=
8516 fi
8517 fi
8518 ;;
8519 *)
8520 path=-L$absdir/$objdir
8521 ;;
8522 esac
8523 else
8524 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
8525 test -z "$libdir" && \
8526 func_fatal_error "'$deplib' is not a valid libtool archive"
8527 test "$absdir" != "$libdir" && \
8528 func_warning "'$deplib' seems to be moved"
8529
8530 path=-L$absdir
8531 fi
8532 ;;
8533 esac
8534 case " $deplibs " in
8535 *" $path "*) ;;
8536 *) deplibs="$path $deplibs" ;;
8537 esac
8538 done
8539 fi # link_all_deplibs != no
8540 fi # linkmode = lib
8541 done # for deplib in $libs
8542 if test link = "$pass"; then
8543 if test prog = "$linkmode"; then
8544 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
8545 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
8546 else
8547 compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
8548 fi
8549 fi
8550 dependency_libs=$newdependency_libs
8551 if test dlpreopen = "$pass"; then
8552 # Link the dlpreopened libraries before other libraries
8553 for deplib in $save_deplibs; do
8554 deplibs="$deplib $deplibs"
8555 done
8556 fi
8557 if test dlopen != "$pass"; then
8558 test conv = "$pass" || {
8559 # Make sure lib_search_path contains only unique directories.
8560 lib_search_path=
8561 for dir in $newlib_search_path; do
8562 case "$lib_search_path " in
8563 *" $dir "*) ;;
8564 *) func_append lib_search_path " $dir" ;;
8565 esac
8566 done
8567 newlib_search_path=
8568 }
8569
8570 if test prog,link = "$linkmode,$pass"; then
8571 vars="compile_deplibs finalize_deplibs"
8572 else
8573 vars=deplibs
8574 fi
8575 for var in $vars dependency_libs; do
8576 # Add libraries to $var in reverse order
8577 eval tmp_libs=\"\$$var\"
8578 new_libs=
8579 for deplib in $tmp_libs; do
8580 # FIXME: Pedantically, this is the right thing to do, so
8581 # that some nasty dependency loop isn't accidentally
8582 # broken:
8583 #new_libs="$deplib $new_libs"
8584 # Pragmatically, this seems to cause very few problems in
8585 # practice:
8586 case $deplib in
8587 -L*) new_libs="$deplib $new_libs" ;;
8588 -R*) ;;
8589 *)
8590 # And here is the reason: when a library appears more
8591 # than once as an explicit dependence of a library, or
8592 # is implicitly linked in more than once by the
8593 # compiler, it is considered special, and multiple
8594 # occurrences thereof are not removed. Compare this
8595 # with having the same library being listed as a
8596 # dependency of multiple other libraries: in this case,
8597 # we know (pedantically, we assume) the library does not
8598 # need to be listed more than once, so we keep only the
8599 # last copy. This is not always right, but it is rare
8600 # enough that we require users that really mean to play
8601 # such unportable linking tricks to link the library
8602 # using -Wl,-lname, so that libtool does not consider it
8603 # for duplicate removal.
8604 case " $specialdeplibs " in
8605 *" $deplib "*) new_libs="$deplib $new_libs" ;;
8606 *)
8607 case " $new_libs " in
8608 *" $deplib "*) ;;
8609 *) new_libs="$deplib $new_libs" ;;
8610 esac
8611 ;;
8612 esac
8613 ;;
8614 esac
8615 done
8616 tmp_libs=
8617 for deplib in $new_libs; do
8618 case $deplib in
8619 -L*)
8620 case " $tmp_libs " in
8621 *" $deplib "*) ;;
8622 *) func_append tmp_libs " $deplib" ;;
8623 esac
8624 ;;
8625 *) func_append tmp_libs " $deplib" ;;
8626 esac
8627 done
8628 eval $var=\"$tmp_libs\"
8629 done # for var
8630 fi
8631
8632 # Add Sun CC postdeps if required:
8633 test CXX = "$tagname" && {
8634 case $host_os in
8635 linux*)
8636 case `$CC -V 2>&1 | sed 5q` in
8637 *Sun\ C*) # Sun C++ 5.9
8638 func_suncc_cstd_abi
8639
8640 if test no != "$suncc_use_cstd_abi"; then
8641 func_append postdeps ' -library=Cstd -library=Crun'
8642 fi
8643 ;;
8644 esac
8645 ;;
8646
8647 solaris*)
8648 func_cc_basename "$CC"
8649 case $func_cc_basename_result in
8650 CC* | sunCC*)
8651 func_suncc_cstd_abi
8652
8653 if test no != "$suncc_use_cstd_abi"; then
8654 func_append postdeps ' -library=Cstd -library=Crun'
8655 fi
8656 ;;
8657 esac
8658 ;;
8659 esac
8660 }
8661
8662 # Last step: remove runtime libs from dependency_libs
8663 # (they stay in deplibs)
8664 tmp_libs=
8665 for i in $dependency_libs; do
8666 case " $predeps $postdeps $compiler_lib_search_path " in
8667 *" $i "*)
8668 i=
8669 ;;
8670 esac
8671 if test -n "$i"; then
8672 func_append tmp_libs " $i"
8673 fi
8674 done
8675 dependency_libs=$tmp_libs
8676 done # for pass
8677 if test prog = "$linkmode"; then
8678 dlfiles=$newdlfiles
8679 fi
8680 if test prog = "$linkmode" || test lib = "$linkmode"; then
8681 dlprefiles=$newdlprefiles
8682 fi
8683
8684 case $linkmode in
8685 oldlib)
8686 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
8687 func_warning "'-dlopen' is ignored for archives"
8688 fi
8689
8690 case " $deplibs" in
8691 *\ -l* | *\ -L*)
8692 func_warning "'-l' and '-L' are ignored for archives" ;;
8693 esac
8694
8695 test -n "$rpath" && \
8696 func_warning "'-rpath' is ignored for archives"
8697
8698 test -n "$xrpath" && \
8699 func_warning "'-R' is ignored for archives"
8700
8701 test -n "$vinfo" && \
8702 func_warning "'-version-info/-version-number' is ignored for archives"
8703
8704 test -n "$release" && \
8705 func_warning "'-release' is ignored for archives"
8706
8707 test -n "$export_symbols$export_symbols_regex" && \
8708 func_warning "'-export-symbols' is ignored for archives"
8709
8710 # Now set the variables for building old libraries.
8711 build_libtool_libs=no
8712 oldlibs=$output
8713 func_append objs "$old_deplibs"
8714 ;;
8715
8716 lib)
8717 # Make sure we only generate libraries of the form 'libNAME.la'.
8718 case $outputname in
8719 lib*)
8720 func_stripname 'lib' '.la' "$outputname"
8721 name=$func_stripname_result
8722 eval shared_ext=\"$shrext_cmds\"
8723 eval libname=\"$libname_spec\"
8724 ;;
8725 *)
8726 test no = "$module" \
8727 && func_fatal_help "libtool library '$output' must begin with 'lib'"
8728
8729 if test no != "$need_lib_prefix"; then
8730 # Add the "lib" prefix for modules if required
8731 func_stripname '' '.la' "$outputname"
8732 name=$func_stripname_result
8733 eval shared_ext=\"$shrext_cmds\"
8734 eval libname=\"$libname_spec\"
8735 else
8736 func_stripname '' '.la' "$outputname"
8737 libname=$func_stripname_result
8738 fi
8739 ;;
8740 esac
8741
8742 if test -n "$objs"; then
8743 if test pass_all != "$deplibs_check_method"; then
8744 func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
8745 else
8746 echo
8747 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
8748 $ECHO "*** objects $objs is not portable!"
8749 func_append libobjs " $objs"
8750 fi
8751 fi
8752
8753 test no = "$dlself" \
8754 || func_warning "'-dlopen self' is ignored for libtool libraries"
8755
8756 set dummy $rpath
8757 shift
8758 test 1 -lt "$#" \
8759 && func_warning "ignoring multiple '-rpath's for a libtool library"
8760
8761 install_libdir=$1
8762
8763 oldlibs=
8764 if test -z "$rpath"; then
8765 if test yes = "$build_libtool_libs"; then
8766 # Building a libtool convenience library.
8767 # Some compilers have problems with a '.al' extension so
8768 # convenience libraries should have the same extension an
8769 # archive normally would.
8770 oldlibs="$output_objdir/$libname.$libext $oldlibs"
8771 build_libtool_libs=convenience
8772 build_old_libs=yes
8773 fi
8774
8775 test -n "$vinfo" && \
8776 func_warning "'-version-info/-version-number' is ignored for convenience libraries"
8777
8778 test -n "$release" && \
8779 func_warning "'-release' is ignored for convenience libraries"
8780 else
8781
8782 # Parse the version information argument.
8783 save_ifs=$IFS; IFS=:
8784 set dummy $vinfo 0 0 0
8785 shift
8786 IFS=$save_ifs
8787
8788 test -n "$7" && \
8789 func_fatal_help "too many parameters to '-version-info'"
8790
8791 # convert absolute version numbers to libtool ages
8792 # this retains compatibility with .la files and attempts
8793 # to make the code below a bit more comprehensible
8794
8795 case $vinfo_number in
8796 yes)
8797 number_major=$1
8798 number_minor=$2
8799 number_revision=$3
8800 #
8801 # There are really only two kinds -- those that
8802 # use the current revision as the major version
8803 # and those that subtract age and use age as
8804 # a minor version. But, then there is irix
8805 # that has an extra 1 added just for fun
8806 #
8807 case $version_type in
8808 # correct linux to gnu/linux during the next big refactor
8809 darwin|freebsd-elf|linux|osf|windows|none)
8810 func_arith $number_major + $number_minor
8811 current=$func_arith_result
8812 age=$number_minor
8813 revision=$number_revision
8814 ;;
8815 freebsd-aout|qnx|sunos)
8816 current=$number_major
8817 revision=$number_minor
8818 age=0
8819 ;;
8820 irix|nonstopux)
8821 func_arith $number_major + $number_minor
8822 current=$func_arith_result
8823 age=$number_minor
8824 revision=$number_minor
8825 lt_irix_increment=no
8826 ;;
8827 esac
8828 ;;
8829 no)
8830 current=$1
8831 revision=$2
8832 age=$3
8833 ;;
8834 esac
8835
8836 # Check that each of the things are valid numbers.
8837 case $current in
8838 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
8839 *)
8840 func_error "CURRENT '$current' must be a nonnegative integer"
8841 func_fatal_error "'$vinfo' is not valid version information"
8842 ;;
8843 esac
8844
8845 case $revision in
8846 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
8847 *)
8848 func_error "REVISION '$revision' must be a nonnegative integer"
8849 func_fatal_error "'$vinfo' is not valid version information"
8850 ;;
8851 esac
8852
8853 case $age in
8854 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
8855 *)
8856 func_error "AGE '$age' must be a nonnegative integer"
8857 func_fatal_error "'$vinfo' is not valid version information"
8858 ;;
8859 esac
8860
8861 if test "$age" -gt "$current"; then
8862 func_error "AGE '$age' is greater than the current interface number '$current'"
8863 func_fatal_error "'$vinfo' is not valid version information"
8864 fi
8865
8866 # Calculate the version variables.
8867 major=
8868 versuffix=
8869 verstring=
8870 case $version_type in
8871 none) ;;
8872
8873 darwin)
8874 # Like Linux, but with the current version available in
8875 # verstring for coding it into the library header
8876 func_arith $current - $age
8877 major=.$func_arith_result
8878 versuffix=$major.$age.$revision
8879 # Darwin ld doesn't like 0 for these options...
8880 func_arith $current + 1
8881 minor_current=$func_arith_result
8882 xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
8883 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
8884 # On Darwin other compilers
8885 case $CC in
8886 nagfor*)
8887 verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
8888 ;;
8889 *)
8890 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
8891 ;;
8892 esac
8893 ;;
8894
8895 freebsd-aout)
8896 major=.$current
8897 versuffix=.$current.$revision
8898 ;;
8899
8900 freebsd-elf)
8901 func_arith $current - $age
8902 major=.$func_arith_result
8903 versuffix=$major.$age.$revision
8904 ;;
8905
8906 irix | nonstopux)
8907 if test no = "$lt_irix_increment"; then
8908 func_arith $current - $age
8909 else
8910 func_arith $current - $age + 1
8911 fi
8912 major=$func_arith_result
8913
8914 case $version_type in
8915 nonstopux) verstring_prefix=nonstopux ;;
8916 *) verstring_prefix=sgi ;;
8917 esac
8918 verstring=$verstring_prefix$major.$revision
8919
8920 # Add in all the interfaces that we are compatible with.
8921 loop=$revision
8922 while test 0 -ne "$loop"; do
8923 func_arith $revision - $loop
8924 iface=$func_arith_result
8925 func_arith $loop - 1
8926 loop=$func_arith_result
8927 verstring=$verstring_prefix$major.$iface:$verstring
8928 done
8929
8930 # Before this point, $major must not contain '.'.
8931 major=.$major
8932 versuffix=$major.$revision
8933 ;;
8934
8935 linux) # correct to gnu/linux during the next big refactor
8936 func_arith $current - $age
8937 major=.$func_arith_result
8938 versuffix=$major.$age.$revision
8939 ;;
8940
8941 osf)
8942 func_arith $current - $age
8943 major=.$func_arith_result
8944 versuffix=.$current.$age.$revision
8945 verstring=$current.$age.$revision
8946
8947 # Add in all the interfaces that we are compatible with.
8948 loop=$age
8949 while test 0 -ne "$loop"; do
8950 func_arith $current - $loop
8951 iface=$func_arith_result
8952 func_arith $loop - 1
8953 loop=$func_arith_result
8954 verstring=$verstring:$iface.0
8955 done
8956
8957 # Make executables depend on our current version.
8958 func_append verstring ":$current.0"
8959 ;;
8960
8961 qnx)
8962 major=.$current
8963 versuffix=.$current
8964 ;;
8965
8966 sco)
8967 major=.$current
8968 versuffix=.$current
8969 ;;
8970
8971 sunos)
8972 major=.$current
8973 versuffix=.$current.$revision
8974 ;;
8975
8976 windows)
8977 # Use '-' rather than '.', since we only want one
8978 # extension on DOS 8.3 file systems.
8979 func_arith $current - $age
8980 major=$func_arith_result
8981 versuffix=-$major
8982 ;;
8983
8984 *)
8985 func_fatal_configuration "unknown library version type '$version_type'"
8986 ;;
8987 esac
8988
8989 # Clear the version info if we defaulted, and they specified a release.
8990 if test -z "$vinfo" && test -n "$release"; then
8991 major=
8992 case $version_type in
8993 darwin)
8994 # we can't check for "0.0" in archive_cmds due to quoting
8995 # problems, so we reset it completely
8996 verstring=
8997 ;;
8998 *)
8999 verstring=0.0
9000 ;;
9001 esac
9002 if test no = "$need_version"; then
9003 versuffix=
9004 else
9005 versuffix=.0.0
9006 fi
9007 fi
9008
9009 # Remove version info from name if versioning should be avoided
9010 if test yes,no = "$avoid_version,$need_version"; then
9011 major=
9012 versuffix=
9013 verstring=
9014 fi
9015
9016 # Check to see if the archive will have undefined symbols.
9017 if test yes = "$allow_undefined"; then
9018 if test unsupported = "$allow_undefined_flag"; then
9019 if test yes = "$build_old_libs"; then
9020 func_warning "undefined symbols not allowed in $host shared libraries; building static only"
9021 build_libtool_libs=no
9022 else
9023 func_fatal_error "can't build $host shared library unless -no-undefined is specified"
9024 fi
9025 fi
9026 else
9027 # Don't allow undefined symbols.
9028 allow_undefined_flag=$no_undefined_flag
9029 fi
9030
9031 fi
9032
9033 func_generate_dlsyms "$libname" "$libname" :
9034 func_append libobjs " $symfileobj"
9035 test " " = "$libobjs" && libobjs=
9036
9037 if test relink != "$opt_mode"; then
9038 # Remove our outputs, but don't remove object files since they
9039 # may have been created when compiling PIC objects.
9040 removelist=
9041 tempremovelist=`$ECHO "$output_objdir/*"`
9042 for p in $tempremovelist; do
9043 case $p in
9044 *.$objext | *.gcno)
9045 ;;
9046 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
9047 if test -n "$precious_files_regex"; then
9048 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
9049 then
9050 continue
9051 fi
9052 fi
9053 func_append removelist " $p"
9054 ;;
9055 *) ;;
9056 esac
9057 done
9058 test -n "$removelist" && \
9059 func_show_eval "${RM}r \$removelist"
9060 fi
9061
9062 # Now set the variables for building old libraries.
9063 if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
9064 func_append oldlibs " $output_objdir/$libname.$libext"
9065
9066 # Transform .lo files to .o files.
9067 oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
9068 fi
9069
9070 # Eliminate all temporary directories.
9071 #for path in $notinst_path; do
9072 # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
9073 # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
9074 # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
9075 #done
9076
9077 if test -n "$xrpath"; then
9078 # If the user specified any rpath flags, then add them.
9079 temp_xrpath=
9080 for libdir in $xrpath; do
9081 func_replace_sysroot "$libdir"
9082 func_append temp_xrpath " -R$func_replace_sysroot_result"
9083 case "$finalize_rpath " in
9084 *" $libdir "*) ;;
9085 *) func_append finalize_rpath " $libdir" ;;
9086 esac
9087 done
9088 if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
9089 dependency_libs="$temp_xrpath $dependency_libs"
9090 fi
9091 fi
9092
9093 # Make sure dlfiles contains only unique files that won't be dlpreopened
9094 old_dlfiles=$dlfiles
9095 dlfiles=
9096 for lib in $old_dlfiles; do
9097 case " $dlprefiles $dlfiles " in
9098 *" $lib "*) ;;
9099 *) func_append dlfiles " $lib" ;;
9100 esac
9101 done
9102
9103 # Make sure dlprefiles contains only unique files
9104 old_dlprefiles=$dlprefiles
9105 dlprefiles=
9106 for lib in $old_dlprefiles; do
9107 case "$dlprefiles " in
9108 *" $lib "*) ;;
9109 *) func_append dlprefiles " $lib" ;;
9110 esac
9111 done
9112
9113 if test yes = "$build_libtool_libs"; then
9114 if test -n "$rpath"; then
9115 case $host in
9116 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
9117 # these systems don't actually have a c library (as such)!
9118 ;;
9119 *-*-rhapsody* | *-*-darwin1.[012])
9120 # Rhapsody C library is in the System framework
9121 func_append deplibs " System.ltframework"
9122 ;;
9123 *-*-netbsd*)
9124 # Don't link with libc until the a.out ld.so is fixed.
9125 ;;
9126 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9127 # Do not include libc due to us having libc/libc_r.
9128 ;;
9129 *-*-sco3.2v5* | *-*-sco5v6*)
9130 # Causes problems with __ctype
9131 ;;
9132 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
9133 # Compiler inserts libc in the correct place for threads to work
9134 ;;
9135 *)
9136 # Add libc to deplibs on all other systems if necessary.
9137 if test yes = "$build_libtool_need_lc"; then
9138 func_append deplibs " -lc"
9139 fi
9140 ;;
9141 esac
9142 fi
9143
9144 # Transform deplibs into only deplibs that can be linked in shared.
9145 name_save=$name
9146 libname_save=$libname
9147 release_save=$release
9148 versuffix_save=$versuffix
9149 major_save=$major
9150 # I'm not sure if I'm treating the release correctly. I think
9151 # release should show up in the -l (ie -lgmp5) so we don't want to
9152 # add it in twice. Is that correct?
9153 release=
9154 versuffix=
9155 major=
9156 newdeplibs=
9157 droppeddeps=no
9158 case $deplibs_check_method in
9159 pass_all)
9160 # Don't check for shared/static. Everything works.
9161 # This might be a little naive. We might want to check
9162 # whether the library exists or not. But this is on
9163 # osf3 & osf4 and I'm not really sure... Just
9164 # implementing what was already the behavior.
9165 newdeplibs=$deplibs
9166 ;;
9167 test_compile)
9168 # This code stresses the "libraries are programs" paradigm to its
9169 # limits. Maybe even breaks it. We compile a program, linking it
9170 # against the deplibs as a proxy for the library. Then we can check
9171 # whether they linked in statically or dynamically with ldd.
9172 $opt_dry_run || $RM conftest.c
9173 cat > conftest.c <<EOF
9174 int main() { return 0; }
9175 EOF
9176 $opt_dry_run || $RM conftest
9177 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
9178 ldd_output=`ldd conftest`
9179 for i in $deplibs; do
9180 case $i in
9181 -l*)
9182 func_stripname -l '' "$i"
9183 name=$func_stripname_result
9184 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9185 case " $predeps $postdeps " in
9186 *" $i "*)
9187 func_append newdeplibs " $i"
9188 i=
9189 ;;
9190 esac
9191 fi
9192 if test -n "$i"; then
9193 libname=`eval "\\$ECHO \"$libname_spec\""`
9194 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9195 set dummy $deplib_matches; shift
9196 deplib_match=$1
9197 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9198 func_append newdeplibs " $i"
9199 else
9200 droppeddeps=yes
9201 echo
9202 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9203 echo "*** I have the capability to make that library automatically link in when"
9204 echo "*** you link to this library. But I can only do this if you have a"
9205 echo "*** shared version of the library, which I believe you do not have"
9206 echo "*** because a test_compile did reveal that the linker did not use it for"
9207 echo "*** its dynamic dependency list that programs get resolved with at runtime."
9208 fi
9209 fi
9210 ;;
9211 *)
9212 func_append newdeplibs " $i"
9213 ;;
9214 esac
9215 done
9216 else
9217 # Error occurred in the first compile. Let's try to salvage
9218 # the situation: Compile a separate program for each library.
9219 for i in $deplibs; do
9220 case $i in
9221 -l*)
9222 func_stripname -l '' "$i"
9223 name=$func_stripname_result
9224 $opt_dry_run || $RM conftest
9225 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
9226 ldd_output=`ldd conftest`
9227 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9228 case " $predeps $postdeps " in
9229 *" $i "*)
9230 func_append newdeplibs " $i"
9231 i=
9232 ;;
9233 esac
9234 fi
9235 if test -n "$i"; then
9236 libname=`eval "\\$ECHO \"$libname_spec\""`
9237 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
9238 set dummy $deplib_matches; shift
9239 deplib_match=$1
9240 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
9241 func_append newdeplibs " $i"
9242 else
9243 droppeddeps=yes
9244 echo
9245 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
9246 echo "*** I have the capability to make that library automatically link in when"
9247 echo "*** you link to this library. But I can only do this if you have a"
9248 echo "*** shared version of the library, which you do not appear to have"
9249 echo "*** because a test_compile did reveal that the linker did not use this one"
9250 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
9251 fi
9252 fi
9253 else
9254 droppeddeps=yes
9255 echo
9256 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
9257 echo "*** make it link in! You will probably need to install it or some"
9258 echo "*** library that it depends on before this library will be fully"
9259 echo "*** functional. Installing it before continuing would be even better."
9260 fi
9261 ;;
9262 *)
9263 func_append newdeplibs " $i"
9264 ;;
9265 esac
9266 done
9267 fi
9268 ;;
9269 file_magic*)
9270 set dummy $deplibs_check_method; shift
9271 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9272 for a_deplib in $deplibs; do
9273 case $a_deplib in
9274 -l*)
9275 func_stripname -l '' "$a_deplib"
9276 name=$func_stripname_result
9277 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9278 case " $predeps $postdeps " in
9279 *" $a_deplib "*)
9280 func_append newdeplibs " $a_deplib"
9281 a_deplib=
9282 ;;
9283 esac
9284 fi
9285 if test -n "$a_deplib"; then
9286 libname=`eval "\\$ECHO \"$libname_spec\""`
9287 if test -n "$file_magic_glob"; then
9288 libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
9289 else
9290 libnameglob=$libname
9291 fi
9292 test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
9293 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9294 if test yes = "$want_nocaseglob"; then
9295 shopt -s nocaseglob
9296 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9297 $nocaseglob
9298 else
9299 potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
9300 fi
9301 for potent_lib in $potential_libs; do
9302 # Follow soft links.
9303 if ls -lLd "$potent_lib" 2>/dev/null |
9304 $GREP " -> " >/dev/null; then
9305 continue
9306 fi
9307 # The statement above tries to avoid entering an
9308 # endless loop below, in case of cyclic links.
9309 # We might still enter an endless loop, since a link
9310 # loop can be closed while we follow links,
9311 # but so what?
9312 potlib=$potent_lib
9313 while test -h "$potlib" 2>/dev/null; do
9314 potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
9315 case $potliblink in
9316 [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
9317 *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
9318 esac
9319 done
9320 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
9321 $SED -e 10q |
9322 $EGREP "$file_magic_regex" > /dev/null; then
9323 func_append newdeplibs " $a_deplib"
9324 a_deplib=
9325 break 2
9326 fi
9327 done
9328 done
9329 fi
9330 if test -n "$a_deplib"; then
9331 droppeddeps=yes
9332 echo
9333 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9334 echo "*** I have the capability to make that library automatically link in when"
9335 echo "*** you link to this library. But I can only do this if you have a"
9336 echo "*** shared version of the library, which you do not appear to have"
9337 echo "*** because I did check the linker path looking for a file starting"
9338 if test -z "$potlib"; then
9339 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
9340 else
9341 $ECHO "*** with $libname and none of the candidates passed a file format test"
9342 $ECHO "*** using a file magic. Last file checked: $potlib"
9343 fi
9344 fi
9345 ;;
9346 *)
9347 # Add a -L argument.
9348 func_append newdeplibs " $a_deplib"
9349 ;;
9350 esac
9351 done # Gone through all deplibs.
9352 ;;
9353 match_pattern*)
9354 set dummy $deplibs_check_method; shift
9355 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
9356 for a_deplib in $deplibs; do
9357 case $a_deplib in
9358 -l*)
9359 func_stripname -l '' "$a_deplib"
9360 name=$func_stripname_result
9361 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9362 case " $predeps $postdeps " in
9363 *" $a_deplib "*)
9364 func_append newdeplibs " $a_deplib"
9365 a_deplib=
9366 ;;
9367 esac
9368 fi
9369 if test -n "$a_deplib"; then
9370 libname=`eval "\\$ECHO \"$libname_spec\""`
9371 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
9372 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
9373 for potent_lib in $potential_libs; do
9374 potlib=$potent_lib # see symlink-check above in file_magic test
9375 if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
9376 $EGREP "$match_pattern_regex" > /dev/null; then
9377 func_append newdeplibs " $a_deplib"
9378 a_deplib=
9379 break 2
9380 fi
9381 done
9382 done
9383 fi
9384 if test -n "$a_deplib"; then
9385 droppeddeps=yes
9386 echo
9387 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
9388 echo "*** I have the capability to make that library automatically link in when"
9389 echo "*** you link to this library. But I can only do this if you have a"
9390 echo "*** shared version of the library, which you do not appear to have"
9391 echo "*** because I did check the linker path looking for a file starting"
9392 if test -z "$potlib"; then
9393 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
9394 else
9395 $ECHO "*** with $libname and none of the candidates passed a file format test"
9396 $ECHO "*** using a regex pattern. Last file checked: $potlib"
9397 fi
9398 fi
9399 ;;
9400 *)
9401 # Add a -L argument.
9402 func_append newdeplibs " $a_deplib"
9403 ;;
9404 esac
9405 done # Gone through all deplibs.
9406 ;;
9407 none | unknown | *)
9408 newdeplibs=
9409 tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
9410 if test yes = "$allow_libtool_libs_with_static_runtimes"; then
9411 for i in $predeps $postdeps; do
9412 # can't use Xsed below, because $i might contain '/'
9413 tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
9414 done
9415 fi
9416 case $tmp_deplibs in
9417 *[!\ \ ]*)
9418 echo
9419 if test none = "$deplibs_check_method"; then
9420 echo "*** Warning: inter-library dependencies are not supported in this platform."
9421 else
9422 echo "*** Warning: inter-library dependencies are not known to be supported."
9423 fi
9424 echo "*** All declared inter-library dependencies are being dropped."
9425 droppeddeps=yes
9426 ;;
9427 esac
9428 ;;
9429 esac
9430 versuffix=$versuffix_save
9431 major=$major_save
9432 release=$release_save
9433 libname=$libname_save
9434 name=$name_save
9435
9436 case $host in
9437 *-*-rhapsody* | *-*-darwin1.[012])
9438 # On Rhapsody replace the C library with the System framework
9439 newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
9440 ;;
9441 esac
9442
9443 if test yes = "$droppeddeps"; then
9444 if test yes = "$module"; then
9445 echo
9446 echo "*** Warning: libtool could not satisfy all declared inter-library"
9447 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
9448 echo "*** a static module, that should work as long as the dlopening"
9449 echo "*** application is linked with the -dlopen flag."
9450 if test -z "$global_symbol_pipe"; then
9451 echo
9452 echo "*** However, this would only work if libtool was able to extract symbol"
9453 echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
9454 echo "*** not find such a program. So, this module is probably useless."
9455 echo "*** 'nm' from GNU binutils and a full rebuild may help."
9456 fi
9457 if test no = "$build_old_libs"; then
9458 oldlibs=$output_objdir/$libname.$libext
9459 build_libtool_libs=module
9460 build_old_libs=yes
9461 else
9462 build_libtool_libs=no
9463 fi
9464 else
9465 echo "*** The inter-library dependencies that have been dropped here will be"
9466 echo "*** automatically added whenever a program is linked with this library"
9467 echo "*** or is declared to -dlopen it."
9468
9469 if test no = "$allow_undefined"; then
9470 echo
9471 echo "*** Since this library must not contain undefined symbols,"
9472 echo "*** because either the platform does not support them or"
9473 echo "*** it was explicitly requested with -no-undefined,"
9474 echo "*** libtool will only create a static version of it."
9475 if test no = "$build_old_libs"; then
9476 oldlibs=$output_objdir/$libname.$libext
9477 build_libtool_libs=module
9478 build_old_libs=yes
9479 else
9480 build_libtool_libs=no
9481 fi
9482 fi
9483 fi
9484 fi
9485 # Done checking deplibs!
9486 deplibs=$newdeplibs
9487 fi
9488 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
9489 case $host in
9490 *-*-darwin*)
9491 newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9492 new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9493 deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
9494 ;;
9495 esac
9496
9497 # move library search paths that coincide with paths to not yet
9498 # installed libraries to the beginning of the library search list
9499 new_libs=
9500 for path in $notinst_path; do
9501 case " $new_libs " in
9502 *" -L$path/$objdir "*) ;;
9503 *)
9504 case " $deplibs " in
9505 *" -L$path/$objdir "*)
9506 func_append new_libs " -L$path/$objdir" ;;
9507 esac
9508 ;;
9509 esac
9510 done
9511 for deplib in $deplibs; do
9512 case $deplib in
9513 -L*)
9514 case " $new_libs " in
9515 *" $deplib "*) ;;
9516 *) func_append new_libs " $deplib" ;;
9517 esac
9518 ;;
9519 *) func_append new_libs " $deplib" ;;
9520 esac
9521 done
9522 deplibs=$new_libs
9523
9524 # All the library-specific variables (install_libdir is set above).
9525 library_names=
9526 old_library=
9527 dlname=
9528
9529 # Test again, we may have decided not to build it any more
9530 if test yes = "$build_libtool_libs"; then
9531 # Remove $wl instances when linking with ld.
9532 # FIXME: should test the right _cmds variable.
9533 case $archive_cmds in
9534 *\$LD\ *) wl= ;;
9535 esac
9536 if test yes = "$hardcode_into_libs"; then
9537 # Hardcode the library paths
9538 hardcode_libdirs=
9539 dep_rpath=
9540 rpath=$finalize_rpath
9541 test relink = "$opt_mode" || rpath=$compile_rpath$rpath
9542 for libdir in $rpath; do
9543 if test -n "$hardcode_libdir_flag_spec"; then
9544 if test -n "$hardcode_libdir_separator"; then
9545 func_replace_sysroot "$libdir"
9546 libdir=$func_replace_sysroot_result
9547 if test -z "$hardcode_libdirs"; then
9548 hardcode_libdirs=$libdir
9549 else
9550 # Just accumulate the unique libdirs.
9551 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
9552 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
9553 ;;
9554 *)
9555 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
9556 ;;
9557 esac
9558 fi
9559 else
9560 eval flag=\"$hardcode_libdir_flag_spec\"
9561 func_append dep_rpath " $flag"
9562 fi
9563 elif test -n "$runpath_var"; then
9564 case "$perm_rpath " in
9565 *" $libdir "*) ;;
9566 *) func_append perm_rpath " $libdir" ;;
9567 esac
9568 fi
9569 done
9570 # Substitute the hardcoded libdirs into the rpath.
9571 if test -n "$hardcode_libdir_separator" &&
9572 test -n "$hardcode_libdirs"; then
9573 libdir=$hardcode_libdirs
9574 eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
9575 fi
9576 if test -n "$runpath_var" && test -n "$perm_rpath"; then
9577 # We should set the runpath_var.
9578 rpath=
9579 for dir in $perm_rpath; do
9580 func_append rpath "$dir:"
9581 done
9582 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
9583 fi
9584 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
9585 fi
9586
9587 shlibpath=$finalize_shlibpath
9588 test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
9589 if test -n "$shlibpath"; then
9590 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
9591 fi
9592
9593 # Get the real and link names of the library.
9594 eval shared_ext=\"$shrext_cmds\"
9595 eval library_names=\"$library_names_spec\"
9596 set dummy $library_names
9597 shift
9598 realname=$1
9599 shift
9600
9601 if test -n "$soname_spec"; then
9602 eval soname=\"$soname_spec\"
9603 else
9604 soname=$realname
9605 fi
9606 if test -z "$dlname"; then
9607 dlname=$soname
9608 fi
9609
9610 lib=$output_objdir/$realname
9611 linknames=
9612 for link
9613 do
9614 func_append linknames " $link"
9615 done
9616
9617 # Use standard objects if they are pic
9618 test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
9619 test "X$libobjs" = "X " && libobjs=
9620
9621 delfiles=
9622 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9623 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
9624 export_symbols=$output_objdir/$libname.uexp
9625 func_append delfiles " $export_symbols"
9626 fi
9627
9628 orig_export_symbols=
9629 case $host_os in
9630 cygwin* | mingw* | cegcc*)
9631 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
9632 # exporting using user supplied symfile
9633 func_dll_def_p "$export_symbols" || {
9634 # and it's NOT already a .def file. Must figure out
9635 # which of the given symbols are data symbols and tag
9636 # them as such. So, trigger use of export_symbols_cmds.
9637 # export_symbols gets reassigned inside the "prepare
9638 # the list of exported symbols" if statement, so the
9639 # include_expsyms logic still works.
9640 orig_export_symbols=$export_symbols
9641 export_symbols=
9642 always_export_symbols=yes
9643 }
9644 fi
9645 ;;
9646 esac
9647
9648 # Prepare the list of exported symbols
9649 if test -z "$export_symbols"; then
9650 if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
9651 func_verbose "generating symbol list for '$libname.la'"
9652 export_symbols=$output_objdir/$libname.exp
9653 $opt_dry_run || $RM $export_symbols
9654 cmds=$export_symbols_cmds
9655 save_ifs=$IFS; IFS='~'
9656 for cmd1 in $cmds; do
9657 IFS=$save_ifs
9658 # Take the normal branch if the nm_file_list_spec branch
9659 # doesn't work or if tool conversion is not needed.
9660 case $nm_file_list_spec~$to_tool_file_cmd in
9661 *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
9662 try_normal_branch=yes
9663 eval cmd=\"$cmd1\"
9664 func_len " $cmd"
9665 len=$func_len_result
9666 ;;
9667 *)
9668 try_normal_branch=no
9669 ;;
9670 esac
9671 if test yes = "$try_normal_branch" \
9672 && { test "$len" -lt "$max_cmd_len" \
9673 || test "$max_cmd_len" -le -1; }
9674 then
9675 func_show_eval "$cmd" 'exit $?'
9676 skipped_export=false
9677 elif test -n "$nm_file_list_spec"; then
9678 func_basename "$output"
9679 output_la=$func_basename_result
9680 save_libobjs=$libobjs
9681 save_output=$output
9682 output=$output_objdir/$output_la.nm
9683 func_to_tool_file "$output"
9684 libobjs=$nm_file_list_spec$func_to_tool_file_result
9685 func_append delfiles " $output"
9686 func_verbose "creating $NM input file list: $output"
9687 for obj in $save_libobjs; do
9688 func_to_tool_file "$obj"
9689 $ECHO "$func_to_tool_file_result"
9690 done > "$output"
9691 eval cmd=\"$cmd1\"
9692 func_show_eval "$cmd" 'exit $?'
9693 output=$save_output
9694 libobjs=$save_libobjs
9695 skipped_export=false
9696 else
9697 # The command line is too long to execute in one step.
9698 func_verbose "using reloadable object file for export list..."
9699 skipped_export=:
9700 # Break out early, otherwise skipped_export may be
9701 # set to false by a later but shorter cmd.
9702 break
9703 fi
9704 done
9705 IFS=$save_ifs
9706 if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
9707 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
9708 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
9709 fi
9710 fi
9711 fi
9712
9713 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9714 tmp_export_symbols=$export_symbols
9715 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
9716 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
9717 fi
9718
9719 if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
9720 # The given exports_symbols file has to be filtered, so filter it.
9721 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
9722 # FIXME: $output_objdir/$libname.filter potentially contains lots of
9723 # 's' commands, which not all seds can handle. GNU sed should be fine
9724 # though. Also, the filter scales superlinearly with the number of
9725 # global variables. join(1) would be nice here, but unfortunately
9726 # isn't a blessed tool.
9727 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
9728 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
9729 export_symbols=$output_objdir/$libname.def
9730 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
9731 fi
9732
9733 tmp_deplibs=
9734 for test_deplib in $deplibs; do
9735 case " $convenience " in
9736 *" $test_deplib "*) ;;
9737 *)
9738 func_append tmp_deplibs " $test_deplib"
9739 ;;
9740 esac
9741 done
9742 deplibs=$tmp_deplibs
9743
9744 if test -n "$convenience"; then
9745 if test -n "$whole_archive_flag_spec" &&
9746 test yes = "$compiler_needs_object" &&
9747 test -z "$libobjs"; then
9748 # extract the archives, so we have objects to list.
9749 # TODO: could optimize this to just extract one archive.
9750 whole_archive_flag_spec=
9751 fi
9752 if test -n "$whole_archive_flag_spec"; then
9753 save_libobjs=$libobjs
9754 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
9755 test "X$libobjs" = "X " && libobjs=
9756 else
9757 gentop=$output_objdir/${outputname}x
9758 func_append generated " $gentop"
9759
9760 func_extract_archives $gentop $convenience
9761 func_append libobjs " $func_extract_archives_result"
9762 test "X$libobjs" = "X " && libobjs=
9763 fi
9764 fi
9765
9766 if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
9767 eval flag=\"$thread_safe_flag_spec\"
9768 func_append linker_flags " $flag"
9769 fi
9770
9771 # Make a backup of the uninstalled library when relinking
9772 if test relink = "$opt_mode"; then
9773 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
9774 fi
9775
9776 # Do each of the archive commands.
9777 if test yes = "$module" && test -n "$module_cmds"; then
9778 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
9779 eval test_cmds=\"$module_expsym_cmds\"
9780 cmds=$module_expsym_cmds
9781 else
9782 eval test_cmds=\"$module_cmds\"
9783 cmds=$module_cmds
9784 fi
9785 else
9786 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
9787 eval test_cmds=\"$archive_expsym_cmds\"
9788 cmds=$archive_expsym_cmds
9789 else
9790 eval test_cmds=\"$archive_cmds\"
9791 cmds=$archive_cmds
9792 fi
9793 fi
9794
9795 if test : != "$skipped_export" &&
9796 func_len " $test_cmds" &&
9797 len=$func_len_result &&
9798 test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
9799 :
9800 else
9801 # The command line is too long to link in one step, link piecewise
9802 # or, if using GNU ld and skipped_export is not :, use a linker
9803 # script.
9804
9805 # Save the value of $output and $libobjs because we want to
9806 # use them later. If we have whole_archive_flag_spec, we
9807 # want to use save_libobjs as it was before
9808 # whole_archive_flag_spec was expanded, because we can't
9809 # assume the linker understands whole_archive_flag_spec.
9810 # This may have to be revisited, in case too many
9811 # convenience libraries get linked in and end up exceeding
9812 # the spec.
9813 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
9814 save_libobjs=$libobjs
9815 fi
9816 save_output=$output
9817 func_basename "$output"
9818 output_la=$func_basename_result
9819
9820 # Clear the reloadable object creation command queue and
9821 # initialize k to one.
9822 test_cmds=
9823 concat_cmds=
9824 objlist=
9825 last_robj=
9826 k=1
9827
9828 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
9829 output=$output_objdir/$output_la.lnkscript
9830 func_verbose "creating GNU ld script: $output"
9831 echo 'INPUT (' > $output
9832 for obj in $save_libobjs
9833 do
9834 func_to_tool_file "$obj"
9835 $ECHO "$func_to_tool_file_result" >> $output
9836 done
9837 echo ')' >> $output
9838 func_append delfiles " $output"
9839 func_to_tool_file "$output"
9840 output=$func_to_tool_file_result
9841 elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
9842 output=$output_objdir/$output_la.lnk
9843 func_verbose "creating linker input file list: $output"
9844 : > $output
9845 set x $save_libobjs
9846 shift
9847 firstobj=
9848 if test yes = "$compiler_needs_object"; then
9849 firstobj="$1 "
9850 shift
9851 fi
9852 for obj
9853 do
9854 func_to_tool_file "$obj"
9855 $ECHO "$func_to_tool_file_result" >> $output
9856 done
9857 func_append delfiles " $output"
9858 func_to_tool_file "$output"
9859 output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
9860 else
9861 if test -n "$save_libobjs"; then
9862 func_verbose "creating reloadable object files..."
9863 output=$output_objdir/$output_la-$k.$objext
9864 eval test_cmds=\"$reload_cmds\"
9865 func_len " $test_cmds"
9866 len0=$func_len_result
9867 len=$len0
9868
9869 # Loop over the list of objects to be linked.
9870 for obj in $save_libobjs
9871 do
9872 func_len " $obj"
9873 func_arith $len + $func_len_result
9874 len=$func_arith_result
9875 if test -z "$objlist" ||
9876 test "$len" -lt "$max_cmd_len"; then
9877 func_append objlist " $obj"
9878 else
9879 # The command $test_cmds is almost too long, add a
9880 # command to the queue.
9881 if test 1 -eq "$k"; then
9882 # The first file doesn't have a previous command to add.
9883 reload_objs=$objlist
9884 eval concat_cmds=\"$reload_cmds\"
9885 else
9886 # All subsequent reloadable object files will link in
9887 # the last one created.
9888 reload_objs="$objlist $last_robj"
9889 eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
9890 fi
9891 last_robj=$output_objdir/$output_la-$k.$objext
9892 func_arith $k + 1
9893 k=$func_arith_result
9894 output=$output_objdir/$output_la-$k.$objext
9895 objlist=" $obj"
9896 func_len " $last_robj"
9897 func_arith $len0 + $func_len_result
9898 len=$func_arith_result
9899 fi
9900 done
9901 # Handle the remaining objects by creating one last
9902 # reloadable object file. All subsequent reloadable object
9903 # files will link in the last one created.
9904 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9905 reload_objs="$objlist $last_robj"
9906 eval concat_cmds=\"\$concat_cmds$reload_cmds\"
9907 if test -n "$last_robj"; then
9908 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
9909 fi
9910 func_append delfiles " $output"
9911
9912 else
9913 output=
9914 fi
9915
9916 ${skipped_export-false} && {
9917 func_verbose "generating symbol list for '$libname.la'"
9918 export_symbols=$output_objdir/$libname.exp
9919 $opt_dry_run || $RM $export_symbols
9920 libobjs=$output
9921 # Append the command to create the export file.
9922 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
9923 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
9924 if test -n "$last_robj"; then
9925 eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
9926 fi
9927 }
9928
9929 test -n "$save_libobjs" &&
9930 func_verbose "creating a temporary reloadable object file: $output"
9931
9932 # Loop through the commands generated above and execute them.
9933 save_ifs=$IFS; IFS='~'
9934 for cmd in $concat_cmds; do
9935 IFS=$save_ifs
9936 $opt_quiet || {
9937 func_quote_for_expand "$cmd"
9938 eval "func_echo $func_quote_for_expand_result"
9939 }
9940 $opt_dry_run || eval "$cmd" || {
9941 lt_exit=$?
9942
9943 # Restore the uninstalled library and exit
9944 if test relink = "$opt_mode"; then
9945 ( cd "$output_objdir" && \
9946 $RM "${realname}T" && \
9947 $MV "${realname}U" "$realname" )
9948 fi
9949
9950 exit $lt_exit
9951 }
9952 done
9953 IFS=$save_ifs
9954
9955 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
9956 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
9957 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
9958 fi
9959 fi
9960
9961 ${skipped_export-false} && {
9962 if test -n "$export_symbols" && test -n "$include_expsyms"; then
9963 tmp_export_symbols=$export_symbols
9964 test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
9965 $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
9966 fi
9967
9968 if test -n "$orig_export_symbols"; then
9969 # The given exports_symbols file has to be filtered, so filter it.
9970 func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
9971 # FIXME: $output_objdir/$libname.filter potentially contains lots of
9972 # 's' commands, which not all seds can handle. GNU sed should be fine
9973 # though. Also, the filter scales superlinearly with the number of
9974 # global variables. join(1) would be nice here, but unfortunately
9975 # isn't a blessed tool.
9976 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
9977 func_append delfiles " $export_symbols $output_objdir/$libname.filter"
9978 export_symbols=$output_objdir/$libname.def
9979 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
9980 fi
9981 }
9982
9983 libobjs=$output
9984 # Restore the value of output.
9985 output=$save_output
9986
9987 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
9988 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
9989 test "X$libobjs" = "X " && libobjs=
9990 fi
9991 # Expand the library linking commands again to reset the
9992 # value of $libobjs for piecewise linking.
9993
9994 # Do each of the archive commands.
9995 if test yes = "$module" && test -n "$module_cmds"; then
9996 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
9997 cmds=$module_expsym_cmds
9998 else
9999 cmds=$module_cmds
10000 fi
10001 else
10002 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
10003 cmds=$archive_expsym_cmds
10004 else
10005 cmds=$archive_cmds
10006 fi
10007 fi
10008 fi
10009
10010 if test -n "$delfiles"; then
10011 # Append the command to remove temporary files to $cmds.
10012 eval cmds=\"\$cmds~\$RM $delfiles\"
10013 fi
10014
10015 # Add any objects from preloaded convenience libraries
10016 if test -n "$dlprefiles"; then
10017 gentop=$output_objdir/${outputname}x
10018 func_append generated " $gentop"
10019
10020 func_extract_archives $gentop $dlprefiles
10021 func_append libobjs " $func_extract_archives_result"
10022 test "X$libobjs" = "X " && libobjs=
10023 fi
10024
10025 save_ifs=$IFS; IFS='~'
10026 for cmd in $cmds; do
10027 IFS=$sp$nl
10028 eval cmd=\"$cmd\"
10029 IFS=$save_ifs
10030 $opt_quiet || {
10031 func_quote_for_expand "$cmd"
10032 eval "func_echo $func_quote_for_expand_result"
10033 }
10034 $opt_dry_run || eval "$cmd" || {
10035 lt_exit=$?
10036
10037 # Restore the uninstalled library and exit
10038 if test relink = "$opt_mode"; then
10039 ( cd "$output_objdir" && \
10040 $RM "${realname}T" && \
10041 $MV "${realname}U" "$realname" )
10042 fi
10043
10044 exit $lt_exit
10045 }
10046 done
10047 IFS=$save_ifs
10048
10049 # Restore the uninstalled library and exit
10050 if test relink = "$opt_mode"; then
10051 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
10052
10053 if test -n "$convenience"; then
10054 if test -z "$whole_archive_flag_spec"; then
10055 func_show_eval '${RM}r "$gentop"'
10056 fi
10057 fi
10058
10059 exit $EXIT_SUCCESS
10060 fi
10061
10062 # Create links to the real library.
10063 for linkname in $linknames; do
10064 if test "$realname" != "$linkname"; then
10065 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
10066 fi
10067 done
10068
10069 # If -module or -export-dynamic was specified, set the dlname.
10070 if test yes = "$module" || test yes = "$export_dynamic"; then
10071 # On all known operating systems, these are identical.
10072 dlname=$soname
10073 fi
10074 fi
10075 ;;
10076
10077 obj)
10078 if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
10079 func_warning "'-dlopen' is ignored for objects"
10080 fi
10081
10082 case " $deplibs" in
10083 *\ -l* | *\ -L*)
10084 func_warning "'-l' and '-L' are ignored for objects" ;;
10085 esac
10086
10087 test -n "$rpath" && \
10088 func_warning "'-rpath' is ignored for objects"
10089
10090 test -n "$xrpath" && \
10091 func_warning "'-R' is ignored for objects"
10092
10093 test -n "$vinfo" && \
10094 func_warning "'-version-info' is ignored for objects"
10095
10096 test -n "$release" && \
10097 func_warning "'-release' is ignored for objects"
10098
10099 case $output in
10100 *.lo)
10101 test -n "$objs$old_deplibs" && \
10102 func_fatal_error "cannot build library object '$output' from non-libtool objects"
10103
10104 libobj=$output
10105 func_lo2o "$libobj"
10106 obj=$func_lo2o_result
10107 ;;
10108 *)
10109 libobj=
10110 obj=$output
10111 ;;
10112 esac
10113
10114 # Delete the old objects.
10115 $opt_dry_run || $RM $obj $libobj
10116
10117 # Objects from convenience libraries. This assumes
10118 # single-version convenience libraries. Whenever we create
10119 # different ones for PIC/non-PIC, this we'll have to duplicate
10120 # the extraction.
10121 reload_conv_objs=
10122 gentop=
10123 # if reload_cmds runs $LD directly, get rid of -Wl from
10124 # whole_archive_flag_spec and hope we can get by with turning comma
10125 # into space.
10126 case $reload_cmds in
10127 *\$LD[\ \$]*) wl= ;;
10128 esac
10129 if test -n "$convenience"; then
10130 if test -n "$whole_archive_flag_spec"; then
10131 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
10132 test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
10133 reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
10134 else
10135 gentop=$output_objdir/${obj}x
10136 func_append generated " $gentop"
10137
10138 func_extract_archives $gentop $convenience
10139 reload_conv_objs="$reload_objs $func_extract_archives_result"
10140 fi
10141 fi
10142
10143 # If we're not building shared, we need to use non_pic_objs
10144 test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
10145
10146 # Create the old-style object.
10147 reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
10148
10149 output=$obj
10150 func_execute_cmds "$reload_cmds" 'exit $?'
10151
10152 # Exit if we aren't doing a library object file.
10153 if test -z "$libobj"; then
10154 if test -n "$gentop"; then
10155 func_show_eval '${RM}r "$gentop"'
10156 fi
10157
10158 exit $EXIT_SUCCESS
10159 fi
10160
10161 test yes = "$build_libtool_libs" || {
10162 if test -n "$gentop"; then
10163 func_show_eval '${RM}r "$gentop"'
10164 fi
10165
10166 # Create an invalid libtool object if no PIC, so that we don't
10167 # accidentally link it into a program.
10168 # $show "echo timestamp > $libobj"
10169 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
10170 exit $EXIT_SUCCESS
10171 }
10172
10173 if test -n "$pic_flag" || test default != "$pic_mode"; then
10174 # Only do commands if we really have different PIC objects.
10175 reload_objs="$libobjs $reload_conv_objs"
10176 output=$libobj
10177 func_execute_cmds "$reload_cmds" 'exit $?'
10178 fi
10179
10180 if test -n "$gentop"; then
10181 func_show_eval '${RM}r "$gentop"'
10182 fi
10183
10184 exit $EXIT_SUCCESS
10185 ;;
10186
10187 prog)
10188 case $host in
10189 *cygwin*) func_stripname '' '.exe' "$output"
10190 output=$func_stripname_result.exe;;
10191 esac
10192 test -n "$vinfo" && \
10193 func_warning "'-version-info' is ignored for programs"
10194
10195 test -n "$release" && \
10196 func_warning "'-release' is ignored for programs"
10197
10198 $preload \
10199 && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
10200 && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
10201
10202 case $host in
10203 *-*-rhapsody* | *-*-darwin1.[012])
10204 # On Rhapsody replace the C library is the System framework
10205 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
10206 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
10207 ;;
10208 esac
10209
10210 case $host in
10211 *-*-darwin*)
10212 # Don't allow lazy linking, it breaks C++ global constructors
10213 # But is supposedly fixed on 10.4 or later (yay!).
10214 if test CXX = "$tagname"; then
10215 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
10216 10.[0123])
10217 func_append compile_command " $wl-bind_at_load"
10218 func_append finalize_command " $wl-bind_at_load"
10219 ;;
10220 esac
10221 fi
10222 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
10223 compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10224 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
10225 ;;
10226 esac
10227
10228
10229 # move library search paths that coincide with paths to not yet
10230 # installed libraries to the beginning of the library search list
10231 new_libs=
10232 for path in $notinst_path; do
10233 case " $new_libs " in
10234 *" -L$path/$objdir "*) ;;
10235 *)
10236 case " $compile_deplibs " in
10237 *" -L$path/$objdir "*)
10238 func_append new_libs " -L$path/$objdir" ;;
10239 esac
10240 ;;
10241 esac
10242 done
10243 for deplib in $compile_deplibs; do
10244 case $deplib in
10245 -L*)
10246 case " $new_libs " in
10247 *" $deplib "*) ;;
10248 *) func_append new_libs " $deplib" ;;
10249 esac
10250 ;;
10251 *) func_append new_libs " $deplib" ;;
10252 esac
10253 done
10254 compile_deplibs=$new_libs
10255
10256
10257 func_append compile_command " $compile_deplibs"
10258 func_append finalize_command " $finalize_deplibs"
10259
10260 if test -n "$rpath$xrpath"; then
10261 # If the user specified any rpath flags, then add them.
10262 for libdir in $rpath $xrpath; do
10263 # This is the magic to use -rpath.
10264 case "$finalize_rpath " in
10265 *" $libdir "*) ;;
10266 *) func_append finalize_rpath " $libdir" ;;
10267 esac
10268 done
10269 fi
10270
10271 # Now hardcode the library paths
10272 rpath=
10273 hardcode_libdirs=
10274 for libdir in $compile_rpath $finalize_rpath; do
10275 if test -n "$hardcode_libdir_flag_spec"; then
10276 if test -n "$hardcode_libdir_separator"; then
10277 if test -z "$hardcode_libdirs"; then
10278 hardcode_libdirs=$libdir
10279 else
10280 # Just accumulate the unique libdirs.
10281 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10282 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10283 ;;
10284 *)
10285 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10286 ;;
10287 esac
10288 fi
10289 else
10290 eval flag=\"$hardcode_libdir_flag_spec\"
10291 func_append rpath " $flag"
10292 fi
10293 elif test -n "$runpath_var"; then
10294 case "$perm_rpath " in
10295 *" $libdir "*) ;;
10296 *) func_append perm_rpath " $libdir" ;;
10297 esac
10298 fi
10299 case $host in
10300 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
10301 testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
10302 case :$dllsearchpath: in
10303 *":$libdir:"*) ;;
10304 ::) dllsearchpath=$libdir;;
10305 *) func_append dllsearchpath ":$libdir";;
10306 esac
10307 case :$dllsearchpath: in
10308 *":$testbindir:"*) ;;
10309 ::) dllsearchpath=$testbindir;;
10310 *) func_append dllsearchpath ":$testbindir";;
10311 esac
10312 ;;
10313 esac
10314 done
10315 # Substitute the hardcoded libdirs into the rpath.
10316 if test -n "$hardcode_libdir_separator" &&
10317 test -n "$hardcode_libdirs"; then
10318 libdir=$hardcode_libdirs
10319 eval rpath=\" $hardcode_libdir_flag_spec\"
10320 fi
10321 compile_rpath=$rpath
10322
10323 rpath=
10324 hardcode_libdirs=
10325 for libdir in $finalize_rpath; do
10326 if test -n "$hardcode_libdir_flag_spec"; then
10327 if test -n "$hardcode_libdir_separator"; then
10328 if test -z "$hardcode_libdirs"; then
10329 hardcode_libdirs=$libdir
10330 else
10331 # Just accumulate the unique libdirs.
10332 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
10333 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
10334 ;;
10335 *)
10336 func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
10337 ;;
10338 esac
10339 fi
10340 else
10341 eval flag=\"$hardcode_libdir_flag_spec\"
10342 func_append rpath " $flag"
10343 fi
10344 elif test -n "$runpath_var"; then
10345 case "$finalize_perm_rpath " in
10346 *" $libdir "*) ;;
10347 *) func_append finalize_perm_rpath " $libdir" ;;
10348 esac
10349 fi
10350 done
10351 # Substitute the hardcoded libdirs into the rpath.
10352 if test -n "$hardcode_libdir_separator" &&
10353 test -n "$hardcode_libdirs"; then
10354 libdir=$hardcode_libdirs
10355 eval rpath=\" $hardcode_libdir_flag_spec\"
10356 fi
10357 finalize_rpath=$rpath
10358
10359 if test -n "$libobjs" && test yes = "$build_old_libs"; then
10360 # Transform all the library objects into standard objects.
10361 compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10362 finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
10363 fi
10364
10365 func_generate_dlsyms "$outputname" "@PROGRAM@" false
10366
10367 # template prelinking step
10368 if test -n "$prelink_cmds"; then
10369 func_execute_cmds "$prelink_cmds" 'exit $?'
10370 fi
10371
10372 wrappers_required=:
10373 case $host in
10374 *cegcc* | *mingw32ce*)
10375 # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
10376 wrappers_required=false
10377 ;;
10378 *cygwin* | *mingw* )
10379 test yes = "$build_libtool_libs" || wrappers_required=false
10380 ;;
10381 *)
10382 if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
10383 wrappers_required=false
10384 fi
10385 ;;
10386 esac
10387 $wrappers_required || {
10388 # Replace the output file specification.
10389 compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10390 link_command=$compile_command$compile_rpath
10391
10392 # We have no uninstalled library dependencies, so finalize right now.
10393 exit_status=0
10394 func_show_eval "$link_command" 'exit_status=$?'
10395
10396 if test -n "$postlink_cmds"; then
10397 func_to_tool_file "$output"
10398 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10399 func_execute_cmds "$postlink_cmds" 'exit $?'
10400 fi
10401
10402 # Delete the generated files.
10403 if test -f "$output_objdir/${outputname}S.$objext"; then
10404 func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
10405 fi
10406
10407 exit $exit_status
10408 }
10409
10410 if test -n "$compile_shlibpath$finalize_shlibpath"; then
10411 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
10412 fi
10413 if test -n "$finalize_shlibpath"; then
10414 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
10415 fi
10416
10417 compile_var=
10418 finalize_var=
10419 if test -n "$runpath_var"; then
10420 if test -n "$perm_rpath"; then
10421 # We should set the runpath_var.
10422 rpath=
10423 for dir in $perm_rpath; do
10424 func_append rpath "$dir:"
10425 done
10426 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
10427 fi
10428 if test -n "$finalize_perm_rpath"; then
10429 # We should set the runpath_var.
10430 rpath=
10431 for dir in $finalize_perm_rpath; do
10432 func_append rpath "$dir:"
10433 done
10434 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
10435 fi
10436 fi
10437
10438 if test yes = "$no_install"; then
10439 # We don't need to create a wrapper script.
10440 link_command=$compile_var$compile_command$compile_rpath
10441 # Replace the output file specification.
10442 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
10443 # Delete the old output file.
10444 $opt_dry_run || $RM $output
10445 # Link the executable and exit
10446 func_show_eval "$link_command" 'exit $?'
10447
10448 if test -n "$postlink_cmds"; then
10449 func_to_tool_file "$output"
10450 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10451 func_execute_cmds "$postlink_cmds" 'exit $?'
10452 fi
10453
10454 exit $EXIT_SUCCESS
10455 fi
10456
10457 case $hardcode_action,$fast_install in
10458 relink,*)
10459 # Fast installation is not supported
10460 link_command=$compile_var$compile_command$compile_rpath
10461 relink_command=$finalize_var$finalize_command$finalize_rpath
10462
10463 func_warning "this platform does not like uninstalled shared libraries"
10464 func_warning "'$output' will be relinked during installation"
10465 ;;
10466 *,yes)
10467 link_command=$finalize_var$compile_command$finalize_rpath
10468 relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
10469 ;;
10470 *,no)
10471 link_command=$compile_var$compile_command$compile_rpath
10472 relink_command=$finalize_var$finalize_command$finalize_rpath
10473 ;;
10474 *,needless)
10475 link_command=$finalize_var$compile_command$finalize_rpath
10476 relink_command=
10477 ;;
10478 esac
10479
10480 # Replace the output file specification.
10481 link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
10482
10483 # Delete the old output files.
10484 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
10485
10486 func_show_eval "$link_command" 'exit $?'
10487
10488 if test -n "$postlink_cmds"; then
10489 func_to_tool_file "$output_objdir/$outputname"
10490 postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
10491 func_execute_cmds "$postlink_cmds" 'exit $?'
10492 fi
10493
10494 # Now create the wrapper script.
10495 func_verbose "creating $output"
10496
10497 # Quote the relink command for shipping.
10498 if test -n "$relink_command"; then
10499 # Preserve any variables that may affect compiler behavior
10500 for var in $variables_saved_for_relink; do
10501 if eval test -z \"\${$var+set}\"; then
10502 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10503 elif eval var_value=\$$var; test -z "$var_value"; then
10504 relink_command="$var=; export $var; $relink_command"
10505 else
10506 func_quote_for_eval "$var_value"
10507 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
10508 fi
10509 done
10510 relink_command="(cd `pwd`; $relink_command)"
10511 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
10512 fi
10513
10514 # Only actually do things if not in dry run mode.
10515 $opt_dry_run || {
10516 # win32 will think the script is a binary if it has
10517 # a .exe suffix, so we strip it off here.
10518 case $output in
10519 *.exe) func_stripname '' '.exe' "$output"
10520 output=$func_stripname_result ;;
10521 esac
10522 # test for cygwin because mv fails w/o .exe extensions
10523 case $host in
10524 *cygwin*)
10525 exeext=.exe
10526 func_stripname '' '.exe' "$outputname"
10527 outputname=$func_stripname_result ;;
10528 *) exeext= ;;
10529 esac
10530 case $host in
10531 *cygwin* | *mingw* )
10532 func_dirname_and_basename "$output" "" "."
10533 output_name=$func_basename_result
10534 output_path=$func_dirname_result
10535 cwrappersource=$output_path/$objdir/lt-$output_name.c
10536 cwrapper=$output_path/$output_name.exe
10537 $RM $cwrappersource $cwrapper
10538 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
10539
10540 func_emit_cwrapperexe_src > $cwrappersource
10541
10542 # The wrapper executable is built using the $host compiler,
10543 # because it contains $host paths and files. If cross-
10544 # compiling, it, like the target executable, must be
10545 # executed on the $host or under an emulation environment.
10546 $opt_dry_run || {
10547 $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
10548 $STRIP $cwrapper
10549 }
10550
10551 # Now, create the wrapper script for func_source use:
10552 func_ltwrapper_scriptname $cwrapper
10553 $RM $func_ltwrapper_scriptname_result
10554 trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
10555 $opt_dry_run || {
10556 # note: this script will not be executed, so do not chmod.
10557 if test "x$build" = "x$host"; then
10558 $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
10559 else
10560 func_emit_wrapper no > $func_ltwrapper_scriptname_result
10561 fi
10562 }
10563 ;;
10564 * )
10565 $RM $output
10566 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
10567
10568 func_emit_wrapper no > $output
10569 chmod +x $output
10570 ;;
10571 esac
10572 }
10573 exit $EXIT_SUCCESS
10574 ;;
10575 esac
10576
10577 # See if we need to build an old-fashioned archive.
10578 for oldlib in $oldlibs; do
10579
10580 case $build_libtool_libs in
10581 convenience)
10582 oldobjs="$libobjs_save $symfileobj"
10583 addlibs=$convenience
10584 build_libtool_libs=no
10585 ;;
10586 module)
10587 oldobjs=$libobjs_save
10588 addlibs=$old_convenience
10589 build_libtool_libs=no
10590 ;;
10591 *)
10592 oldobjs="$old_deplibs $non_pic_objects"
10593 $preload && test -f "$symfileobj" \
10594 && func_append oldobjs " $symfileobj"
10595 addlibs=$old_convenience
10596 ;;
10597 esac
10598
10599 if test -n "$addlibs"; then
10600 gentop=$output_objdir/${outputname}x
10601 func_append generated " $gentop"
10602
10603 func_extract_archives $gentop $addlibs
10604 func_append oldobjs " $func_extract_archives_result"
10605 fi
10606
10607 # Do each command in the archive commands.
10608 if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
10609 cmds=$old_archive_from_new_cmds
10610 else
10611
10612 # Add any objects from preloaded convenience libraries
10613 if test -n "$dlprefiles"; then
10614 gentop=$output_objdir/${outputname}x
10615 func_append generated " $gentop"
10616
10617 func_extract_archives $gentop $dlprefiles
10618 func_append oldobjs " $func_extract_archives_result"
10619 fi
10620
10621 # POSIX demands no paths to be encoded in archives. We have
10622 # to avoid creating archives with duplicate basenames if we
10623 # might have to extract them afterwards, e.g., when creating a
10624 # static archive out of a convenience library, or when linking
10625 # the entirety of a libtool archive into another (currently
10626 # not supported by libtool).
10627 if (for obj in $oldobjs
10628 do
10629 func_basename "$obj"
10630 $ECHO "$func_basename_result"
10631 done | sort | sort -uc >/dev/null 2>&1); then
10632 :
10633 else
10634 echo "copying selected object files to avoid basename conflicts..."
10635 gentop=$output_objdir/${outputname}x
10636 func_append generated " $gentop"
10637 func_mkdir_p "$gentop"
10638 save_oldobjs=$oldobjs
10639 oldobjs=
10640 counter=1
10641 for obj in $save_oldobjs
10642 do
10643 func_basename "$obj"
10644 objbase=$func_basename_result
10645 case " $oldobjs " in
10646 " ") oldobjs=$obj ;;
10647 *[\ /]"$objbase "*)
10648 while :; do
10649 # Make sure we don't pick an alternate name that also
10650 # overlaps.
10651 newobj=lt$counter-$objbase
10652 func_arith $counter + 1
10653 counter=$func_arith_result
10654 case " $oldobjs " in
10655 *[\ /]"$newobj "*) ;;
10656 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
10657 esac
10658 done
10659 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
10660 func_append oldobjs " $gentop/$newobj"
10661 ;;
10662 *) func_append oldobjs " $obj" ;;
10663 esac
10664 done
10665 fi
10666 func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
10667 tool_oldlib=$func_to_tool_file_result
10668 eval cmds=\"$old_archive_cmds\"
10669
10670 func_len " $cmds"
10671 len=$func_len_result
10672 if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
10673 cmds=$old_archive_cmds
10674 elif test -n "$archiver_list_spec"; then
10675 func_verbose "using command file archive linking..."
10676 for obj in $oldobjs
10677 do
10678 func_to_tool_file "$obj"
10679 $ECHO "$func_to_tool_file_result"
10680 done > $output_objdir/$libname.libcmd
10681 func_to_tool_file "$output_objdir/$libname.libcmd"
10682 oldobjs=" $archiver_list_spec$func_to_tool_file_result"
10683 cmds=$old_archive_cmds
10684 else
10685 # the command line is too long to link in one step, link in parts
10686 func_verbose "using piecewise archive linking..."
10687 save_RANLIB=$RANLIB
10688 RANLIB=:
10689 objlist=
10690 concat_cmds=
10691 save_oldobjs=$oldobjs
10692 oldobjs=
10693 # Is there a better way of finding the last object in the list?
10694 for obj in $save_oldobjs
10695 do
10696 last_oldobj=$obj
10697 done
10698 eval test_cmds=\"$old_archive_cmds\"
10699 func_len " $test_cmds"
10700 len0=$func_len_result
10701 len=$len0
10702 for obj in $save_oldobjs
10703 do
10704 func_len " $obj"
10705 func_arith $len + $func_len_result
10706 len=$func_arith_result
10707 func_append objlist " $obj"
10708 if test "$len" -lt "$max_cmd_len"; then
10709 :
10710 else
10711 # the above command should be used before it gets too long
10712 oldobjs=$objlist
10713 if test "$obj" = "$last_oldobj"; then
10714 RANLIB=$save_RANLIB
10715 fi
10716 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
10717 eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
10718 objlist=
10719 len=$len0
10720 fi
10721 done
10722 RANLIB=$save_RANLIB
10723 oldobjs=$objlist
10724 if test -z "$oldobjs"; then
10725 eval cmds=\"\$concat_cmds\"
10726 else
10727 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
10728 fi
10729 fi
10730 fi
10731 func_execute_cmds "$cmds" 'exit $?'
10732 done
10733
10734 test -n "$generated" && \
10735 func_show_eval "${RM}r$generated"
10736
10737 # Now create the libtool archive.
10738 case $output in
10739 *.la)
10740 old_library=
10741 test yes = "$build_old_libs" && old_library=$libname.$libext
10742 func_verbose "creating $output"
10743
10744 # Preserve any variables that may affect compiler behavior
10745 for var in $variables_saved_for_relink; do
10746 if eval test -z \"\${$var+set}\"; then
10747 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
10748 elif eval var_value=\$$var; test -z "$var_value"; then
10749 relink_command="$var=; export $var; $relink_command"
10750 else
10751 func_quote_for_eval "$var_value"
10752 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
10753 fi
10754 done
10755 # Quote the link command for shipping.
10756 relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
10757 relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
10758 if test yes = "$hardcode_automatic"; then
10759 relink_command=
10760 fi
10761
10762 # Only create the output if not a dry run.
10763 $opt_dry_run || {
10764 for installed in no yes; do
10765 if test yes = "$installed"; then
10766 if test -z "$install_libdir"; then
10767 break
10768 fi
10769 output=$output_objdir/${outputname}i
10770 # Replace all uninstalled libtool libraries with the installed ones
10771 newdependency_libs=
10772 for deplib in $dependency_libs; do
10773 case $deplib in
10774 *.la)
10775 func_basename "$deplib"
10776 name=$func_basename_result
10777 func_resolve_sysroot "$deplib"
10778 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
10779 test -z "$libdir" && \
10780 func_fatal_error "'$deplib' is not a valid libtool archive"
10781 func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
10782 ;;
10783 -L*)
10784 func_stripname -L '' "$deplib"
10785 func_replace_sysroot "$func_stripname_result"
10786 func_append newdependency_libs " -L$func_replace_sysroot_result"
10787 ;;
10788 -R*)
10789 func_stripname -R '' "$deplib"
10790 func_replace_sysroot "$func_stripname_result"
10791 func_append newdependency_libs " -R$func_replace_sysroot_result"
10792 ;;
10793 *) func_append newdependency_libs " $deplib" ;;
10794 esac
10795 done
10796 dependency_libs=$newdependency_libs
10797 newdlfiles=
10798
10799 for lib in $dlfiles; do
10800 case $lib in
10801 *.la)
10802 func_basename "$lib"
10803 name=$func_basename_result
10804 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
10805 test -z "$libdir" && \
10806 func_fatal_error "'$lib' is not a valid libtool archive"
10807 func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
10808 ;;
10809 *) func_append newdlfiles " $lib" ;;
10810 esac
10811 done
10812 dlfiles=$newdlfiles
10813 newdlprefiles=
10814 for lib in $dlprefiles; do
10815 case $lib in
10816 *.la)
10817 # Only pass preopened files to the pseudo-archive (for
10818 # eventual linking with the app. that links it) if we
10819 # didn't already link the preopened objects directly into
10820 # the library:
10821 func_basename "$lib"
10822 name=$func_basename_result
10823 eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
10824 test -z "$libdir" && \
10825 func_fatal_error "'$lib' is not a valid libtool archive"
10826 func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
10827 ;;
10828 esac
10829 done
10830 dlprefiles=$newdlprefiles
10831 else
10832 newdlfiles=
10833 for lib in $dlfiles; do
10834 case $lib in
10835 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
10836 *) abs=`pwd`"/$lib" ;;
10837 esac
10838 func_append newdlfiles " $abs"
10839 done
10840 dlfiles=$newdlfiles
10841 newdlprefiles=
10842 for lib in $dlprefiles; do
10843 case $lib in
10844 [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
10845 *) abs=`pwd`"/$lib" ;;
10846 esac
10847 func_append newdlprefiles " $abs"
10848 done
10849 dlprefiles=$newdlprefiles
10850 fi
10851 $RM $output
10852 # place dlname in correct position for cygwin
10853 # In fact, it would be nice if we could use this code for all target
10854 # systems that can't hard-code library paths into their executables
10855 # and that have no shared library path variable independent of PATH,
10856 # but it turns out we can't easily determine that from inspecting
10857 # libtool variables, so we have to hard-code the OSs to which it
10858 # applies here; at the moment, that means platforms that use the PE
10859 # object format with DLL files. See the long comment at the top of
10860 # tests/bindir.at for full details.
10861 tdlname=$dlname
10862 case $host,$output,$installed,$module,$dlname in
10863 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
10864 # If a -bindir argument was supplied, place the dll there.
10865 if test -n "$bindir"; then
10866 func_relative_path "$install_libdir" "$bindir"
10867 tdlname=$func_relative_path_result/$dlname
10868 else
10869 # Otherwise fall back on heuristic.
10870 tdlname=../bin/$dlname
10871 fi
10872 ;;
10873 esac
10874 $ECHO > $output "\
10875 # $outputname - a libtool library file
10876 # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
10877 #
10878 # Please DO NOT delete this file!
10879 # It is necessary for linking the library.
10880
10881 # The name that we can dlopen(3).
10882 dlname='$tdlname'
10883
10884 # Names of this library.
10885 library_names='$library_names'
10886
10887 # The name of the static archive.
10888 old_library='$old_library'
10889
10890 # Linker flags that cannot go in dependency_libs.
10891 inherited_linker_flags='$new_inherited_linker_flags'
10892
10893 # Libraries that this one depends upon.
10894 dependency_libs='$dependency_libs'
10895
10896 # Names of additional weak libraries provided by this library
10897 weak_library_names='$weak_libs'
10898
10899 # Version information for $libname.
10900 current=$current
10901 age=$age
10902 revision=$revision
10903
10904 # Is this an already installed library?
10905 installed=$installed
10906
10907 # Should we warn about portability when linking against -modules?
10908 shouldnotlink=$module
10909
10910 # Files to dlopen/dlpreopen
10911 dlopen='$dlfiles'
10912 dlpreopen='$dlprefiles'
10913
10914 # Directory that this library needs to be installed in:
10915 libdir='$install_libdir'"
10916 if test no,yes = "$installed,$need_relink"; then
10917 $ECHO >> $output "\
10918 relink_command=\"$relink_command\""
10919 fi
10920 done
10921 }
10922
10923 # Do a symbolic link so that the libtool archive can be found in
10924 # LD_LIBRARY_PATH before the program is installed.
10925 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
10926 ;;
10927 esac
10928 exit $EXIT_SUCCESS
10929 }
10930
10931 if test link = "$opt_mode" || test relink = "$opt_mode"; then
10932 func_mode_link ${1+"$@"}
10933 fi
10934
10935
10936 # func_mode_uninstall arg...
10937 func_mode_uninstall ()
10938 {
10939 $debug_cmd
10940
10941 RM=$nonopt
10942 files=
10943 rmforce=false
10944 exit_status=0
10945
10946 # This variable tells wrapper scripts just to set variables rather
10947 # than running their programs.
10948 libtool_install_magic=$magic
10949
10950 for arg
10951 do
10952 case $arg in
10953 -f) func_append RM " $arg"; rmforce=: ;;
10954 -*) func_append RM " $arg" ;;
10955 *) func_append files " $arg" ;;
10956 esac
10957 done
10958
10959 test -z "$RM" && \
10960 func_fatal_help "you must specify an RM program"
10961
10962 rmdirs=
10963
10964 for file in $files; do
10965 func_dirname "$file" "" "."
10966 dir=$func_dirname_result
10967 if test . = "$dir"; then
10968 odir=$objdir
10969 else
10970 odir=$dir/$objdir
10971 fi
10972 func_basename "$file"
10973 name=$func_basename_result
10974 test uninstall = "$opt_mode" && odir=$dir
10975
10976 # Remember odir for removal later, being careful to avoid duplicates
10977 if test clean = "$opt_mode"; then
10978 case " $rmdirs " in
10979 *" $odir "*) ;;
10980 *) func_append rmdirs " $odir" ;;
10981 esac
10982 fi
10983
10984 # Don't error if the file doesn't exist and rm -f was used.
10985 if { test -L "$file"; } >/dev/null 2>&1 ||
10986 { test -h "$file"; } >/dev/null 2>&1 ||
10987 test -f "$file"; then
10988 :
10989 elif test -d "$file"; then
10990 exit_status=1
10991 continue
10992 elif $rmforce; then
10993 continue
10994 fi
10995
10996 rmfiles=$file
10997
10998 case $name in
10999 *.la)
11000 # Possibly a libtool archive, so verify it.
11001 if func_lalib_p "$file"; then
11002 func_source $dir/$name
11003
11004 # Delete the libtool libraries and symlinks.
11005 for n in $library_names; do
11006 func_append rmfiles " $odir/$n"
11007 done
11008 test -n "$old_library" && func_append rmfiles " $odir/$old_library"
11009
11010 case $opt_mode in
11011 clean)
11012 case " $library_names " in
11013 *" $dlname "*) ;;
11014 *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
11015 esac
11016 test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
11017 ;;
11018 uninstall)
11019 if test -n "$library_names"; then
11020 # Do each command in the postuninstall commands.
11021 func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
11022 fi
11023
11024 if test -n "$old_library"; then
11025 # Do each command in the old_postuninstall commands.
11026 func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
11027 fi
11028 # FIXME: should reinstall the best remaining shared library.
11029 ;;
11030 esac
11031 fi
11032 ;;
11033
11034 *.lo)
11035 # Possibly a libtool object, so verify it.
11036 if func_lalib_p "$file"; then
11037
11038 # Read the .lo file
11039 func_source $dir/$name
11040
11041 # Add PIC object to the list of files to remove.
11042 if test -n "$pic_object" && test none != "$pic_object"; then
11043 func_append rmfiles " $dir/$pic_object"
11044 fi
11045
11046 # Add non-PIC object to the list of files to remove.
11047 if test -n "$non_pic_object" && test none != "$non_pic_object"; then
11048 func_append rmfiles " $dir/$non_pic_object"
11049 fi
11050 fi
11051 ;;
11052
11053 *)
11054 if test clean = "$opt_mode"; then
11055 noexename=$name
11056 case $file in
11057 *.exe)
11058 func_stripname '' '.exe' "$file"
11059 file=$func_stripname_result
11060 func_stripname '' '.exe' "$name"
11061 noexename=$func_stripname_result
11062 # $file with .exe has already been added to rmfiles,
11063 # add $file without .exe
11064 func_append rmfiles " $file"
11065 ;;
11066 esac
11067 # Do a test to see if this is a libtool program.
11068 if func_ltwrapper_p "$file"; then
11069 if func_ltwrapper_executable_p "$file"; then
11070 func_ltwrapper_scriptname "$file"
11071 relink_command=
11072 func_source $func_ltwrapper_scriptname_result
11073 func_append rmfiles " $func_ltwrapper_scriptname_result"
11074 else
11075 relink_command=
11076 func_source $dir/$noexename
11077 fi
11078
11079 # note $name still contains .exe if it was in $file originally
11080 # as does the version of $file that was added into $rmfiles
11081 func_append rmfiles " $odir/$name $odir/${name}S.$objext"
11082 if test yes = "$fast_install" && test -n "$relink_command"; then
11083 func_append rmfiles " $odir/lt-$name"
11084 fi
11085 if test "X$noexename" != "X$name"; then
11086 func_append rmfiles " $odir/lt-$noexename.c"
11087 fi
11088 fi
11089 fi
11090 ;;
11091 esac
11092 func_show_eval "$RM $rmfiles" 'exit_status=1'
11093 done
11094
11095 # Try to remove the $objdir's in the directories where we deleted files
11096 for dir in $rmdirs; do
11097 if test -d "$dir"; then
11098 func_show_eval "rmdir $dir >/dev/null 2>&1"
11099 fi
11100 done
11101
11102 exit $exit_status
11103 }
11104
11105 if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
11106 func_mode_uninstall ${1+"$@"}
11107 fi
11108
11109 test -z "$opt_mode" && {
11110 help=$generic_help
11111 func_fatal_help "you must specify a MODE"
11112 }
11113
11114 test -z "$exec_cmd" && \
11115 func_fatal_help "invalid operation mode '$opt_mode'"
11116
11117 if test -n "$exec_cmd"; then
11118 eval exec "$exec_cmd"
11119 exit $EXIT_FAILURE
11120 fi
11121
11122 exit $exit_status
11123
11124
11125 # The TAGs below are defined such that we never get into a situation
11126 # where we disable both kinds of libraries. Given conflicting
11127 # choices, we go for a static library, that is the most portable,
11128 # since we can't tell whether shared libraries were disabled because
11129 # the user asked for that or because the platform doesn't support
11130 # them. This is particularly important on AIX, because we don't
11131 # support having both static and shared libraries enabled at the same
11132 # time on that platform, so we default to a shared-only configuration.
11133 # If a disable-shared tag is given, we'll fallback to a static-only
11134 # configuration. But we'll never go from static-only to shared-only.
11135
11136 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
11137 build_libtool_libs=no
11138 build_old_libs=yes
11139 # ### END LIBTOOL TAG CONFIG: disable-shared
11140
11141 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
11142 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
11143 # ### END LIBTOOL TAG CONFIG: disable-static
11144
11145 # Local Variables:
11146 # mode:shell-script
11147 # sh-indentation:2
11148 # End:
7474 double s = ((A.y - p.y) * (B.x - A.x) - (A.x - p.x) * (B.y - A.y)) /
7575 ((B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y));
7676
77 return fabs(s) * sqrt(((B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y)));
77 return std::fabs(s) * std::sqrt(((B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y)));
7878 }
7979
8080 /*public static*/
9696 double s = ((A.y - p.y) * (B.x - A.x) - (A.x - p.x) * (B.y - A.y))
9797 /
9898 ((B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y));
99 return fabs(s) * sqrt(((B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y)));
99 return std::fabs(s) * std::sqrt(((B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y)));
100100 }
101101
102102 /*public static*/
228228 xoff = (p.x - p1.x);
229229 yoff = (p.y - p1.y);
230230 double pdist = (xoff * xoff + yoff * yoff);
231 double fract = sqrt(pdist / seglen);
231 double fract = std::sqrt(pdist / seglen);
232232 double zoff = zgap * fract;
233233 //double interpolated = p1.z < p2.z ? p1.z+zoff : p1.z-zoff;
234234 double interpolated = p1.z + zoff;
599599 double xoff = (p.x - p1.x);
600600 double yoff = (p.y - p1.y);
601601 double plen = (xoff * xoff + yoff * yoff);
602 double frac = sqrt(plen / seglen);
602 double frac = std::sqrt(plen / seglen);
603603 double zoff = dz * frac;
604604 double zInterpolated = p1z + zoff;
605605 #if GEOS_DEBUG
3030 #include <geos/geom/Triangle.h>
3131 #include <geos/util/GEOSException.h>
3232
33 #include <math.h> // sqrt
33 #include <cmath> // sqrt
3434 #include <memory> // for unique_ptr
3535 #include <typeinfo>
3636 #include <vector>
315315 if(dy < 0) {
316316 dy = -dy;
317317 }
318 double len = sqrt(dx * dx + dy * dy);
318 double len = std::sqrt(dx * dx + dy * dy);
319319 double sin = dy / len;
320320
321321 if(sin < minSin) {
278278
279279 double dx = p1.x - p0.x;
280280 double dy = p1.y - p0.y;
281 double len = sqrt(dx * dx + dy * dy);
281 double len = std::sqrt(dx * dx + dy * dy);
282282
283283 double ux = 0.0;
284284 double uy = 0.0;
1717 *
1818 **********************************************************************/
1919
20 #include <math.h>
20 #include <cmath>
2121
2222 #include <geos/geom/util/Densifier.h>
2323 #include <geos/geom/CoordinateSequenceFactory.h>
201201 CoordinateSequence::Ptr seq(transformCoordinates(
202202 geom->getCoordinatesRO(), geom));
203203
204 auto seqSize = seq->size();
204 std::size_t seqSize = seq ? seq->size() : 0;
205205
206206 // ensure a valid LinearRing
207207 if(seqSize > 0 && seqSize < 4 && ! preserveType) {
4848 {
4949 try {
5050 const json& j = json::parse(geoJsonText);
51 const std::string& type = j["type"];
51 const std::string& type = j.at("type");
5252 if (type == "Feature") {
5353 return readFeatureForGeometry(j);
5454 }
6868 {
6969 try {
7070 const json& j = json::parse(geoJsonText);
71 const std::string& type = j["type"];
71 const std::string& type = j.at("type");
7272 if (type == "Feature") {
7373 const auto& feature = readFeature(j);
7474 return GeoJSONFeatureCollection { std::vector<GeoJSONFeature>{feature} };
8989 std::unique_ptr<geom::Geometry> GeoJSONReader::readFeatureForGeometry(
9090 const geos_nlohmann::json& j) const
9191 {
92 const auto& geometryJson = j["geometry"];
92 const auto& geometryJson = j.at("geometry");
9393 auto geometry = readGeometry(geometryJson);
9494 return geometry;
9595 }
9696
9797 GeoJSONFeature GeoJSONReader::readFeature(const geos_nlohmann::json& j) const
9898 {
99 const auto& geometryJson = j["geometry"];
100 const auto& properties = j["properties"];
99 const auto& geometryJson = j.at("geometry");
100 const auto& properties = j.at("properties");
101101 return GeoJSONFeature{readGeometry(geometryJson), readProperties(properties)};
102102 }
103103
146146 std::unique_ptr<geom::Geometry> GeoJSONReader::readFeatureCollectionForGeometry(
147147 const geos_nlohmann::json& j) const
148148 {
149 const auto& featuresJson = j["features"];
149 const auto& featuresJson = j.at("features");
150150 std::vector<std::unique_ptr<geom::Geometry>> geometries;
151151 geometries.reserve(featuresJson.size());
152152 for (const auto& featureJson : featuresJson) {
159159 GeoJSONFeatureCollection GeoJSONReader::readFeatureCollection(
160160 const geos_nlohmann::json& j) const
161161 {
162 const auto& featuresJson = j["features"];
162 const auto& featuresJson = j.at("features");
163163 std::vector<GeoJSONFeature> features;
164164 features.reserve(featuresJson.size());
165165 for (const auto& featureJson : featuresJson) {
172172 std::unique_ptr<geom::Geometry> GeoJSONReader::readGeometry(
173173 const geos_nlohmann::json& j) const
174174 {
175 const std::string& type = j["type"];
175 const std::string& type = j.at("type");
176176 if (type == "Point") {
177177 return readPoint(j);
178178 }
216216 std::unique_ptr<geom::Point> GeoJSONReader::readPoint(
217217 const geos_nlohmann::json& j) const
218218 {
219 const auto& coords = j["coordinates"].get<std::vector<double>>();
219 const auto& coords = j.at("coordinates").get<std::vector<double>>();
220220 if (coords.size() == 1) {
221221 throw ParseException("Expected two coordinates found one");
222222 }
232232 std::unique_ptr<geom::LineString> GeoJSONReader::readLineString(
233233 const geos_nlohmann::json& j) const
234234 {
235 const auto& coords = j["coordinates"].get<std::vector<std::vector<double>>>();
235 const auto& coords = j.at("coordinates").get<std::vector<std::vector<double>>>();
236236 std::vector<geom::Coordinate> coordinates;
237237 coordinates.reserve(coords.size());
238238 for (const auto& coord : coords) {
244244 }
245245
246246 std::unique_ptr<geom::Polygon> GeoJSONReader::readPolygon(
247 const geos_nlohmann::json& json) const
248 {
249 const auto& polygonCoords = json["coordinates"].get<std::vector<std::vector<std::vector<double>>>>();
247 const geos_nlohmann::json& j) const
248 {
249 const auto& polygonCoords = j.at("coordinates").get<std::vector<std::vector<std::vector<double>>>>();
250250 return readPolygon(polygonCoords);
251251 }
252252
285285 std::unique_ptr<geom::MultiPoint> GeoJSONReader::readMultiPoint(
286286 const geos_nlohmann::json& j) const
287287 {
288 const auto& coords = j["coordinates"].get<std::vector<std::vector<double>>>();
288 const auto& coords = j.at("coordinates").get<std::vector<std::vector<double>>>();
289289 std::vector<std::unique_ptr<geom::Point>> points;
290290 points.reserve(coords.size());
291291 for (const auto& coord : coords) {
296296 }
297297
298298 std::unique_ptr<geom::MultiLineString> GeoJSONReader::readMultiLineString(
299 const geos_nlohmann::json& json) const
300 {
301 const auto& listOfCoords = json["coordinates"].get<std::vector<std::vector<std::vector<double>>>>();
299 const geos_nlohmann::json& j) const
300 {
301 const auto& listOfCoords = j.at("coordinates").get<std::vector<std::vector<std::vector<double>>>>();
302302 std::vector<std::unique_ptr<geom::LineString>> lines;
303303 lines.reserve(listOfCoords.size());
304304 for (const auto& coords : listOfCoords) {
315315 }
316316
317317 std::unique_ptr<geom::MultiPolygon> GeoJSONReader::readMultiPolygon(
318 const geos_nlohmann::json& json) const
319 {
320 const auto& multiPolygonCoords = json["coordinates"].get<std::vector<std::vector<std::vector<std::vector<double>>>>>();
318 const geos_nlohmann::json& j) const
319 {
320 const auto& multiPolygonCoords = j.at("coordinates").get<std::vector<std::vector<std::vector<std::vector<double>>>>>();
321321 std::vector<std::unique_ptr<geom::Polygon>> polygons;
322322 polygons.reserve(multiPolygonCoords.size());
323323 for (const auto& polygonCoords : multiPolygonCoords) {
329329 std::unique_ptr<geom::GeometryCollection> GeoJSONReader::readGeometryCollection(
330330 const geos_nlohmann::json& j) const
331331 {
332 const auto& jsonGeometries = j["geometries"];
332 const auto& jsonGeometries = j.at("geometries");
333333 std::vector<std::unique_ptr<geom::Geometry>> geometries;
334334 geometries.reserve(jsonGeometries.size());
335335 for (const auto& jsonGeometry : jsonGeometries) {
119119 std::unique_ptr<geom::Geometry>
120120 CascadedPolygonUnion::unionSafe(const geom::Geometry* g0, const geom::Geometry* g1) const
121121 {
122 if(g0 == nullptr && g1 == nullptr) {
123 return nullptr;
124 }
125
126 if(g0 == nullptr) {
122 if(g0 != nullptr && g1 != nullptr) {
123 return unionActual(g0, g1);
124 }
125
126 if(g1 != nullptr) {
127127 return g1->clone();
128128 }
129 if(g1 == nullptr) {
129 if(g0 != nullptr) {
130130 return g0->clone();
131131 }
132
133 return unionActual(g0, g1);
132 return nullptr;
134133 }
135134
136135 std::unique_ptr<geom::Geometry>
1818 #include <geos/triangulate/VoronoiDiagramBuilder.h>
1919
2020 #include <algorithm>
21 #include <math.h>
21 #include <cmath>
2222 #include <vector>
2323 #include <iostream>
2424
1010 #include <cstdlib>
1111 #include <fenv.h>
1212 #include <memory>
13 #include <math.h>
13 #include <cmath>
1414
1515 #include "capi_test_utils.h"
1616
133133 int status = GEOSDistance(g1, g2, &d);
134134
135135 ensure_equals(status, 1);
136 ensure_equals(d, sqrt(2));
136 ensure_equals(d, std::sqrt(2));
137137
138138 // check for floating point overflow exceptions
139139 int raised = fetestexcept(FE_OVERFLOW);
159159 int status = GEOSDistance(g1, g2, &d);
160160
161161 ensure_equals(status, 1);
162 // ensure_equals(d, sqrt(2));
162 // ensure_equals(d, std::sqrt(2));
163163
164164 // check for floating point overflow exceptions
165165 int raised = fetestexcept(FE_OVERFLOW);
88 #include <cstdio>
99 #include <cstdlib>
1010 #include <memory>
11 #include <math.h>
11 #include <cmath>
1212
1313 #include "capi_test_utils.h"
1414
157157 ensure_geometry_equals(geom2_, "LINESTRING (0 0, 0 0)");
158158 }
159159
160
161 // Collapse a linearRing / Trac #1135
162 template<>
163 template<>
164 void object::test<10> ()
165 {
166 geom1_ = fromWKT("LINEARRING (0 0, 0.1 0, 0.1 0.1, 0 0.1, 0 0)");
167 geom2_ = GEOSGeom_setPrecision(geom1_, 1.0, 0);
168 ensure_geometry_equals(geom2_, "LINEARRING EMPTY");
169 }
170
160171 } // namespace tut
161172
88 #include <cstdio>
99 #include <cstdlib>
1010 #include <memory>
11 #include <math.h>
11 #include <cmath>
1212
1313 #include "capi_test_utils.h"
1414
3737 int dx = p2->x - p1->x;
3838 int dy = p2->y - p1->y;
3939
40 *distance = sqrt(static_cast<double>(dx * dx) + dy * dy);
40 *distance = std::sqrt(static_cast<double>(dx * dx) + dy * dy);
4141 return 1;
4242 }
4343
436436 ensure_equals("ParseException: Expected two coordinates found more than two", errorMessage);
437437 }
438438
439 }
440
439 // Throw ParseException for bad GeoJSON
440 template<>
441 template<>
442 void object::test<30>
443 ()
444 {
445 std::string errorMessage;
446 std::string geojson { "{ \"missing\": \"type\" }" };
447 bool error = false;
448 try {
449 GeomPtr geom(geojsonreader.read(geojson));
450 } catch (geos::io::ParseException& e) {
451 error = true;
452 }
453 ensure(error == true);
454 }
455
456 }
457
+0
-77
tools/geos-config less more
0 #!/bin/sh
1
2 prefix=/usr/local
3 libdir=${prefix}/lib
4
5 usage()
6 {
7 cat <<EOF
8 Usage: geos-config [OPTIONS]
9 Options:
10 [--prefix]
11 [--version]
12 [--libs]
13 [--clibs]
14 [--cclibs]
15 [--static-clibs]
16 [--static-cclibs]
17 [--cflags]
18 [--ldflags]
19 [--includes]
20 [--jtsport]
21 EOF
22 exit $1
23 }
24
25 if test $# -eq 0; then
26 usage 1 1>&2
27 fi
28
29 while test $# -gt 0; do
30 case "$1" in
31 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
32 *) optarg= ;;
33 esac
34 case $1 in
35 --prefix)
36 echo ${prefix}
37 ;;
38 --version)
39 echo 3.10.0dev
40 ;;
41 --libs)
42 # TODO: make an alias for --clibs
43 # see http://trac.osgeo.org/geos/ticket/497
44 echo -L${libdir} -lgeos-3
45 ;;
46 --clibs)
47 echo -L${libdir} -lgeos_c
48 ;;
49 --cclibs)
50 echo -L${libdir} -lgeos
51 ;;
52 --static-clibs)
53 echo -L${libdir} -lgeos_c -lgeos -lm
54 ;;
55 --static-cclibs)
56 echo -L${libdir} -lgeos -lm
57 ;;
58 --cflags)
59 echo -I${prefix}/include
60 ;;
61 --ldflags)
62 echo -L${libdir}
63 ;;
64 --includes)
65 echo ${prefix}/include
66 ;;
67 --jtsport)
68 echo 1.17.0
69 ;;
70 *)
71 usage 1 1>&2
72 ;;
73 esac
74 shift
75 done
76
+0
-11
tools/geos.pc less more
0 prefix=/usr/local
1 exec_prefix=${prefix}
2 includedir=${prefix}/include
3 libdir=${prefix}/lib
4
5 Name: GEOS
6 Description: Geometry Engine, Open Source - C API
7 Requires:
8 Version: 3.10.0dev
9 Cflags: -I${includedir}
10 Libs: -L${libdir} -lgeos_c