diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..7bb676fcc --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,148 @@ +# +# Stage 0: Build xorg dependencies. +# +FROM debian:bullseye-slim as xorg-deps + +ENV DEBIAN_FRONTEND=noninteractive + +RUN set -eux; \ + apt-get update; \ + apt-get install -y \ + git gcc pkgconf autoconf automake libtool make xorg-dev xutils-dev \ + && rm -rf /var/lib/apt/lists/*; + +WORKDIR /xorg + +COPY xorg/ /xorg/ + +# build xserver-xorg-video-dummy 0.3.8-2 with RandR support. +RUN set -eux; \ + cd xf86-video-dummy; \ + git clone --depth 1 --branch xserver-xorg-video-dummy-1_0.3.8-2 https://salsa.debian.org/xorg-team/driver/xserver-xorg-video-dummy; \ + cd xserver-xorg-video-dummy; \ + patch -p1 < ../xdummy-randr.patch; \ + ./autogen.sh; \ + make -j$(nproc); \ + make install; + +# build custom input driver +RUN set -eux; \ + cd xf86-input-neko; \ + ./autogen.sh --prefix=/usr; \ + ./configure; \ + make -j$(nproc); \ + make install; + +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.166.0/containers/go/.devcontainer/base.Dockerfile + +# [Choice] Go version: 1, 1.16, 1.15 +ARG VARIANT="1" +FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT} + +# [Option] Install Node.js +ARG INSTALL_NODE="true" +ARG NODE_VERSION="lts/*" +RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi + +# build dependencies +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends \ + libx11-dev libxrandr-dev libxtst-dev libgtk-3-dev \ + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev; \ + # install libxcvt-dev (not available in base image) + wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt-dev_0.1.2-1_amd64.deb; \ + wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_amd64.deb; \ + apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_amd64.deb ./libxcvt-dev_0.1.2-1_amd64.deb; + +# runtime dependencies +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends \ + wget ca-certificates supervisor \ + pulseaudio dbus-x11 xserver-xorg-video-dummy \ + libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx6 \ + # + # needed for profile upload preStop hook + zip curl \ + # + # file chooser handler, clipboard, drop + xdotool xclip libgtk-3-0 \ + # + # gst + gstreamer1.0-plugins-base gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \ + gstreamer1.0-pulseaudio; + # libxcvt already installed + +# dev runtime dependencies +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends \ + xfce4 xfce4-terminal firefox-esr sudo; + +# configure runtime +ARG USERNAME=neko +ARG USER_UID=1001 +ARG USER_GID=$USER_UID +RUN set -eux; \ + # + # create a non-root user + groupadd --gid $USER_GID $USERNAME; \ + useradd --uid $USER_UID --gid $USERNAME --shell /bin/bash --create-home $USERNAME; \ + adduser $USERNAME audio; \ + adduser $USERNAME video; \ + adduser $USERNAME pulse; \ + # + # add sudo support + echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME; \ + chmod 0440 /etc/sudoers.d/$USERNAME; \ + # + # workaround for an X11 problem: http://blog.tigerteufel.de/?p=476 + mkdir /tmp/.X11-unix; \ + chmod 1777 /tmp/.X11-unix; \ + chown $USERNAME /tmp/.X11-unix/; \ + # + # make directories for neko + mkdir -p /etc/neko /var/www; \ + chown -R $USERNAME:$USERNAME /home/$USERNAME; \ + # + # install fonts + apt-get install -y --no-install-recommends \ + # Emojis + fonts-noto-color-emoji \ + # Chinese fonts + fonts-arphic-ukai fonts-arphic-uming \ + # Japanese fonts + fonts-ipafont-mincho fonts-ipafont-gothic \ + # Korean fonts + fonts-unfonts-core \ + # Indian fonts + fonts-indic; + +# copy dependencies from previous stage +COPY --from=xorg-deps /usr/local/lib/xorg/modules/drivers/dummy_drv.so /usr/lib/xorg/modules/drivers/dummy_drv.so +COPY --from=xorg-deps /usr/local/lib/xorg/modules/input/neko_drv.so /usr/lib/xorg/modules/input/neko_drv.so + +# copy runtime files +COPY runtime/dbus /usr/bin/dbus +COPY runtime/default.pa /etc/pulse/default.pa +COPY runtime/supervisord.conf /etc/neko/supervisord.conf +COPY runtime/xorg.conf /etc/neko/xorg.conf +COPY runtime/icon-theme /home/$USERNAME/.icons/default + +# copy dev runtime files +COPY dev/runtime/config.yml /etc/neko/neko.yml +COPY dev/runtime/supervisord.conf /etc/neko/supervisord/dev.conf + +# customized scripts +RUN chmod +x /usr/bin/dbus;\ + echo '#!/bin/sh\nsleep infinity' > /usr/bin/neko; \ + chmod +x /usr/bin/neko; \ + echo '#!/bin/sh\nsudo sh -c "export USER='$USERNAME'\nexport HOME=/home/'$USERNAME'\n/usr/bin/supervisord -c /etc/neko/supervisord.conf"' > /usr/bin/deps; \ + chmod +x /usr/bin/deps; \ + touch .env.development; + +# set default envs +ENV USER=$USERNAME +ENV DISPLAY=:99.0 +ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket +ENV NEKO_SERVER_BIND=:3000 +ENV NEKO_WEBRTC_EPR=3001-3004 diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 000000000..1ddcb7f8f --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,20 @@ +# dev container + +You need to run all dependencies with `deps` command before you start debugging. + +Create `.env.development` in repository root. Make sure your local IP is correct. + +```sh +NEKO_WEBRTC_NAT1TO1=10.0.0.8 +``` + +# without container + +- Make sure `pulseaudio` contains correct configuration. +- Specify `DISPLAY` that is being used by xorg. + +```sh +DISPLAY=:0 +NEKO_WEBRTC_NAT1TO1=10.0.0.8 +NEKO_SERVER_BIND=:3000 +``` diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..69824f102 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,44 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.166.0/containers/go +{ + "name": "Go", + "build": { + "dockerfile": "Dockerfile", + "context": "../server/", + "args": { + // Update the VARIANT arg to pick a version of Go: 1, 1.16, 1.15 + "VARIANT": "1.20", + // Options + "INSTALL_NODE": "false", + "NODE_VERSION": "lts/*" + } + }, + "runArgs": [ "--cap-add=SYS_PTRACE", "--cap-add=SYS_ADMIN", "--shm-size=2G", "--security-opt", "seccomp=unconfined" ], + + "customizations": { + "vscode": { + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/bin/bash", + "go.toolsManagement.checkForUpdates": "local", + "go.useLanguageServer": true, + "go.gopath": "/go", + "go.goroot": "/usr/local/go" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "golang.Go" + ] + } + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "appPort": ["3000:3000", "3001:3001/udp", "3002:3002/udp", "3003:3003/udp", "3004:3004/udp"], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "go version", + + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "neko" +} diff --git a/server/.editorconfig b/.editorconfig similarity index 78% rename from server/.editorconfig rename to .editorconfig index 3dce4145f..9d08a1a82 100644 --- a/server/.editorconfig +++ b/.editorconfig @@ -6,4 +6,4 @@ indent_style = space indent_size = 2 end_of_line = lf insert_final_newline = true -trim_trailing_whitespace = true \ No newline at end of file +trim_trailing_whitespace = true diff --git a/.gitattributes b/.gitattributes index bab221542..34ae8dd8d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -19,4 +19,4 @@ *.ico binary *.mov binary *.mp4 binary -*.mp3 binary \ No newline at end of file +*.mp3 binary diff --git a/.github/workflows/server_build.yml b/.github/workflows/server_build.yml new file mode 100644 index 000000000..d31d0438b --- /dev/null +++ b/.github/workflows/server_build.yml @@ -0,0 +1,44 @@ +name: Create and publish a Docker image + +on: workflow_dispatch +# push: +# branches: +# - 'master' +# tags: +# - 'v*' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: ./server/ + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/server_build_variants.yml b/.github/workflows/server_build_variants.yml new file mode 100644 index 000000000..b4a7f31f4 --- /dev/null +++ b/.github/workflows/server_build_variants.yml @@ -0,0 +1,53 @@ +name: Create and publish a Docker image variant + +on: workflow_dispatch +# push: +# tags: +# - 'v*' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image-variant: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + strategy: + matrix: + include: + - variant: bookworm + dockerfile: Dockerfile.bookworm + - variant: nvidia + dockerfile: Dockerfile.nvidia + - variant: nvidia_bookworm + dockerfile: Dockerfile.nvidia.bookworm + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.variant }} + + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: ./server/ + file: ${{ matrix.dockerfile }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/server_pull_requests.yml b/.github/workflows/server_pull_requests.yml new file mode 100644 index 000000000..b22f84fd8 --- /dev/null +++ b/.github/workflows/server_pull_requests.yml @@ -0,0 +1,21 @@ +name: Build a Docker image + +on: + pull_request: + branches: + - master + +jobs: + build-image: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Build Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: ./server/ diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..28e6e3ac0 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,23 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "launch", + "type": "go", + "debugAdapter": "dlv-dap", + "request": "launch", + "mode": "debug", + "program": "${workspaceFolder}/server/cmd/neko", + "output": "${workspaceFolder}/server/bin/debug/neko", + "cwd": "${workspaceFolder}/server/", + "args": ["serve", "-d", "-c", "dev/runtime/config.yml"], + "env": { + "DISPLAY": ":99.0", + "PION_LOG_TRACE": "all", + } + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 9e26dfeeb..45ab0ed90 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1 +1,13 @@ -{} \ No newline at end of file +{ + "go.inferGopath": false, + "go.autocompleteUnimportedPackages": true, + "go.delveConfig": { + "useApiV1": false + }, + "[go]": { + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + } + } +} diff --git a/LICENSE b/LICENSE index 1992a7fcf..44165dd9a 100644 --- a/LICENSE +++ b/LICENSE @@ -187,7 +187,8 @@ identification within third-party archives. Copyright (C) 2020 Nurdism - Copyright (C) 2020-2023 m1k1o + Copyright (C) 2020-2024 m1k1o & Demodesk GmbH + Copyright (C) 2024- m1k1o All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); @@ -200,4 +201,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file + limitations under the License. diff --git a/server/.env.development b/server/.env.development deleted file mode 100644 index b58849260..000000000 --- a/server/.env.development +++ /dev/null @@ -1,2 +0,0 @@ -DISPLAY=:99.0 -PION_LOG_TRACE=all diff --git a/server/.gitignore b/server/.gitignore new file mode 100644 index 000000000..3428a0dfd --- /dev/null +++ b/server/.gitignore @@ -0,0 +1,12 @@ +bin/ +.idea +.env.development + +runtime/fonts/* +!runtime/fonts/.gitkeep + +runtime/icon-theme/* +!runtime/icon-theme/.gitkeep + +plugins/* +!plugins/.gitkeep diff --git a/server/.vscode/launch.json b/server/.vscode/launch.json deleted file mode 100644 index 02c7b7db5..000000000 --- a/server/.vscode/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "launch", - "type": "go", - "request": "launch", - "mode": "debug", - "program": "${workspaceFolder}/cmd/neko", - "envFile": "${workspaceFolder}/.env.development", - "output": "${workspaceFolder}/bin/debug/neko", - "cwd": "${workspaceFolder}/", - "args": ["serve", "-d", "--bind", ":3000", "--static", "../client/dist", "--password", "neko", "--password_admin", "admin"] - } - ] -} diff --git a/server/.vscode/settings.json b/server/.vscode/settings.json deleted file mode 100644 index 452ccec1e..000000000 --- a/server/.vscode/settings.json +++ /dev/null @@ -1,22 +0,0 @@ - -{ - "go.formatTool": "goformat", - "go.inferGopath": false, - "go.autocompleteUnimportedPackages": true, - "go.delveConfig": { - "useApiV1": false, - "dlvLoadConfig": { - "followPointers": true, - "maxVariableRecurse": 3, - "maxStringLen": 400, - "maxArrayValues": 400, - "maxStructFields": -1 - } - }, - "[go]": { - "editor.formatOnSave": true, - "editor.codeActionsOnSave": { - "source.organizeImports": true - } - } - } diff --git a/server/Dockerfile b/server/Dockerfile new file mode 100644 index 000000000..438b24fe7 --- /dev/null +++ b/server/Dockerfile @@ -0,0 +1,182 @@ +ARG BASE_IMAGE=debian:bullseye-slim +ARG BUILD_IMAGE=golang:1.21-bullseye + +# +# Stage 0: Build xorg dependencies. +# +FROM $BASE_IMAGE as xorg-deps + +ENV DEBIAN_FRONTEND=noninteractive + +RUN set -eux; \ + apt-get update; \ + apt-get install -y \ + git gcc pkgconf autoconf automake libtool make xorg-dev xutils-dev \ + && rm -rf /var/lib/apt/lists/*; + +WORKDIR /xorg + +COPY xorg/ /xorg/ + +# build xf86-video-dummy v0.3.8 with RandR support +RUN set -eux; \ + cd xf86-video-dummy/v0.3.8; \ + patch -p1 < ../01_v0.3.8_xdummy-randr.patch; \ + autoreconf -v --install; \ + ./configure; \ + make -j$(nproc); \ + make install; + +# build custom input driver +RUN set -eux; \ + cd xf86-input-neko; \ + ./autogen.sh --prefix=/usr; \ + ./configure; \ + make -j$(nproc); \ + make install; + +# +# Stage 1: Build. +# +FROM $BUILD_IMAGE as build +WORKDIR /src + +# +# install dependencies +ENV DEBIAN_FRONTEND=noninteractive +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libx11-dev libxrandr-dev libxtst-dev libgtk-3-dev \ + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev; \ + # install libxcvt-dev (not available in debian:bullseye) + wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt-dev_0.1.2-1_amd64.deb; \ + wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_amd64.deb; \ + apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_amd64.deb ./libxcvt-dev_0.1.2-1_amd64.deb; \ + # + # clean up + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +ARG GIT_COMMIT +ARG GIT_BRANCH +ARG GIT_TAG + +# +# build server +COPY . . +RUN ./build + +# +# Stage 2: Runtime. +# +FROM $BASE_IMAGE as runtime + +# +# set custom user +ARG USERNAME=neko +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# +# install dependencies +ENV DEBIAN_FRONTEND=noninteractive +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + wget ca-certificates supervisor \ + pulseaudio dbus-x11 xserver-xorg-video-dummy \ + libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx6 \ + # + # needed for profile upload preStop hook + zip curl \ + # + # file chooser handler, clipboard, drop + xdotool xclip libgtk-3-0 \ + # + # gst + gstreamer1.0-plugins-base gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \ + gstreamer1.0-pulseaudio; \ + # install libxcvt0 (not available in debian:bullseye) + wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_amd64.deb; \ + apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_amd64.deb; \ + rm ./libxcvt0_0.1.2-1_amd64.deb; \ + # + # create a non-root user + groupadd --gid $USER_GID $USERNAME; \ + useradd --uid $USER_UID --gid $USERNAME --shell /bin/bash --create-home $USERNAME; \ + adduser $USERNAME audio; \ + adduser $USERNAME video; \ + adduser $USERNAME pulse; \ + # + # workaround for an X11 problem: http://blog.tigerteufel.de/?p=476 + mkdir /tmp/.X11-unix; \ + chmod 1777 /tmp/.X11-unix; \ + chown $USERNAME /tmp/.X11-unix/; \ + # + # make directories for neko + mkdir -p /etc/neko /var/www; \ + chown -R $USERNAME:$USERNAME /home/$USERNAME; \ + # + # install fonts + apt-get install -y --no-install-recommends \ + # Emojis + fonts-noto-color-emoji \ + # Chinese fonts + fonts-arphic-ukai fonts-arphic-uming \ + # Japanese fonts + fonts-ipafont-mincho fonts-ipafont-gothic \ + # Korean fonts + fonts-unfonts-core \ + # Indian fonts + fonts-indic; \ + # + # clean up + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +# copy dependencies from previous stage +COPY --from=xorg-deps /usr/local/lib/xorg/modules/drivers/dummy_drv.so /usr/lib/xorg/modules/drivers/dummy_drv.so +COPY --from=xorg-deps /usr/local/lib/xorg/modules/input/neko_drv.so /usr/lib/xorg/modules/input/neko_drv.so + +# +# copy runtime configs +COPY --chown=neko:neko runtime/.Xresources /home/$USERNAME/.Xresources +COPY runtime/dbus /usr/bin/dbus +COPY runtime/default.pa /etc/pulse/default.pa +COPY runtime/supervisord.conf /etc/neko/supervisord.conf +COPY runtime/supervisord.dbus.conf /etc/neko/supervisord.dbus.conf +COPY runtime/xorg.conf /etc/neko/xorg.conf + +# +# copy runtime folders +COPY --chown=neko:neko runtime/icon-theme /home/$USERNAME/.icons/default +COPY runtime/fontconfig/* /etc/fonts/conf.d/ +COPY runtime/fonts /usr/local/share/fonts + +# +# set default envs +ENV USER=$USERNAME +ENV DISPLAY=:99.0 +ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket +ENV NEKO_SERVER_BIND=:8080 +ENV NEKO_PLUGINS_ENABLED=true +ENV NEKO_PLUGINS_DIR=/etc/neko/plugins/ + +# +# copy plugins from previous stage +COPY --from=build /src/bin/plugins/ $NEKO_PLUGINS_DIR + +# +# copy executable from previous stage +COPY --from=build /src/bin/neko /usr/bin/neko + +# +# add healthcheck +HEALTHCHECK --interval=10s --timeout=5s --retries=8 \ + CMD wget -O - http://localhost:${NEKO_SERVER_BIND#*:}/health || exit 1 + +# +# run neko +CMD ["/usr/bin/supervisord", "-s", "-c", "/etc/neko/supervisord.conf"] diff --git a/server/Dockerfile.bookworm b/server/Dockerfile.bookworm new file mode 100644 index 000000000..f7c393ff2 --- /dev/null +++ b/server/Dockerfile.bookworm @@ -0,0 +1,172 @@ +ARG BASE_IMAGE=debian:bookworm-slim +ARG BUILD_IMAGE=golang:1.21-bookworm + +# +# Stage 0: Build xorg dependencies. +# +FROM $BASE_IMAGE as xorg-deps + +ENV DEBIAN_FRONTEND=noninteractive + +RUN set -eux; \ + apt-get update; \ + apt-get install -y \ + git gcc pkgconf autoconf automake libtool make xorg-dev xutils-dev \ + && rm -rf /var/lib/apt/lists/*; + +WORKDIR /xorg + +COPY xorg/ /xorg/ + +# build xf86-video-dummy v0.3.8 with RandR support +RUN set -eux; \ + cd xf86-video-dummy/v0.3.8; \ + patch -p1 < ../01_v0.3.8_xdummy-randr.patch; \ + autoreconf -v --install; \ + ./configure; \ + make -j$(nproc); \ + make install; + +# build custom input driver +RUN set -eux; \ + cd xf86-input-neko; \ + ./autogen.sh --prefix=/usr; \ + ./configure; \ + make -j$(nproc); \ + make install; + +# +# Stage 1: Build. +# +FROM $BUILD_IMAGE as build +WORKDIR /src + +# +# install dependencies +ENV DEBIAN_FRONTEND=noninteractive +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libx11-dev libxrandr-dev libxtst-dev libgtk-3-dev libxcvt-dev \ + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev; \ + # + # clean up + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +ARG GIT_COMMIT +ARG GIT_BRANCH +ARG GIT_TAG + +# +# build server +COPY . . +RUN ./build + +# +# Stage 2: Runtime. +# +FROM $BASE_IMAGE as runtime + +# +# set custom user +ARG USERNAME=neko +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# +# install dependencies +ENV DEBIAN_FRONTEND=noninteractive +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + wget ca-certificates supervisor \ + pulseaudio xserver-xorg-video-dummy \ + libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx7 libxcvt0 \ + # + # needed for profile upload preStop hook + zip curl \ + # + # file chooser handler, clipboard, drop + xdotool xclip libgtk-3-0 \ + # + # gst + gstreamer1.0-plugins-base gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \ + gstreamer1.0-pulseaudio; \ + # + # create a non-root user + groupadd --gid $USER_GID $USERNAME; \ + useradd --uid $USER_UID --gid $USERNAME --shell /bin/bash --create-home $USERNAME; \ + adduser $USERNAME audio; \ + adduser $USERNAME video; \ + adduser $USERNAME pulse; \ + # + # workaround for an X11 problem: http://blog.tigerteufel.de/?p=476 + mkdir /tmp/.X11-unix; \ + chmod 1777 /tmp/.X11-unix; \ + chown $USERNAME /tmp/.X11-unix/; \ + # + # make directories for neko + mkdir -p /etc/neko /var/www; \ + chown -R $USERNAME:$USERNAME /home/$USERNAME; \ + # + # install fonts + apt-get install -y --no-install-recommends \ + # Emojis + fonts-noto-color-emoji \ + # Chinese fonts + fonts-arphic-ukai fonts-arphic-uming \ + # Japanese fonts + fonts-ipafont-mincho fonts-ipafont-gothic \ + # Korean fonts + fonts-unfonts-core \ + # Indian fonts + fonts-indic; \ + # + # clean up + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +# copy dependencies from previous stage +COPY --from=xorg-deps /usr/local/lib/xorg/modules/drivers/dummy_drv.so /usr/lib/xorg/modules/drivers/dummy_drv.so +COPY --from=xorg-deps /usr/local/lib/xorg/modules/input/neko_drv.so /usr/lib/xorg/modules/input/neko_drv.so + +# +# copy runtime configs +COPY --chown=neko:neko runtime/.Xresources /home/$USERNAME/.Xresources +COPY runtime/default.pa /etc/pulse/default.pa +COPY runtime/supervisord.conf /etc/neko/supervisord.conf +COPY runtime/xorg.conf /etc/neko/xorg.conf + +# +# copy runtime folders +COPY --chown=neko:neko runtime/icon-theme /home/$USERNAME/.icons/default +COPY runtime/fontconfig/* /etc/fonts/conf.d/ +COPY runtime/fonts /usr/local/share/fonts + +# +# set default envs +ENV USER=$USERNAME +ENV DISPLAY=:99.0 +ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket +ENV NEKO_SERVER_BIND=:8080 +ENV NEKO_PLUGINS_ENABLED=true +ENV NEKO_PLUGINS_DIR=/etc/neko/plugins/ + +# +# copy plugins from previous stage +COPY --from=build /src/bin/plugins/ $NEKO_PLUGINS_DIR + +# +# copy executable from previous stage +COPY --from=build /src/bin/neko /usr/bin/neko + +# +# add healthcheck +HEALTHCHECK --interval=10s --timeout=5s --retries=8 \ + CMD wget -O - http://localhost:${NEKO_SERVER_BIND#*:}/health || exit 1 + +# +# run neko +CMD ["/usr/bin/supervisord", "-s", "-c", "/etc/neko/supervisord.conf"] diff --git a/server/Dockerfile.nvidia b/server/Dockerfile.nvidia new file mode 100644 index 000000000..8edc4b2db --- /dev/null +++ b/server/Dockerfile.nvidia @@ -0,0 +1,335 @@ +ARG UBUNTU_RELEASE=20.04 +ARG CUDA_VERSION=11.4.3 +ARG VIRTUALGL_VERSION=3.1 +ARG GSTREAMER_VERSION=1.20 + +# +# Stage 0: Build gstreamer with nvidia plugins. +# +FROM ubuntu:${UBUNTU_RELEASE} AS gstreamer +ARG GSTREAMER_VERSION + +# +# install dependencies +ENV DEBIAN_FRONTEND=noninteractive +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + # Install essentials + curl build-essential ca-certificates git \ + # Install pip and ninja + python3-pip python-gi-dev ninja-build \ + # Install build deps + autopoint autoconf automake autotools-dev libtool gettext bison flex gtk-doc-tools \ + # Install libraries + librtmp-dev \ + libvo-aacenc-dev \ + libtool-bin \ + libgtk2.0-dev \ + libgl1-mesa-dev \ + libopus-dev \ + libpulse-dev \ + libssl-dev \ + libx264-dev \ + libvpx-dev; \ + # Install meson + pip3 install meson; \ + # + # clean up + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +# +# build gstreamer +RUN set -eux; \ + git clone --depth 1 --branch $GSTREAMER_VERSION https://gitlab.freedesktop.org/gstreamer/gstreamer.git /gstreamer/src; \ + cd /gstreamer/src; \ + mkdir -p /usr/share/gstreamer; \ + meson --prefix /usr/share/gstreamer \ + -Dgpl=enabled \ + -Dugly=enabled \ + -Dgst-plugins-ugly:x264=enabled \ + build; \ + ninja -C build; \ + meson install -C build; + +# +# Stage 0: Build xorg dependencies. +# +FROM debian:bullseye-slim as xorg-deps + +ENV DEBIAN_FRONTEND=noninteractive + +RUN set -eux; \ + apt-get update; \ + apt-get install -y \ + git gcc pkgconf autoconf automake libtool make xorg-dev xutils-dev \ + && rm -rf /var/lib/apt/lists/*; + +WORKDIR /xorg + +COPY xorg/ /xorg/ + +# build xf86-video-dummy v0.3.8 with RandR support +RUN set -eux; \ + cd xf86-video-dummy/v0.3.8; \ + patch -p1 < ../01_v0.3.8_xdummy-randr.patch; \ + autoreconf -v --install; \ + ./configure; \ + make -j$(nproc); \ + make install; + +# build custom input driver +RUN set -eux; \ + cd xf86-input-neko; \ + ./autogen.sh --prefix=/usr; \ + ./configure; \ + make -j$(nproc); \ + make install; + +# +# Stage 1: Build. +# +FROM golang:1.21-bullseye as build +WORKDIR /src + +# +# install dependencies +ENV DEBIAN_FRONTEND=noninteractive +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libx11-dev libxrandr-dev libxtst-dev libgtk-3-dev \ + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev; \ + # install libxcvt-dev (not available in debian:bullseye) + wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt-dev_0.1.2-1_amd64.deb; \ + wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_amd64.deb; \ + apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_amd64.deb ./libxcvt-dev_0.1.2-1_amd64.deb; \ + # + # clean up + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +ARG GIT_COMMIT +ARG GIT_BRANCH +ARG GIT_TAG + +# +# build server +COPY . . +RUN ./build + +# +# Stage 2: Runtime. +# +FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu${UBUNTU_RELEASE} as runtime +ARG UBUNTU_RELEASE +ARG VIRTUALGL_VERSION + +# Make all NVIDIA GPUs visible by default +ENV NVIDIA_VISIBLE_DEVICES all +# All NVIDIA driver capabilities should preferably be used, check `NVIDIA_DRIVER_CAPABILITIES` inside the container if things do not work +ENV NVIDIA_DRIVER_CAPABILITIES all + +# +# set vgl-display to headless 3d gpu card/// correct values are egl[n] or /dev/dri/card0:if this is passed into container +ENV VGL_DISPLAY egl + +# +# set custom user +ARG USERNAME=neko +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# +# install hardware accleration dependencies +ENV DEBIAN_FRONTEND=noninteractive +RUN set -eux; \ + dpkg --add-architecture i386; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + # opengl base: https://gitlab.com/nvidia/container-images/opengl/-/blob/ubuntu20.04/base/Dockerfile + libxau6 libxau6:i386 \ + libxdmcp6 libxdmcp6:i386 \ + libxcb1 libxcb1:i386 \ + libxext6 libxext6:i386 \ + libx11-6 libx11-6:i386 \ + # opengl runtime: https://gitlab.com/nvidia/container-images/opengl/-/blob/ubuntu20.04/glvnd/runtime/Dockerfile + libglvnd0 libglvnd0:i386 \ + libgl1 libgl1:i386 \ + libglx0 libglx0:i386 \ + libegl1 libegl1:i386 \ + libgles2 libgles2:i386 \ + # hardware accleration utilities + libglu1 libglu1:i386 \ + libvulkan-dev libvulkan-dev:i386 \ + mesa-utils mesa-utils-extra \ + mesa-va-drivers mesa-vulkan-drivers \ + vainfo vdpauinfo; \ + # + # install vulkan-utils or vulkan-tools depending on ubuntu release + if [ "${UBUNTU_RELEASE}" = "18.04" ]; then \ + apt-get install -y --no-install-recommends vulkan-utils; \ + else \ + apt-get install -y --no-install-recommends vulkan-tools; \ + fi; \ + # + # create symlink for libnvrtc.so (needed for cudaconvert) + find /usr/local/cuda/lib64/ -maxdepth 1 -type l -name "*libnvrtc.so.*" -exec sh -c 'ln -sf {} /usr/local/cuda/lib64/libnvrtc.so' \;; \ + # + # clean up + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +# +# add cuda to ld path, for gstreamer cuda plugins +ENV LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}:/usr/local/cuda/lib:/usr/local/cuda/lib64" + +# +# install dependencies +ENV DEBIAN_FRONTEND=noninteractive +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + wget ca-certificates supervisor \ + pulseaudio dbus-x11 xserver-xorg-video-dummy \ + libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx6 libx264-155 libvo-aacenc0 librtmp1 \ + libgtk-3-bin software-properties-common cabextract aptitude vim curl \ + # + # needed for profile upload preStop hook + zip curl \ + # + # file chooser handler, clipboard, drop + xdotool xclip libgtk-3-0; \ + # install libxcvt0 (not available in debian:bullseye) + wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_amd64.deb; \ + apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_amd64.deb; \ + rm ./libxcvt0_0.1.2-1_amd64.deb; \ + # + # create a non-root user + groupadd --gid $USER_GID $USERNAME; \ + useradd --uid $USER_UID --gid $USERNAME --shell /bin/bash --create-home $USERNAME; \ + adduser $USERNAME audio; \ + adduser $USERNAME video; \ + adduser $USERNAME pulse; \ + # + # workaround for an X11 problem: http://blog.tigerteufel.de/?p=476 + mkdir /tmp/.X11-unix; \ + chmod 1777 /tmp/.X11-unix; \ + chown $USERNAME /tmp/.X11-unix/; \ + # + # make directories for neko + mkdir -p /etc/neko /var/www; \ + chown -R $USERNAME:$USERNAME /home/$USERNAME; \ + # + # install fonts + apt-get install -y --no-install-recommends \ + # Emojis + fonts-noto-color-emoji \ + # Chinese fonts + fonts-arphic-ukai fonts-arphic-uming \ + # Japanese fonts + fonts-ipafont-mincho fonts-ipafont-gothic \ + # Korean fonts + fonts-unfonts-core \ + # Indian fonts + fonts-indic; \ + # + # clean up + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +# copy dependencies from previous stage +COPY --from=xorg-deps /usr/local/lib/xorg/modules/drivers/dummy_drv.so /usr/lib/xorg/modules/drivers/dummy_drv.so +COPY --from=xorg-deps /usr/local/lib/xorg/modules/input/neko_drv.so /usr/lib/xorg/modules/input/neko_drv.so + +# +# configure EGL and Vulkan manually +RUN VULKAN_API_VERSION=$(dpkg -s libvulkan1 | grep -oP 'Version: [0-9|\.]+' | grep -oP '[0-9]+(\.[0-9]+)(\.[0-9]+)') && \ + # Configure EGL manually + mkdir -p /usr/share/glvnd/egl_vendor.d/ && \ + echo "{\n\ + \"file_format_version\" : \"1.0.0\",\n\ + \"ICD\": {\n\ + \"library_path\": \"libEGL_nvidia.so.0\"\n\ + }\n\ +}" > /usr/share/glvnd/egl_vendor.d/10_nvidia.json && \ + # Configure Vulkan manually + mkdir -p /etc/vulkan/icd.d/ && \ + echo "{\n\ + \"file_format_version\" : \"1.0.0\",\n\ + \"ICD\": {\n\ + \"library_path\": \"libGLX_nvidia.so.0\",\n\ + \"api_version\" : \"${VULKAN_API_VERSION}\"\n\ + }\n\ +}" > /etc/vulkan/icd.d/nvidia_icd.json + +# +# install VirtualGL and make libraries available for preload +RUN set -eux; \ + apt-get update; \ + wget "https://sourceforge.net/projects/virtualgl/files/virtualgl_${VIRTUALGL_VERSION}_amd64.deb"; \ + wget "https://sourceforge.net/projects/virtualgl/files/virtualgl32_${VIRTUALGL_VERSION}_amd64.deb"; \ + apt-get install -y --no-install-recommends ./virtualgl_${VIRTUALGL_VERSION}_amd64.deb ./virtualgl32_${VIRTUALGL_VERSION}_amd64.deb; \ + rm -f "virtualgl_${VIRTUALGL_VERSION}_amd64.deb" "virtualgl32_${VIRTUALGL_VERSION}_amd64.deb"; \ + chmod u+s /usr/lib/libvglfaker.so; \ + chmod u+s /usr/lib/libdlfaker.so; \ + chmod u+s /usr/lib32/libvglfaker.so; \ + chmod u+s /usr/lib32/libdlfaker.so; \ + chmod u+s /usr/lib/i386-linux-gnu/libvglfaker.so; \ + chmod u+s /usr/lib/i386-linux-gnu/libdlfaker.so; \ + # + # clean up + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/*; + +# +# copy runtime configs +COPY --chown=neko:neko runtime/.Xresources /home/$USERNAME/.Xresources +COPY runtime/dbus /usr/bin/dbus +COPY runtime/default.pa /etc/pulse/default.pa +COPY runtime/supervisord.conf /etc/neko/supervisord.conf +COPY runtime/supervisord.dbus.conf /etc/neko/supervisord.dbus.conf +COPY runtime/xorg.conf /etc/neko/xorg.conf + +# +# copy runtime folders +COPY --chown=neko:neko runtime/icon-theme /home/$USERNAME/.icons/default +COPY runtime/fontconfig/* /etc/fonts/conf.d/ +COPY runtime/fonts /usr/local/share/fonts + +# +# set default envs +ENV USER=$USERNAME +ENV DISPLAY=:99.0 +ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket +ENV NEKO_SERVER_BIND=:8080 +ENV NEKO_PLUGINS_ENABLED=true +ENV NEKO_PLUGINS_DIR=/etc/neko/plugins/ + +# +# set gstreamer envs +ENV PATH="/usr/share/gstreamer/bin:${PATH}" +ENV LD_LIBRARY_PATH="/usr/share/gstreamer/lib/x86_64-linux-gnu${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" +ENV PKG_CONFIG_PATH="/usr/share/gstreamer/lib/x86_64-linux-gnu/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}" + +# +# copy gstreamer from previous stage +COPY --from=gstreamer /usr/share/gstreamer /usr/share/gstreamer + +# +# copy plugins from previous stage +COPY --from=build /src/bin/plugins/ $NEKO_PLUGINS_DIR + +# +# copy executable from previous stage +COPY --from=build /src/bin/neko /usr/bin/neko + +# +# add healthcheck +HEALTHCHECK --interval=10s --timeout=5s --retries=8 \ + CMD wget -O - http://localhost:${NEKO_SERVER_BIND#*:}/health || exit 1 + +# +# run neko +CMD ["/usr/bin/supervisord", "-s", "-c", "/etc/neko/supervisord.conf"] diff --git a/server/Dockerfile.nvidia.bookworm b/server/Dockerfile.nvidia.bookworm new file mode 100644 index 000000000..a2932aeab --- /dev/null +++ b/server/Dockerfile.nvidia.bookworm @@ -0,0 +1,325 @@ +ARG UBUNTU_RELEASE=22.04 +ARG CUDA_VERSION=12.2.0 +ARG VIRTUALGL_VERSION=3.1 +ARG GSTREAMER_VERSION=1.22 + +# +# Stage 0: Build gstreamer with nvidia plugins. +# +FROM ubuntu:${UBUNTU_RELEASE} AS gstreamer +ARG GSTREAMER_VERSION + +# +# install dependencies +ENV DEBIAN_FRONTEND=noninteractive +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + # Install essentials + curl build-essential ca-certificates git \ + # Install pip and ninja + python3-pip python-gi-dev ninja-build \ + # Install build deps + autopoint autoconf automake autotools-dev libtool gettext bison flex gtk-doc-tools \ + # Install libraries + librtmp-dev \ + libvo-aacenc-dev \ + libtool-bin \ + libgtk2.0-dev \ + libgl1-mesa-dev \ + libopus-dev \ + libpulse-dev \ + libssl-dev \ + libx264-dev \ + libvpx-dev; \ + # Install meson + pip3 install meson; \ + # + # clean up + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +# +# build gstreamer +RUN set -eux; \ + git clone --depth 1 --branch $GSTREAMER_VERSION https://gitlab.freedesktop.org/gstreamer/gstreamer.git /gstreamer/src; \ + cd /gstreamer/src; \ + mkdir -p /usr/share/gstreamer; \ + meson --prefix /usr/share/gstreamer \ + -Dgpl=enabled \ + -Dugly=enabled \ + -Dgst-plugins-ugly:x264=enabled \ + build; \ + ninja -C build; \ + meson install -C build; + +# +# Stage 0: Build xorg dependencies. +# +FROM debian:bookworm-slim as xorg-deps + +ENV DEBIAN_FRONTEND=noninteractive + +RUN set -eux; \ + apt-get update; \ + apt-get install -y \ + git gcc pkgconf autoconf automake libtool make xorg-dev xutils-dev \ + && rm -rf /var/lib/apt/lists/*; + +WORKDIR /xorg + +COPY xorg/ /xorg/ + +# build xf86-video-dummy v0.3.8 with RandR support +RUN set -eux; \ + cd xf86-video-dummy/v0.3.8; \ + patch -p1 < ../01_v0.3.8_xdummy-randr.patch; \ + autoreconf -v --install; \ + ./configure; \ + make -j$(nproc); \ + make install; + +# build custom input driver +RUN set -eux; \ + cd xf86-input-neko; \ + ./autogen.sh --prefix=/usr; \ + ./configure; \ + make -j$(nproc); \ + make install; + +# +# Stage 1: Build. +# +FROM golang:1.21-bookworm as build +WORKDIR /src + +# +# install dependencies +ENV DEBIAN_FRONTEND=noninteractive +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + libx11-dev libxrandr-dev libxtst-dev libgtk-3-dev libxcvt-dev \ + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev; \ + # + # clean up + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +ARG GIT_COMMIT +ARG GIT_BRANCH +ARG GIT_TAG + +# +# build server +COPY . . +RUN ./build + +# +# Stage 2: Runtime. +# +FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu${UBUNTU_RELEASE} as runtime +ARG UBUNTU_RELEASE +ARG VIRTUALGL_VERSION + +# Make all NVIDIA GPUs visible by default +ENV NVIDIA_VISIBLE_DEVICES all +# All NVIDIA driver capabilities should preferably be used, check `NVIDIA_DRIVER_CAPABILITIES` inside the container if things do not work +ENV NVIDIA_DRIVER_CAPABILITIES all + +# +# set vgl-display to headless 3d gpu card/// correct values are egl[n] or /dev/dri/card0:if this is passed into container +ENV VGL_DISPLAY egl + +# +# set custom user +ARG USERNAME=neko +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# +# install hardware accleration dependencies +ENV DEBIAN_FRONTEND=noninteractive +RUN set -eux; \ + dpkg --add-architecture i386; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + # opengl base: https://gitlab.com/nvidia/container-images/opengl/-/blob/ubuntu20.04/base/Dockerfile + libxau6 libxau6:i386 \ + libxdmcp6 libxdmcp6:i386 \ + libxcb1 libxcb1:i386 \ + libxext6 libxext6:i386 \ + libx11-6 libx11-6:i386 \ + # opengl runtime: https://gitlab.com/nvidia/container-images/opengl/-/blob/ubuntu20.04/glvnd/runtime/Dockerfile + libglvnd0 libglvnd0:i386 \ + libgl1 libgl1:i386 \ + libglx0 libglx0:i386 \ + libegl1 libegl1:i386 \ + libgles2 libgles2:i386 \ + # hardware accleration utilities + libglu1 libglu1:i386 \ + libvulkan-dev libvulkan-dev:i386 \ + mesa-utils mesa-utils-extra \ + mesa-va-drivers mesa-vulkan-drivers \ + vainfo vdpauinfo; \ + # + # install vulkan-utils or vulkan-tools depending on ubuntu release + if [ "${UBUNTU_RELEASE}" = "18.04" ]; then \ + apt-get install -y --no-install-recommends vulkan-utils; \ + else \ + apt-get install -y --no-install-recommends vulkan-tools; \ + fi; \ + # + # create symlink for libnvrtc.so (needed for cudaconvert) + find /usr/local/cuda/lib64/ -maxdepth 1 -type l -name "*libnvrtc.so.*" -exec sh -c 'ln -sf {} /usr/local/cuda/lib64/libnvrtc.so' \;; \ + # + # clean up + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +# +# add cuda to ld path, for gstreamer cuda plugins +ENV LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}:/usr/local/cuda/lib:/usr/local/cuda/lib64" + +# +# install dependencies +ENV DEBIAN_FRONTEND=noninteractive +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + wget ca-certificates supervisor \ + pulseaudio xserver-xorg-video-dummy \ + libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx7 libx264-163 libvo-aacenc0 librtmp1 libxcvt0 \ + libgtk-3-bin software-properties-common cabextract aptitude vim curl \ + # + # needed for profile upload preStop hook + zip curl \ + # + # file chooser handler, clipboard, drop + xdotool xclip libgtk-3-0; \ + # + # create a non-root user + groupadd --gid $USER_GID $USERNAME; \ + useradd --uid $USER_UID --gid $USERNAME --shell /bin/bash --create-home $USERNAME; \ + adduser $USERNAME audio; \ + adduser $USERNAME video; \ + adduser $USERNAME pulse; \ + # + # workaround for an X11 problem: http://blog.tigerteufel.de/?p=476 + mkdir /tmp/.X11-unix; \ + chmod 1777 /tmp/.X11-unix; \ + chown $USERNAME /tmp/.X11-unix/; \ + # + # make directories for neko + mkdir -p /etc/neko /var/www; \ + chown -R $USERNAME:$USERNAME /home/$USERNAME; \ + # + # install fonts + apt-get install -y --no-install-recommends \ + # Emojis + fonts-noto-color-emoji \ + # Chinese fonts + fonts-arphic-ukai fonts-arphic-uming \ + # Japanese fonts + fonts-ipafont-mincho fonts-ipafont-gothic \ + # Korean fonts + fonts-unfonts-core \ + # Indian fonts + fonts-indic; \ + # + # clean up + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +# copy dependencies from previous stage +COPY --from=xorg-deps /usr/local/lib/xorg/modules/drivers/dummy_drv.so /usr/lib/xorg/modules/drivers/dummy_drv.so +COPY --from=xorg-deps /usr/local/lib/xorg/modules/input/neko_drv.so /usr/lib/xorg/modules/input/neko_drv.so + +# +# configure EGL and Vulkan manually +RUN VULKAN_API_VERSION=$(dpkg -s libvulkan1 | grep -oP 'Version: [0-9|\.]+' | grep -oP '[0-9]+(\.[0-9]+)(\.[0-9]+)') && \ + # Configure EGL manually + mkdir -p /usr/share/glvnd/egl_vendor.d/ && \ + echo "{\n\ + \"file_format_version\" : \"1.0.0\",\n\ + \"ICD\": {\n\ + \"library_path\": \"libEGL_nvidia.so.0\"\n\ + }\n\ +}" > /usr/share/glvnd/egl_vendor.d/10_nvidia.json && \ + # Configure Vulkan manually + mkdir -p /etc/vulkan/icd.d/ && \ + echo "{\n\ + \"file_format_version\" : \"1.0.0\",\n\ + \"ICD\": {\n\ + \"library_path\": \"libGLX_nvidia.so.0\",\n\ + \"api_version\" : \"${VULKAN_API_VERSION}\"\n\ + }\n\ +}" > /etc/vulkan/icd.d/nvidia_icd.json + +# +# install VirtualGL and make libraries available for preload +RUN set -eux; \ + apt-get update; \ + wget "https://sourceforge.net/projects/virtualgl/files/virtualgl_${VIRTUALGL_VERSION}_amd64.deb"; \ + wget "https://sourceforge.net/projects/virtualgl/files/virtualgl32_${VIRTUALGL_VERSION}_amd64.deb"; \ + apt-get install -y --no-install-recommends ./virtualgl_${VIRTUALGL_VERSION}_amd64.deb ./virtualgl32_${VIRTUALGL_VERSION}_amd64.deb; \ + rm -f "virtualgl_${VIRTUALGL_VERSION}_amd64.deb" "virtualgl32_${VIRTUALGL_VERSION}_amd64.deb"; \ + chmod u+s /usr/lib/libvglfaker.so; \ + chmod u+s /usr/lib/libdlfaker.so; \ + chmod u+s /usr/lib32/libvglfaker.so; \ + chmod u+s /usr/lib32/libdlfaker.so; \ + chmod u+s /usr/lib/i386-linux-gnu/libvglfaker.so; \ + chmod u+s /usr/lib/i386-linux-gnu/libdlfaker.so; \ + # + # clean up + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/*; + +# +# copy runtime configs +COPY --chown=neko:neko runtime/.Xresources /home/$USERNAME/.Xresources +COPY runtime/default.pa /etc/pulse/default.pa +COPY runtime/supervisord.conf /etc/neko/supervisord.conf +COPY runtime/xorg.conf /etc/neko/xorg.conf + +# +# copy runtime folders +COPY --chown=neko:neko runtime/icon-theme /home/$USERNAME/.icons/default +COPY runtime/fontconfig/* /etc/fonts/conf.d/ +COPY runtime/fonts /usr/local/share/fonts + +# +# set default envs +ENV USER=$USERNAME +ENV DISPLAY=:99.0 +ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket +ENV NEKO_SERVER_BIND=:8080 +ENV NEKO_PLUGINS_ENABLED=true +ENV NEKO_PLUGINS_DIR=/etc/neko/plugins/ + +# +# set gstreamer envs +ENV PATH="/usr/share/gstreamer/bin:${PATH}" +ENV LD_LIBRARY_PATH="/usr/share/gstreamer/lib/x86_64-linux-gnu${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" +ENV PKG_CONFIG_PATH="/usr/share/gstreamer/lib/x86_64-linux-gnu/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}" + +# +# copy gstreamer from previous stage +COPY --from=gstreamer /usr/share/gstreamer /usr/share/gstreamer + +# +# copy plugins from previous stage +COPY --from=build /src/bin/plugins/ $NEKO_PLUGINS_DIR + +# +# copy executable from previous stage +COPY --from=build /src/bin/neko /usr/bin/neko + +# +# add healthcheck +HEALTHCHECK --interval=10s --timeout=5s --retries=8 \ + CMD wget -O - http://localhost:${NEKO_SERVER_BIND#*:}/health || exit 1 + +# +# run neko +CMD ["/usr/bin/supervisord", "-s", "-c", "/etc/neko/supervisord.conf"] diff --git a/server/build b/server/build index 6c3a2543f..6bf20befa 100755 --- a/server/build +++ b/server/build @@ -4,7 +4,12 @@ # aborting if any command returns a non-zero value set -e -BUILD_TIME=`date -u +'%Y-%m-%dT%H:%M:%SZ'` +# +# do not build plugins when passing "core" as first argument +if [ "$1" = "core" ]; +then + skip_plugins="true" +fi # # set git build variables if git exists @@ -13,12 +18,10 @@ then GIT_COMMIT=`git rev-parse --short HEAD` GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD` GIT_TAG=`git tag --points-at $GIT_COMMIT | head -n 1` - GIT_DIRTY=`git diff-index --quiet HEAD -- || echo "✗-"` - GIT_COMMIT="${GIT_DIRTY}${GIT_COMMIT}" fi # -# load dependencies +# load server dependencies go get -v -t -d . # @@ -27,9 +30,58 @@ go build \ -o bin/neko \ -ldflags " -s -w - -X 'm1k1o/neko.buildDate=${BUILD_TIME}' + -X 'm1k1o/neko.buildDate=`date -u +'%Y-%m-%dT%H:%M:%SZ'`' -X 'm1k1o/neko.gitCommit=${GIT_COMMIT}' -X 'm1k1o/neko.gitBranch=${GIT_BRANCH}' -X 'm1k1o/neko.gitTag=${GIT_TAG}' " \ cmd/neko/main.go; + +# +# ensure plugins folder exists +mkdir -p bin/plugins + +# +# if plugins are ignored +if [ "$skip_plugins" = "true" ]; +then + echo "Not building plugins..." + exit 0 +fi + +# +# if plugins directory does not exist +if [ ! -d "./plugins" ]; +then + echo "No plugins directory found, skipping..." + exit 0 +fi + +# +# remove old plugins +rm -f bin/plugins/* + +# +# build plugins +for plugPath in ./plugins/*; do + if [ ! -d $plugPath ]; + then + continue + fi + + pushd $plugPath + + echo "Building plugin: $plugPath" + + if [ ! -f "go.plug.mod" ]; + then + echo "go.plug.mod not found, skipping..." + popd + continue + fi + + # build plugin + go build -modfile=go.plug.mod -buildmode=plugin -buildvcs=false -o "../../bin/plugins/${plugPath##*/}.so" + + popd +done diff --git a/server/cmd/neko/main.go b/server/cmd/neko/main.go index a1a2206fc..405235494 100644 --- a/server/cmd/neko/main.go +++ b/server/cmd/neko/main.go @@ -7,11 +7,11 @@ import ( "m1k1o/neko" "m1k1o/neko/cmd" - "m1k1o/neko/internal/utils" + "m1k1o/neko/pkg/utils" ) func main() { - fmt.Print(utils.Colorf(neko.Header, "server", neko.Service.Version)) + fmt.Print(utils.Colorf(neko.Header, "server", neko.Version)) if err := cmd.Execute(); err != nil { log.Panic().Err(err).Msg("failed to execute command") } diff --git a/server/cmd/plugins.go b/server/cmd/plugins.go new file mode 100644 index 000000000..b58961a75 --- /dev/null +++ b/server/cmd/plugins.go @@ -0,0 +1,50 @@ +package cmd + +import ( + "encoding/json" + "os" + + "m1k1o/neko/internal/config" + "m1k1o/neko/internal/plugins" + + "github.com/rs/zerolog/log" + "github.com/spf13/cobra" +) + +func init() { + command := &cobra.Command{ + Use: "plugins [directory]", + Short: "load, verify and list plugins", + Long: `load, verify and list plugins`, + Run: pluginsCmd, + Args: cobra.MaximumNArgs(1), + } + root.AddCommand(command) +} + +func pluginsCmd(cmd *cobra.Command, args []string) { + pluginDir := "/etc/neko/plugins" + if len(args) > 0 { + pluginDir = args[0] + } + log.Info().Str("dir", pluginDir).Msg("plugins directory") + + plugs := plugins.New(&config.Plugins{ + Enabled: true, + Required: true, + Dir: pluginDir, + }) + + meta := plugs.Metadata() + if len(meta) == 0 { + log.Fatal().Msg("no plugins found") + } + + // marshal indent to stdout + dec := json.NewEncoder(os.Stdout) + dec.SetIndent("", " ") + err := dec.Encode(meta) + if err != nil { + log.Fatal().Err(err).Msg("unable to marshal metadata") + } +} diff --git a/server/cmd/root.go b/server/cmd/root.go index d402f3ce3..0ab934bf2 100644 --- a/server/cmd/root.go +++ b/server/cmd/root.go @@ -6,6 +6,7 @@ import ( "os" "path/filepath" "runtime" + "strings" "time" "github.com/rs/zerolog" @@ -15,9 +16,18 @@ import ( "github.com/spf13/viper" "m1k1o/neko" + "m1k1o/neko/internal/config" ) func Execute() error { + // properly log unhandled panics + defer func() { + panicVal := recover() + if panicVal != nil { + log.Panic().Msgf("%v", panicVal) + } + }() + return root.Execute() } @@ -25,103 +35,131 @@ var root = &cobra.Command{ Use: "neko", Short: "neko streaming server", Long: `neko streaming server`, - Version: neko.Service.Version.String(), + Version: neko.Version.String(), } func init() { + rootConfig := config.Root{} + cobra.OnInitialize(func() { ////// - // logs + // configs ////// - zerolog.TimeFieldFormat = "" - zerolog.SetGlobalLevel(zerolog.InfoLevel) - console := zerolog.ConsoleWriter{Out: os.Stdout} + config := viper.GetString("config") // Use config file from the flag. + if config == "" { + config = os.Getenv("NEKO_CONFIG") // Use config file from the environment variable. + } - if !viper.GetBool("logs") { - log.Logger = log.Output(console) + if config != "" { + viper.SetConfigFile(config) } else { - logs := filepath.Join(".", "logs") if runtime.GOOS == "linux" { - logs = "/var/log/neko" + viper.AddConfigPath("/etc/neko/") + } + + viper.AddConfigPath(".") + viper.SetConfigName("neko") + } + + viper.SetEnvPrefix("NEKO") + viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) + viper.AutomaticEnv() // read in environment variables that match + + // read config values + err := viper.ReadInConfig() + if err != nil { + _, notFound := err.(viper.ConfigFileNotFoundError) + if !notFound { + log.Fatal().Err(err).Msg("unable to read config file") } + } + + // get full config file path + config = viper.ConfigFileUsed() + + // set root config values + rootConfig.Set() + + ////// + // logs + ////// + var logWriter io.Writer - if _, err := os.Stat(logs); os.IsNotExist(err) { - _ = os.Mkdir(logs, os.ModePerm) + // log to a directory instead of stderr + if rootConfig.LogDir != "" { + if _, err := os.Stat(rootConfig.LogDir); os.IsNotExist(err) { + _ = os.Mkdir(rootConfig.LogDir, os.ModePerm) } - latest := filepath.Join(logs, "neko-latest.log") - _, err := os.Stat(latest) - if err == nil { - err = os.Rename(latest, filepath.Join(logs, "neko."+time.Now().Format("2006-01-02T15-04-05Z07-00")+".log")) + latest := filepath.Join(rootConfig.LogDir, "neko-latest.log") + if _, err := os.Stat(latest); err == nil { + err = os.Rename(latest, filepath.Join(rootConfig.LogDir, "neko."+time.Now().Format("2006-01-02T15-04-05Z07-00")+".log")) if err != nil { - log.Panic().Err(err).Msg("failed to rotate log file") + log.Fatal().Err(err).Msg("failed to rotate log file") } } logf, err := os.OpenFile(latest, os.O_RDWR|os.O_CREATE, 0666) if err != nil { - log.Panic().Err(err).Msg("failed to create log file") + log.Fatal().Err(err).Msg("failed to open log file") } - logger := diode.NewWriter(logf, 1000, 10*time.Millisecond, func(missed int) { + logWriter = diode.NewWriter(logf, 1000, 10*time.Millisecond, func(missed int) { fmt.Printf("logger dropped %d messages", missed) }) - - log.Logger = log.Output(io.MultiWriter(console, logger)) + } else { + logWriter = os.Stderr } - ////// - // configs - ////// - config := viper.GetString("config") - if config != "" { - viper.SetConfigFile(config) // Use config file from the flag. - } else { - if runtime.GOOS == "linux" { - viper.AddConfigPath("/etc/neko/") + // log console output instead of json + if !rootConfig.LogJson { + logWriter = zerolog.ConsoleWriter{ + Out: logWriter, + NoColor: rootConfig.LogNocolor, } - - viper.AddConfigPath(".") - viper.SetConfigName("neko") } - viper.SetEnvPrefix("NEKO") - viper.AutomaticEnv() // read in environment variables that match + // save new logger output + log.Logger = log.Output(logWriter) - if err := viper.ReadInConfig(); err != nil { - if _, ok := err.(viper.ConfigFileNotFoundError); !ok { - log.Error().Err(err) - } - if config != "" { - log.Error().Err(err) - } + // set custom log level + if rootConfig.LogLevel != zerolog.NoLevel { + zerolog.SetGlobalLevel(rootConfig.LogLevel) + } + + // set custom log tiem format + if rootConfig.LogTime != "" { + zerolog.TimeFieldFormat = rootConfig.LogTime } - debug := viper.GetBool("debug") - if debug { - zerolog.SetGlobalLevel(zerolog.DebugLevel) + timeFormat := rootConfig.LogTime + if rootConfig.LogTime == zerolog.TimeFormatUnix { + timeFormat = "UNIX" } - file := viper.ConfigFileUsed() logger := log.With(). - Bool("debug", debug). - Str("logging", viper.GetString("logs")). - Str("config", file). + Str("config", config). + Str("log-level", zerolog.GlobalLevel().String()). + Bool("log-json", rootConfig.LogJson). + Str("log-time", timeFormat). + Str("log-dir", rootConfig.LogDir). Logger() - if file == "" { + if config == "" { logger.Warn().Msg("preflight complete without config file") } else { - logger.Info().Msg("preflight complete") + if _, err := os.Stat(config); os.IsNotExist(err) { + logger.Err(err).Msg("preflight complete with nonexistent config file") + } else { + logger.Info().Msg("preflight complete with config file") + } } - - neko.Service.Root.Set() }) - if err := neko.Service.Root.Init(root); err != nil { + if err := rootConfig.Init(root); err != nil { log.Panic().Err(err).Msg("unable to run root command") } - root.SetVersionTemplate(neko.Service.Version.Details()) + root.SetVersionTemplate(neko.Version.Details()) } diff --git a/server/cmd/serve.go b/server/cmd/serve.go index d8c4f605e..90947a658 100644 --- a/server/cmd/serve.go +++ b/server/cmd/serve.go @@ -1,41 +1,240 @@ package cmd import ( + "os" + "os/signal" + + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/spf13/cobra" - "m1k1o/neko" + "m1k1o/neko/internal/api" + "m1k1o/neko/internal/capture" "m1k1o/neko/internal/config" + "m1k1o/neko/internal/desktop" + "m1k1o/neko/internal/http" + "m1k1o/neko/internal/member" + "m1k1o/neko/internal/plugins" + "m1k1o/neko/internal/session" + "m1k1o/neko/internal/webrtc" + "m1k1o/neko/internal/websocket" ) func init() { + service := serve{} + command := &cobra.Command{ - Use: "serve", - Short: "serve neko streaming server", - Long: `serve neko streaming server`, - Run: neko.Service.ServeCommand, + Use: "serve", + Short: "serve neko streaming server", + Long: `serve neko streaming server`, + PreRun: service.PreRun, + Run: service.Run, } - configs := []config.Config{ - neko.Service.Server, - neko.Service.WebRTC, - neko.Service.Capture, - neko.Service.Desktop, - neko.Service.WebSocket, + if err := service.Init(command); err != nil { + log.Panic().Err(err).Msg("unable to initialize configuration") } - cobra.OnInitialize(func() { - for _, cfg := range configs { - cfg.Set() - } - neko.Service.Preflight() - }) + root.AddCommand(command) +} - for _, cfg := range configs { - if err := cfg.Init(command); err != nil { - log.Panic().Err(err).Msg("unable to run serve command") - } +type serve struct { + logger zerolog.Logger + + configs struct { + Desktop config.Desktop + Capture config.Capture + WebRTC config.WebRTC + Member config.Member + Session config.Session + Plugins config.Plugins + Server config.Server } - root.AddCommand(command) + managers struct { + desktop *desktop.DesktopManagerCtx + capture *capture.CaptureManagerCtx + webRTC *webrtc.WebRTCManagerCtx + member *member.MemberManagerCtx + session *session.SessionManagerCtx + webSocket *websocket.WebSocketManagerCtx + plugins *plugins.ManagerCtx + api *api.ApiManagerCtx + http *http.HttpManagerCtx + } +} + +func (c *serve) Init(cmd *cobra.Command) error { + if err := c.configs.Desktop.Init(cmd); err != nil { + return err + } + if err := c.configs.Capture.Init(cmd); err != nil { + return err + } + if err := c.configs.WebRTC.Init(cmd); err != nil { + return err + } + if err := c.configs.Member.Init(cmd); err != nil { + return err + } + if err := c.configs.Session.Init(cmd); err != nil { + return err + } + if err := c.configs.Plugins.Init(cmd); err != nil { + return err + } + if err := c.configs.Server.Init(cmd); err != nil { + return err + } + + // V2 configuration + + if err := c.configs.Desktop.InitV2(cmd); err != nil { + return err + } + if err := c.configs.Capture.InitV2(cmd); err != nil { + return err + } + if err := c.configs.WebRTC.InitV2(cmd); err != nil { + return err + } + if err := c.configs.Member.InitV2(cmd); err != nil { + return err + } + if err := c.configs.Session.InitV2(cmd); err != nil { + return err + } + if err := c.configs.Server.InitV2(cmd); err != nil { + return err + } + + return nil +} + +func (c *serve) PreRun(cmd *cobra.Command, args []string) { + c.logger = log.With().Str("service", "neko").Logger() + + c.configs.Desktop.Set() + c.configs.Capture.Set() + c.configs.WebRTC.Set() + c.configs.Member.Set() + c.configs.Session.Set() + c.configs.Plugins.Set() + c.configs.Server.Set() + + c.configs.Desktop.SetV2() + c.configs.Capture.SetV2() + c.configs.WebRTC.SetV2() + c.configs.Member.SetV2() + c.configs.Session.SetV2() + c.configs.Server.SetV2() +} + +func (c *serve) Start(cmd *cobra.Command) { + c.managers.session = session.New( + &c.configs.Session, + ) + + c.managers.member = member.New( + c.managers.session, + &c.configs.Member, + ) + + if err := c.managers.member.Connect(); err != nil { + c.logger.Panic().Err(err).Msg("unable to connect to member manager") + } + + c.managers.desktop = desktop.New( + &c.configs.Desktop, + ) + c.managers.desktop.Start() + + c.managers.capture = capture.New( + c.managers.desktop, + &c.configs.Capture, + ) + c.managers.capture.Start() + + c.managers.webRTC = webrtc.New( + c.managers.desktop, + c.managers.capture, + &c.configs.WebRTC, + ) + c.managers.webRTC.Start() + + c.managers.webSocket = websocket.New( + c.managers.session, + c.managers.desktop, + c.managers.capture, + c.managers.webRTC, + ) + c.managers.webSocket.Start() + + c.managers.api = api.New( + c.managers.session, + c.managers.member, + c.managers.desktop, + c.managers.capture, + ) + + c.managers.plugins = plugins.New( + &c.configs.Plugins, + ) + + // init and set configuration now + // this means it won't be in --help + c.managers.plugins.InitConfigs(cmd) + c.managers.plugins.SetConfigs() + + c.managers.plugins.Start( + c.managers.session, + c.managers.webSocket, + c.managers.api, + ) + + c.managers.http = http.New( + c.managers.webSocket, + c.managers.api, + &c.configs.Server, + ) + c.managers.http.Start() +} + +func (c *serve) Shutdown() { + var err error + + err = c.managers.http.Shutdown() + c.logger.Err(err).Msg("http manager shutdown") + + err = c.managers.plugins.Shutdown() + c.logger.Err(err).Msg("plugins manager shutdown") + + err = c.managers.webSocket.Shutdown() + c.logger.Err(err).Msg("websocket manager shutdown") + + err = c.managers.webRTC.Shutdown() + c.logger.Err(err).Msg("webrtc manager shutdown") + + err = c.managers.capture.Shutdown() + c.logger.Err(err).Msg("capture manager shutdown") + + err = c.managers.desktop.Shutdown() + c.logger.Err(err).Msg("desktop manager shutdown") + + err = c.managers.member.Disconnect() + c.logger.Err(err).Msg("member manager disconnect") +} + +func (c *serve) Run(cmd *cobra.Command, args []string) { + c.logger.Info().Msg("starting neko server") + c.Start(cmd) + c.logger.Info().Msg("neko ready") + + quit := make(chan os.Signal, 1) + signal.Notify(quit, os.Interrupt) + sig := <-quit + + c.logger.Warn().Msgf("received %s, attempting graceful shutdown", sig) + c.Shutdown() + c.logger.Info().Msg("shutdown complete") } diff --git a/server/dev/build b/server/dev/build new file mode 100755 index 000000000..50d9876b2 --- /dev/null +++ b/server/dev/build @@ -0,0 +1,23 @@ +#!/bin/bash +cd "$(dirname "$0")" + +# +# aborting if any command returns a non-zero value +set -e + +GIT_COMMIT=`git rev-parse --short HEAD` +GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD` + +# if first argument is nvidia, use nvidia dockerfile +if [ "$1" = "nvidia" ]; then + echo "Building nvidia docker image" + DOCKERFILE="Dockerfile.nvidia" +else + echo "Building default docker image" + DOCKERFILE="Dockerfile" +fi + +docker build -t neko_server_build --target build --build-arg "GIT_COMMIT=$GIT_COMMIT" --build-arg "GIT_BRANCH=$GIT_BRANCH" -f ../$DOCKERFILE .. +docker build -t neko_server_runtime --target runtime --build-arg "GIT_COMMIT=$GIT_COMMIT" --build-arg "GIT_BRANCH=$GIT_BRANCH" -f ../$DOCKERFILE .. + +docker build -t neko_server_app --build-arg "BASE_IMAGE=neko_server_runtime" -f ./runtime/Dockerfile ./runtime diff --git a/server/dev/exec b/server/dev/exec new file mode 100755 index 000000000..e9d894217 --- /dev/null +++ b/server/dev/exec @@ -0,0 +1,3 @@ +#!/bin/bash + +docker exec -it neko_server_dev /bin/bash diff --git a/server/dev/fmt b/server/dev/fmt new file mode 100755 index 000000000..69c24eef3 --- /dev/null +++ b/server/dev/fmt @@ -0,0 +1,12 @@ +#!/bin/bash +cd "$(dirname "$0")" + +if [ "$(docker images -q neko_server_build 2> /dev/null)" == "" ]; then + echo "Image 'neko_server_build' not found. Run ./build first." + exit 1 +fi + +docker run -it --rm \ + --entrypoint="go" \ + -v "${PWD}/../:/src" \ + neko_server_build fmt ./... diff --git a/server/dev/go b/server/dev/go new file mode 100755 index 000000000..ae0acf12b --- /dev/null +++ b/server/dev/go @@ -0,0 +1,25 @@ +#!/bin/bash +cd "$(dirname "$0")" + +if [ "$(docker images -q neko_server_build 2> /dev/null)" == "" ]; then + echo "Image 'neko_server_build' not found. Run ./build first." + exit 1 +fi + +docker run -it \ + --name "neko_server_go" \ + --entrypoint="go" \ + -v "${PWD}/../:/src" \ + neko_server_build "$@"; +# +# copy package files +docker cp neko_server_go:/src/go.mod "../go.mod" +docker cp neko_server_go:/src/go.sum "../go.sum" + +# +# commit changes to image +docker commit "neko_server_go" "neko_server_build" + +# +# remove contianer +docker rm "neko_server_go" diff --git a/server/dev/lint b/server/dev/lint new file mode 100755 index 000000000..4124fda4a --- /dev/null +++ b/server/dev/lint @@ -0,0 +1,14 @@ +#!/bin/bash +cd "$(dirname "$0")" + +if [ "$(docker images -q neko_server_build 2> /dev/null)" == "" ]; then + echo "Image 'neko_server_build' not found. Run ./build first." + exit 1 +fi + +# +# build server +docker run --rm -it \ + -v "${PWD}/../:/src" \ + --entrypoint="/bin/bash" \ + neko_server_build -c '[ -f ./bin/golangci-lint ] || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.31.0;./bin/golangci-lint run'; diff --git a/server/dev/rebuild b/server/dev/rebuild new file mode 100755 index 000000000..ffa57bf3a --- /dev/null +++ b/server/dev/rebuild @@ -0,0 +1,32 @@ +#!/bin/bash +cd "$(dirname "$0")" + +# +# aborting if any command returns a non-zero value +set -e + +# +# build server +docker run --rm -it \ + -v "${PWD}/../:/src" \ + --entrypoint="/bin/bash" \ + neko_server_build "./build" "$@"; + +# +# remove old plugins +docker exec neko_server_dev rm -rf /etc/neko/plugins + +# +# replace server binary in container +docker cp "${PWD}/../bin/neko" neko_server_dev:/usr/bin/neko + +# +# replace plugin binaries in container +if [ -d "${PWD}/../bin/plugins" ]; +then + docker cp "${PWD}/../bin/plugins" neko_server_dev:/etc/neko/plugins +fi + +# +# restart server +docker exec neko_server_dev supervisorctl -c /etc/neko/supervisord.conf restart neko diff --git a/server/dev/rebuild.input b/server/dev/rebuild.input new file mode 100755 index 000000000..7f10523d0 --- /dev/null +++ b/server/dev/rebuild.input @@ -0,0 +1,32 @@ +#!/bin/bash +cd "$(dirname "$0")" +cd ../xorg/xf86-input-neko + +# +# aborting if any command returns a non-zero value +set -e + +# +# check if docker image exists +if [ -z "$(docker images -q xf86-input-neko)" ]; then + echo "Docker image not found, building it" + docker build -t xf86-input-neko . +fi + +# +# if there is no ./configure script, run autogen.sh and configure +if [ ! -f ./configure ]; then + docker run -v $PWD/:/app --rm xf86-input-neko bash -c './autogen.sh && ./configure' +fi + +# +# make install +docker run -v $PWD/:/app --rm xf86-input-neko bash -c 'make && make install DESTDIR=/app/build' + +# +# replace input driver in container +docker cp "${PWD}/build/usr/local/lib/xorg/modules/input/neko_drv.so" neko_server_dev:/usr/lib/xorg/modules/input/neko_drv.so + +# +# restart server +docker exec neko_server_dev supervisorctl -c /etc/neko/supervisord.conf restart x-server diff --git a/server/dev/runtime/Dockerfile b/server/dev/runtime/Dockerfile new file mode 100644 index 000000000..c6c3b99ba --- /dev/null +++ b/server/dev/runtime/Dockerfile @@ -0,0 +1,31 @@ +ARG BASE_IMAGE=neko_server_runtime:latest +FROM $BASE_IMAGE + +ARG SRC_URL="https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US" + +# +# install xfce and firefox +RUN set -eux; apt-get update; \ + apt-get install -y --no-install-recommends \ + dbus-x11 xfce4 xfce4-terminal sudo \ + xz-utils bzip2 libgtk-3-0 libdbus-glib-1-2; \ + # + # fetch latest firefox release + wget -O /tmp/firefox-setup.tar.bz2 "${SRC_URL}"; \ + mkdir /usr/lib/firefox; \ + tar -xjf /tmp/firefox-setup.tar.bz2 -C /usr/lib; \ + rm -f /tmp/firefox-setup.tar.bz2; \ + ln -s /usr/lib/firefox/firefox /usr/bin/firefox; \ + # + # add user to sudoers + usermod -aG sudo neko; \ + echo "neko:neko" | chpasswd; \ + echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers; \ + # clean up + apt-get --purge autoremove -y xz-utils bzip2; \ + apt-get clean -y; \ + rm -rf /var/lib/apt/lists/* /var/cache/apt/* + +# +# copy configuation files +COPY supervisord.conf /etc/neko/supervisord/xfce.conf diff --git a/server/dev/runtime/config.nvidia.yml b/server/dev/runtime/config.nvidia.yml new file mode 100644 index 000000000..eb82d79aa --- /dev/null +++ b/server/dev/runtime/config.nvidia.yml @@ -0,0 +1,122 @@ +capture: + video: + codec: h264 + ids: + - nvh264enc + - x264enc + pipelines: + nvh264enc: + fps: 25 + bitrate: 2 + #gst_prefix: "! cudaupload ! cudaconvert ! video/x-raw(memory:CUDAMemory),format=NV12" + gst_prefix: "! video/x-raw,format=NV12" + gst_encoder: "nvh264enc" + gst_params: + bitrate: 3000 + rc-mode: 5 # Low-Delay CBR, High Quality + preset: 5 # Low Latency, High Performance + zerolatency: true + gop-size: 25 + gst_suffix: "! h264parse config-interval=-1 ! video/x-h264,stream-format=byte-stream,profile=constrained-baseline" + x264enc: + fps: 25 + bitrate: 1 + gst_prefix: "! video/x-raw,format=I420" + gst_encoder: "x264enc" + gst_params: + threads: 4 + bitrate: 4096 + key-int-max: 25 + byte-stream: true + tune: zerolatency + speed-preset: veryfast + gst_suffix: "! video/x-h264,stream-format=byte-stream,profile=constrained-baseline" + screencast: + enabled: true + +server: + pprof: true + +desktop: + screen: "1920x1080@60" + +member: + # provider: "object" + # object: + # users: + # - username: "admin" + # password: "admin" + # profile: + # name: "Administrator" + # is_admin: true + # can_login: true + # can_connect: true + # can_watch: true + # can_host: true + # can_share_media: true + # can_access_clipboard: true + # sends_inactive_cursor: true + # can_see_inactive_cursors: true + # - username: "user" + # password: "neko" + # profile: + # name: "User" + # is_admin: false + # can_login: true + # can_connect: true + # can_watch: true + # can_host: true + # can_share_media: true + # can_access_clipboard: true + # sends_inactive_cursor: true + # can_see_inactive_cursors: false + # provider: "file" + # file: + # path: "/home/neko/members.json" + provider: "multiuser" + multiuser: + admin_password: "admin" + user_password: "neko" + # admin_profile: # optional + # user_profile: # optional + # provider: "noauth" + +session: + # Allows reconnecting the websocket even if the previous + # connection was not closed. Can lead to session hijacking. + merciful_reconnect: true + # Show inactive cursors on the screen. Can lead to multiple + # data sent via WebSockets and additonal rendering cost on + # the clients. + implicit_hosting: false + inactive_cursors: true + api_token: "neko123" + cookie: + # Disabling cookies will result to use Bearer Authentication. + # This is less secure, because access token will be sent to + # client in playload and accessible via JS app. + enabled: false + secure: false + +webrtc: + icelite: true + iceservers: + # Backend servers are ignored if icelite is true. + backend: + - urls: [ stun:stun.l.google.com:19302 ] + frontend: + - urls: [ stun:stun.l.google.com:19305 ] + #username: foo + #credential: bar + # estimator: + # enabled: true + # passive: false + # debug: true + # initial_bitrate: 1000000 + # read_interval: 1s + # stable_duration: 10s + # unstable_duration: 5s + # stalled_duration: 20s + # downgrade_backoff: 10s + # upgrade_backoff: 30s + # diff_threshold: 0.5 diff --git a/server/dev/runtime/config.yml b/server/dev/runtime/config.yml new file mode 100644 index 000000000..1bf51b034 --- /dev/null +++ b/server/dev/runtime/config.yml @@ -0,0 +1,144 @@ +capture: + video: + codec: vp8 + ids: [ hq, lq ] + pipelines: + hq: + fps: 25 + gst_encoder: vp8enc + gst_params: + target-bitrate: round(3072 * 650) + cpu-used: 4 + end-usage: cbr + threads: 4 + deadline: 1 + undershoot: 95 + buffer-size: (3072 * 4) + buffer-initial-size: (3072 * 2) + buffer-optimal-size: (3072 * 3) + keyframe-max-dist: 25 + min-quantizer: 4 + max-quantizer: 20 + lq: + fps: 25 + gst_encoder: vp8enc + gst_params: + target-bitrate: round(1024 * 650) + cpu-used: 4 + end-usage: cbr + threads: 4 + deadline: 1 + undershoot: 95 + buffer-size: (1024 * 4) + buffer-initial-size: (1024 * 2) + buffer-optimal-size: (1024 * 3) + keyframe-max-dist: 25 + min-quantizer: 4 + max-quantizer: 20 + # video: + # codec: h264 + # ids: [ main ] + # pipelines: + # main: + # width: (width / 3) * 2 + # height: (height / 3) * 2 + # fps: 20 + # gst_prefix: "! video/x-raw,format=I420" + # gst_encoder: "x264enc" + # gst_params: + # threads: 4 + # bitrate: 4096 + # key-int-max: 15 + # byte-stream: true + # tune: zerolatency + # speed-preset: veryfast + # gst_suffix: "! video/x-h264,stream-format=byte-stream" + screencast: + enabled: true + +server: + pprof: true + +desktop: + screen: "1920x1080@60" + +member: + # provider: "object" + # object: + # users: + # - username: "admin" + # password: "admin" + # profile: + # name: "Administrator" + # is_admin: true + # can_login: true + # can_connect: true + # can_watch: true + # can_host: true + # can_share_media: true + # can_access_clipboard: true + # sends_inactive_cursor: true + # can_see_inactive_cursors: true + # - username: "user" + # password: "neko" + # profile: + # name: "User" + # is_admin: false + # can_login: true + # can_connect: true + # can_watch: true + # can_host: true + # can_share_media: true + # can_access_clipboard: true + # sends_inactive_cursor: true + # can_see_inactive_cursors: false + # provider: "file" + # file: + # path: "/home/neko/members.json" + provider: "multiuser" + multiuser: + admin_password: "admin" + user_password: "neko" + # admin_profile: # optional + # user_profile: # optional + # provider: "noauth" + +session: + # Allows reconnecting the websocket even if the previous + # connection was not closed. Can lead to session hijacking. + merciful_reconnect: true + # Show inactive cursors on the screen. Can lead to multiple + # data sent via WebSockets and additonal rendering cost on + # the clients. + implicit_hosting: false + inactive_cursors: true + api_token: "neko123" + cookie: + # Disabling cookies will result to use Bearer Authentication. + # This is less secure, because access token will be sent to + # client in playload and accessible via JS app. + enabled: false + secure: false + +webrtc: + icelite: true + iceservers: + # Backend servers are ignored if icelite is true. + backend: + - urls: [ stun:stun.l.google.com:19302 ] + frontend: + - urls: [ stun:stun.l.google.com:19305 ] + #username: foo + #credential: bar + # estimator: + # enabled: true + # passive: false + # debug: true + # initial_bitrate: 1000000 + # read_interval: 1s + # stable_duration: 10s + # unstable_duration: 5s + # stalled_duration: 20s + # downgrade_backoff: 10s + # upgrade_backoff: 30s + # diff_threshold: 0.5 diff --git a/server/dev/runtime/supervisord.conf b/server/dev/runtime/supervisord.conf new file mode 100644 index 000000000..bcd958fe8 --- /dev/null +++ b/server/dev/runtime/supervisord.conf @@ -0,0 +1,10 @@ +[program:xfce] +environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s" +command=/usr/bin/startxfce4 +stopsignal=INT +autorestart=true +priority=500 +user=%(ENV_USER)s +stdout_logfile=/dev/stderr +stdout_logfile_maxbytes=0 +redirect_stderr=true diff --git a/server/dev/start b/server/dev/start new file mode 100755 index 000000000..210e61c08 --- /dev/null +++ b/server/dev/start @@ -0,0 +1,64 @@ +#!/bin/bash +cd "$(dirname "$0")" + +if [ -z "$(docker images -q neko_server_app 2> /dev/null)" ]; then + echo "Image 'neko_server_app' not found. Running ./build first." + ./build +fi + +if [ -z $NEKO_PORT ]; then + NEKO_PORT="3000" +fi + +if [ -z $NEKO_MUX ]; then + NEKO_MUX="52100" +fi + +if [ -z $NEKO_NAT1TO1 ]; then + for i in $(ifconfig -l 2>/dev/null); do + NEKO_NAT1TO1=$(ipconfig getifaddr $i) + if [ ! -z $NEKO_NAT1TO1 ]; then + break + fi + done + + if [ -z $NEKO_NAT1TO1 ]; then + NEKO_NAT1TO1=$(hostname -I 2>/dev/null | awk '{print $1}') + fi + + if [ -z $NEKO_NAT1TO1 ]; then + NEKO_NAT1TO1=$(hostname -i 2>/dev/null) + fi +fi + +# if first argument is nvidia, start with nvidia runtime +if [ "$1" = "nvidia" ]; then + echo "Starting nvidia docker image" + EXTRAOPTS="--gpus all" + CONFIG="config.nvidia.yml" +else + echo "Starting default docker image" + EXTRAOPTS="" + CONFIG="config.yml" +fi + +echo "Using app port: ${NEKO_PORT}" +echo "Using mux port: ${NEKO_MUX}" +echo "Using IP address: ${NEKO_NAT1TO1}" + +# start server +docker run --rm -it \ + --name "neko_server_dev" \ + -p "${NEKO_PORT}:8080" \ + -p "${NEKO_MUX}:${NEKO_MUX}/tcp" \ + -p "${NEKO_MUX}:${NEKO_MUX}/udp" \ + -e "NEKO_WEBRTC_UDPMUX=${NEKO_MUX}" \ + -e "NEKO_WEBRTC_TCPMUX=${NEKO_MUX}" \ + -e "NEKO_WEBRTC_NAT1TO1=${NEKO_NAT1TO1}" \ + -e "NEKO_SESSION_FILE=/home/neko/sessions.txt" \ + -v "${PWD}/runtime/$CONFIG:/etc/neko/neko.yml" \ + -e "NEKO_DEBUG=1" \ + --shm-size=2G \ + --security-opt seccomp=unconfined \ + $EXTRAOPTS \ + neko_server_app:latest; diff --git a/server/go.mod b/server/go.mod index 98e16d2a0..b7e6f851c 100644 --- a/server/go.mod +++ b/server/go.mod @@ -1,55 +1,68 @@ module m1k1o/neko -go 1.20 +go 1.21 require ( - github.com/fsnotify/fsnotify v1.6.0 - github.com/go-chi/chi/v5 v5.0.10 + github.com/PaesslerAG/gval v1.2.2 + github.com/go-chi/chi v1.5.5 github.com/go-chi/cors v1.2.1 - github.com/gorilla/websocket v1.5.0 - github.com/pion/ice/v2 v2.3.0 - github.com/pion/interceptor v0.1.12 + github.com/gorilla/websocket v1.5.1 + github.com/kataras/go-events v0.0.3 + github.com/pion/ice/v2 v2.3.12 + github.com/pion/interceptor v0.1.25 github.com/pion/logging v0.2.2 - github.com/pion/rtp v1.7.13 // indirect - github.com/pion/srtp/v2 v2.0.12 // indirect - github.com/pion/webrtc/v3 v3.1.55 - github.com/pkg/errors v0.9.1 - github.com/rs/zerolog v1.29.0 - github.com/spf13/cast v1.5.0 // indirect - github.com/spf13/cobra v1.6.1 - github.com/spf13/viper v1.15.0 - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + github.com/pion/rtcp v1.2.13 + github.com/pion/webrtc/v3 v3.2.24 + github.com/prometheus/client_golang v1.18.0 + github.com/rs/zerolog v1.31.0 + github.com/spf13/cobra v1.8.0 + github.com/spf13/viper v1.18.2 ) require ( - github.com/google/uuid v1.3.0 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/kr/pretty v0.3.1 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/pelletier/go-toml/v2 v2.0.6 // indirect + github.com/pelletier/go-toml/v2 v2.1.1 // indirect github.com/pion/datachannel v1.5.5 // indirect - github.com/pion/dtls/v2 v2.2.6 // indirect - github.com/pion/mdns v0.0.7 // indirect + github.com/pion/dtls/v2 v2.2.9 // indirect + github.com/pion/mdns v0.0.9 // indirect github.com/pion/randutil v0.1.0 // indirect - github.com/pion/rtcp v1.2.10 // indirect - github.com/pion/sctp v1.8.6 // indirect + github.com/pion/rtp v1.8.3 // indirect + github.com/pion/sctp v1.8.9 // indirect github.com/pion/sdp/v3 v3.0.6 // indirect - github.com/pion/stun v0.4.0 // indirect - github.com/pion/transport/v2 v2.0.2 // indirect - github.com/pion/turn/v2 v2.1.0 // indirect - github.com/pion/udp/v2 v2.0.1 // indirect - github.com/spf13/afero v1.9.4 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/pion/srtp/v2 v2.0.18 // indirect + github.com/pion/stun v0.6.1 // indirect + github.com/pion/transport/v2 v2.2.4 // indirect + github.com/pion/turn/v2 v2.1.4 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/common v0.46.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/shopspring/decimal v1.3.1 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/subosito/gotenv v1.4.2 // indirect + github.com/stretchr/testify v1.8.4 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/crypto v0.18.0 // indirect + golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sys v0.16.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/server/go.sum b/server/go.sum index a16b653f9..84008d03d 100644 --- a/server/go.sum +++ b/server/go.sum @@ -1,155 +1,57 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/PaesslerAG/gval v1.2.2 h1:Y7iBzhgE09IGTt5QgGQ2IdaYYYOU134YGHBThD+wm9E= +github.com/PaesslerAG/gval v1.2.2/go.mod h1:XRFLwvmkTEdYziLdaCeCa5ImcGVrfQbeNUbVR+C6xac= +github.com/PaesslerAG/jsonpath v0.1.0 h1:gADYeifvlqK3R3i2cR5B4DGgxLXIPb3TRTH1mGi0jPI= +github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= -github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/go-chi/chi v1.5.5 h1:vOB/HbEMt9QqBqErz07QehcOKHaWFtuj87tTDVz2qXE= +github.com/go-chi/chi v1.5.5/go.mod h1:C9JqLr3tIYjDOZpzn+BCuxY8z8vmca43EeMgyZt7irw= github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4= github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= +github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kataras/go-events v0.0.3 h1:o5YK53uURXtrlg7qE/vovxd/yKOJcLuFtPQbf1rYMC4= +github.com/kataras/go-events v0.0.3/go.mod h1:bFBgtzwwzrag7kQmGuU1ZaVxhK2qseYPQomXoVEMsj4= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -158,13 +60,12 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= @@ -176,425 +77,221 @@ github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042 github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= -github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= +github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pion/datachannel v1.5.5 h1:10ef4kwdjije+M9d7Xm9im2Y3O6A6ccQb0zcqZcJew8= github.com/pion/datachannel v1.5.5/go.mod h1:iMz+lECmfdCMqFRhXhcA/219B0SQlbpoR2V118yimL0= -github.com/pion/dtls/v2 v2.2.4/go.mod h1:WGKfxqhrddne4Kg3p11FUMJrynkOY4lb25zHNO49wuw= -github.com/pion/dtls/v2 v2.2.6 h1:yXMxKr0Skd+Ub6A8UqXTRLSywskx93ooMRHsQUtd+Z4= -github.com/pion/dtls/v2 v2.2.6/go.mod h1:t8fWJCIquY5rlQZwA2yWxUS1+OCrAdXrhVKXB5oD/wY= -github.com/pion/ice/v2 v2.3.0 h1:G+ysriabk1p9wbySDpdsnlD+6ZspLlDLagRduRfzJPk= -github.com/pion/ice/v2 v2.3.0/go.mod h1:+xO/cXVnnVUr6D2ZJcCT5g9LngucUkkTvfnTMqUxKRM= -github.com/pion/interceptor v0.1.12 h1:CslaNriCFUItiXS5o+hh5lpL0t0ytQkFnUcbbCs2Zq8= -github.com/pion/interceptor v0.1.12/go.mod h1:bDtgAD9dRkBZpWHGKaoKb42FhDHTG2rX8Ii9LRALLVA= +github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s= +github.com/pion/dtls/v2 v2.2.9 h1:K+D/aVf9/REahQvqk6G5JavdrD8W1PWDKC11UlwN7ts= +github.com/pion/dtls/v2 v2.2.9/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s= +github.com/pion/ice/v2 v2.3.11/go.mod h1:hPcLC3kxMa+JGRzMHqQzjoSj3xtE9F+eoncmXLlCL4E= +github.com/pion/ice/v2 v2.3.12 h1:NWKW2b3+oSZS3klbQMIEWQ0i52Kuo0KBg505a5kQv4s= +github.com/pion/ice/v2 v2.3.12/go.mod h1:hPcLC3kxMa+JGRzMHqQzjoSj3xtE9F+eoncmXLlCL4E= +github.com/pion/interceptor v0.1.25 h1:pwY9r7P6ToQ3+IF0bajN0xmk/fNw/suTgaTdlwTDmhc= +github.com/pion/interceptor v0.1.25/go.mod h1:wkbPYAak5zKsfpVDYMtEfWEy8D4zL+rpxCxPImLOg3Y= github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= -github.com/pion/mdns v0.0.7 h1:P0UB4Sr6xDWEox0kTVxF0LmQihtCbSAdW0H2nEgkA3U= -github.com/pion/mdns v0.0.7/go.mod h1:4iP2UbeFhLI/vWju/bw6ZfwjJzk0z8DNValjGxR/dD8= +github.com/pion/mdns v0.0.8/go.mod h1:hYE72WX8WDveIhg7fmXgMKivD3Puklk0Ymzog0lSyaI= +github.com/pion/mdns v0.0.9 h1:7Ue5KZsqq8EuqStnpPWV33vYYEH0+skdDN5L7EiEsI4= +github.com/pion/mdns v0.0.9/go.mod h1:2JA5exfxwzXiCihmxpTKgFUpiQws2MnipoPK09vecIc= github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA= github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8= -github.com/pion/rtcp v1.2.10 h1:nkr3uj+8Sp97zyItdN60tE/S6vk4al5CPRR6Gejsdjc= github.com/pion/rtcp v1.2.10/go.mod h1:ztfEwXZNLGyF1oQDttz/ZKIBaeeg/oWbRYqzBM9TL1I= -github.com/pion/rtp v1.7.13 h1:qcHwlmtiI50t1XivvoawdCGTP4Uiypzfrsap+bijcoA= -github.com/pion/rtp v1.7.13/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= +github.com/pion/rtcp v1.2.12/go.mod h1:sn6qjxvnwyAkkPzPULIbVqSKI5Dv54Rv7VG0kNxh9L4= +github.com/pion/rtcp v1.2.13 h1:+EQijuisKwm/8VBs8nWllr0bIndR7Lf7cZG200mpbNo= +github.com/pion/rtcp v1.2.13/go.mod h1:sn6qjxvnwyAkkPzPULIbVqSKI5Dv54Rv7VG0kNxh9L4= +github.com/pion/rtp v1.8.2/go.mod h1:pBGHaFt/yW7bf1jjWAoUjpSNoDnw98KTMg+jWWvziqU= +github.com/pion/rtp v1.8.3 h1:VEHxqzSVQxCkKDSHro5/4IUUG1ea+MFdqR2R3xSpNU8= +github.com/pion/rtp v1.8.3/go.mod h1:pBGHaFt/yW7bf1jjWAoUjpSNoDnw98KTMg+jWWvziqU= github.com/pion/sctp v1.8.5/go.mod h1:SUFFfDpViyKejTAdwD1d/HQsCu+V/40cCs2nZIvC3s0= -github.com/pion/sctp v1.8.6 h1:CUex11Vkt9YS++VhLf8b55O3VqKrWL6W3SDwX4jAqsI= -github.com/pion/sctp v1.8.6/go.mod h1:SUFFfDpViyKejTAdwD1d/HQsCu+V/40cCs2nZIvC3s0= +github.com/pion/sctp v1.8.8/go.mod h1:igF9nZBrjh5AtmKc7U30jXltsFHicFCXSmWA2GWRaWs= +github.com/pion/sctp v1.8.9 h1:TP5ZVxV5J7rz7uZmbyvnUvsn7EJ2x/5q9uhsTtXbI3g= +github.com/pion/sctp v1.8.9/go.mod h1:cMLT45jqw3+jiJCrtHVwfQLnfR0MGZ4rgOJwUOIqLkI= github.com/pion/sdp/v3 v3.0.6 h1:WuDLhtuFUUVpTfus9ILC4HRyHsW6TdugjEX/QY9OiUw= github.com/pion/sdp/v3 v3.0.6/go.mod h1:iiFWFpQO8Fy3S5ldclBkpXqmWy02ns78NOKoLLL0YQw= -github.com/pion/srtp/v2 v2.0.12 h1:WrmiVCubGMOAObBU1vwWjG0H3VSyQHawKeer2PVA5rY= -github.com/pion/srtp/v2 v2.0.12/go.mod h1:C3Ep44hlOo2qEYaq4ddsmK5dL63eLehXFbHaZ9F5V9Y= -github.com/pion/stun v0.4.0 h1:vgRrbBE2htWHy7l3Zsxckk7rkjnjOsSM7PHZnBwo8rk= -github.com/pion/stun v0.4.0/go.mod h1:QPsh1/SbXASntw3zkkrIk3ZJVKz4saBY2G7S10P3wCw= +github.com/pion/srtp/v2 v2.0.18 h1:vKpAXfawO9RtTRKZJbG4y0v1b11NZxQnxRl85kGuUlo= +github.com/pion/srtp/v2 v2.0.18/go.mod h1:0KJQjA99A6/a0DOVTu1PhDSw0CXF2jTkqOoMg3ODqdA= +github.com/pion/stun v0.6.1 h1:8lp6YejULeHBF8NmV8e2787BogQhduZugh5PdhDyyN4= +github.com/pion/stun v0.6.1/go.mod h1:/hO7APkX4hZKu/D0f2lHzNyvdkTGtIy3NDmLR7kSz/8= github.com/pion/transport v0.14.1 h1:XSM6olwW+o8J4SCmOBb/BpwZypkHeyM0PGFCxNQBr40= github.com/pion/transport v0.14.1/go.mod h1:4tGmbk00NeYA3rUa9+n+dzCCoKkcy3YlYb99Jn2fNnI= -github.com/pion/transport/v2 v2.0.0/go.mod h1:HS2MEBJTwD+1ZI2eSXSvHJx/HnzQqRy2/LXxt6eVMHc= -github.com/pion/transport/v2 v2.0.1/go.mod h1:93OYg91+mrGxKW+Jrgzmqr80kgXqD7J0yybOrdr7w0Y= -github.com/pion/transport/v2 v2.0.2 h1:St+8o+1PEzPT51O9bv+tH/KYYLMNR5Vwm5Z3Qkjsywg= -github.com/pion/transport/v2 v2.0.2/go.mod h1:vrz6bUbFr/cjdwbnxq8OdDDzHf7JJfGsIRkxfpZoTA0= -github.com/pion/turn/v2 v2.1.0 h1:5wGHSgGhJhP/RpabkUb/T9PdsAjkGLS6toYz5HNzoSI= -github.com/pion/turn/v2 v2.1.0/go.mod h1:yrT5XbXSGX1VFSF31A3c1kCNB5bBZgk/uu5LET162qs= -github.com/pion/udp v0.1.4/go.mod h1:G8LDo56HsFwC24LIcnT4YIDU5qcB6NepqqjP0keL2us= -github.com/pion/udp/v2 v2.0.1 h1:xP0z6WNux1zWEjhC7onRA3EwwSliXqu1ElUZAQhUP54= -github.com/pion/udp/v2 v2.0.1/go.mod h1:B7uvTMP00lzWdyMr/1PVZXtV3wpPIxBRd4Wl6AksXn8= -github.com/pion/webrtc/v3 v3.1.55 h1:jQt98hZ8DUi/l/s/rtogthBdsKKvKekFgZCX9hMEqRo= -github.com/pion/webrtc/v3 v3.1.55/go.mod h1:M1gU5mnvvo4e1nnLvF23esYz0nZAFOtbU/wq44MSfbc= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pion/transport/v2 v2.2.1/go.mod h1:cXXWavvCnFF6McHTft3DWS9iic2Mftcz1Aq29pGcU5g= +github.com/pion/transport/v2 v2.2.2/go.mod h1:OJg3ojoBJopjEeECq2yJdXH9YVrUJ1uQ++NjXLOUorc= +github.com/pion/transport/v2 v2.2.3/go.mod h1:q2U/tf9FEfnSBGSW6w5Qp5PFWRLRj3NjLhCCgpRK4p0= +github.com/pion/transport/v2 v2.2.4 h1:41JJK6DZQYSeVLxILA2+F4ZkKb4Xd/tFJZRFZQ9QAlo= +github.com/pion/transport/v2 v2.2.4/go.mod h1:q2U/tf9FEfnSBGSW6w5Qp5PFWRLRj3NjLhCCgpRK4p0= +github.com/pion/transport/v3 v3.0.1 h1:gDTlPJwROfSfz6QfSi0ZmeCSkFcnWWiiR9ES0ouANiM= +github.com/pion/transport/v3 v3.0.1/go.mod h1:UY7kiITrlMv7/IKgd5eTUcaahZx5oUN3l9SzK5f5xE0= +github.com/pion/turn/v2 v2.1.3/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY= +github.com/pion/turn/v2 v2.1.4 h1:2xn8rduI5W6sCZQkEnIUDAkrBQNl2eYIBCHMZ3QMmP8= +github.com/pion/turn/v2 v2.1.4/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY= +github.com/pion/webrtc/v3 v3.2.24 h1:MiFL5DMo2bDaaIFWr0DDpwiV/L4EGbLZb+xoRvfEo1Y= +github.com/pion/webrtc/v3 v3.2.24/go.mod h1:1CaT2fcZzZ6VZA+O1i9yK2DU4EOcXVvSbWG9pr5jefs= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.29.0 h1:Zes4hju04hjbvkVkOhdl2HpZa+0PmVwigmo8XoORE5w= -github.com/rs/zerolog v1.29.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= +github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= +github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= +github.com/prometheus/common v0.46.0 h1:doXzt5ybi1HBKpsZOL0sSkaNHJJqkyfEWZGGqqScV0Y= +github.com/prometheus/common v0.46.0/go.mod h1:Tp0qkxpb9Jsg54QMe+EAmqXkSV7Evdy1BTn+g2pa/hQ= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= +github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= -github.com/spf13/afero v1.9.4 h1:Sd43wM1IWz/s1aVXdOBkjJvuP8UdyqioeE4AmM0QsBs= -github.com/spf13/afero v1.9.4/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= -github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= -github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= -github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= -github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= +github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= -github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= +github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= +github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= -github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= +golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= +golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA= +golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= +golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= +golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -606,13 +303,3 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/server/internal/api/members/bluk.go b/server/internal/api/members/bluk.go new file mode 100644 index 000000000..44ee14cc7 --- /dev/null +++ b/server/internal/api/members/bluk.go @@ -0,0 +1,84 @@ +package members + +import ( + "encoding/json" + "io" + "net/http" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +type MemberBulkUpdatePayload struct { + IDs []string `json:"ids"` + Profile types.MemberProfile `json:"profile"` +} + +func (h *MembersHandler) membersBulkUpdate(w http.ResponseWriter, r *http.Request) error { + bytes, err := io.ReadAll(r.Body) + if err != nil { + return utils.HttpBadRequest("unable to read post body").WithInternalErr(err) + } + + header := &MemberBulkUpdatePayload{} + if err := json.Unmarshal(bytes, &header); err != nil { + return utils.HttpBadRequest("unable to unmarshal payload").WithInternalErr(err) + } + + for _, memberId := range header.IDs { + // TODO: Bulk select? + profile, err := h.members.Select(memberId) + if err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + WithInternalMsg("unable to select member profile"). + Msgf("failed to update member %s", memberId) + } + + body := &MemberBulkUpdatePayload{ + Profile: profile, + } + + if err := json.Unmarshal(bytes, &body); err != nil { + return utils.HttpBadRequest(). + WithInternalErr(err). + Msgf("unable to unmarshal payload for member %s", memberId) + } + + if err := h.members.UpdateProfile(memberId, body.Profile); err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + WithInternalMsg("unable to update member profile"). + Msgf("failed to update member %s", memberId) + } + } + + return utils.HttpSuccess(w) +} + +type MemberBulkDeletePayload struct { + IDs []string `json:"ids"` +} + +func (h *MembersHandler) membersBulkDelete(w http.ResponseWriter, r *http.Request) error { + bytes, err := io.ReadAll(r.Body) + if err != nil { + return utils.HttpBadRequest("unable to read post body").WithInternalErr(err) + } + + data := &MemberBulkDeletePayload{} + if err := json.Unmarshal(bytes, &data); err != nil { + return utils.HttpBadRequest("unable to unmarshal payload").WithInternalErr(err) + } + + for _, memberId := range data.IDs { + if err := h.members.Delete(memberId); err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + WithInternalMsg("unable to delete member"). + Msgf("failed to delete member %s", memberId) + } + } + + return utils.HttpSuccess(w) +} diff --git a/server/internal/api/members/controler.go b/server/internal/api/members/controler.go new file mode 100644 index 000000000..74c793c24 --- /dev/null +++ b/server/internal/api/members/controler.go @@ -0,0 +1,144 @@ +package members + +import ( + "errors" + "net/http" + "strconv" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +type MemberDataPayload struct { + ID string `json:"id"` + Profile types.MemberProfile `json:"profile"` +} + +type MemberCreatePayload struct { + Username string `json:"username"` + Password string `json:"password"` + Profile types.MemberProfile `json:"profile"` +} + +type MemberPasswordPayload struct { + Password string `json:"password"` +} + +func (h *MembersHandler) membersList(w http.ResponseWriter, r *http.Request) error { + limit, err := strconv.Atoi(r.URL.Query().Get("limit")) + if err != nil { + // TODO: Default zero. + limit = 0 + } + + offset, err := strconv.Atoi(r.URL.Query().Get("offset")) + if err != nil { + // TODO: Default zero. + offset = 0 + } + + entries, err := h.members.SelectAll(limit, offset) + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + members := []MemberDataPayload{} + for id, profile := range entries { + members = append(members, MemberDataPayload{ + ID: id, + Profile: profile, + }) + } + + return utils.HttpSuccess(w, members) +} + +func (h *MembersHandler) membersCreate(w http.ResponseWriter, r *http.Request) error { + data := &MemberCreatePayload{ + // default values + Profile: types.MemberProfile{ + IsAdmin: false, + CanLogin: true, + CanConnect: true, + CanWatch: true, + CanHost: true, + CanShareMedia: true, + CanAccessClipboard: true, + SendsInactiveCursor: true, + CanSeeInactiveCursors: true, + }, + } + + if err := utils.HttpJsonRequest(w, r, data); err != nil { + return err + } + + if data.Username == "" { + return utils.HttpBadRequest("username cannot be empty") + } + + if data.Password == "" { + return utils.HttpBadRequest("password cannot be empty") + } + + id, err := h.members.Insert(data.Username, data.Password, data.Profile) + if err != nil { + if errors.Is(err, types.ErrMemberAlreadyExists) { + return utils.HttpUnprocessableEntity("member already exists") + } + + return utils.HttpInternalServerError().WithInternalErr(err) + } + + return utils.HttpSuccess(w, MemberDataPayload{ + ID: id, + Profile: data.Profile, + }) +} + +func (h *MembersHandler) membersRead(w http.ResponseWriter, r *http.Request) error { + member := GetMember(r) + profile := member.Profile + + return utils.HttpSuccess(w, profile) +} + +func (h *MembersHandler) membersUpdateProfile(w http.ResponseWriter, r *http.Request) error { + member := GetMember(r) + data := &member.Profile + + if err := utils.HttpJsonRequest(w, r, data); err != nil { + return err + } + + if err := h.members.UpdateProfile(member.ID, *data); err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + return utils.HttpSuccess(w) +} + +func (h *MembersHandler) membersUpdatePassword(w http.ResponseWriter, r *http.Request) error { + member := GetMember(r) + data := &MemberPasswordPayload{} + + if err := utils.HttpJsonRequest(w, r, data); err != nil { + return err + } + + if err := h.members.UpdatePassword(member.ID, data.Password); err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + return utils.HttpSuccess(w) +} + +func (h *MembersHandler) membersDelete(w http.ResponseWriter, r *http.Request) error { + member := GetMember(r) + + if err := h.members.Delete(member.ID); err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + return utils.HttpSuccess(w) +} diff --git a/server/internal/api/members/handler.go b/server/internal/api/members/handler.go new file mode 100644 index 000000000..7e9b6ee97 --- /dev/null +++ b/server/internal/api/members/handler.go @@ -0,0 +1,83 @@ +package members + +import ( + "context" + "errors" + "net/http" + + "github.com/go-chi/chi" + + "m1k1o/neko/pkg/auth" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +type key int + +const keyMemberCtx key = iota + +type MembersHandler struct { + members types.MemberManager +} + +func New( + members types.MemberManager, +) *MembersHandler { + // Init + + return &MembersHandler{ + members: members, + } +} + +func (h *MembersHandler) Route(r types.Router) { + r.Get("/", h.membersList) + + r.With(auth.AdminsOnly).Group(func(r types.Router) { + r.Post("/", h.membersCreate) + r.With(h.ExtractMember).Route("/{memberId}", func(r types.Router) { + r.Get("/", h.membersRead) + r.Post("/", h.membersUpdateProfile) + r.Post("/password", h.membersUpdatePassword) + r.Delete("/", h.membersDelete) + }) + }) +} + +func (h *MembersHandler) RouteBulk(r types.Router) { + r.With(auth.AdminsOnly).Group(func(r types.Router) { + r.Post("/update", h.membersBulkUpdate) + r.Post("/delete", h.membersBulkDelete) + }) +} + +type MemberData struct { + ID string + Profile types.MemberProfile +} + +func SetMember(r *http.Request, session MemberData) context.Context { + return context.WithValue(r.Context(), keyMemberCtx, session) +} + +func GetMember(r *http.Request) MemberData { + return r.Context().Value(keyMemberCtx).(MemberData) +} + +func (h *MembersHandler) ExtractMember(w http.ResponseWriter, r *http.Request) (context.Context, error) { + memberId := chi.URLParam(r, "memberId") + + profile, err := h.members.Select(memberId) + if err != nil { + if errors.Is(err, types.ErrMemberDoesNotExist) { + return nil, utils.HttpNotFound("member not found") + } + + return nil, utils.HttpInternalServerError().WithInternalErr(err) + } + + return SetMember(r, MemberData{ + ID: memberId, + Profile: profile, + }), nil +} diff --git a/server/internal/api/room/broadcast.go b/server/internal/api/room/broadcast.go new file mode 100644 index 000000000..c995f0f0a --- /dev/null +++ b/server/internal/api/room/broadcast.go @@ -0,0 +1,70 @@ +package room + +import ( + "net/http" + + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" + "m1k1o/neko/pkg/utils" +) + +type BroadcastStatusPayload struct { + URL string `json:"url,omitempty"` + IsActive bool `json:"is_active"` +} + +func (h *RoomHandler) broadcastStatus(w http.ResponseWriter, r *http.Request) error { + broadcast := h.capture.Broadcast() + + return utils.HttpSuccess(w, BroadcastStatusPayload{ + IsActive: broadcast.Started(), + URL: broadcast.Url(), + }) +} + +func (h *RoomHandler) broadcastStart(w http.ResponseWriter, r *http.Request) error { + data := &BroadcastStatusPayload{} + if err := utils.HttpJsonRequest(w, r, data); err != nil { + return err + } + + if data.URL == "" { + return utils.HttpBadRequest("missing broadcast URL") + } + + broadcast := h.capture.Broadcast() + if broadcast.Started() { + return utils.HttpUnprocessableEntity("server is already broadcasting") + } + + if err := broadcast.Start(data.URL); err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + h.sessions.AdminBroadcast( + event.BROADCAST_STATUS, + message.BroadcastStatus{ + IsActive: broadcast.Started(), + URL: broadcast.Url(), + }) + + return utils.HttpSuccess(w) +} + +func (h *RoomHandler) broadcastStop(w http.ResponseWriter, r *http.Request) error { + broadcast := h.capture.Broadcast() + if !broadcast.Started() { + return utils.HttpUnprocessableEntity("server is not broadcasting") + } + + broadcast.Stop() + + h.sessions.AdminBroadcast( + event.BROADCAST_STATUS, + message.BroadcastStatus{ + IsActive: broadcast.Started(), + URL: broadcast.Url(), + }) + + return utils.HttpSuccess(w) +} diff --git a/server/internal/api/room/clipboard.go b/server/internal/api/room/clipboard.go new file mode 100644 index 000000000..57445acc3 --- /dev/null +++ b/server/internal/api/room/clipboard.go @@ -0,0 +1,107 @@ +package room + +import ( + // TODO: Unused now. + //"bytes" + //"strings" + + "net/http" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +type ClipboardPayload struct { + Text string `json:"text,omitempty"` + HTML string `json:"html,omitempty"` +} + +func (h *RoomHandler) clipboardGetText(w http.ResponseWriter, r *http.Request) error { + data, err := h.desktop.ClipboardGetText() + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + return utils.HttpSuccess(w, ClipboardPayload{ + Text: data.Text, + HTML: data.HTML, + }) +} + +func (h *RoomHandler) clipboardSetText(w http.ResponseWriter, r *http.Request) error { + data := &ClipboardPayload{} + if err := utils.HttpJsonRequest(w, r, data); err != nil { + return err + } + + err := h.desktop.ClipboardSetText(types.ClipboardText{ + Text: data.Text, + HTML: data.HTML, + }) + + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + return utils.HttpSuccess(w) +} + +func (h *RoomHandler) clipboardGetImage(w http.ResponseWriter, r *http.Request) error { + bytes, err := h.desktop.ClipboardGetBinary("image/png") + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + w.Header().Set("Content-Type", "image/png") + + _, err = w.Write(bytes) + return err +} + +/* TODO: Unused now. +func (h *RoomHandler) clipboardSetImage(w http.ResponseWriter, r *http.Request) error { + err := r.ParseMultipartForm(MAX_UPLOAD_SIZE) + if err != nil { + return utils.HttpBadRequest("failed to parse multipart form").WithInternalErr(err) + } + + //nolint + defer r.MultipartForm.RemoveAll() + + file, header, err := r.FormFile("file") + if err != nil { + return utils.HttpBadRequest("no file received").WithInternalErr(err) + } + + defer file.Close() + + mime := header.Header.Get("Content-Type") + if !strings.HasPrefix(mime, "image/") { + return utils.HttpBadRequest("file must be image") + } + + buffer := new(bytes.Buffer) + _, err = buffer.ReadFrom(file) + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err).WithInternalMsg("unable to read from uploaded file") + } + + err = h.desktop.ClipboardSetBinary("image/png", buffer.Bytes()) + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err).WithInternalMsg("unable set image to clipboard") + } + + return utils.HttpSuccess(w) +} + +func (h *RoomHandler) clipboardGetTargets(w http.ResponseWriter, r *http.Request) error { + targets, err := h.desktop.ClipboardGetTargets() + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + return utils.HttpSuccess(w, targets) +} + +*/ diff --git a/server/internal/api/room/control.go b/server/internal/api/room/control.go new file mode 100644 index 000000000..d13be6d38 --- /dev/null +++ b/server/internal/api/room/control.go @@ -0,0 +1,109 @@ +package room + +import ( + "net/http" + + "github.com/go-chi/chi" + + "m1k1o/neko/pkg/auth" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" + "m1k1o/neko/pkg/utils" +) + +type ControlStatusPayload struct { + HasHost bool `json:"has_host"` + HostId string `json:"host_id,omitempty"` +} + +type ControlTargetPayload struct { + ID string `json:"id"` +} + +func (h *RoomHandler) controlStatus(w http.ResponseWriter, r *http.Request) error { + host, hasHost := h.sessions.GetHost() + + var hostId string + if hasHost { + hostId = host.ID() + } + + return utils.HttpSuccess(w, ControlStatusPayload{ + HasHost: hasHost, + HostId: hostId, + }) +} + +func (h *RoomHandler) controlRequest(w http.ResponseWriter, r *http.Request) error { + session, _ := auth.GetSession(r) + host, hasHost := h.sessions.GetHost() + if hasHost { + // TODO: Some throttling mechanism to prevent spamming. + + // let host know that someone wants to take control + host.Send( + event.CONTROL_REQUEST, + message.SessionID{ + ID: session.ID(), + }) + + return utils.HttpError(http.StatusAccepted, "control request sent") + } + + if h.sessions.Settings().LockedControls && !session.Profile().IsAdmin { + return utils.HttpForbidden("controls are locked") + } + + session.SetAsHost() + + return utils.HttpSuccess(w) +} + +func (h *RoomHandler) controlRelease(w http.ResponseWriter, r *http.Request) error { + session, _ := auth.GetSession(r) + if !session.IsHost() { + return utils.HttpUnprocessableEntity("session is not the host") + } + + h.desktop.ResetKeys() + session.ClearHost() + + return utils.HttpSuccess(w) +} + +func (h *RoomHandler) controlTake(w http.ResponseWriter, r *http.Request) error { + session, _ := auth.GetSession(r) + session.SetAsHost() + + return utils.HttpSuccess(w) +} + +func (h *RoomHandler) controlGive(w http.ResponseWriter, r *http.Request) error { + session, _ := auth.GetSession(r) + sessionId := chi.URLParam(r, "sessionId") + + target, ok := h.sessions.Get(sessionId) + if !ok { + return utils.HttpNotFound("target session was not found") + } + + if !target.Profile().CanHost { + return utils.HttpBadRequest("target session is not allowed to host") + } + + target.SetAsHostBy(session) + + return utils.HttpSuccess(w) +} + +func (h *RoomHandler) controlReset(w http.ResponseWriter, r *http.Request) error { + session, _ := auth.GetSession(r) + _, hasHost := h.sessions.GetHost() + + if hasHost { + h.desktop.ResetKeys() + session.ClearHost() + } + + return utils.HttpSuccess(w) +} diff --git a/server/internal/api/room/handler.go b/server/internal/api/room/handler.go new file mode 100644 index 000000000..d5d183d10 --- /dev/null +++ b/server/internal/api/room/handler.go @@ -0,0 +1,126 @@ +package room + +import ( + "context" + "net/http" + + "github.com/rs/zerolog/log" + + "m1k1o/neko/pkg/auth" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +type RoomHandler struct { + sessions types.SessionManager + desktop types.DesktopManager + capture types.CaptureManager + + privateModeImage []byte +} + +func New( + sessions types.SessionManager, + desktop types.DesktopManager, + capture types.CaptureManager, +) *RoomHandler { + h := &RoomHandler{ + sessions: sessions, + desktop: desktop, + capture: capture, + } + + // generate fallback image for private mode when needed + sessions.OnSettingsChanged(func(session types.Session, new, old types.Settings) { + if old.PrivateMode && !new.PrivateMode { + log.Debug().Msg("clearing private mode fallback image") + h.privateModeImage = nil + return + } + + if !old.PrivateMode && new.PrivateMode { + img := h.desktop.GetScreenshotImage() + bytes, err := utils.CreateJPGImage(img, 90) + if err != nil { + log.Err(err).Msg("could not generate private mode fallback image") + return + } + + log.Debug().Msg("using private mode fallback image") + h.privateModeImage = bytes + } + }) + + return h +} + +func (h *RoomHandler) Route(r types.Router) { + r.With(auth.AdminsOnly).Route("/settings", func(r types.Router) { + r.Post("/", h.settingsSet) + r.Get("/", h.settingsGet) + }) + + r.With(auth.AdminsOnly).Route("/broadcast", func(r types.Router) { + r.Get("/", h.broadcastStatus) + r.Post("/start", h.broadcastStart) + r.Post("/stop", h.broadcastStop) + }) + + r.With(auth.CanAccessClipboardOnly).With(auth.HostsOnly).Route("/clipboard", func(r types.Router) { + r.Get("/", h.clipboardGetText) + r.Post("/", h.clipboardSetText) + r.Get("/image.png", h.clipboardGetImage) + + // TODO: Refactor. xclip is failing to set propper target type + // and this content is sent back to client as text in another + // clipboard update. Therefore endpoint is not usable! + //r.Post("/image", h.clipboardSetImage) + + // TODO: Refactor. If there would be implemented custom target + // retrieval, this endpoint would be useful. + //r.Get("/targets", h.clipboardGetTargets) + }) + + r.With(auth.CanHostOnly).Route("/keyboard", func(r types.Router) { + r.Get("/map", h.keyboardMapGet) + r.With(auth.HostsOnly).Post("/map", h.keyboardMapSet) + + r.Get("/modifiers", h.keyboardModifiersGet) + r.With(auth.HostsOnly).Post("/modifiers", h.keyboardModifiersSet) + }) + + r.With(auth.CanHostOnly).Route("/control", func(r types.Router) { + r.Get("/", h.controlStatus) + r.Post("/request", h.controlRequest) + r.Post("/release", h.controlRelease) + + r.With(auth.AdminsOnly).Post("/take", h.controlTake) + r.With(auth.HostsOrAdminsOnly).Post("/give/{sessionId}", h.controlGive) + r.With(auth.AdminsOnly).Post("/reset", h.controlReset) + }) + + r.With(auth.CanWatchOnly).Route("/screen", func(r types.Router) { + r.Get("/", h.screenConfiguration) + r.With(auth.AdminsOnly).Post("/", h.screenConfigurationChange) + r.With(auth.AdminsOnly).Get("/configurations", h.screenConfigurationsList) + + r.Get("/cast.jpg", h.screenCastGet) + r.With(auth.AdminsOnly).Get("/shot.jpg", h.screenShotGet) + }) + + r.With(h.uploadMiddleware).Route("/upload", func(r types.Router) { + r.Post("/drop", h.uploadDrop) + r.Post("/dialog", h.uploadDialogPost) + r.Delete("/dialog", h.uploadDialogClose) + }) + +} + +func (h *RoomHandler) uploadMiddleware(w http.ResponseWriter, r *http.Request) (context.Context, error) { + session, ok := auth.GetSession(r) + if !ok || (!session.IsHost() && (!session.Profile().CanHost || !h.sessions.Settings().ImplicitHosting)) { + return nil, utils.HttpForbidden("without implicit hosting, only host can upload files") + } + + return nil, nil +} diff --git a/server/internal/api/room/keyboard.go b/server/internal/api/room/keyboard.go new file mode 100644 index 000000000..c0c52bdfa --- /dev/null +++ b/server/internal/api/room/keyboard.go @@ -0,0 +1,47 @@ +package room + +import ( + "net/http" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +func (h *RoomHandler) keyboardMapSet(w http.ResponseWriter, r *http.Request) error { + keyboardMap := types.KeyboardMap{} + if err := utils.HttpJsonRequest(w, r, &keyboardMap); err != nil { + return err + } + + err := h.desktop.SetKeyboardMap(keyboardMap) + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + return utils.HttpSuccess(w) +} + +func (h *RoomHandler) keyboardMapGet(w http.ResponseWriter, r *http.Request) error { + keyboardMap, err := h.desktop.GetKeyboardMap() + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + return utils.HttpSuccess(w, keyboardMap) +} + +func (h *RoomHandler) keyboardModifiersSet(w http.ResponseWriter, r *http.Request) error { + keyboardModifiers := types.KeyboardModifiers{} + if err := utils.HttpJsonRequest(w, r, &keyboardModifiers); err != nil { + return err + } + + h.desktop.SetKeyboardModifiers(keyboardModifiers) + return utils.HttpSuccess(w) +} + +func (h *RoomHandler) keyboardModifiersGet(w http.ResponseWriter, r *http.Request) error { + keyboardModifiers := h.desktop.GetKeyboardModifiers() + + return utils.HttpSuccess(w, keyboardModifiers) +} diff --git a/server/internal/api/room/screen.go b/server/internal/api/room/screen.go new file mode 100644 index 000000000..3351b9102 --- /dev/null +++ b/server/internal/api/room/screen.go @@ -0,0 +1,101 @@ +package room + +import ( + "net/http" + "strconv" + + "m1k1o/neko/pkg/auth" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" + "m1k1o/neko/pkg/utils" +) + +func (h *RoomHandler) screenConfiguration(w http.ResponseWriter, r *http.Request) error { + screenSize := h.desktop.GetScreenSize() + + return utils.HttpSuccess(w, screenSize) +} + +func (h *RoomHandler) screenConfigurationChange(w http.ResponseWriter, r *http.Request) error { + auth, _ := auth.GetSession(r) + + data := &types.ScreenSize{} + if err := utils.HttpJsonRequest(w, r, data); err != nil { + return err + } + + size, err := h.desktop.SetScreenSize(types.ScreenSize{ + Width: data.Width, + Height: data.Height, + Rate: data.Rate, + }) + + if err != nil { + return utils.HttpUnprocessableEntity("cannot set screen size").WithInternalErr(err) + } + + h.sessions.Broadcast(event.SCREEN_UPDATED, message.ScreenSizeUpdate{ + ID: auth.ID(), + ScreenSize: size, + }) + + return utils.HttpSuccess(w, data) +} + +// TODO: remove. +func (h *RoomHandler) screenConfigurationsList(w http.ResponseWriter, r *http.Request) error { + configurations := h.desktop.ScreenConfigurations() + + return utils.HttpSuccess(w, configurations) +} + +func (h *RoomHandler) screenShotGet(w http.ResponseWriter, r *http.Request) error { + quality, err := strconv.Atoi(r.URL.Query().Get("quality")) + if err != nil { + quality = 90 + } + + img := h.desktop.GetScreenshotImage() + bytes, err := utils.CreateJPGImage(img, quality) + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + w.Header().Set("Content-Type", "image/jpeg") + + _, err = w.Write(bytes) + return err +} + +func (h *RoomHandler) screenCastGet(w http.ResponseWriter, r *http.Request) error { + // display fallback image when private mode is enabled even if screencast is not + if session, ok := auth.GetSession(r); ok && session.PrivateModeEnabled() { + if h.privateModeImage != nil { + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + w.Header().Set("Content-Type", "image/jpeg") + + _, err := w.Write(h.privateModeImage) + return err + } + + return utils.HttpBadRequest("private mode is enabled but no fallback image available") + } + + screencast := h.capture.Screencast() + if !screencast.Enabled() { + return utils.HttpBadRequest("screencast pipeline is not enabled") + } + + bytes, err := screencast.Image() + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + w.Header().Set("Content-Type", "image/jpeg") + + _, err = w.Write(bytes) + return err +} diff --git a/server/internal/api/room/settings.go b/server/internal/api/room/settings.go new file mode 100644 index 000000000..dc88a4734 --- /dev/null +++ b/server/internal/api/room/settings.go @@ -0,0 +1,38 @@ +package room + +import ( + "encoding/json" + "io" + "net/http" + + "m1k1o/neko/pkg/auth" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +func (h *RoomHandler) settingsGet(w http.ResponseWriter, r *http.Request) error { + settings := h.sessions.Settings() + return utils.HttpSuccess(w, settings) +} + +func (h *RoomHandler) settingsSet(w http.ResponseWriter, r *http.Request) error { + session, _ := auth.GetSession(r) + + // We read the request body first and unmashal it inside the UpdateSettingsFunc + // to ensure atomicity of the operation. + body, err := io.ReadAll(r.Body) + if err != nil { + return utils.HttpBadRequest("unable to read request body").WithInternalErr(err) + } + + h.sessions.UpdateSettingsFunc(session, func(settings *types.Settings) bool { + err = json.Unmarshal(body, settings) + return err == nil + }) + + if err != nil { + return utils.HttpBadRequest("unable to parse provided data").WithInternalErr(err) + } + + return utils.HttpSuccess(w) +} diff --git a/server/internal/api/room/upload.go b/server/internal/api/room/upload.go new file mode 100644 index 000000000..e72321592 --- /dev/null +++ b/server/internal/api/room/upload.go @@ -0,0 +1,172 @@ +package room + +import ( + "io" + "net/http" + "os" + "path" + "strconv" + + "m1k1o/neko/pkg/utils" +) + +// TODO: Extract file uploading to custom utility. + +// maximum upload size of 32 MB +const maxUploadSize = 32 << 20 + +func (h *RoomHandler) uploadDrop(w http.ResponseWriter, r *http.Request) error { + if !h.desktop.IsUploadDropEnabled() { + return utils.HttpBadRequest("upload drop is disabled") + } + + err := r.ParseMultipartForm(maxUploadSize) + if err != nil { + return utils.HttpBadRequest("failed to parse multipart form").WithInternalErr(err) + } + + //nolint + defer r.MultipartForm.RemoveAll() + + X, err := strconv.Atoi(r.FormValue("x")) + if err != nil { + return utils.HttpBadRequest("no X coordinate received").WithInternalErr(err) + } + + Y, err := strconv.Atoi(r.FormValue("y")) + if err != nil { + return utils.HttpBadRequest("no Y coordinate received").WithInternalErr(err) + } + + req_files := r.MultipartForm.File["files"] + if len(req_files) == 0 { + return utils.HttpBadRequest("no files received") + } + + dir, err := os.MkdirTemp("", "neko-drop-*") + if err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + WithInternalMsg("unable to create temporary directory") + } + + files := []string{} + for _, req_file := range req_files { + path := path.Join(dir, req_file.Filename) + + srcFile, err := req_file.Open() + if err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + WithInternalMsg("unable to open uploaded file") + } + + defer srcFile.Close() + + dstFile, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) + if err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + WithInternalMsg("unable to open destination file") + } + + defer dstFile.Close() + + _, err = io.Copy(dstFile, srcFile) + if err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + WithInternalMsg("unable to copy uploaded file to destination file") + } + + files = append(files, path) + } + + if !h.desktop.DropFiles(X, Y, files) { + return utils.HttpInternalServerError(). + WithInternalMsg("unable to drop files") + } + + return utils.HttpSuccess(w) +} + +func (h *RoomHandler) uploadDialogPost(w http.ResponseWriter, r *http.Request) error { + if !h.desktop.IsFileChooserDialogEnabled() { + return utils.HttpBadRequest("file chooser dialog is disabled") + } + + err := r.ParseMultipartForm(maxUploadSize) + if err != nil { + return utils.HttpBadRequest("failed to parse multipart form").WithInternalErr(err) + } + + //nolint + defer r.MultipartForm.RemoveAll() + + req_files := r.MultipartForm.File["files"] + if len(req_files) == 0 { + return utils.HttpBadRequest("no files received") + } + + if !h.desktop.IsFileChooserDialogOpened() { + return utils.HttpUnprocessableEntity("file chooser dialog is not open") + } + + dir, err := os.MkdirTemp("", "neko-dialog-*") + if err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + WithInternalMsg("unable to create temporary directory") + } + + for _, req_file := range req_files { + path := path.Join(dir, req_file.Filename) + + srcFile, err := req_file.Open() + if err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + WithInternalMsg("unable to open uploaded file") + } + + defer srcFile.Close() + + dstFile, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) + if err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + WithInternalMsg("unable to open destination file") + } + + defer dstFile.Close() + + _, err = io.Copy(dstFile, srcFile) + if err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + WithInternalMsg("unable to copy uploaded file to destination file") + } + } + + if err := h.desktop.HandleFileChooserDialog(dir); err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + WithInternalMsg("unable to handle file chooser dialog") + } + + return utils.HttpSuccess(w) +} + +func (h *RoomHandler) uploadDialogClose(w http.ResponseWriter, r *http.Request) error { + if !h.desktop.IsFileChooserDialogEnabled() { + return utils.HttpBadRequest("file chooser dialog is disabled") + } + + if !h.desktop.IsFileChooserDialogOpened() { + return utils.HttpUnprocessableEntity("file chooser dialog is not open") + } + + h.desktop.CloseFileChooserDialog() + + return utils.HttpSuccess(w) +} diff --git a/server/internal/api/router.go b/server/internal/api/router.go new file mode 100644 index 000000000..0144264b3 --- /dev/null +++ b/server/internal/api/router.go @@ -0,0 +1,86 @@ +package api + +import ( + "context" + "errors" + "net/http" + + "m1k1o/neko/internal/api/members" + "m1k1o/neko/internal/api/room" + "m1k1o/neko/internal/api/sessions" + "m1k1o/neko/pkg/auth" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +type ApiManagerCtx struct { + sessions types.SessionManager + members types.MemberManager + desktop types.DesktopManager + capture types.CaptureManager + routers map[string]func(types.Router) +} + +func New( + sessions types.SessionManager, + members types.MemberManager, + desktop types.DesktopManager, + capture types.CaptureManager, +) *ApiManagerCtx { + + return &ApiManagerCtx{ + sessions: sessions, + members: members, + desktop: desktop, + capture: capture, + routers: make(map[string]func(types.Router)), + } +} + +func (api *ApiManagerCtx) Route(r types.Router) { + r.Post("/login", api.Login) + + // Authenticated area + r.Group(func(r types.Router) { + r.Use(api.Authenticate) + + r.Post("/logout", api.Logout) + r.Get("/whoami", api.Whoami) + r.Post("/profile", api.UpdateProfile) + + sessionsHandler := sessions.New(api.sessions) + r.Route("/sessions", sessionsHandler.Route) + + membersHandler := members.New(api.members) + r.Route("/members", membersHandler.Route) + r.Route("/members_bulk", membersHandler.RouteBulk) + + roomHandler := room.New(api.sessions, api.desktop, api.capture) + r.Route("/room", roomHandler.Route) + + for path, router := range api.routers { + r.Route(path, router) + } + }) +} + +func (api *ApiManagerCtx) Authenticate(w http.ResponseWriter, r *http.Request) (context.Context, error) { + session, err := api.sessions.Authenticate(r) + if err != nil { + if api.sessions.CookieEnabled() { + api.sessions.CookieClearToken(w, r) + } + + if errors.Is(err, types.ErrSessionLoginDisabled) { + return nil, utils.HttpForbidden("login is disabled for this session") + } + + return nil, utils.HttpUnauthorized().WithInternalErr(err) + } + + return auth.SetSession(r, session), nil +} + +func (api *ApiManagerCtx) AddRouter(path string, router func(types.Router)) { + api.routers[path] = router +} diff --git a/server/internal/api/session.go b/server/internal/api/session.go new file mode 100644 index 000000000..358521bed --- /dev/null +++ b/server/internal/api/session.go @@ -0,0 +1,105 @@ +package api + +import ( + "errors" + "net/http" + + "m1k1o/neko/pkg/auth" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +type SessionLoginPayload struct { + Username string `json:"username"` + Password string `json:"password"` +} + +type SessionDataPayload struct { + ID string `json:"id"` + Token string `json:"token,omitempty"` + Profile types.MemberProfile `json:"profile"` + State types.SessionState `json:"state"` +} + +func (api *ApiManagerCtx) Login(w http.ResponseWriter, r *http.Request) error { + data := &SessionLoginPayload{} + if err := utils.HttpJsonRequest(w, r, data); err != nil { + return err + } + + session, token, err := api.members.Login(data.Username, data.Password) + if err != nil { + if errors.Is(err, types.ErrSessionAlreadyConnected) { + return utils.HttpUnprocessableEntity("session already connected") + } else if errors.Is(err, types.ErrMemberDoesNotExist) || errors.Is(err, types.ErrMemberInvalidPassword) { + return utils.HttpUnauthorized().WithInternalErr(err) + } else if errors.Is(err, types.ErrSessionLoginsLocked) { + return utils.HttpForbidden("logins are locked").WithInternalErr(err) + } else { + return utils.HttpInternalServerError().WithInternalErr(err) + } + } + + sessionData := SessionDataPayload{ + ID: session.ID(), + Profile: session.Profile(), + State: session.State(), + } + + if api.sessions.CookieEnabled() { + api.sessions.CookieSetToken(w, token) + } else { + sessionData.Token = token + } + + return utils.HttpSuccess(w, sessionData) +} + +func (api *ApiManagerCtx) Logout(w http.ResponseWriter, r *http.Request) error { + session, _ := auth.GetSession(r) + + err := api.members.Logout(session.ID()) + if err != nil { + if errors.Is(err, types.ErrSessionNotFound) { + return utils.HttpBadRequest("session is not logged in") + } else { + return utils.HttpInternalServerError().WithInternalErr(err) + } + } + + if api.sessions.CookieEnabled() { + api.sessions.CookieClearToken(w, r) + } + + return utils.HttpSuccess(w, true) +} + +func (api *ApiManagerCtx) Whoami(w http.ResponseWriter, r *http.Request) error { + session, _ := auth.GetSession(r) + + return utils.HttpSuccess(w, SessionDataPayload{ + ID: session.ID(), + Profile: session.Profile(), + State: session.State(), + }) +} + +func (api *ApiManagerCtx) UpdateProfile(w http.ResponseWriter, r *http.Request) error { + session, _ := auth.GetSession(r) + + data := session.Profile() + if err := utils.HttpJsonRequest(w, r, &data); err != nil { + return err + } + + err := api.sessions.Update(session.ID(), data) + if err != nil { + if errors.Is(err, types.ErrSessionNotFound) { + return utils.HttpBadRequest("session does not exist") + } else { + return utils.HttpInternalServerError().WithInternalErr(err) + } + } + + return utils.HttpSuccess(w, true) +} diff --git a/server/internal/api/sessions/controller.go b/server/internal/api/sessions/controller.go new file mode 100644 index 000000000..c3c57dab0 --- /dev/null +++ b/server/internal/api/sessions/controller.go @@ -0,0 +1,81 @@ +package sessions + +import ( + "errors" + "net/http" + + "m1k1o/neko/pkg/auth" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" + + "github.com/go-chi/chi" +) + +type SessionDataPayload struct { + ID string `json:"id"` + Profile types.MemberProfile `json:"profile"` + State types.SessionState `json:"state"` +} + +func (h *SessionsHandler) sessionsList(w http.ResponseWriter, r *http.Request) error { + sessions := []SessionDataPayload{} + for _, session := range h.sessions.List() { + sessions = append(sessions, SessionDataPayload{ + ID: session.ID(), + Profile: session.Profile(), + State: session.State(), + }) + } + + return utils.HttpSuccess(w, sessions) +} + +func (h *SessionsHandler) sessionsRead(w http.ResponseWriter, r *http.Request) error { + sessionId := chi.URLParam(r, "sessionId") + + session, ok := h.sessions.Get(sessionId) + if !ok { + return utils.HttpNotFound("session not found") + } + + return utils.HttpSuccess(w, SessionDataPayload{ + ID: session.ID(), + Profile: session.Profile(), + State: session.State(), + }) +} + +func (h *SessionsHandler) sessionsDelete(w http.ResponseWriter, r *http.Request) error { + session, _ := auth.GetSession(r) + + sessionId := chi.URLParam(r, "sessionId") + if sessionId == session.ID() { + return utils.HttpBadRequest("cannot delete own session") + } + + err := h.sessions.Delete(sessionId) + if err != nil { + if errors.Is(err, types.ErrSessionNotFound) { + return utils.HttpBadRequest("session not found") + } else { + return utils.HttpInternalServerError().WithInternalErr(err) + } + } + + return utils.HttpSuccess(w) +} + +func (h *SessionsHandler) sessionsDisconnect(w http.ResponseWriter, r *http.Request) error { + sessionId := chi.URLParam(r, "sessionId") + + err := h.sessions.Disconnect(sessionId) + if err != nil { + if errors.Is(err, types.ErrSessionNotFound) { + return utils.HttpBadRequest("session not found") + } else { + return utils.HttpInternalServerError().WithInternalErr(err) + } + } + + return utils.HttpSuccess(w) +} diff --git a/server/internal/api/sessions/handler.go b/server/internal/api/sessions/handler.go new file mode 100644 index 000000000..700604319 --- /dev/null +++ b/server/internal/api/sessions/handler.go @@ -0,0 +1,30 @@ +package sessions + +import ( + "m1k1o/neko/pkg/auth" + "m1k1o/neko/pkg/types" +) + +type SessionsHandler struct { + sessions types.SessionManager +} + +func New( + sessions types.SessionManager, +) *SessionsHandler { + // Init + + return &SessionsHandler{ + sessions: sessions, + } +} + +func (h *SessionsHandler) Route(r types.Router) { + r.Get("/", h.sessionsList) + + r.With(auth.AdminsOnly).Route("/{sessionId}", func(r types.Router) { + r.Get("/", h.sessionsRead) + r.Delete("/", h.sessionsDelete) + r.Post("/disconnect", h.sessionsDisconnect) + }) +} diff --git a/server/internal/capture/broadcast.go b/server/internal/capture/broadcast.go index fc6727e13..ea25b3b2d 100644 --- a/server/internal/capture/broadcast.go +++ b/server/internal/capture/broadcast.go @@ -3,26 +3,32 @@ package capture import ( "sync" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" "github.com/rs/zerolog" "github.com/rs/zerolog/log" - "m1k1o/neko/internal/capture/gst" - "m1k1o/neko/internal/types" + "m1k1o/neko/pkg/gst" + "m1k1o/neko/pkg/types" ) type BroacastManagerCtx struct { logger zerolog.Logger mu sync.Mutex - pipeline *gst.Pipeline + pipeline gst.Pipeline pipelineMu sync.Mutex pipelineFn func(url string) (string, error) url string started bool + + // metrics + pipelinesCounter prometheus.Counter + pipelinesActive prometheus.Gauge } -func broadcastNew(pipelineFn func(url string) (string, error), url string, started bool) *BroacastManagerCtx { +func broadcastNew(pipelineFn func(url string) (string, error), defaultUrl string, autostart bool) *BroacastManagerCtx { logger := log.With(). Str("module", "capture"). Str("submodule", "broadcast"). @@ -31,8 +37,34 @@ func broadcastNew(pipelineFn func(url string) (string, error), url string, start return &BroacastManagerCtx{ logger: logger, pipelineFn: pipelineFn, - url: url, - started: started && url != "", + url: defaultUrl, + started: defaultUrl != "" && autostart, + + // metrics + pipelinesCounter: promauto.NewCounter(prometheus.CounterOpts{ + Name: "pipelines_total", + Namespace: "neko", + Subsystem: "capture", + Help: "Total number of created pipelines.", + ConstLabels: map[string]string{ + "submodule": "broadcast", + "video_id": "main", + "codec_name": "-", + "codec_type": "-", + }, + }), + pipelinesActive: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "pipelines_active", + Namespace: "neko", + Subsystem: "capture", + Help: "Total number of active pipelines.", + ConstLabels: map[string]string{ + "submodule": "broadcast", + "video_id": "main", + "codec_name": "-", + "codec_type": "-", + }, + }), } } @@ -86,7 +118,6 @@ func (manager *BroacastManagerCtx) createPipeline() error { return types.ErrCapturePipelineAlreadyExists } - var err error pipelineStr, err := manager.pipelineFn(manager.url) if err != nil { return err @@ -103,6 +134,8 @@ func (manager *BroacastManagerCtx) createPipeline() error { } manager.pipeline.Play() + manager.pipelinesCounter.Inc() + manager.pipelinesActive.Set(1) return nil } @@ -118,4 +151,6 @@ func (manager *BroacastManagerCtx) destroyPipeline() { manager.pipeline.Destroy() manager.logger.Info().Msgf("destroying pipeline") manager.pipeline = nil + + manager.pipelinesActive.Set(0) } diff --git a/server/internal/capture/manager.go b/server/internal/capture/manager.go index 0cc483251..d7c78db40 100644 --- a/server/internal/capture/manager.go +++ b/server/internal/capture/manager.go @@ -2,48 +2,189 @@ package capture import ( "errors" + "fmt" + "strings" "github.com/rs/zerolog" "github.com/rs/zerolog/log" - "m1k1o/neko/internal/capture/gst" "m1k1o/neko/internal/config" - "m1k1o/neko/internal/types" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/codec" ) type CaptureManagerCtx struct { logger zerolog.Logger desktop types.DesktopManager + config *config.Capture // sinks - broadcast *BroacastManagerCtx - audio *StreamSinkManagerCtx - video *StreamSinkManagerCtx + broadcast *BroacastManagerCtx + screencast *ScreencastManagerCtx + audio *StreamSinkManagerCtx + video *StreamSelectorManagerCtx + + // sources + webcam *StreamSrcManagerCtx + microphone *StreamSrcManagerCtx } func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCtx { logger := log.With().Str("module", "capture").Logger() + videos := map[string]types.StreamSinkManager{} + for video_id, cnf := range config.VideoPipelines { + pipelineConf := cnf + + createPipeline := func() (string, error) { + if pipelineConf.GstPipeline != "" { + // replace {display} with valid display + return strings.Replace(pipelineConf.GstPipeline, "{display}", config.Display, 1), nil + } + + screen := desktop.GetScreenSize() + pipeline, err := pipelineConf.GetPipeline(screen) + if err != nil { + return "", err + } + + return fmt.Sprintf( + "ximagesrc display-name=%s show-pointer=false use-damage=false "+ + "%s ! appsink name=appsink", config.Display, pipeline, + ), nil + } + + // trigger function to catch evaluation errors at startup + pipeline, err := createPipeline() + if err != nil { + logger.Panic().Err(err). + Str("video_id", video_id). + Msg("failed to create video pipeline") + } + + logger.Info(). + Str("video_id", video_id). + Str("pipeline", pipeline). + Msg("syntax check for video stream pipeline passed") + + // append to videos + videos[video_id] = streamSinkNew(config.VideoCodec, createPipeline, video_id) + } + return &CaptureManagerCtx{ logger: logger, desktop: desktop, + config: config, // sinks broadcast: broadcastNew(func(url string) (string, error) { - return NewBroadcastPipeline(config.AudioDevice, config.Display, config.BroadcastPipeline, url) + if config.BroadcastPipeline != "" { + var pipeline = config.BroadcastPipeline + // replace {display} with valid display + pipeline = strings.Replace(pipeline, "{display}", config.Display, 1) + // replace {device} with valid device + pipeline = strings.Replace(pipeline, "{device}", config.AudioDevice, 1) + // replace {url} with valid URL + return strings.Replace(pipeline, "{url}", url, 1), nil + } + + return fmt.Sprintf( + "flvmux name=mux ! rtmpsink location='%s live=1' "+ + "pulsesrc device=%s "+ + "! audio/x-raw,channels=2 "+ + "! audioconvert "+ + "! queue "+ + "! voaacenc bitrate=%d "+ + "! mux. "+ + "ximagesrc display-name=%s show-pointer=true use-damage=false "+ + "! video/x-raw "+ + "! videoconvert "+ + "! queue "+ + "! x264enc threads=4 bitrate=%d key-int-max=15 byte-stream=true tune=zerolatency speed-preset=%s "+ + "! mux.", url, config.AudioDevice, config.BroadcastAudioBitrate*1000, config.Display, config.BroadcastVideoBitrate, config.BroadcastPreset, + ), nil }, config.BroadcastUrl, config.BroadcastAutostart), + screencast: screencastNew(config.ScreencastEnabled, func() string { + if config.ScreencastPipeline != "" { + // replace {display} with valid display + return strings.Replace(config.ScreencastPipeline, "{display}", config.Display, 1) + } + + return fmt.Sprintf( + "ximagesrc display-name=%s show-pointer=true use-damage=false "+ + "! video/x-raw,framerate=%s "+ + "! videoconvert "+ + "! queue "+ + "! jpegenc quality=%s "+ + "! appsink name=appsink", config.Display, config.ScreencastRate, config.ScreencastQuality, + ) + }()), + audio: streamSinkNew(config.AudioCodec, func() (string, error) { - return NewAudioPipeline(config.AudioCodec, config.AudioDevice, config.AudioPipeline, config.AudioBitrate) - }, "audio"), - video: streamSinkNew(config.VideoCodec, func() (string, error) { - // use screen fps as default - fps := desktop.GetScreenSize().Rate - // if max fps is set, cap it to that value - if config.VideoMaxFPS > 0 && config.VideoMaxFPS < fps { - fps = config.VideoMaxFPS + if config.AudioPipeline != "" { + // replace {device} with valid device + return strings.Replace(config.AudioPipeline, "{device}", config.AudioDevice, 1), nil } - return NewVideoPipeline(config.VideoCodec, config.Display, config.VideoPipeline, fps, config.VideoBitrate, config.VideoHWEnc) - }, "video"), + + return fmt.Sprintf( + "pulsesrc device=%s "+ + "! audio/x-raw,channels=2 "+ + "! audioconvert "+ + "! queue "+ + "! %s "+ + "! appsink name=appsink", config.AudioDevice, config.AudioCodec.Pipeline, + ), nil + }, "audio"), + video: streamSelectorNew(config.VideoCodec, videos, config.VideoIDs), + + // sources + webcam: streamSrcNew(config.WebcamEnabled, map[string]string{ + codec.VP8().Name: "appsrc format=time is-live=true do-timestamp=true name=appsrc " + + fmt.Sprintf("! application/x-rtp, payload=%d, encoding-name=VP8-DRAFT-IETF-01 ", codec.VP8().PayloadType) + + "! rtpvp8depay " + + "! decodebin " + + "! videoconvert " + + "! videorate " + + "! videoscale " + + fmt.Sprintf("! video/x-raw,width=%d,height=%d ", config.WebcamWidth, config.WebcamHeight) + + "! identity drop-allocation=true " + + fmt.Sprintf("! v4l2sink sync=false device=%s", config.WebcamDevice), + // TODO: Test this pipeline. + codec.VP9().Name: "appsrc format=time is-live=true do-timestamp=true name=appsrc " + + "! application/x-rtp " + + "! rtpvp9depay " + + "! decodebin " + + "! videoconvert " + + "! videorate " + + "! videoscale " + + fmt.Sprintf("! video/x-raw,width=%d,height=%d ", config.WebcamWidth, config.WebcamHeight) + + "! identity drop-allocation=true " + + fmt.Sprintf("! v4l2sink sync=false device=%s", config.WebcamDevice), + // TODO: Test this pipeline. + codec.H264().Name: "appsrc format=time is-live=true do-timestamp=true name=appsrc " + + "! application/x-rtp " + + "! rtph264depay " + + "! decodebin " + + "! videoconvert " + + "! videorate " + + "! videoscale " + + fmt.Sprintf("! video/x-raw,width=%d,height=%d ", config.WebcamWidth, config.WebcamHeight) + + "! identity drop-allocation=true " + + fmt.Sprintf("! v4l2sink sync=false device=%s", config.WebcamDevice), + }, "webcam"), + microphone: streamSrcNew(config.MicrophoneEnabled, map[string]string{ + codec.Opus().Name: "appsrc format=time is-live=true do-timestamp=true name=appsrc " + + fmt.Sprintf("! application/x-rtp, payload=%d, encoding-name=OPUS ", codec.Opus().PayloadType) + + "! rtpopusdepay " + + "! decodebin " + + fmt.Sprintf("! pulsesink device=%s", config.MicrophoneDevice), + // TODO: Test this pipeline. + codec.G722().Name: "appsrc format=time is-live=true do-timestamp=true name=appsrc " + + "! application/x-rtp clock-rate=8000 " + + "! rtpg722depay " + + "! decodebin " + + fmt.Sprintf("! pulsesink device=%s", config.MicrophoneDevice), + }, "microphone"), } } @@ -54,55 +195,51 @@ func (manager *CaptureManagerCtx) Start() { } } - go gst.RunMainLoop() - go func() { - for { - before, ok := <-manager.desktop.GetScreenSizeChangeChannel() - if !ok { - manager.logger.Info().Msg("screen size change channel was closed") - return + manager.desktop.OnBeforeScreenSizeChange(func() { + manager.video.destroyPipelines() + + if manager.broadcast.Started() { + manager.broadcast.destroyPipeline() + } + + if manager.screencast.Started() { + manager.screencast.destroyPipeline() + } + }) + + manager.desktop.OnAfterScreenSizeChange(func() { + err := manager.video.recreatePipelines() + if err != nil { + manager.logger.Panic().Err(err).Msg("unable to recreate video pipelines") + } + + if manager.broadcast.Started() { + err := manager.broadcast.createPipeline() + if err != nil && !errors.Is(err, types.ErrCapturePipelineAlreadyExists) { + manager.logger.Panic().Err(err).Msg("unable to recreate broadcast pipeline") } + } - if before { - // before screen size change, we need to destroy all pipelines - - if manager.video.Started() { - manager.video.destroyPipeline() - } - - if manager.broadcast.Started() { - manager.broadcast.destroyPipeline() - } - } else { - // after screen size change, we need to recreate all pipelines - - if manager.video.Started() { - err := manager.video.createPipeline() - if err != nil && !errors.Is(err, types.ErrCapturePipelineAlreadyExists) { - manager.logger.Panic().Err(err).Msg("unable to recreate video pipeline") - } - } - - if manager.broadcast.Started() { - err := manager.broadcast.createPipeline() - if err != nil && !errors.Is(err, types.ErrCapturePipelineAlreadyExists) { - manager.logger.Panic().Err(err).Msg("unable to recreate broadcast pipeline") - } - } + if manager.screencast.Started() { + err := manager.screencast.createPipeline() + if err != nil && !errors.Is(err, types.ErrCapturePipelineAlreadyExists) { + manager.logger.Panic().Err(err).Msg("unable to recreate screencast pipeline") } } - }() + }) } func (manager *CaptureManagerCtx) Shutdown() error { manager.logger.Info().Msgf("shutdown") manager.broadcast.shutdown() + manager.screencast.shutdown() manager.audio.shutdown() manager.video.shutdown() - gst.QuitMainLoop() + manager.webcam.shutdown() + manager.microphone.shutdown() return nil } @@ -111,10 +248,22 @@ func (manager *CaptureManagerCtx) Broadcast() types.BroadcastManager { return manager.broadcast } +func (manager *CaptureManagerCtx) Screencast() types.ScreencastManager { + return manager.screencast +} + func (manager *CaptureManagerCtx) Audio() types.StreamSinkManager { return manager.audio } -func (manager *CaptureManagerCtx) Video() types.StreamSinkManager { +func (manager *CaptureManagerCtx) Video() types.StreamSelectorManager { return manager.video } + +func (manager *CaptureManagerCtx) Webcam() types.StreamSrcManager { + return manager.webcam +} + +func (manager *CaptureManagerCtx) Microphone() types.StreamSrcManager { + return manager.microphone +} diff --git a/server/internal/capture/screencast.go b/server/internal/capture/screencast.go new file mode 100644 index 000000000..9547413cb --- /dev/null +++ b/server/internal/capture/screencast.go @@ -0,0 +1,257 @@ +package capture + +import ( + "errors" + "sync" + "sync/atomic" + "time" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + + "m1k1o/neko/pkg/gst" + "m1k1o/neko/pkg/types" +) + +// timeout between intervals, when screencast pipeline is checked +const screencastTimeout = 5 * time.Second + +type ScreencastManagerCtx struct { + logger zerolog.Logger + mu sync.Mutex + wg sync.WaitGroup + + pipeline gst.Pipeline + pipelineStr string + pipelineMu sync.Mutex + + image types.Sample + imageMu sync.Mutex + tickerStop chan struct{} + + enabled bool + started bool + expired int32 + + // metrics + imagesCounter prometheus.Counter + pipelinesCounter prometheus.Counter + pipelinesActive prometheus.Gauge +} + +func screencastNew(enabled bool, pipelineStr string) *ScreencastManagerCtx { + logger := log.With(). + Str("module", "capture"). + Str("submodule", "screencast"). + Logger() + + manager := &ScreencastManagerCtx{ + logger: logger, + pipelineStr: pipelineStr, + tickerStop: make(chan struct{}), + enabled: enabled, + started: false, + + // metrics + imagesCounter: promauto.NewCounter(prometheus.CounterOpts{ + Name: "screencast_images_total", + Namespace: "neko", + Subsystem: "capture", + Help: "Total number of created images.", + }), + pipelinesCounter: promauto.NewCounter(prometheus.CounterOpts{ + Name: "pipelines_total", + Namespace: "neko", + Subsystem: "capture", + Help: "Total number of created pipelines.", + ConstLabels: map[string]string{ + "submodule": "screencast", + "video_id": "main", + "codec_name": "-", + "codec_type": "-", + }, + }), + pipelinesActive: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "pipelines_active", + Namespace: "neko", + Subsystem: "capture", + Help: "Total number of active pipelines.", + ConstLabels: map[string]string{ + "submodule": "screencast", + "video_id": "main", + "codec_name": "-", + "codec_type": "-", + }, + }), + } + + manager.wg.Add(1) + + go func() { + defer manager.wg.Done() + + ticker := time.NewTicker(screencastTimeout) + defer ticker.Stop() + + for { + select { + case <-manager.tickerStop: + return + case <-ticker.C: + if manager.Started() && !atomic.CompareAndSwapInt32(&manager.expired, 0, 1) { + manager.stop() + } + } + } + }() + + return manager +} + +func (manager *ScreencastManagerCtx) shutdown() { + manager.logger.Info().Msgf("shutdown") + + manager.destroyPipeline() + + close(manager.tickerStop) + manager.wg.Wait() +} + +func (manager *ScreencastManagerCtx) Enabled() bool { + manager.mu.Lock() + defer manager.mu.Unlock() + + return manager.enabled +} + +func (manager *ScreencastManagerCtx) Started() bool { + manager.mu.Lock() + defer manager.mu.Unlock() + + return manager.started +} + +func (manager *ScreencastManagerCtx) Image() ([]byte, error) { + atomic.StoreInt32(&manager.expired, 0) + + err := manager.start() + if err != nil && !errors.Is(err, types.ErrCapturePipelineAlreadyExists) { + return nil, err + } + + manager.imageMu.Lock() + defer manager.imageMu.Unlock() + + if manager.image.Data == nil { + return nil, errors.New("image data not found") + } + + return manager.image.Data, nil +} + +func (manager *ScreencastManagerCtx) start() error { + manager.mu.Lock() + defer manager.mu.Unlock() + + if !manager.enabled { + return errors.New("screencast not enabled") + } + + err := manager.createPipeline() + if err != nil { + return err + } + + manager.started = true + return nil +} + +func (manager *ScreencastManagerCtx) stop() { + manager.mu.Lock() + defer manager.mu.Unlock() + + manager.started = false + manager.destroyPipeline() +} + +func (manager *ScreencastManagerCtx) createPipeline() error { + manager.pipelineMu.Lock() + defer manager.pipelineMu.Unlock() + + if manager.pipeline != nil { + return types.ErrCapturePipelineAlreadyExists + } + + var err error + + manager.logger.Info(). + Str("str", manager.pipelineStr). + Msgf("creating pipeline") + + manager.pipeline, err = gst.CreatePipeline(manager.pipelineStr) + if err != nil { + return err + } + + manager.pipeline.AttachAppsink("appsink") + manager.pipeline.Play() + manager.pipelinesCounter.Inc() + manager.pipelinesActive.Set(1) + + // get first image + select { + case image, ok := <-manager.pipeline.Sample(): + if !ok { + return errors.New("unable to get first image") + } else { + manager.setImage(image) + } + case <-time.After(1 * time.Second): + return errors.New("timeouted while waiting for first image") + } + + manager.wg.Add(1) + pipeline := manager.pipeline + + go func() { + manager.logger.Debug().Msg("started receiving images") + defer manager.wg.Done() + + for { + image, ok := <-pipeline.Sample() + if !ok { + manager.logger.Debug().Msg("stopped receiving images") + return + } + + manager.setImage(image) + } + }() + + return nil +} + +func (manager *ScreencastManagerCtx) setImage(image types.Sample) { + manager.imageMu.Lock() + manager.image = image + manager.imageMu.Unlock() + + manager.imagesCounter.Inc() +} + +func (manager *ScreencastManagerCtx) destroyPipeline() { + manager.pipelineMu.Lock() + defer manager.pipelineMu.Unlock() + + if manager.pipeline == nil { + return + } + + manager.pipeline.Destroy() + manager.logger.Info().Msgf("destroying pipeline") + manager.pipeline = nil + + manager.pipelinesActive.Set(0) +} diff --git a/server/internal/capture/streamselector.go b/server/internal/capture/streamselector.go new file mode 100644 index 000000000..bda1be1cd --- /dev/null +++ b/server/internal/capture/streamselector.go @@ -0,0 +1,206 @@ +package capture + +import ( + "errors" + "sort" + + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/codec" +) + +type StreamSelectorManagerCtx struct { + logger zerolog.Logger + codec codec.RTPCodec + streams map[string]types.StreamSinkManager + streamIDs []string +} + +func streamSelectorNew(codec codec.RTPCodec, streams map[string]types.StreamSinkManager, streamIDs []string) *StreamSelectorManagerCtx { + logger := log.With(). + Str("module", "capture"). + Str("submodule", "stream-selector"). + Logger() + + return &StreamSelectorManagerCtx{ + logger: logger, + codec: codec, + streams: streams, + streamIDs: streamIDs, + } +} + +func (manager *StreamSelectorManagerCtx) shutdown() { + manager.logger.Info().Msgf("shutdown") + + manager.destroyPipelines() +} + +func (manager *StreamSelectorManagerCtx) destroyPipelines() { + for _, stream := range manager.streams { + if stream.Started() { + stream.DestroyPipeline() + } + } +} + +func (manager *StreamSelectorManagerCtx) recreatePipelines() error { + for _, stream := range manager.streams { + if stream.Started() { + err := stream.CreatePipeline() + if err != nil && !errors.Is(err, types.ErrCapturePipelineAlreadyExists) { + return err + } + } + } + return nil +} + +func (manager *StreamSelectorManagerCtx) IDs() []string { + return manager.streamIDs +} + +func (manager *StreamSelectorManagerCtx) Codec() codec.RTPCodec { + return manager.codec +} + +func (manager *StreamSelectorManagerCtx) GetStream(selector types.StreamSelector) (types.StreamSinkManager, bool) { + // select stream by ID + if selector.ID != "" { + // select lower stream + if selector.Type == types.StreamSelectorTypeLower { + var lastStream types.StreamSinkManager + for i := len(manager.streamIDs) - 1; i >= 0; i-- { + streamID := manager.streamIDs[i] + if streamID == selector.ID { + return lastStream, lastStream != nil + } + stream, ok := manager.streams[streamID] + if ok { + lastStream = stream + } + } + // we couldn't find a lower stream + return nil, false + } + + // select higher stream + if selector.Type == types.StreamSelectorTypeHigher { + var lastStream types.StreamSinkManager + for _, streamID := range manager.streamIDs { + if streamID == selector.ID { + return lastStream, lastStream != nil + } + stream, ok := manager.streams[streamID] + if ok { + lastStream = stream + } + } + // we couldn't find a higher stream + return nil, false + } + + // select exact stream + stream, ok := manager.streams[selector.ID] + return stream, ok + } + + // select stream by bitrate + if selector.Bitrate != 0 { + // select stream by nearest bitrate + if selector.Type == types.StreamSelectorTypeNearest { + return manager.nearestBitrate(selector.Bitrate), true + } + + // select lower stream + if selector.Type == types.StreamSelectorTypeLower { + // start from the highest stream, and go down, until we find a lower stream + for i := len(manager.streamIDs) - 1; i >= 0; i-- { + streamID := manager.streamIDs[i] + stream := manager.streams[streamID] + // if stream should be considered in calculation + considered := stream.Bitrate() != 0 && stream.Started() + if considered && stream.Bitrate() < selector.Bitrate { + return stream, true + } + } + // we couldn't find a lower stream + return nil, false + } + + // select higher stream + if selector.Type == types.StreamSelectorTypeHigher { + // start from the lowest stream, and go up, until we find a higher stream + for _, streamID := range manager.streamIDs { + stream := manager.streams[streamID] + // if stream should be considered in calculation + considered := stream.Bitrate() != 0 && stream.Started() + if considered && stream.Bitrate() > selector.Bitrate { + return stream, true + } + } + // we couldn't find a higher stream + return nil, false + } + + // select stream by exact bitrate + for _, stream := range manager.streams { + if stream.Bitrate() == selector.Bitrate { + return stream, true + } + } + } + + // we couldn't find a stream + return nil, false +} + +// TODO: This is a very naive implementation, we should use a binary search instead. +func (manager *StreamSelectorManagerCtx) nearestBitrate(bitrate uint64) types.StreamSinkManager { + type streamDiff struct { + id string + bitrateDiff int + } + + sortDiff := func(a, b int) bool { + switch { + case a < 0 && b < 0: + return a > b + case a >= 0: + if b >= 0 { + return a <= b + } + return true + } + return false + } + + var diffs []streamDiff + + for _, stream := range manager.streams { + // if stream should be considered in calculation + considered := stream.Bitrate() != 0 && stream.Started() + if !considered { + continue + } + diffs = append(diffs, streamDiff{ + id: stream.ID(), + bitrateDiff: int(bitrate) - int(stream.Bitrate()), + }) + } + + // no streams available + if len(diffs) == 0 { + // return first (lowest) stream + return manager.streams[manager.streamIDs[0]] + } + + sort.Slice(diffs, func(i, j int) bool { + return sortDiff(diffs[i].bitrateDiff, diffs[j].bitrateDiff) + }) + + bestDiff := diffs[0] + return manager.streams[bestDiff.id] +} diff --git a/server/internal/capture/streamsink.go b/server/internal/capture/streamsink.go index 2aa3b3676..850d90d7b 100644 --- a/server/internal/capture/streamsink.go +++ b/server/internal/capture/streamsink.go @@ -2,41 +2,122 @@ package capture import ( "errors" + "reflect" "sync" + "sync/atomic" + "time" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" "github.com/rs/zerolog" "github.com/rs/zerolog/log" - "m1k1o/neko/internal/capture/gst" - "m1k1o/neko/internal/types" - "m1k1o/neko/internal/types/codec" + "m1k1o/neko/pkg/gst" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/codec" ) +var moveSinkListenerMu = sync.Mutex{} + type StreamSinkManagerCtx struct { - logger zerolog.Logger - mu sync.Mutex - sampleChannel chan types.Sample + id string + + // wait for a keyframe before sending samples + waitForKf bool + + bitrate uint64 // atomic + brBuckets map[int]float64 + + logger zerolog.Logger + mu sync.Mutex + wg sync.WaitGroup codec codec.RTPCodec - pipeline *gst.Pipeline + pipeline gst.Pipeline pipelineMu sync.Mutex pipelineFn func() (string, error) - listeners int + listeners map[uintptr]types.SampleListener + listenersKf map[uintptr]types.SampleListener // keyframe lobby listenersMu sync.Mutex + + // metrics + currentListeners prometheus.Gauge + totalBytes prometheus.Counter + pipelinesCounter prometheus.Counter + pipelinesActive prometheus.Gauge } -func streamSinkNew(codec codec.RTPCodec, pipelineFn func() (string, error), video_id string) *StreamSinkManagerCtx { +func streamSinkNew(codec codec.RTPCodec, pipelineFn func() (string, error), id string) *StreamSinkManagerCtx { logger := log.With(). Str("module", "capture"). Str("submodule", "stream-sink"). - Str("video_id", video_id).Logger() + Str("id", id).Logger() manager := &StreamSinkManagerCtx{ - logger: logger, - codec: codec, - pipelineFn: pipelineFn, - sampleChannel: make(chan types.Sample), + id: id, + + // only wait for keyframes if the codec is video + waitForKf: codec.IsVideo(), + + bitrate: 0, + brBuckets: map[int]float64{}, + + logger: logger, + codec: codec, + pipelineFn: pipelineFn, + + listeners: map[uintptr]types.SampleListener{}, + listenersKf: map[uintptr]types.SampleListener{}, + + // metrics + currentListeners: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "streamsink_listeners", + Namespace: "neko", + Subsystem: "capture", + Help: "Current number of listeners for a pipeline.", + ConstLabels: map[string]string{ + "video_id": id, + "codec_name": codec.Name, + "codec_type": codec.Type.String(), + }, + }), + totalBytes: promauto.NewCounter(prometheus.CounterOpts{ + Name: "streamsink_bytes", + Namespace: "neko", + Subsystem: "capture", + Help: "Total number of bytes created by the pipeline.", + ConstLabels: map[string]string{ + "video_id": id, + "codec_name": codec.Name, + "codec_type": codec.Type.String(), + }, + }), + pipelinesCounter: promauto.NewCounter(prometheus.CounterOpts{ + Name: "pipelines_total", + Namespace: "neko", + Subsystem: "capture", + Help: "Total number of created pipelines.", + ConstLabels: map[string]string{ + "submodule": "streamsink", + "video_id": id, + "codec_name": codec.Name, + "codec_type": codec.Type.String(), + }, + }), + pipelinesActive: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "pipelines_active", + Namespace: "neko", + Subsystem: "capture", + Help: "Total number of active pipelines.", + ConstLabels: map[string]string{ + "submodule": "streamsink", + "video_id": id, + "codec_name": codec.Name, + "codec_type": codec.Type.String(), + }, + }), } return manager @@ -45,7 +126,25 @@ func streamSinkNew(codec codec.RTPCodec, pipelineFn func() (string, error), vide func (manager *StreamSinkManagerCtx) shutdown() { manager.logger.Info().Msgf("shutdown") - manager.destroyPipeline() + manager.listenersMu.Lock() + for key := range manager.listeners { + delete(manager.listeners, key) + } + for key := range manager.listenersKf { + delete(manager.listenersKf, key) + } + manager.listenersMu.Unlock() + + manager.DestroyPipeline() + manager.wg.Wait() +} + +func (manager *StreamSinkManagerCtx) ID() string { + return manager.id +} + +func (manager *StreamSinkManagerCtx) Bitrate() uint64 { + return atomic.LoadUint64(&manager.bitrate) } func (manager *StreamSinkManagerCtx) Codec() codec.RTPCodec { @@ -53,8 +152,8 @@ func (manager *StreamSinkManagerCtx) Codec() codec.RTPCodec { } func (manager *StreamSinkManagerCtx) start() error { - if manager.listeners == 0 { - err := manager.createPipeline() + if len(manager.listeners)+len(manager.listenersKf) == 0 { + err := manager.CreatePipeline() if err != nil && !errors.Is(err, types.ErrCapturePipelineAlreadyExists) { return err } @@ -66,45 +165,123 @@ func (manager *StreamSinkManagerCtx) start() error { } func (manager *StreamSinkManagerCtx) stop() { - if manager.listeners == 0 { - manager.destroyPipeline() + if len(manager.listeners)+len(manager.listenersKf) == 0 { + manager.DestroyPipeline() manager.logger.Info().Msgf("last listener, stopping") } } -func (manager *StreamSinkManagerCtx) addListener() { +func (manager *StreamSinkManagerCtx) addListener(listener types.SampleListener) { + ptr := reflect.ValueOf(listener).Pointer() + emitKeyframe := false + manager.listenersMu.Lock() - manager.listeners++ + if manager.waitForKf { + // if this is the first listener, we need to emit a keyframe + emitKeyframe = len(manager.listenersKf) == 0 + // if we're waiting for a keyframe, add it to the keyframe lobby + manager.listenersKf[ptr] = listener + } else { + // otherwise, add it as a regular listener + manager.listeners[ptr] = listener + } manager.listenersMu.Unlock() + + manager.logger.Debug().Interface("ptr", ptr).Msgf("adding listener") + manager.currentListeners.Set(float64(manager.ListenersCount())) + + // if we will be waiting for a keyframe, emit one now + if manager.pipeline != nil && emitKeyframe { + manager.pipeline.EmitVideoKeyframe() + } } -func (manager *StreamSinkManagerCtx) removeListener() { +func (manager *StreamSinkManagerCtx) removeListener(listener types.SampleListener) { + ptr := reflect.ValueOf(listener).Pointer() + manager.listenersMu.Lock() - manager.listeners-- + delete(manager.listeners, ptr) + delete(manager.listenersKf, ptr) // if it's a keyframe listener, remove it too manager.listenersMu.Unlock() + + manager.logger.Debug().Interface("ptr", ptr).Msgf("removing listener") + manager.currentListeners.Set(float64(manager.ListenersCount())) } -func (manager *StreamSinkManagerCtx) AddListener() error { +func (manager *StreamSinkManagerCtx) AddListener(listener types.SampleListener) error { manager.mu.Lock() defer manager.mu.Unlock() + if listener == nil { + return errors.New("listener cannot be nil") + } + // start if stopped if err := manager.start(); err != nil { return err } // add listener - manager.addListener() + manager.addListener(listener) return nil } -func (manager *StreamSinkManagerCtx) RemoveListener() error { +func (manager *StreamSinkManagerCtx) RemoveListener(listener types.SampleListener) error { manager.mu.Lock() defer manager.mu.Unlock() + if listener == nil { + return errors.New("listener cannot be nil") + } + // remove listener - manager.removeListener() + manager.removeListener(listener) + + // stop if started + manager.stop() + + return nil +} + +// moving listeners between streams ensures, that target pipeline is running +// before listener is added, and stops source pipeline if there are 0 listeners +func (manager *StreamSinkManagerCtx) MoveListenerTo(listener types.SampleListener, stream types.StreamSinkManager) error { + if listener == nil { + return errors.New("listener cannot be nil") + } + + targetStream, ok := stream.(*StreamSinkManagerCtx) + if !ok { + return errors.New("target stream manager does not support moving listeners") + } + + // we need to acquire both mutextes, from source stream and from target stream + // in order to do that safely (without possibility of deadlock) we need third + // global mutex, that ensures atomic locking + + // lock global mutex + moveSinkListenerMu.Lock() + + // lock source stream + manager.mu.Lock() + defer manager.mu.Unlock() + + // lock target stream + targetStream.mu.Lock() + defer targetStream.mu.Unlock() + + // unlock global mutex + moveSinkListenerMu.Unlock() + + // start if stopped + if err := targetStream.start(); err != nil { + return err + } + + // swap listeners + manager.removeListener(listener) + targetStream.addListener(listener) // stop if started manager.stop() @@ -116,14 +293,14 @@ func (manager *StreamSinkManagerCtx) ListenersCount() int { manager.listenersMu.Lock() defer manager.listenersMu.Unlock() - return manager.listeners + return len(manager.listeners) + len(manager.listenersKf) } func (manager *StreamSinkManagerCtx) Started() bool { return manager.ListenersCount() > 0 } -func (manager *StreamSinkManagerCtx) createPipeline() error { +func (manager *StreamSinkManagerCtx) CreatePipeline() error { manager.pipelineMu.Lock() defer manager.pipelineMu.Unlock() @@ -146,18 +323,79 @@ func (manager *StreamSinkManagerCtx) createPipeline() error { return err } - appsinkSubfix := "audio" - if manager.codec.IsVideo() { - appsinkSubfix = "video" - } - - manager.pipeline.AttachAppsink("appsink"+appsinkSubfix, manager.sampleChannel) + manager.pipeline.AttachAppsink("appsink") manager.pipeline.Play() + manager.wg.Add(1) + pipeline := manager.pipeline + + go func() { + manager.logger.Debug().Msg("started emitting samples") + defer manager.wg.Done() + + for { + sample, ok := <-pipeline.Sample() + if !ok { + manager.logger.Debug().Msg("stopped emitting samples") + return + } + + manager.onSample(sample) + } + }() + + manager.pipelinesCounter.Inc() + manager.pipelinesActive.Set(1) + return nil } -func (manager *StreamSinkManagerCtx) destroyPipeline() { +func (manager *StreamSinkManagerCtx) saveSampleBitrate(timestamp time.Time, delta float64) { + // get unix timestamp in seconds + sec := timestamp.Unix() + // last bucket is timestamp rounded to 3 seconds - 1 second + last := int((sec - 1) % 3) + // current bucket is timestamp rounded to 3 seconds + curr := int(sec % 3) + // next bucket is timestamp rounded to 3 seconds + 1 second + next := int((sec + 1) % 3) + + if manager.brBuckets[next] != 0 { + // atomic update bitrate + atomic.StoreUint64(&manager.bitrate, uint64(manager.brBuckets[last])) + // empty next bucket + manager.brBuckets[next] = 0 + } + + // add rate to current bucket + manager.brBuckets[curr] += delta +} + +func (manager *StreamSinkManagerCtx) onSample(sample types.Sample) { + manager.listenersMu.Lock() + defer manager.listenersMu.Unlock() + + // save to metrics + length := float64(sample.Length) + manager.totalBytes.Add(length) + manager.saveSampleBitrate(sample.Timestamp, length) + + // if is not delta unit -> it can be decoded independently -> it is a keyframe + if manager.waitForKf && !sample.DeltaUnit && len(manager.listenersKf) > 0 { + // if current sample is a keyframe, move listeners from + // keyframe lobby to actual listeners map and clear lobby + for k, v := range manager.listenersKf { + manager.listeners[k] = v + } + manager.listenersKf = make(map[uintptr]types.SampleListener) + } + + for _, l := range manager.listeners { + l.WriteSample(sample) + } +} + +func (manager *StreamSinkManagerCtx) DestroyPipeline() { manager.pipelineMu.Lock() defer manager.pipelineMu.Unlock() @@ -168,8 +406,9 @@ func (manager *StreamSinkManagerCtx) destroyPipeline() { manager.pipeline.Destroy() manager.logger.Info().Msgf("destroying pipeline") manager.pipeline = nil -} -func (manager *StreamSinkManagerCtx) GetSampleChannel() chan types.Sample { - return manager.sampleChannel + manager.pipelinesActive.Set(0) + + manager.brBuckets = make(map[int]float64) + atomic.StoreUint64(&manager.bitrate, 0) } diff --git a/server/internal/capture/streamsrc.go b/server/internal/capture/streamsrc.go new file mode 100644 index 000000000..15b5b0b82 --- /dev/null +++ b/server/internal/capture/streamsrc.go @@ -0,0 +1,197 @@ +package capture + +import ( + "errors" + "sync" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + + "m1k1o/neko/pkg/gst" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/codec" +) + +type StreamSrcManagerCtx struct { + logger zerolog.Logger + enabled bool + codecPipeline map[string]string // codec -> pipeline + + codec codec.RTPCodec + pipeline gst.Pipeline + pipelineMu sync.Mutex + pipelineStr string + + // metrics + pushedData map[string]prometheus.Summary + pipelinesCounter map[string]prometheus.Counter + pipelinesActive map[string]prometheus.Gauge +} + +func streamSrcNew(enabled bool, codecPipeline map[string]string, video_id string) *StreamSrcManagerCtx { + logger := log.With(). + Str("module", "capture"). + Str("submodule", "stream-src"). + Str("video_id", video_id).Logger() + + pushedData := map[string]prometheus.Summary{} + pipelinesCounter := map[string]prometheus.Counter{} + pipelinesActive := map[string]prometheus.Gauge{} + + for codecName, pipeline := range codecPipeline { + codec, ok := codec.ParseStr(codecName) + if !ok { + logger.Fatal(). + Str("codec", codecName). + Str("pipeline", pipeline). + Msg("unknown codec name") + } + + pushedData[codecName] = promauto.NewSummary(prometheus.SummaryOpts{ + Name: "streamsrc_data_bytes", + Namespace: "neko", + Subsystem: "capture", + Help: "Data pushed to a pipeline (in bytes).", + ConstLabels: map[string]string{ + "video_id": video_id, + "codec_name": codec.Name, + "codec_type": codec.Type.String(), + }, + }) + pipelinesCounter[codecName] = promauto.NewCounter(prometheus.CounterOpts{ + Name: "pipelines_total", + Namespace: "neko", + Subsystem: "capture", + Help: "Total number of created pipelines.", + ConstLabels: map[string]string{ + "submodule": "streamsrc", + "video_id": video_id, + "codec_name": codec.Name, + "codec_type": codec.Type.String(), + }, + }) + pipelinesActive[codecName] = promauto.NewGauge(prometheus.GaugeOpts{ + Name: "pipelines_active", + Namespace: "neko", + Subsystem: "capture", + Help: "Total number of active pipelines.", + ConstLabels: map[string]string{ + "submodule": "streamsrc", + "video_id": video_id, + "codec_name": codec.Name, + "codec_type": codec.Type.String(), + }, + }) + } + + return &StreamSrcManagerCtx{ + logger: logger, + enabled: enabled, + codecPipeline: codecPipeline, + + // metrics + pushedData: pushedData, + pipelinesCounter: pipelinesCounter, + pipelinesActive: pipelinesActive, + } +} + +func (manager *StreamSrcManagerCtx) shutdown() { + manager.logger.Info().Msgf("shutdown") + + manager.Stop() +} + +func (manager *StreamSrcManagerCtx) Codec() codec.RTPCodec { + manager.pipelineMu.Lock() + defer manager.pipelineMu.Unlock() + + return manager.codec +} + +func (manager *StreamSrcManagerCtx) Start(codec codec.RTPCodec) error { + manager.pipelineMu.Lock() + defer manager.pipelineMu.Unlock() + + if manager.pipeline != nil { + return types.ErrCapturePipelineAlreadyExists + } + + if !manager.enabled { + return errors.New("stream-src not enabled") + } + + found := false + for codecName, pipeline := range manager.codecPipeline { + if codecName == codec.Name { + manager.pipelineStr = pipeline + manager.codec = codec + found = true + break + } + } + + if !found { + return errors.New("no pipeline found for a codec") + } + + var err error + + manager.logger.Info(). + Str("codec", manager.codec.Name). + Str("src", manager.pipelineStr). + Msgf("creating pipeline") + + manager.pipeline, err = gst.CreatePipeline(manager.pipelineStr) + if err != nil { + return err + } + + manager.pipeline.AttachAppsrc("appsrc") + manager.pipeline.Play() + + manager.pipelinesCounter[manager.codec.Name].Inc() + manager.pipelinesActive[manager.codec.Name].Set(1) + + return nil +} + +func (manager *StreamSrcManagerCtx) Stop() { + manager.pipelineMu.Lock() + defer manager.pipelineMu.Unlock() + + if manager.pipeline == nil { + return + } + + manager.pipeline.Destroy() + manager.pipeline = nil + + manager.logger.Info(). + Str("codec", manager.codec.Name). + Str("src", manager.pipelineStr). + Msgf("destroying pipeline") + + manager.pipelinesActive[manager.codec.Name].Set(0) +} + +func (manager *StreamSrcManagerCtx) Push(bytes []byte) { + manager.pipelineMu.Lock() + defer manager.pipelineMu.Unlock() + + if manager.pipeline == nil { + return + } + + manager.pipeline.Push(bytes) + manager.pushedData[manager.codec.Name].Observe(float64(len(bytes))) +} + +func (manager *StreamSrcManagerCtx) Started() bool { + manager.pipelineMu.Lock() + defer manager.pipelineMu.Unlock() + + return manager.pipeline != nil +} diff --git a/server/internal/config/capture.go b/server/internal/config/capture.go index 2db0be6bc..591279f3c 100644 --- a/server/internal/config/capture.go +++ b/server/internal/config/capture.go @@ -1,55 +1,197 @@ package config import ( - "m1k1o/neko/internal/types/codec" + "os" "strings" "github.com/pion/webrtc/v3" "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/codec" + "m1k1o/neko/pkg/utils" ) +// Legacy capture configuration type HwEnc int +// Legacy capture configuration const ( - HwEncNone HwEnc = iota + HwEncUnset HwEnc = iota + HwEncNone HwEncVAAPI HwEncNVENC ) type Capture struct { - // video - Display string - VideoCodec codec.RTPCodec - VideoHWEnc HwEnc // TODO: Pipeline builder. - VideoBitrate uint // TODO: Pipeline builder. - VideoMaxFPS int16 // TODO: Pipeline builder. - VideoPipeline string + Display string + + VideoCodec codec.RTPCodec + VideoIDs []string + VideoPipelines map[string]types.VideoConfig - // audio AudioDevice string AudioCodec codec.RTPCodec - AudioBitrate uint // TODO: Pipeline builder. AudioPipeline string - // broadcast - BroadcastPipeline string - BroadcastUrl string - BroadcastAutostart bool + BroadcastAudioBitrate int + BroadcastVideoBitrate int + BroadcastPreset string + BroadcastPipeline string + BroadcastUrl string + BroadcastAutostart bool + + ScreencastEnabled bool + ScreencastRate string + ScreencastQuality string + ScreencastPipeline string + + WebcamEnabled bool + WebcamDevice string + WebcamWidth int + WebcamHeight int + + MicrophoneEnabled bool + MicrophoneDevice string } func (Capture) Init(cmd *cobra.Command) error { - // - // video - // + // audio + cmd.PersistentFlags().String("capture.audio.device", "audio_output.monitor", "pulseaudio device to capture") + if err := viper.BindPFlag("capture.audio.device", cmd.PersistentFlags().Lookup("capture.audio.device")); err != nil { + return err + } + + cmd.PersistentFlags().String("capture.audio.codec", "opus", "audio codec to be used") + if err := viper.BindPFlag("capture.audio.codec", cmd.PersistentFlags().Lookup("capture.audio.codec")); err != nil { + return err + } - cmd.PersistentFlags().String("display", ":99.0", "XDisplay to capture") + cmd.PersistentFlags().String("capture.audio.pipeline", "", "gstreamer pipeline used for audio streaming") + if err := viper.BindPFlag("capture.audio.pipeline", cmd.PersistentFlags().Lookup("capture.audio.pipeline")); err != nil { + return err + } + + // videos + cmd.PersistentFlags().String("capture.video.display", "", "X display to capture") + if err := viper.BindPFlag("capture.video.display", cmd.PersistentFlags().Lookup("capture.video.display")); err != nil { + return err + } + + cmd.PersistentFlags().String("capture.video.codec", "vp8", "video codec to be used") + if err := viper.BindPFlag("capture.video.codec", cmd.PersistentFlags().Lookup("capture.video.codec")); err != nil { + return err + } + + cmd.PersistentFlags().StringSlice("capture.video.ids", []string{}, "ordered list of video ids") + if err := viper.BindPFlag("capture.video.ids", cmd.PersistentFlags().Lookup("capture.video.ids")); err != nil { + return err + } + + cmd.PersistentFlags().String("capture.video.pipelines", "[]", "pipelines config in JSON used for video streaming") + if err := viper.BindPFlag("capture.video.pipelines", cmd.PersistentFlags().Lookup("capture.video.pipelines")); err != nil { + return err + } + + // broadcast + cmd.PersistentFlags().Int("capture.broadcast.audio_bitrate", 128, "broadcast audio bitrate in KB/s") + if err := viper.BindPFlag("capture.broadcast.audio_bitrate", cmd.PersistentFlags().Lookup("capture.broadcast.audio_bitrate")); err != nil { + return err + } + + cmd.PersistentFlags().Int("capture.broadcast.video_bitrate", 4096, "broadcast video bitrate in KB/s") + if err := viper.BindPFlag("capture.broadcast.video_bitrate", cmd.PersistentFlags().Lookup("capture.broadcast.video_bitrate")); err != nil { + return err + } + + cmd.PersistentFlags().String("capture.broadcast.preset", "veryfast", "broadcast speed preset for h264 encoding") + if err := viper.BindPFlag("capture.broadcast.preset", cmd.PersistentFlags().Lookup("capture.broadcast.preset")); err != nil { + return err + } + + cmd.PersistentFlags().String("capture.broadcast.pipeline", "", "gstreamer pipeline used for broadcasting") + if err := viper.BindPFlag("capture.broadcast.pipeline", cmd.PersistentFlags().Lookup("capture.broadcast.pipeline")); err != nil { + return err + } + + cmd.PersistentFlags().String("capture.broadcast.url", "", "initial URL for broadcasting, setting this value will automatically start broadcasting") + if err := viper.BindPFlag("capture.broadcast.url", cmd.PersistentFlags().Lookup("capture.broadcast.url")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("capture.broadcast.autostart", true, "automatically start broadcasting when neko starts and broadcast_url is set") + if err := viper.BindPFlag("capture.broadcast.autostart", cmd.PersistentFlags().Lookup("capture.broadcast.autostart")); err != nil { + return err + } + + // screencast + cmd.PersistentFlags().Bool("capture.screencast.enabled", false, "enable screencast") + if err := viper.BindPFlag("capture.screencast.enabled", cmd.PersistentFlags().Lookup("capture.screencast.enabled")); err != nil { + return err + } + + cmd.PersistentFlags().String("capture.screencast.rate", "10/1", "screencast frame rate") + if err := viper.BindPFlag("capture.screencast.rate", cmd.PersistentFlags().Lookup("capture.screencast.rate")); err != nil { + return err + } + + cmd.PersistentFlags().String("capture.screencast.quality", "60", "screencast JPEG quality") + if err := viper.BindPFlag("capture.screencast.quality", cmd.PersistentFlags().Lookup("capture.screencast.quality")); err != nil { + return err + } + + cmd.PersistentFlags().String("capture.screencast.pipeline", "", "gstreamer pipeline used for screencasting") + if err := viper.BindPFlag("capture.screencast.pipeline", cmd.PersistentFlags().Lookup("capture.screencast.pipeline")); err != nil { + return err + } + + // webcam + cmd.PersistentFlags().Bool("capture.webcam.enabled", false, "enable webcam stream") + if err := viper.BindPFlag("capture.webcam.enabled", cmd.PersistentFlags().Lookup("capture.webcam.enabled")); err != nil { + return err + } + + // sudo apt install v4l2loopback-dkms v4l2loopback-utils + // sudo apt-get install linux-headers-`uname -r` linux-modules-extra-`uname -r` + // sudo modprobe v4l2loopback exclusive_caps=1 + cmd.PersistentFlags().String("capture.webcam.device", "/dev/video0", "v4l2sink device used for webcam") + if err := viper.BindPFlag("capture.webcam.device", cmd.PersistentFlags().Lookup("capture.webcam.device")); err != nil { + return err + } + + cmd.PersistentFlags().Int("capture.webcam.width", 1280, "webcam stream width") + if err := viper.BindPFlag("capture.webcam.width", cmd.PersistentFlags().Lookup("capture.webcam.width")); err != nil { + return err + } + + cmd.PersistentFlags().Int("capture.webcam.height", 720, "webcam stream height") + if err := viper.BindPFlag("capture.webcam.height", cmd.PersistentFlags().Lookup("capture.webcam.height")); err != nil { + return err + } + + // microphone + cmd.PersistentFlags().Bool("capture.microphone.enabled", true, "enable microphone stream") + if err := viper.BindPFlag("capture.microphone.enabled", cmd.PersistentFlags().Lookup("capture.microphone.enabled")); err != nil { + return err + } + + cmd.PersistentFlags().String("capture.microphone.device", "audio_input", "pulseaudio device used for microphone") + if err := viper.BindPFlag("capture.microphone.device", cmd.PersistentFlags().Lookup("capture.microphone.device")); err != nil { + return err + } + + return nil +} + +func (Capture) InitV2(cmd *cobra.Command) error { + cmd.PersistentFlags().String("display", "", "V2: XDisplay to capture") if err := viper.BindPFlag("display", cmd.PersistentFlags().Lookup("display")); err != nil { return err } - cmd.PersistentFlags().String("video_codec", "vp8", "video codec to be used") + cmd.PersistentFlags().String("video_codec", "", "V2: video codec to be used") if err := viper.BindPFlag("video_codec", cmd.PersistentFlags().Lookup("video_codec")); err != nil { return err } @@ -78,22 +220,22 @@ func (Capture) Init(cmd *cobra.Command) error { return err } - cmd.PersistentFlags().String("hwenc", "", "use hardware accelerated encoding") + cmd.PersistentFlags().String("hwenc", "", "V2: use hardware accelerated encoding") if err := viper.BindPFlag("hwenc", cmd.PersistentFlags().Lookup("hwenc")); err != nil { return err } - cmd.PersistentFlags().Int("video_bitrate", 3072, "video bitrate in kbit/s") + cmd.PersistentFlags().Int("video_bitrate", 0, "V2: video bitrate in kbit/s") if err := viper.BindPFlag("video_bitrate", cmd.PersistentFlags().Lookup("video_bitrate")); err != nil { return err } - cmd.PersistentFlags().Int("max_fps", 25, "maximum fps delivered via WebRTC, 0 is for no maximum") + cmd.PersistentFlags().Int("max_fps", 0, "V2: maximum fps delivered via WebRTC, 0 is for no maximum") if err := viper.BindPFlag("max_fps", cmd.PersistentFlags().Lookup("max_fps")); err != nil { return err } - cmd.PersistentFlags().String("video", "", "video codec parameters to use for streaming") + cmd.PersistentFlags().String("video", "", "V2: video codec parameters to use for streaming") if err := viper.BindPFlag("video", cmd.PersistentFlags().Lookup("video")); err != nil { return err } @@ -102,12 +244,12 @@ func (Capture) Init(cmd *cobra.Command) error { // audio // - cmd.PersistentFlags().String("device", "audio_output.monitor", "audio device to capture") + cmd.PersistentFlags().String("device", "", "V2: audio device to capture") if err := viper.BindPFlag("device", cmd.PersistentFlags().Lookup("device")); err != nil { return err } - cmd.PersistentFlags().String("audio_codec", "opus", "audio codec to be used") + cmd.PersistentFlags().String("audio_codec", "", "V2: audio codec to be used") if err := viper.BindPFlag("audio_codec", cmd.PersistentFlags().Lookup("audio_codec")); err != nil { return err } @@ -137,12 +279,12 @@ func (Capture) Init(cmd *cobra.Command) error { } // audio codecs - cmd.PersistentFlags().Int("audio_bitrate", 128, "audio bitrate in kbit/s") + cmd.PersistentFlags().Int("audio_bitrate", 0, "V2: audio bitrate in kbit/s") if err := viper.BindPFlag("audio_bitrate", cmd.PersistentFlags().Lookup("audio_bitrate")); err != nil { return err } - cmd.PersistentFlags().String("audio", "", "audio codec parameters to use for streaming") + cmd.PersistentFlags().String("audio", "", "V2: audio codec parameters to use for streaming") if err := viper.BindPFlag("audio", cmd.PersistentFlags().Lookup("audio")); err != nil { return err } @@ -151,17 +293,17 @@ func (Capture) Init(cmd *cobra.Command) error { // broadcast // - cmd.PersistentFlags().String("broadcast_pipeline", "", "custom gst pipeline used for broadcasting, strings {url} {device} {display} will be replaced") + cmd.PersistentFlags().String("broadcast_pipeline", "", "V2: custom gst pipeline used for broadcasting, strings {url} {device} {display} will be replaced") if err := viper.BindPFlag("broadcast_pipeline", cmd.PersistentFlags().Lookup("broadcast_pipeline")); err != nil { return err } - cmd.PersistentFlags().String("broadcast_url", "", "a default default URL for broadcast streams, can be disabled/changed later by admins in the GUI") + cmd.PersistentFlags().String("broadcast_url", "", "V2: a default default URL for broadcast streams, can be disabled/changed later by admins in the GUI") if err := viper.BindPFlag("broadcast_url", cmd.PersistentFlags().Lookup("broadcast_url")); err != nil { return err } - cmd.PersistentFlags().Bool("broadcast_autostart", true, "automatically start broadcasting when neko starts and broadcast_url is set") + cmd.PersistentFlags().Bool("broadcast_autostart", false, "V2: automatically start broadcasting when neko starts and broadcast_url is set") if err := viper.BindPFlag("broadcast_autostart", cmd.PersistentFlags().Lookup("broadcast_autostart")); err != nil { return err } @@ -172,86 +314,220 @@ func (Capture) Init(cmd *cobra.Command) error { func (s *Capture) Set() { var ok bool - // - // video - // + s.Display = viper.GetString("capture.video.display") - s.Display = viper.GetString("display") + // Display is provided by env variable unless explicitly set + if s.Display == "" { + s.Display = os.Getenv("DISPLAY") + } - videoCodec := viper.GetString("video_codec") + // video + videoCodec := viper.GetString("capture.video.codec") s.VideoCodec, ok = codec.ParseStr(videoCodec) - if !ok || s.VideoCodec.Type != webrtc.RTPCodecTypeVideo { + if !ok || !s.VideoCodec.IsVideo() { log.Warn().Str("codec", videoCodec).Msgf("unknown video codec, using Vp8") s.VideoCodec = codec.VP8() } + s.VideoIDs = viper.GetStringSlice("capture.video.ids") + if err := viper.UnmarshalKey("capture.video.pipelines", &s.VideoPipelines, viper.DecodeHook( + utils.JsonStringAutoDecode(s.VideoPipelines), + )); err != nil { + log.Warn().Err(err).Msgf("unable to parse video pipelines") + } + + // default video + if len(s.VideoPipelines) == 0 { + log.Warn().Msgf("no video pipelines specified, using defaults") + + s.VideoCodec = codec.VP8() + s.VideoPipelines = map[string]types.VideoConfig{ + "main": { + Fps: "25", + GstEncoder: "vp8enc", + GstParams: map[string]string{ + "target-bitrate": "round(3072 * 650)", + "cpu-used": "4", + "end-usage": "cbr", + "threads": "4", + "deadline": "1", + "undershoot": "95", + "buffer-size": "(3072 * 4)", + "buffer-initial-size": "(3072 * 2)", + "buffer-optimal-size": "(3072 * 3)", + "keyframe-max-dist": "25", + "min-quantizer": "4", + "max-quantizer": "20", + }, + }, + } + s.VideoIDs = []string{"main"} + } + + // audio + s.AudioDevice = viper.GetString("capture.audio.device") + s.AudioPipeline = viper.GetString("capture.audio.pipeline") + + audioCodec := viper.GetString("capture.audio.codec") + s.AudioCodec, ok = codec.ParseStr(audioCodec) + if !ok || !s.AudioCodec.IsAudio() { + log.Warn().Str("codec", audioCodec).Msgf("unknown audio codec, using Opus") + s.AudioCodec = codec.Opus() + } + + // broadcast + s.BroadcastAudioBitrate = viper.GetInt("capture.broadcast.audio_bitrate") + s.BroadcastVideoBitrate = viper.GetInt("capture.broadcast.video_bitrate") + s.BroadcastPreset = viper.GetString("capture.broadcast.preset") + s.BroadcastPipeline = viper.GetString("capture.broadcast.pipeline") + s.BroadcastUrl = viper.GetString("capture.broadcast.url") + s.BroadcastAutostart = viper.GetBool("capture.broadcast.autostart") + + // screencast + s.ScreencastEnabled = viper.GetBool("capture.screencast.enabled") + s.ScreencastRate = viper.GetString("capture.screencast.rate") + s.ScreencastQuality = viper.GetString("capture.screencast.quality") + s.ScreencastPipeline = viper.GetString("capture.screencast.pipeline") + + // webcam + s.WebcamEnabled = viper.GetBool("capture.webcam.enabled") + s.WebcamDevice = viper.GetString("capture.webcam.device") + s.WebcamWidth = viper.GetInt("capture.webcam.width") + s.WebcamHeight = viper.GetInt("capture.webcam.height") + + // microphone + s.MicrophoneEnabled = viper.GetBool("capture.microphone.enabled") + s.MicrophoneDevice = viper.GetString("capture.microphone.device") +} + +func (s *Capture) SetV2() { + var ok bool + + // + // video + // + + if display := viper.GetString("display"); display != "" { + s.Display = display + log.Warn().Msg("you are using v2 configuration 'NEKO_DISPLAY' which is deprecated, please use 'NEKO_CAPTURE_VIDEO_DISPLAY' and/or 'NEKO_DESKTOP_DISPLAY' instead, also consider using 'DISPLAY' env variable if both should be the same") + } + + if videoCodec := viper.GetString("video_codec"); videoCodec != "" { + s.VideoCodec, ok = codec.ParseStr(videoCodec) + if !ok || s.VideoCodec.Type != webrtc.RTPCodecTypeVideo { + log.Warn().Str("codec", videoCodec).Msgf("unknown video codec, using Vp8") + s.VideoCodec = codec.VP8() + } + log.Warn().Msg("you are using v2 configuration 'NEKO_VIDEO_CODEC' which is deprecated, please use 'NEKO_CAPTURE_VIDEO_CODEC' instead") + } + if viper.GetBool("vp8") { s.VideoCodec = codec.VP8() - log.Warn().Msg("you are using deprecated config setting 'NEKO_VP8=true', use 'NEKO_VIDEO_CODEC=vp8' instead") + log.Warn().Msg("you are using deprecated config setting 'NEKO_VP8=true', use 'NEKO_CAPTURE_VIDEO_CODEC=vp8' instead") } else if viper.GetBool("vp9") { s.VideoCodec = codec.VP9() - log.Warn().Msg("you are using deprecated config setting 'NEKO_VP9=true', use 'NEKO_VIDEO_CODEC=vp9' instead") + log.Warn().Msg("you are using deprecated config setting 'NEKO_VP9=true', use 'NEKO_CAPTURE_VIDEO_CODEC=vp9' instead") } else if viper.GetBool("h264") { s.VideoCodec = codec.H264() - log.Warn().Msg("you are using deprecated config setting 'NEKO_H264=true', use 'NEKO_VIDEO_CODEC=h264' instead") + log.Warn().Msg("you are using deprecated config setting 'NEKO_H264=true', use 'NEKO_CAPTURE_VIDEO_CODEC=h264' instead") } else if viper.GetBool("av1") { s.VideoCodec = codec.AV1() - log.Warn().Msg("you are using deprecated config setting 'NEKO_AV1=true', use 'NEKO_VIDEO_CODEC=av1' instead") + log.Warn().Msg("you are using deprecated config setting 'NEKO_AV1=true', use 'NEKO_CAPTURE_VIDEO_CODEC=av1' instead") } - videoHWEnc := strings.ToLower(viper.GetString("hwenc")) - switch videoHWEnc { - case "": - fallthrough - case "none": - s.VideoHWEnc = HwEncNone - case "vaapi": - s.VideoHWEnc = HwEncVAAPI - case "nvenc": - s.VideoHWEnc = HwEncNVENC - default: - log.Warn().Str("hwenc", videoHWEnc).Msgf("unknown video hw encoder, using CPU") + videoHWEnc := HwEncUnset + if hwenc := strings.ToLower(viper.GetString("hwenc")); hwenc != "" { + switch hwenc { + case "none": + videoHWEnc = HwEncNone + case "vaapi": + videoHWEnc = HwEncVAAPI + case "nvenc": + videoHWEnc = HwEncNVENC + default: + log.Warn().Str("hwenc", hwenc).Msgf("unknown video hw encoder, using CPU") + } } - s.VideoBitrate = viper.GetUint("video_bitrate") - s.VideoMaxFPS = int16(viper.GetInt("max_fps")) - s.VideoPipeline = viper.GetString("video") + videoBitrate := viper.GetUint("video_bitrate") + videoMaxFPS := int16(viper.GetInt("max_fps")) + videoPipeline := viper.GetString("video") + + // video pipeline + if videoHWEnc != HwEncUnset || videoBitrate != 0 || videoMaxFPS != 0 || videoPipeline != "" { + pipeline, err := NewVideoPipeline(s.VideoCodec, s.Display, videoPipeline, videoMaxFPS, videoBitrate, videoHWEnc) + if err != nil { + log.Warn().Err(err).Msg("unable to create video pipeline, using default") + } else { + s.VideoPipelines = map[string]types.VideoConfig{ + "main": { + GstPipeline: pipeline, + }, + } + // TODO: add deprecated warning and proper alternative + } + } // // audio // - s.AudioDevice = viper.GetString("device") + if audioDevice := viper.GetString("device"); audioDevice != "" { + s.AudioDevice = audioDevice + log.Warn().Msg("you are using v2 configuration 'NEKO_DEVICE' which is deprecated, please use 'NEKO_CAPTURE_AUDIO_DEVICE' instead") + } - audioCodec := viper.GetString("audio_codec") - s.AudioCodec, ok = codec.ParseStr(audioCodec) - if !ok || s.AudioCodec.Type != webrtc.RTPCodecTypeAudio { - log.Warn().Str("codec", audioCodec).Msgf("unknown audio codec, using Opus") - s.AudioCodec = codec.Opus() + if audioCodec := viper.GetString("audio_codec"); audioCodec != "" { + s.AudioCodec, ok = codec.ParseStr(audioCodec) + if !ok || s.AudioCodec.Type != webrtc.RTPCodecTypeAudio { + log.Warn().Str("codec", audioCodec).Msgf("unknown audio codec, using Opus") + s.AudioCodec = codec.Opus() + } + log.Warn().Msg("you are using v2 configuration 'NEKO_AUDIO_CODEC' which is deprecated, please use 'NEKO_CAPTURE_AUDIO_CODEC' instead") } if viper.GetBool("opus") { s.AudioCodec = codec.Opus() - log.Warn().Msg("you are using deprecated config setting 'NEKO_OPUS=true', use 'NEKO_VIDEO_CODEC=opus' instead") + log.Warn().Msg("you are using deprecated config setting 'NEKO_OPUS=true', use 'NEKO_CAPTURE_AUDIO_CODEC=opus' instead") } else if viper.GetBool("g722") { s.AudioCodec = codec.G722() - log.Warn().Msg("you are using deprecated config setting 'NEKO_G722=true', use 'NEKO_VIDEO_CODEC=g722' instead") + log.Warn().Msg("you are using deprecated config setting 'NEKO_G722=true', use 'NEKO_CAPTURE_AUDIO_CODEC=g722' instead") } else if viper.GetBool("pcmu") { s.AudioCodec = codec.PCMU() - log.Warn().Msg("you are using deprecated config setting 'NEKO_PCMU=true', use 'NEKO_VIDEO_CODEC=pcmu' instead") + log.Warn().Msg("you are using deprecated config setting 'NEKO_PCMU=true', use 'NEKO_CAPTURE_AUDIO_CODEC=pcmu' instead") } else if viper.GetBool("pcma") { s.AudioCodec = codec.PCMA() - log.Warn().Msg("you are using deprecated config setting 'NEKO_PCMA=true', use 'NEKO_VIDEO_CODEC=pcma' instead") + log.Warn().Msg("you are using deprecated config setting 'NEKO_PCMA=true', use 'NEKO_CAPTURE_AUDIO_CODEC=pcma' instead") } - s.AudioBitrate = viper.GetUint("audio_bitrate") - s.AudioPipeline = viper.GetString("audio") + audioBitrate := viper.GetUint("audio_bitrate") + audioPipeline := viper.GetString("audio") + + // audio pipeline + if audioBitrate != 0 || audioPipeline != "" { + pipeline, err := NewAudioPipeline(s.AudioCodec, s.AudioDevice, audioPipeline, audioBitrate) + if err != nil { + log.Warn().Err(err).Msg("unable to create audio pipeline, using default") + } else { + s.AudioPipeline = pipeline + } + // TODO: add deprecated warning and proper alternative + } // // broadcast // - s.BroadcastPipeline = viper.GetString("broadcast_pipeline") - s.BroadcastUrl = viper.GetString("broadcast_url") - s.BroadcastAutostart = viper.GetBool("broadcast_autostart") + if viper.IsSet("broadcast_pipeline") { + s.BroadcastPipeline = viper.GetString("broadcast_pipeline") + log.Warn().Msg("you are using v2 configuration 'NEKO_BROADCAST_PIPELINE' which is deprecated, please use 'NEKO_CAPTURE_BROADCAST_PIPELINE' instead") + } + if viper.IsSet("broadcast_url") { + s.BroadcastUrl = viper.GetString("broadcast_url") + log.Warn().Msg("you are using v2 configuration 'NEKO_BROADCAST_URL' which is deprecated, please use 'NEKO_CAPTURE_BROADCAST_URL' instead") + } + if viper.IsSet("broadcast_autostart") { + s.BroadcastAutostart = viper.GetBool("broadcast_autostart") + log.Warn().Msg("you are using v2 configuration 'NEKO_BROADCAST_AUTOSTART' which is deprecated, please use 'NEKO_CAPTURE_BROADCAST_AUTOSTART' instead") + } } diff --git a/server/internal/capture/pipelines.go b/server/internal/config/capture_pipeline.go similarity index 95% rename from server/internal/capture/pipelines.go rename to server/internal/config/capture_pipeline.go index 654ddd317..c64c9fef5 100644 --- a/server/internal/capture/pipelines.go +++ b/server/internal/config/capture_pipeline.go @@ -1,12 +1,12 @@ -package capture +// Legacy pipeline configuration for gstreamer. +package config import ( "fmt" "strings" - "m1k1o/neko/internal/capture/gst" - "m1k1o/neko/internal/config" - "m1k1o/neko/internal/types/codec" + "m1k1o/neko/pkg/gst" + "m1k1o/neko/pkg/types/codec" ) /* @@ -34,7 +34,7 @@ const ( audioSrc = "pulsesrc device=%s ! audio/x-raw,channels=2 ! audioconvert ! " ) -func NewBroadcastPipeline(device string, display string, pipelineSrc string, url string) (string, error) { +func NewBroadcastPipeline(device string, display string, pipelineSrc string, url string) string { video := fmt.Sprintf(videoSrc, display, 25) audio := fmt.Sprintf(audioSrc, device) @@ -50,10 +50,10 @@ func NewBroadcastPipeline(device string, display string, pipelineSrc string, url pipelineStr = fmt.Sprintf("flvmux name=mux ! rtmpsink location='%s live=1' %s audio/x-raw,channels=2 ! audioconvert ! voaacenc ! mux. %s x264enc bframes=0 key-int-max=60 byte-stream=true tune=zerolatency speed-preset=veryfast ! mux.", url, audio, video) } - return pipelineStr, nil + return pipelineStr } -func NewVideoPipeline(rtpCodec codec.RTPCodec, display string, pipelineSrc string, fps int16, bitrate uint, hwenc config.HwEnc) (string, error) { +func NewVideoPipeline(rtpCodec codec.RTPCodec, display string, pipelineSrc string, fps int16, bitrate uint, hwenc HwEnc) (string, error) { pipelineStr := " ! appsink name=appsinkvideo" // if using custom pipeline @@ -69,7 +69,7 @@ func NewVideoPipeline(rtpCodec codec.RTPCodec, display string, pipelineSrc strin switch rtpCodec.Name { case codec.VP8().Name: - if hwenc == config.HwEncVAAPI { + if hwenc == HwEncVAAPI { if err := gst.CheckPlugins([]string{"ximagesrc", "vaapi"}); err != nil { return "", err } @@ -144,13 +144,13 @@ func NewVideoPipeline(rtpCodec codec.RTPCodec, display string, pipelineSrc strin vbvbuf = bitrate } - if hwenc == config.HwEncVAAPI { + if hwenc == HwEncVAAPI { if err := gst.CheckPlugins([]string{"vaapi"}); err != nil { return "", err } pipelineStr = fmt.Sprintf(videoSrc+"video/x-raw,format=NV12 ! vaapih264enc rate-control=vbr bitrate=%d keyframe-period=180 quality-level=7 ! video/x-h264,stream-format=byte-stream,profile=constrained-baseline"+pipelineStr, display, fps, bitrate) - } else if hwenc == config.HwEncNVENC { + } else if hwenc == HwEncNVENC { if err := gst.CheckPlugins([]string{"nvcodec"}); err != nil { return "", err } diff --git a/server/internal/config/desktop.go b/server/internal/config/desktop.go index 6d1ec5839..36dc664d0 100644 --- a/server/internal/config/desktop.go +++ b/server/internal/config/desktop.go @@ -5,20 +5,67 @@ import ( "regexp" "strconv" + "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" + + "m1k1o/neko/pkg/types" ) type Desktop struct { Display string - ScreenWidth int - ScreenHeight int - ScreenRate int16 + ScreenSize types.ScreenSize + + UseInputDriver bool + InputSocket string + + Unminimize bool + UploadDrop bool + FileChooserDialog bool } func (Desktop) Init(cmd *cobra.Command) error { - cmd.PersistentFlags().String("screen", "1280x720@30", "default screen resolution and framerate") + cmd.PersistentFlags().String("desktop.display", "", "X display to use for desktop sharing") + if err := viper.BindPFlag("desktop.display", cmd.PersistentFlags().Lookup("desktop.display")); err != nil { + return err + } + + cmd.PersistentFlags().String("desktop.screen", "1280x720@30", "default screen size and framerate") + if err := viper.BindPFlag("desktop.screen", cmd.PersistentFlags().Lookup("desktop.screen")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("desktop.input.enabled", true, "whether custom xf86 input driver should be used to handle touchscreen") + if err := viper.BindPFlag("desktop.input.enabled", cmd.PersistentFlags().Lookup("desktop.input.enabled")); err != nil { + return err + } + + cmd.PersistentFlags().String("desktop.input.socket", "/tmp/xf86-input-neko.sock", "socket path for custom xf86 input driver connection") + if err := viper.BindPFlag("desktop.input.socket", cmd.PersistentFlags().Lookup("desktop.input.socket")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("desktop.unminimize", true, "automatically unminimize window when it is minimized") + if err := viper.BindPFlag("desktop.unminimize", cmd.PersistentFlags().Lookup("desktop.unminimize")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("desktop.upload_drop", true, "whether drop upload is enabled") + if err := viper.BindPFlag("desktop.upload_drop", cmd.PersistentFlags().Lookup("desktop.upload_drop")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("desktop.file_chooser_dialog", false, "whether to handle file chooser dialog externally") + if err := viper.BindPFlag("desktop.file_chooser_dialog", cmd.PersistentFlags().Lookup("desktop.file_chooser_dialog")); err != nil { + return err + } + + return nil +} + +func (Desktop) InitV2(cmd *cobra.Command) error { + cmd.PersistentFlags().String("screen", "", "V2: default screen resolution and framerate") if err := viper.BindPFlag("screen", cmd.PersistentFlags().Lookup("screen")); err != nil { return err } @@ -27,15 +74,21 @@ func (Desktop) Init(cmd *cobra.Command) error { } func (s *Desktop) Set() { - // Display is provided by env variable - s.Display = os.Getenv("DISPLAY") + s.Display = viper.GetString("desktop.display") + + // Display is provided by env variable unless explicitly set + if s.Display == "" { + s.Display = os.Getenv("DISPLAY") + } - s.ScreenWidth = 1280 - s.ScreenHeight = 720 - s.ScreenRate = 30 + s.ScreenSize = types.ScreenSize{ + Width: 1280, + Height: 720, + Rate: 30, + } r := regexp.MustCompile(`([0-9]{1,4})x([0-9]{1,4})@([0-9]{1,3})`) - res := r.FindStringSubmatch(viper.GetString("screen")) + res := r.FindStringSubmatch(viper.GetString("desktop.screen")) if len(res) > 0 { width, err1 := strconv.ParseInt(res[1], 10, 64) @@ -43,9 +96,35 @@ func (s *Desktop) Set() { rate, err3 := strconv.ParseInt(res[3], 10, 64) if err1 == nil && err2 == nil && err3 == nil { - s.ScreenWidth = int(width) - s.ScreenHeight = int(height) - s.ScreenRate = int16(rate) + s.ScreenSize.Width = int(width) + s.ScreenSize.Height = int(height) + s.ScreenSize.Rate = int16(rate) + } + } + + s.UseInputDriver = viper.GetBool("desktop.input.enabled") + s.InputSocket = viper.GetString("desktop.input.socket") + s.Unminimize = viper.GetBool("desktop.unminimize") + s.UploadDrop = viper.GetBool("desktop.upload_drop") + s.FileChooserDialog = viper.GetBool("desktop.file_chooser_dialog") +} + +func (s *Desktop) SetV2() { + if viper.IsSet("screen") { + r := regexp.MustCompile(`([0-9]{1,4})x([0-9]{1,4})@([0-9]{1,3})`) + res := r.FindStringSubmatch(viper.GetString("screen")) + + if len(res) > 0 { + width, err1 := strconv.ParseInt(res[1], 10, 64) + height, err2 := strconv.ParseInt(res[2], 10, 64) + rate, err3 := strconv.ParseInt(res[3], 10, 64) + + if err1 == nil && err2 == nil && err3 == nil { + s.ScreenSize.Width = int(width) + s.ScreenSize.Height = int(height) + s.ScreenSize.Rate = int16(rate) + } } + log.Warn().Msg("you are using v2 configuration 'NEKO_SCREEN' which is deprecated, please use 'NEKO_DESKTOP_SCREEN' instead") } } diff --git a/server/internal/config/member.go b/server/internal/config/member.go new file mode 100644 index 000000000..8fc98e145 --- /dev/null +++ b/server/internal/config/member.go @@ -0,0 +1,159 @@ +package config + +import ( + "github.com/rs/zerolog/log" + "github.com/spf13/cobra" + "github.com/spf13/viper" + + "m1k1o/neko/internal/member/file" + "m1k1o/neko/internal/member/multiuser" + "m1k1o/neko/internal/member/object" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +type Member struct { + Provider string + + // providers + File file.Config + Object object.Config + Multiuser multiuser.Config +} + +func (Member) Init(cmd *cobra.Command) error { + cmd.PersistentFlags().String("member.provider", "multiuser", "choose member provider") + if err := viper.BindPFlag("member.provider", cmd.PersistentFlags().Lookup("member.provider")); err != nil { + return err + } + + // file provider + cmd.PersistentFlags().String("member.file.path", "", "member file provider: storage path") + if err := viper.BindPFlag("member.file.path", cmd.PersistentFlags().Lookup("member.file.path")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("member.file.hash", true, "member file provider: whether to hash passwords using sha256 (recommended)") + if err := viper.BindPFlag("member.file.hash", cmd.PersistentFlags().Lookup("member.file.hash")); err != nil { + return err + } + + // object provider + cmd.PersistentFlags().String("member.object.users", "[]", "member object provider: users in JSON format") + if err := viper.BindPFlag("member.object.users", cmd.PersistentFlags().Lookup("member.object.users")); err != nil { + return err + } + + // multiuser provider + cmd.PersistentFlags().String("member.multiuser.user_password", "neko", "member multiuser provider: user password") + if err := viper.BindPFlag("member.multiuser.user_password", cmd.PersistentFlags().Lookup("member.multiuser.user_password")); err != nil { + return err + } + + cmd.PersistentFlags().String("member.multiuser.admin_password", "admin", "member multiuser provider: admin password") + if err := viper.BindPFlag("member.multiuser.admin_password", cmd.PersistentFlags().Lookup("member.multiuser.admin_password")); err != nil { + return err + } + + cmd.PersistentFlags().String("member.multiuser.user_profile", "{}", "member multiuser provider: user profile in JSON format") + if err := viper.BindPFlag("member.multiuser.user_profile", cmd.PersistentFlags().Lookup("member.multiuser.user_profile")); err != nil { + return err + } + + cmd.PersistentFlags().String("member.multiuser.admin_profile", "{}", "member multiuser provider: admin profile in JSON format") + if err := viper.BindPFlag("member.multiuser.admin_profile", cmd.PersistentFlags().Lookup("member.multiuser.admin_profile")); err != nil { + return err + } + + return nil +} + +func (Member) InitV2(cmd *cobra.Command) error { + cmd.PersistentFlags().String("password", "", "V2: password for connecting to stream") + if err := viper.BindPFlag("password", cmd.PersistentFlags().Lookup("password")); err != nil { + return err + } + + cmd.PersistentFlags().String("password_admin", "", "V2: admin password for connecting to stream") + if err := viper.BindPFlag("password_admin", cmd.PersistentFlags().Lookup("password_admin")); err != nil { + return err + } + + return nil +} + +func (s *Member) Set() { + s.Provider = viper.GetString("member.provider") + + // file provider + s.File.Path = viper.GetString("member.file.path") + s.File.Hash = viper.GetBool("member.file.hash") + + // object provider + if err := viper.UnmarshalKey("member.object.users", &s.Object.Users, viper.DecodeHook( + utils.JsonStringAutoDecode(s.Object.Users), + )); err != nil { + log.Warn().Err(err).Msgf("unable to parse member object users") + } + + // multiuser provider + s.Multiuser.UserPassword = viper.GetString("member.multiuser.user_password") + s.Multiuser.AdminPassword = viper.GetString("member.multiuser.admin_password") + + // default user profile + s.Multiuser.UserProfile = types.MemberProfile{ + IsAdmin: false, + CanLogin: true, + CanConnect: true, + CanWatch: true, + CanHost: true, + CanShareMedia: true, + CanAccessClipboard: true, + SendsInactiveCursor: true, + CanSeeInactiveCursors: false, + } + + // override user profile + if err := viper.UnmarshalKey("member.multiuser.user_profile", &s.Multiuser.UserProfile, viper.DecodeHook( + utils.JsonStringAutoDecode(s.Multiuser.UserProfile), + )); err != nil { + log.Warn().Err(err).Msgf("unable to parse member multiuser user profile") + } + + // default admin profile + s.Multiuser.AdminProfile = types.MemberProfile{ + IsAdmin: true, + CanLogin: true, + CanConnect: true, + CanWatch: true, + CanHost: true, + CanShareMedia: true, + CanAccessClipboard: true, + SendsInactiveCursor: true, + CanSeeInactiveCursors: true, + } + + // override admin profile + if err := viper.UnmarshalKey("member.multiuser.admin_profile", &s.Multiuser.AdminProfile, viper.DecodeHook( + utils.JsonStringAutoDecode(s.Multiuser.AdminProfile), + )); err != nil { + log.Warn().Err(err).Msgf("unable to parse member multiuser admin profile") + } +} + +func (s *Member) SetV2() { + if viper.IsSet("password") || viper.IsSet("password_admin") { + s.Provider = "multiuser" + if userPassword := viper.GetString("password"); userPassword != "" { + s.Multiuser.UserPassword = userPassword + } else { + s.Multiuser.UserPassword = "neko" + } + if adminPassword := viper.GetString("password_admin"); adminPassword != "" { + s.Multiuser.AdminPassword = adminPassword + } else { + s.Multiuser.AdminPassword = "admin" + } + log.Warn().Msg("you are using v2 configuration 'NEKO_PASSWORD' and 'NEKO_PASSWORD_ADMIN' which are deprecated, please use 'NEKO_MEMBER_MULTIUSER_USER_PASSWORD' and 'NEKO_MEMBER_MULTIUSER_ADMIN_PASSWORD' with 'NEKO_MEMBER_PROVIDER=multiuser' instead") + } +} diff --git a/server/internal/config/plugins.go b/server/internal/config/plugins.go new file mode 100644 index 000000000..2c3544c1b --- /dev/null +++ b/server/internal/config/plugins.go @@ -0,0 +1,37 @@ +package config + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +type Plugins struct { + Enabled bool + Dir string + Required bool +} + +func (Plugins) Init(cmd *cobra.Command) error { + cmd.PersistentFlags().Bool("plugins.enabled", false, "load plugins in runtime") + if err := viper.BindPFlag("plugins.enabled", cmd.PersistentFlags().Lookup("plugins.enabled")); err != nil { + return err + } + + cmd.PersistentFlags().String("plugins.dir", "./bin/plugins", "path to neko plugins to load") + if err := viper.BindPFlag("plugins.dir", cmd.PersistentFlags().Lookup("plugins.dir")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("plugins.required", false, "if true, neko will exit if there is an error when loading a plugin") + if err := viper.BindPFlag("plugins.required", cmd.PersistentFlags().Lookup("plugins.required")); err != nil { + return err + } + + return nil +} + +func (s *Plugins) Set() { + s.Enabled = viper.GetBool("plugins.enabled") + s.Dir = viper.GetString("plugins.dir") + s.Required = viper.GetBool("plugins.required") +} diff --git a/server/internal/config/root.go b/server/internal/config/root.go index 0223d7b25..978e51302 100644 --- a/server/internal/config/root.go +++ b/server/internal/config/root.go @@ -1,29 +1,69 @@ package config import ( + "os" + "path/filepath" + "runtime" + + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" ) type Root struct { - Debug bool - Logs bool - CfgFile string + Config string + + LogLevel zerolog.Level + LogTime string + LogJson bool + LogNocolor bool + LogDir string } func (Root) Init(cmd *cobra.Command) error { + cmd.PersistentFlags().StringP("config", "c", "", "configuration file path") + if err := viper.BindPFlag("config", cmd.PersistentFlags().Lookup("config")); err != nil { + return err + } + + // just a shortcut cmd.PersistentFlags().BoolP("debug", "d", false, "enable debug mode") if err := viper.BindPFlag("debug", cmd.PersistentFlags().Lookup("debug")); err != nil { return err } - cmd.PersistentFlags().BoolP("logs", "l", false, "save logs to file") - if err := viper.BindPFlag("logs", cmd.PersistentFlags().Lookup("logs")); err != nil { + cmd.PersistentFlags().String("log.level", "info", "set log level (trace, debug, info, warn, error, fatal, panic, disabled)") + if err := viper.BindPFlag("log.level", cmd.PersistentFlags().Lookup("log.level")); err != nil { return err } - cmd.PersistentFlags().String("config", "", "configuration file path") - if err := viper.BindPFlag("config", cmd.PersistentFlags().Lookup("config")); err != nil { + cmd.PersistentFlags().String("log.time", "unix", "time format used in logs (unix, unixms, unixmicro)") + if err := viper.BindPFlag("log.time", cmd.PersistentFlags().Lookup("log.time")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("log.json", false, "logs in JSON format") + if err := viper.BindPFlag("log.json", cmd.PersistentFlags().Lookup("log.json")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("log.nocolor", false, "no ANSI colors in non-JSON output") + if err := viper.BindPFlag("log.nocolor", cmd.PersistentFlags().Lookup("log.nocolor")); err != nil { + return err + } + + cmd.PersistentFlags().String("log.dir", "", "logging directory to store logs") + if err := viper.BindPFlag("log.dir", cmd.PersistentFlags().Lookup("log.dir")); err != nil { + return err + } + + return nil +} + +func (Root) InitV2(cmd *cobra.Command) error { + cmd.PersistentFlags().BoolP("logs", "l", false, "V2: save logs to file") + if err := viper.BindPFlag("logs", cmd.PersistentFlags().Lookup("logs")); err != nil { return err } @@ -31,7 +71,53 @@ func (Root) Init(cmd *cobra.Command) error { } func (s *Root) Set() { - s.Logs = viper.GetBool("logs") - s.Debug = viper.GetBool("debug") - s.CfgFile = viper.GetString("config") + s.Config = viper.GetString("config") + + logLevel := viper.GetString("log.level") + level, err := zerolog.ParseLevel(logLevel) + if err != nil { + log.Warn().Msgf("unknown log level %s", logLevel) + } else { + s.LogLevel = level + } + + logTime := viper.GetString("log.time") + switch logTime { + case "unix": + s.LogTime = zerolog.TimeFormatUnix + case "unixms": + s.LogTime = zerolog.TimeFormatUnixMs + case "unixmicro": + s.LogTime = zerolog.TimeFormatUnixMicro + default: + log.Warn().Msgf("unknown log time %s", logTime) + } + + s.LogJson = viper.GetBool("log.json") + s.LogNocolor = viper.GetBool("log.nocolor") + s.LogDir = viper.GetString("log.dir") + + if viper.GetBool("debug") && s.LogLevel != zerolog.TraceLevel { + s.LogLevel = zerolog.DebugLevel + } + + // support for NO_COLOR env variable: https://no-color.org/ + if os.Getenv("NO_COLOR") != "" { + s.LogNocolor = true + } +} + +func (s *Root) SetV2() { + if viper.IsSet("logs") { + if viper.GetBool("logs") { + logs := filepath.Join(".", "logs") + if runtime.GOOS == "linux" { + logs = "/var/log/neko" + } + s.LogDir = logs + } else { + s.LogDir = "" + } + log.Warn().Msg("you are using v2 configuration 'NEKO_LOGS' which is deprecated, please use 'NEKO_LOG_DIR=/path/to/logs' instead") + } } diff --git a/server/internal/config/server.go b/server/internal/config/server.go index a06f5a896..087b24855 100644 --- a/server/internal/config/server.go +++ b/server/internal/config/server.go @@ -1,13 +1,13 @@ package config import ( - "net/http" "path" + "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" - "m1k1o/neko/internal/utils" + "m1k1o/neko/pkg/utils" ) type Server struct { @@ -17,41 +17,92 @@ type Server struct { Proxy bool Static string PathPrefix string + PProf bool + Metrics bool CORS []string } func (Server) Init(cmd *cobra.Command) error { - cmd.PersistentFlags().String("bind", "127.0.0.1:8080", "address/port/socket to serve neko") + cmd.PersistentFlags().String("server.bind", "127.0.0.1:8080", "address/port/socket to serve neko") + if err := viper.BindPFlag("server.bind", cmd.PersistentFlags().Lookup("server.bind")); err != nil { + return err + } + + cmd.PersistentFlags().String("server.cert", "", "path to the SSL cert used to secure the neko server") + if err := viper.BindPFlag("server.cert", cmd.PersistentFlags().Lookup("server.cert")); err != nil { + return err + } + + cmd.PersistentFlags().String("server.key", "", "path to the SSL key used to secure the neko server") + if err := viper.BindPFlag("server.key", cmd.PersistentFlags().Lookup("server.key")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("server.proxy", false, "trust reverse proxy headers") + if err := viper.BindPFlag("server.proxy", cmd.PersistentFlags().Lookup("server.proxy")); err != nil { + return err + } + + cmd.PersistentFlags().String("server.static", "", "path to neko client files to serve") + if err := viper.BindPFlag("server.static", cmd.PersistentFlags().Lookup("server.static")); err != nil { + return err + } + + cmd.PersistentFlags().String("server.path_prefix", "/", "path prefix for HTTP requests") + if err := viper.BindPFlag("server.path_prefix", cmd.PersistentFlags().Lookup("server.path_prefix")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("server.pprof", false, "enable pprof endpoint available at /debug/pprof") + if err := viper.BindPFlag("server.pprof", cmd.PersistentFlags().Lookup("server.pprof")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("server.metrics", true, "enable prometheus metrics available at /metrics") + if err := viper.BindPFlag("server.metrics", cmd.PersistentFlags().Lookup("server.metrics")); err != nil { + return err + } + + cmd.PersistentFlags().StringSlice("server.cors", []string{}, "list of allowed origins for CORS, if empty CORS is disabled, if '*' is present all origins are allowed") + if err := viper.BindPFlag("server.cors", cmd.PersistentFlags().Lookup("server.cors")); err != nil { + return err + } + + return nil +} + +func (Server) InitV2(cmd *cobra.Command) error { + cmd.PersistentFlags().String("bind", "", "V2: address/port/socket to serve neko") if err := viper.BindPFlag("bind", cmd.PersistentFlags().Lookup("bind")); err != nil { return err } - cmd.PersistentFlags().String("cert", "", "path to the SSL cert used to secure the neko server") + cmd.PersistentFlags().String("cert", "", "V2: path to the SSL cert used to secure the neko server") if err := viper.BindPFlag("cert", cmd.PersistentFlags().Lookup("cert")); err != nil { return err } - cmd.PersistentFlags().String("key", "", "path to the SSL key used to secure the neko server") + cmd.PersistentFlags().String("key", "", "V2: path to the SSL key used to secure the neko server") if err := viper.BindPFlag("key", cmd.PersistentFlags().Lookup("key")); err != nil { return err } - cmd.PersistentFlags().Bool("proxy", false, "enable reverse proxy mode") + cmd.PersistentFlags().Bool("proxy", false, "V2: enable reverse proxy mode") if err := viper.BindPFlag("proxy", cmd.PersistentFlags().Lookup("proxy")); err != nil { return err } - cmd.PersistentFlags().String("static", "./www", "path to neko client files to serve") + cmd.PersistentFlags().String("static", "", "V2: path to neko client files to serve") if err := viper.BindPFlag("static", cmd.PersistentFlags().Lookup("static")); err != nil { return err } - cmd.PersistentFlags().String("path_prefix", "/", "path prefix for HTTP requests") + cmd.PersistentFlags().String("path_prefix", "", "V2: path prefix for HTTP requests") if err := viper.BindPFlag("path_prefix", cmd.PersistentFlags().Lookup("path_prefix")); err != nil { return err } - cmd.PersistentFlags().StringSlice("cors", []string{"*"}, "list of allowed origins for CORS") + cmd.PersistentFlags().StringSlice("cors", []string{}, "V2: list of allowed origins for CORS") if err := viper.BindPFlag("cors", cmd.PersistentFlags().Lookup("cors")); err != nil { return err } @@ -60,21 +111,68 @@ func (Server) Init(cmd *cobra.Command) error { } func (s *Server) Set() { - s.Cert = viper.GetString("cert") - s.Key = viper.GetString("key") - s.Bind = viper.GetString("bind") - s.Proxy = viper.GetBool("proxy") - s.Static = viper.GetString("static") - s.PathPrefix = path.Join("/", path.Clean(viper.GetString("path_prefix"))) - - s.CORS = viper.GetStringSlice("cors") + s.Cert = viper.GetString("server.cert") + s.Key = viper.GetString("server.key") + s.Bind = viper.GetString("server.bind") + s.Proxy = viper.GetBool("server.proxy") + s.Static = viper.GetString("server.static") + s.PathPrefix = path.Join("/", path.Clean(viper.GetString("server.path_prefix"))) + s.PProf = viper.GetBool("server.pprof") + s.Metrics = viper.GetBool("server.metrics") + + s.CORS = viper.GetStringSlice("server.cors") in, _ := utils.ArrayIn("*", s.CORS) if len(s.CORS) == 0 || in { s.CORS = []string{"*"} } } -func (s *Server) AllowOrigin(r *http.Request, origin string) bool { +func (s *Server) SetV2() { + if viper.IsSet("cert") { + s.Cert = viper.GetString("cert") + log.Warn().Msg("you are using v2 configuration 'NEKO_CERT' which is deprecated, please use 'NEKO_SERVER_CERT' instead") + } + if viper.IsSet("key") { + s.Key = viper.GetString("key") + log.Warn().Msg("you are using v2 configuration 'NEKO_KEY' which is deprecated, please use 'NEKO_SERVER_KEY' instead") + } + if viper.IsSet("bind") { + s.Bind = viper.GetString("bind") + log.Warn().Msg("you are using v2 configuration 'NEKO_BIND' which is deprecated, please use 'NEKO_SERVER_BIND' instead") + } + if viper.IsSet("proxy") { + s.Proxy = viper.GetBool("proxy") + log.Warn().Msg("you are using v2 configuration 'NEKO_PROXY' which is deprecated, please use 'NEKO_SERVER_PROXY' instead") + } + if viper.IsSet("static") { + s.Static = viper.GetString("static") + log.Warn().Msg("you are using v2 configuration 'NEKO_STATIC' which is deprecated, please use 'NEKO_SERVER_STATIC' instead") + } + if viper.IsSet("path_prefix") { + s.PathPrefix = path.Join("/", path.Clean(viper.GetString("path_prefix"))) + log.Warn().Msg("you are using v2 configuration 'NEKO_PATH_PREFIX' which is deprecated, please use 'NEKO_SERVER_PATH_PREFIX' instead") + } + if viper.IsSet("cors") { + s.CORS = viper.GetStringSlice("cors") + in, _ := utils.ArrayIn("*", s.CORS) + if len(s.CORS) == 0 || in { + s.CORS = []string{"*"} + } + log.Warn().Msg("you are using v2 configuration 'NEKO_CORS' which is deprecated, please use 'NEKO_SERVER_CORS' instead") + } +} + +func (s *Server) HasCors() bool { + return len(s.CORS) > 0 +} + +func (s *Server) AllowOrigin(origin string) bool { + // if CORS is disabled, allow all origins + if len(s.CORS) == 0 { + return true + } + + // if CORS is enabled, allow only origins in the list in, _ := utils.ArrayIn(origin, s.CORS) return in || s.CORS[0] == "*" } diff --git a/server/internal/config/session.go b/server/internal/config/session.go new file mode 100644 index 000000000..08934ab4d --- /dev/null +++ b/server/internal/config/session.go @@ -0,0 +1,159 @@ +package config + +import ( + "time" + + "github.com/rs/zerolog/log" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +type Session struct { + File string + + PrivateMode bool + LockedLogins bool + LockedControls bool + ControlProtection bool + ImplicitHosting bool + InactiveCursors bool + MercifulReconnect bool + APIToken string + + CookieEnabled bool + CookieName string + CookieExpiration time.Duration + CookieSecure bool +} + +func (Session) Init(cmd *cobra.Command) error { + cmd.PersistentFlags().String("session.file", "", "if sessions should be stored in a file, otherwise they will be stored only in memory") + if err := viper.BindPFlag("session.file", cmd.PersistentFlags().Lookup("session.file")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("session.private_mode", false, "whether private mode should be enabled initially") + if err := viper.BindPFlag("session.private_mode", cmd.PersistentFlags().Lookup("session.private_mode")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("session.locked_logins", false, "whether logins should be locked for users initially") + if err := viper.BindPFlag("session.locked_logins", cmd.PersistentFlags().Lookup("session.locked_logins")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("session.locked_controls", false, "whether controls should be locked for users initially") + if err := viper.BindPFlag("session.locked_controls", cmd.PersistentFlags().Lookup("session.locked_controls")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("session.control_protection", false, "users can gain control only if at least one admin is in the room") + if err := viper.BindPFlag("session.control_protection", cmd.PersistentFlags().Lookup("session.control_protection")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("session.implicit_hosting", true, "allow implicit control switching") + if err := viper.BindPFlag("session.implicit_hosting", cmd.PersistentFlags().Lookup("session.implicit_hosting")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("session.inactive_cursors", false, "show inactive cursors on the screen") + if err := viper.BindPFlag("session.inactive_cursors", cmd.PersistentFlags().Lookup("session.inactive_cursors")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("session.merciful_reconnect", true, "allow reconnecting to websocket even if previous connection was not closed") + if err := viper.BindPFlag("session.merciful_reconnect", cmd.PersistentFlags().Lookup("session.merciful_reconnect")); err != nil { + return err + } + + cmd.PersistentFlags().String("session.api_token", "", "API token for interacting with external services") + if err := viper.BindPFlag("session.api_token", cmd.PersistentFlags().Lookup("session.api_token")); err != nil { + return err + } + + // cookie + cmd.PersistentFlags().Bool("session.cookie.enabled", true, "whether cookies authentication should be enabled") + if err := viper.BindPFlag("session.cookie.enabled", cmd.PersistentFlags().Lookup("session.cookie.enabled")); err != nil { + return err + } + + cmd.PersistentFlags().String("session.cookie.name", "NEKO_SESSION", "name of the cookie that holds token") + if err := viper.BindPFlag("session.cookie.name", cmd.PersistentFlags().Lookup("session.cookie.name")); err != nil { + return err + } + + cmd.PersistentFlags().Int("session.cookie.expiration", 365*24, "expiration of the cookie in hours") + if err := viper.BindPFlag("session.cookie.expiration", cmd.PersistentFlags().Lookup("session.cookie.expiration")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("session.cookie.secure", true, "use secure cookies") + if err := viper.BindPFlag("session.cookie.secure", cmd.PersistentFlags().Lookup("session.cookie.secure")); err != nil { + return err + } + + return nil +} + +func (Session) InitV2(cmd *cobra.Command) error { + cmd.PersistentFlags().StringSlice("locks", []string{}, "V2: resources, that will be locked when starting (control, login)") + if err := viper.BindPFlag("locks", cmd.PersistentFlags().Lookup("locks")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("control_protection", false, "V2: control protection means, users can gain control only if at least one admin is in the room") + if err := viper.BindPFlag("control_protection", cmd.PersistentFlags().Lookup("control_protection")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("implicit_control", false, "V2: if enabled members can gain control implicitly") + if err := viper.BindPFlag("implicit_control", cmd.PersistentFlags().Lookup("implicit_control")); err != nil { + return err + } + + return nil +} + +func (s *Session) Set() { + s.File = viper.GetString("session.file") + + s.PrivateMode = viper.GetBool("session.private_mode") + s.LockedLogins = viper.GetBool("session.locked_logins") + s.LockedControls = viper.GetBool("session.locked_controls") + s.ControlProtection = viper.GetBool("session.control_protection") + s.ImplicitHosting = viper.GetBool("session.implicit_hosting") + s.InactiveCursors = viper.GetBool("session.inactive_cursors") + s.MercifulReconnect = viper.GetBool("session.merciful_reconnect") + s.APIToken = viper.GetString("session.api_token") + + s.CookieEnabled = viper.GetBool("session.cookie.enabled") + s.CookieName = viper.GetString("session.cookie.name") + s.CookieExpiration = time.Duration(viper.GetInt("session.cookie.expiration")) * time.Hour + s.CookieSecure = viper.GetBool("session.cookie.secure") +} + +func (s *Session) SetV2() { + if viper.IsSet("locks") { + locks := viper.GetStringSlice("locks") + for _, lock := range locks { + switch lock { + // TODO: file_transfer + case "control": + s.LockedControls = true + case "login": + s.LockedLogins = true + } + } + log.Warn().Msg("you are using v2 configuration 'NEKO_LOCKS' which is deprecated, please use 'NEKO_SESSION_LOCKED_CONTROLS' and 'NEKO_SESSION_LOCKED_LOGINS' instead") + } + + if viper.IsSet("implicit_control") { + s.ImplicitHosting = viper.GetBool("implicit_control") + log.Warn().Msg("you are using v2 configuration 'NEKO_IMPLICIT_CONTROL' which is deprecated, please use 'NEKO_SESSION_IMPLICIT_HOSTING' instead") + } + if viper.IsSet("control_protection") { + s.ControlProtection = viper.GetBool("control_protection") + log.Warn().Msg("you are using v2 configuration 'NEKO_CONTROL_PROTECTION' which is deprecated, please use 'NEKO_SESSION_CONTROL_PROTECTION' instead") + } +} diff --git a/server/internal/config/webrtc.go b/server/internal/config/webrtc.go index d7dcb1b9a..df7dc08b1 100644 --- a/server/internal/config/webrtc.go +++ b/server/internal/config/webrtc.go @@ -4,131 +4,396 @@ import ( "encoding/json" "strconv" "strings" - - "m1k1o/neko/internal/utils" + "time" "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/pion/webrtc/v3" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" ) +// default stun server +const defStunSrv = "stun:stun.l.google.com:19302" + +type WebRTCEstimator struct { + Enabled bool + Passive bool + Debug bool + InitialBitrate int + + // how often to read and process bandwidth estimation reports + ReadInterval time.Duration + // how long to wait for stable connection (only neutral or upward trend) before upgrading + StableDuration time.Duration + // how long to wait for unstable connection (downward trend) before downgrading + UnstableDuration time.Duration + // how long to wait for stalled connection (neutral trend with low bandwidth) before downgrading + StalledDuration time.Duration + // how long to wait before downgrading again after previous downgrade + DowngradeBackoff time.Duration + // how long to wait before upgrading again after previous upgrade + UpgradeBackoff time.Duration + // how bigger the difference between estimated and stream bitrate must be to trigger upgrade/downgrade + DiffThreshold float64 +} + type WebRTC struct { - ICELite bool - ICEServers []webrtc.ICEServer - EphemeralMin uint16 - EphemeralMax uint16 - NAT1To1IPs []string - TCPMUX int - UDPMUX int - - ImplicitControl bool + ICELite bool + ICETrickle bool + ICEServersFrontend []types.ICEServer + ICEServersBackend []types.ICEServer + EphemeralMin uint16 + EphemeralMax uint16 + TCPMux int + UDPMux int + + NAT1To1IPs []string + IpRetrievalUrl string + + Estimator WebRTCEstimator } func (WebRTC) Init(cmd *cobra.Command) error { - cmd.PersistentFlags().String("epr", "59000-59100", "limits the pool of ephemeral ports that ICE UDP connections can allocate from") + cmd.PersistentFlags().Bool("webrtc.icelite", false, "configures whether or not the ICE agent should be a lite agent") + if err := viper.BindPFlag("webrtc.icelite", cmd.PersistentFlags().Lookup("webrtc.icelite")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("webrtc.icetrickle", true, "configures whether cadidates should be sent asynchronously using Trickle ICE") + if err := viper.BindPFlag("webrtc.icetrickle", cmd.PersistentFlags().Lookup("webrtc.icetrickle")); err != nil { + return err + } + + // Looks like this is conflicting with the frontend and backend ICE servers since latest versions + //cmd.PersistentFlags().String("webrtc.iceservers", "[]", "Global STUN and TURN servers in JSON format with `urls`, `username` and `credential` keys") + //if err := viper.BindPFlag("webrtc.iceservers", cmd.PersistentFlags().Lookup("webrtc.iceservers")); err != nil { + // return err + //} + + cmd.PersistentFlags().String("webrtc.iceservers.frontend", "[]", "Frontend only STUN and TURN servers in JSON format with `urls`, `username` and `credential` keys") + if err := viper.BindPFlag("webrtc.iceservers.frontend", cmd.PersistentFlags().Lookup("webrtc.iceservers.frontend")); err != nil { + return err + } + + cmd.PersistentFlags().String("webrtc.iceservers.backend", "[]", "Backend only STUN and TURN servers in JSON format with `urls`, `username` and `credential` keys") + if err := viper.BindPFlag("webrtc.iceservers.backend", cmd.PersistentFlags().Lookup("webrtc.iceservers.backend")); err != nil { + return err + } + + cmd.PersistentFlags().String("webrtc.epr", "", "limits the pool of ephemeral ports that ICE UDP connections can allocate from") + if err := viper.BindPFlag("webrtc.epr", cmd.PersistentFlags().Lookup("webrtc.epr")); err != nil { + return err + } + + cmd.PersistentFlags().Int("webrtc.tcpmux", 0, "single TCP mux port for all peers") + if err := viper.BindPFlag("webrtc.tcpmux", cmd.PersistentFlags().Lookup("webrtc.tcpmux")); err != nil { + return err + } + + cmd.PersistentFlags().Int("webrtc.udpmux", 0, "single UDP mux port for all peers, replaces EPR") + if err := viper.BindPFlag("webrtc.udpmux", cmd.PersistentFlags().Lookup("webrtc.udpmux")); err != nil { + return err + } + + cmd.PersistentFlags().StringSlice("webrtc.nat1to1", []string{}, "sets a list of external IP addresses of 1:1 (D)NAT and a candidate type for which the external IP address is used") + if err := viper.BindPFlag("webrtc.nat1to1", cmd.PersistentFlags().Lookup("webrtc.nat1to1")); err != nil { + return err + } + + cmd.PersistentFlags().String("webrtc.ip_retrieval_url", "https://checkip.amazonaws.com", "URL address used for retrieval of the external IP address") + if err := viper.BindPFlag("webrtc.ip_retrieval_url", cmd.PersistentFlags().Lookup("webrtc.ip_retrieval_url")); err != nil { + return err + } + + // bandwidth estimator + + cmd.PersistentFlags().Bool("webrtc.estimator.enabled", false, "enables the bandwidth estimator") + if err := viper.BindPFlag("webrtc.estimator.enabled", cmd.PersistentFlags().Lookup("webrtc.estimator.enabled")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("webrtc.estimator.passive", false, "passive estimator mode, when it does not switch pipelines, only estimates") + if err := viper.BindPFlag("webrtc.estimator.passive", cmd.PersistentFlags().Lookup("webrtc.estimator.passive")); err != nil { + return err + } + + cmd.PersistentFlags().Bool("webrtc.estimator.debug", false, "enables debug logging for the bandwidth estimator") + if err := viper.BindPFlag("webrtc.estimator.debug", cmd.PersistentFlags().Lookup("webrtc.estimator.debug")); err != nil { + return err + } + + cmd.PersistentFlags().Int("webrtc.estimator.initial_bitrate", 1_000_000, "initial bitrate for the bandwidth estimator") + if err := viper.BindPFlag("webrtc.estimator.initial_bitrate", cmd.PersistentFlags().Lookup("webrtc.estimator.initial_bitrate")); err != nil { + return err + } + + cmd.PersistentFlags().Duration("webrtc.estimator.read_interval", 2*time.Second, "how often to read and process bandwidth estimation reports") + if err := viper.BindPFlag("webrtc.estimator.read_interval", cmd.PersistentFlags().Lookup("webrtc.estimator.read_interval")); err != nil { + return err + } + + cmd.PersistentFlags().Duration("webrtc.estimator.stable_duration", 12*time.Second, "how long to wait for stable connection (upward or neutral trend) before upgrading") + if err := viper.BindPFlag("webrtc.estimator.stable_duration", cmd.PersistentFlags().Lookup("webrtc.estimator.stable_duration")); err != nil { + return err + } + + cmd.PersistentFlags().Duration("webrtc.estimator.unstable_duration", 6*time.Second, "how long to wait for stalled connection (neutral trend with low bandwidth) before downgrading") + if err := viper.BindPFlag("webrtc.estimator.unstable_duration", cmd.PersistentFlags().Lookup("webrtc.estimator.unstable_duration")); err != nil { + return err + } + + cmd.PersistentFlags().Duration("webrtc.estimator.stalled_duration", 24*time.Second, "how long to wait for stalled bandwidth estimation before downgrading") + if err := viper.BindPFlag("webrtc.estimator.stalled_duration", cmd.PersistentFlags().Lookup("webrtc.estimator.stalled_duration")); err != nil { + return err + } + + cmd.PersistentFlags().Duration("webrtc.estimator.downgrade_backoff", 10*time.Second, "how long to wait before downgrading again after previous downgrade") + if err := viper.BindPFlag("webrtc.estimator.downgrade_backoff", cmd.PersistentFlags().Lookup("webrtc.estimator.downgrade_backoff")); err != nil { + return err + } + + cmd.PersistentFlags().Duration("webrtc.estimator.upgrade_backoff", 5*time.Second, "how long to wait before upgrading again after previous upgrade") + if err := viper.BindPFlag("webrtc.estimator.upgrade_backoff", cmd.PersistentFlags().Lookup("webrtc.estimator.upgrade_backoff")); err != nil { + return err + } + + cmd.PersistentFlags().Float64("webrtc.estimator.diff_threshold", 0.15, "how bigger the difference between estimated and stream bitrate must be to trigger upgrade/downgrade") + if err := viper.BindPFlag("webrtc.estimator.diff_threshold", cmd.PersistentFlags().Lookup("webrtc.estimator.diff_threshold")); err != nil { + return err + } + + return nil +} + +func (WebRTC) InitV2(cmd *cobra.Command) error { + cmd.PersistentFlags().String("epr", "", "V2: limits the pool of ephemeral ports that ICE UDP connections can allocate from") if err := viper.BindPFlag("epr", cmd.PersistentFlags().Lookup("epr")); err != nil { return err } - cmd.PersistentFlags().StringSlice("nat1to1", []string{}, "sets a list of external IP addresses of 1:1 (D)NAT and a candidate type for which the external IP address is used") + cmd.PersistentFlags().StringSlice("nat1to1", []string{}, "V2: sets a list of external IP addresses of 1:1 (D)NAT and a candidate type for which the external IP address is used") if err := viper.BindPFlag("nat1to1", cmd.PersistentFlags().Lookup("nat1to1")); err != nil { return err } - cmd.PersistentFlags().Int("tcpmux", 0, "single TCP mux port for all peers") + cmd.PersistentFlags().Int("tcpmux", 0, "V2: single TCP mux port for all peers") if err := viper.BindPFlag("tcpmux", cmd.PersistentFlags().Lookup("tcpmux")); err != nil { return err } - cmd.PersistentFlags().Int("udpmux", 0, "single UDP mux port for all peers") + cmd.PersistentFlags().Int("udpmux", 0, "V2: single UDP mux port for all peers") if err := viper.BindPFlag("udpmux", cmd.PersistentFlags().Lookup("udpmux")); err != nil { return err } - cmd.PersistentFlags().String("ipfetch", "http://checkip.amazonaws.com", "automatically fetch IP address from given URL when nat1to1 is not present") + cmd.PersistentFlags().String("ipfetch", "", "V2: automatically fetch IP address from given URL when nat1to1 is not present") if err := viper.BindPFlag("ipfetch", cmd.PersistentFlags().Lookup("ipfetch")); err != nil { return err } - cmd.PersistentFlags().Bool("icelite", false, "configures whether or not the ice agent should be a lite agent") + cmd.PersistentFlags().Bool("icelite", false, "V2: configures whether or not the ice agent should be a lite agent") if err := viper.BindPFlag("icelite", cmd.PersistentFlags().Lookup("icelite")); err != nil { return err } - cmd.PersistentFlags().StringSlice("iceserver", []string{"stun:stun.l.google.com:19302"}, "describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer") + cmd.PersistentFlags().StringSlice("iceserver", []string{}, "V2: describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer") if err := viper.BindPFlag("iceserver", cmd.PersistentFlags().Lookup("iceserver")); err != nil { return err } - cmd.PersistentFlags().String("iceservers", "", "describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer") + cmd.PersistentFlags().String("iceservers", "", "V2: describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer") if err := viper.BindPFlag("iceservers", cmd.PersistentFlags().Lookup("iceservers")); err != nil { return err } - // TODO: Should be moved to session config. - cmd.PersistentFlags().Bool("implicit_control", false, "if enabled members can gain control implicitly") - if err := viper.BindPFlag("implicit_control", cmd.PersistentFlags().Lookup("implicit_control")); err != nil { - return err - } - return nil } func (s *WebRTC) Set() { - s.NAT1To1IPs = viper.GetStringSlice("nat1to1") - s.TCPMUX = viper.GetInt("tcpmux") - s.UDPMUX = viper.GetInt("udpmux") - s.ICELite = viper.GetBool("icelite") - s.ICEServers = []webrtc.ICEServer{} - - iceServersJson := viper.GetString("iceservers") - if iceServersJson != "" { - err := json.Unmarshal([]byte(iceServersJson), &s.ICEServers) - if err != nil { - log.Panic().Err(err).Msg("failed to process iceservers") - } + s.ICELite = viper.GetBool("webrtc.icelite") + s.ICETrickle = viper.GetBool("webrtc.icetrickle") + + // parse frontend ice servers + if err := viper.UnmarshalKey("webrtc.iceservers.frontend", &s.ICEServersFrontend, viper.DecodeHook( + utils.JsonStringAutoDecode([]types.ICEServer{}), + )); err != nil { + log.Warn().Err(err).Msgf("unable to parse frontend ICE servers") } - iceServerSlice := viper.GetStringSlice("iceserver") - if len(iceServerSlice) > 0 { - s.ICEServers = append(s.ICEServers, webrtc.ICEServer{URLs: iceServerSlice}) + // parse backend ice servers + if err := viper.UnmarshalKey("webrtc.iceservers.backend", &s.ICEServersBackend, viper.DecodeHook( + utils.JsonStringAutoDecode([]types.ICEServer{}), + )); err != nil { + log.Warn().Err(err).Msgf("unable to parse backend ICE servers") } - if len(s.NAT1To1IPs) == 0 { - ipfetch := viper.GetString("ipfetch") - ip, err := utils.GetIP(ipfetch) - if err != nil { - log.Panic().Err(err).Str("ipfetch", ipfetch).Msg("failed to fetch ip address") + if s.ICELite && len(s.ICEServersBackend) > 0 { + log.Warn().Msgf("ICE Lite is enabled, but backend ICE servers are configured. Backend ICE servers will be ignored.") + } + + // if no frontend or backend ice servers are configured + if len(s.ICEServersFrontend) == 0 && len(s.ICEServersBackend) == 0 { + // parse global ice servers + var iceServers []types.ICEServer + if err := viper.UnmarshalKey("webrtc.iceservers", &iceServers, viper.DecodeHook( + utils.JsonStringAutoDecode([]types.ICEServer{}), + )); err != nil { + log.Warn().Err(err).Msgf("unable to parse global ICE servers") + } + + // add default stun server if none are configured + if len(iceServers) == 0 { + iceServers = append(iceServers, types.ICEServer{ + URLs: []string{defStunSrv}, + }) } - s.NAT1To1IPs = append(s.NAT1To1IPs, ip) + + s.ICEServersFrontend = append(s.ICEServersFrontend, iceServers...) + s.ICEServersBackend = append(s.ICEServersBackend, iceServers...) } - min := uint16(59000) - max := uint16(59100) - epr := viper.GetString("epr") - ports := strings.SplitN(epr, "-", -1) - if len(ports) > 1 { - start, err := strconv.ParseUint(ports[0], 10, 16) - if err == nil { - min = uint16(start) + s.TCPMux = viper.GetInt("webrtc.tcpmux") + s.UDPMux = viper.GetInt("webrtc.udpmux") + + epr := viper.GetString("webrtc.epr") + if epr != "" { + ports := strings.SplitN(epr, "-", -1) + if len(ports) > 1 { + min, err := strconv.ParseUint(ports[0], 10, 16) + if err != nil { + log.Panic().Err(err).Msgf("unable to parse ephemeral min port") + } + + max, err := strconv.ParseUint(ports[1], 10, 16) + if err != nil { + log.Panic().Err(err).Msgf("unable to parse ephemeral max port") + } + + s.EphemeralMin = uint16(min) + s.EphemeralMax = uint16(max) + } + + if s.EphemeralMin > s.EphemeralMax { + log.Panic().Msgf("ephemeral min port cannot be bigger than max") } + } + + if epr == "" && s.TCPMux == 0 && s.UDPMux == 0 { + // using default epr range + s.EphemeralMin = 59000 + s.EphemeralMax = 59100 + + log.Warn(). + Uint16("min", s.EphemeralMin). + Uint16("max", s.EphemeralMax). + Msgf("no TCP, UDP mux or epr specified, using default epr range") + } - end, err := strconv.ParseUint(ports[1], 10, 16) + s.NAT1To1IPs = viper.GetStringSlice("webrtc.nat1to1") + s.IpRetrievalUrl = viper.GetString("webrtc.ip_retrieval_url") + if s.IpRetrievalUrl != "" && len(s.NAT1To1IPs) == 0 { + ip, err := utils.HttpRequestGET(s.IpRetrievalUrl) if err == nil { - max = uint16(end) + s.NAT1To1IPs = append(s.NAT1To1IPs, ip) + } else { + log.Warn().Err(err).Msgf("IP retrieval failed") + } + } + + // bandwidth estimator + + s.Estimator.Enabled = viper.GetBool("webrtc.estimator.enabled") + s.Estimator.Passive = viper.GetBool("webrtc.estimator.passive") + s.Estimator.Debug = viper.GetBool("webrtc.estimator.debug") + s.Estimator.InitialBitrate = viper.GetInt("webrtc.estimator.initial_bitrate") + s.Estimator.ReadInterval = viper.GetDuration("webrtc.estimator.read_interval") + s.Estimator.StableDuration = viper.GetDuration("webrtc.estimator.stable_duration") + s.Estimator.UnstableDuration = viper.GetDuration("webrtc.estimator.unstable_duration") + s.Estimator.StalledDuration = viper.GetDuration("webrtc.estimator.stalled_duration") + s.Estimator.DowngradeBackoff = viper.GetDuration("webrtc.estimator.downgrade_backoff") + s.Estimator.UpgradeBackoff = viper.GetDuration("webrtc.estimator.upgrade_backoff") + s.Estimator.DiffThreshold = viper.GetFloat64("webrtc.estimator.diff_threshold") +} + +func (s *WebRTC) SetV2() { + if viper.IsSet("nat1to1") { + s.NAT1To1IPs = viper.GetStringSlice("nat1to1") + log.Warn().Msg("you are using v2 configuration 'NEKO_NAT1TO1' which is deprecated, please use 'NEKO_WEBRTC_NAT1TO1' instead") + } + if viper.IsSet("tcpmux") { + s.TCPMux = viper.GetInt("tcpmux") + log.Warn().Msg("you are using v2 configuration 'NEKO_TCPMUX' which is deprecated, please use 'NEKO_WEBRTC_TCPMUX' instead") + } + if viper.IsSet("udpmux") { + s.UDPMux = viper.GetInt("udpmux") + log.Warn().Msg("you are using v2 configuration 'NEKO_UDPMUX' which is deprecated, please use 'NEKO_WEBRTC_UDPMUX' instead") + } + if viper.IsSet("icelite") { + s.ICELite = viper.GetBool("icelite") + log.Warn().Msg("you are using v2 configuration 'NEKO_ICELITE' which is deprecated, please use 'NEKO_WEBRTC_ICELITE' instead") + } + + if viper.IsSet("iceservers") { + iceServers := []types.ICEServer{} + iceServersJson := viper.GetString("iceservers") + if iceServersJson != "" { + err := json.Unmarshal([]byte(iceServersJson), &iceServers) + if err != nil { + log.Panic().Err(err).Msg("failed to process iceservers") + } + } + s.ICEServersFrontend = iceServers + s.ICEServersBackend = iceServers + log.Warn().Msg("you are using v2 configuration 'NEKO_ICESERVERS' which is deprecated, please use 'NEKO_WEBRTC_ICESERVERS_FRONTEND' and/or 'NEKO_WEBRTC_ICESERVERS_BACKEND' instead") + } + + if viper.IsSet("iceserver") { + iceServerSlice := viper.GetStringSlice("iceserver") + if len(iceServerSlice) > 0 { + s.ICEServersFrontend = append(s.ICEServersFrontend, types.ICEServer{URLs: iceServerSlice}) + s.ICEServersBackend = append(s.ICEServersBackend, types.ICEServer{URLs: iceServerSlice}) } + log.Warn().Msg("you are using v2 configuration 'NEKO_ICESERVER' which is deprecated, please use 'NEKO_WEBRTC_ICESERVERS_FRONTEND' and/or 'NEKO_WEBRTC_ICESERVERS_BACKEND' instead") } - if min > max { - s.EphemeralMin = max - s.EphemeralMax = min - } else { - s.EphemeralMin = min - s.EphemeralMax = max + if viper.IsSet("ipfetch") { + if len(s.NAT1To1IPs) == 0 { + ipfetch := viper.GetString("ipfetch") + ip, err := utils.HttpRequestGET(ipfetch) + if err != nil { + log.Panic().Err(err).Str("ipfetch", ipfetch).Msg("failed to fetch ip address") + } + s.NAT1To1IPs = append(s.NAT1To1IPs, ip) + } + log.Warn().Msg("you are using v2 configuration 'NEKO_IPFETCH' which is deprecated, please use 'NEKO_WEBRTC_IP_RETRIEVAL_URL' instead") } - // TODO: Should be moved to session config. - s.ImplicitControl = viper.GetBool("implicit_control") + if viper.IsSet("epr") { + min := uint16(59000) + max := uint16(59100) + epr := viper.GetString("epr") + ports := strings.SplitN(epr, "-", -1) + if len(ports) > 1 { + start, err := strconv.ParseUint(ports[0], 10, 16) + if err == nil { + min = uint16(start) + } + + end, err := strconv.ParseUint(ports[1], 10, 16) + if err == nil { + max = uint16(end) + } + } + + if min > max { + s.EphemeralMin = max + s.EphemeralMax = min + } else { + s.EphemeralMin = min + s.EphemeralMax = max + } + log.Warn().Msg("you are using v2 configuration 'NEKO_EPR' which is deprecated, please use 'NEKO_WEBRTC_EPR' instead") + } } diff --git a/server/internal/config/websocket.go b/server/internal/config/websocket.go deleted file mode 100644 index 9bf973817..000000000 --- a/server/internal/config/websocket.go +++ /dev/null @@ -1,67 +0,0 @@ -package config - -import ( - "path/filepath" - - "github.com/spf13/cobra" - "github.com/spf13/viper" -) - -type WebSocket struct { - Password string - AdminPassword string - Locks []string - - ControlProtection bool - - FileTransferEnabled bool - FileTransferPath string -} - -func (WebSocket) Init(cmd *cobra.Command) error { - cmd.PersistentFlags().String("password", "neko", "password for connecting to stream") - if err := viper.BindPFlag("password", cmd.PersistentFlags().Lookup("password")); err != nil { - return err - } - - cmd.PersistentFlags().String("password_admin", "admin", "admin password for connecting to stream") - if err := viper.BindPFlag("password_admin", cmd.PersistentFlags().Lookup("password_admin")); err != nil { - return err - } - - cmd.PersistentFlags().StringSlice("locks", []string{}, "resources, that will be locked when starting (control, login)") - if err := viper.BindPFlag("locks", cmd.PersistentFlags().Lookup("locks")); err != nil { - return err - } - - cmd.PersistentFlags().Bool("control_protection", false, "control protection means, users can gain control only if at least one admin is in the room") - if err := viper.BindPFlag("control_protection", cmd.PersistentFlags().Lookup("control_protection")); err != nil { - return err - } - - // File transfer - - cmd.PersistentFlags().Bool("file_transfer_enabled", false, "enable file transfer feature") - if err := viper.BindPFlag("file_transfer_enabled", cmd.PersistentFlags().Lookup("file_transfer_enabled")); err != nil { - return err - } - - cmd.PersistentFlags().String("file_transfer_path", "/home/neko/Downloads", "path to use for file transfer") - if err := viper.BindPFlag("file_transfer_path", cmd.PersistentFlags().Lookup("file_transfer_path")); err != nil { - return err - } - - return nil -} - -func (s *WebSocket) Set() { - s.Password = viper.GetString("password") - s.AdminPassword = viper.GetString("password_admin") - s.Locks = viper.GetStringSlice("locks") - - s.ControlProtection = viper.GetBool("control_protection") - - s.FileTransferEnabled = viper.GetBool("file_transfer_enabled") - s.FileTransferPath = viper.GetString("file_transfer_path") - s.FileTransferPath = filepath.Clean(s.FileTransferPath) -} diff --git a/server/internal/desktop/clipboard.go b/server/internal/desktop/clipboard.go index 036a1177f..26a8bfe21 100644 --- a/server/internal/desktop/clipboard.go +++ b/server/internal/desktop/clipboard.go @@ -1,11 +1,122 @@ package desktop -import "m1k1o/neko/internal/desktop/clipboard" +import ( + "bytes" + "fmt" + "os/exec" + "strings" -func (manager *DesktopManagerCtx) ReadClipboard() string { - return clipboard.Read() + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/xevent" +) + +func (manager *DesktopManagerCtx) ClipboardGetText() (*types.ClipboardText, error) { + text, err := manager.ClipboardGetBinary("STRING") + if err != nil { + return nil, err + } + + // Rich text must not always be available, can fail silently. + html, _ := manager.ClipboardGetBinary("text/html") + + return &types.ClipboardText{ + Text: string(text), + HTML: string(html), + }, nil +} + +func (manager *DesktopManagerCtx) ClipboardSetText(data types.ClipboardText) error { + // TODO: Refactor. + // Current implementation is unable to set multiple targets. HTML + // is set, if available. Otherwise plain text. + + if data.HTML != "" { + return manager.ClipboardSetBinary("text/html", []byte(data.HTML)) + } + + return manager.ClipboardSetBinary("STRING", []byte(data.Text)) +} + +func (manager *DesktopManagerCtx) ClipboardGetBinary(mime string) ([]byte, error) { + cmd := exec.Command("xclip", "-selection", "clipboard", "-out", "-target", mime) + + var stdout, stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + + err := cmd.Run() + if err != nil { + msg := strings.TrimSpace(stderr.String()) + return nil, fmt.Errorf("%s", msg) + } + + return stdout.Bytes(), nil +} + +func (manager *DesktopManagerCtx) ClipboardSetBinary(mime string, data []byte) error { + cmd := exec.Command("xclip", "-selection", "clipboard", "-in", "-target", mime) + + var stderr bytes.Buffer + cmd.Stderr = &stderr + + stdin, err := cmd.StdinPipe() + if err != nil { + return err + } + + // TODO: Refactor. + // We need to wait until the data came to the clipboard. + wait := make(chan struct{}) + xevent.Emmiter.Once("clipboard-updated", func(payload ...any) { + wait <- struct{}{} + }) + + err = cmd.Start() + if err != nil { + msg := strings.TrimSpace(stderr.String()) + return fmt.Errorf("%s", msg) + } + + _, err = stdin.Write(data) + if err != nil { + return err + } + + stdin.Close() + + // TODO: Refactor. + // cmd.Wait() + <-wait + + return nil } -func (manager *DesktopManagerCtx) WriteClipboard(data string) { - clipboard.Write(data) +func (manager *DesktopManagerCtx) ClipboardGetTargets() ([]string, error) { + cmd := exec.Command("xclip", "-selection", "clipboard", "-out", "-target", "TARGETS") + + var stdout, stderr bytes.Buffer + cmd.Stdout = &stdout + cmd.Stderr = &stderr + + err := cmd.Run() + if err != nil { + msg := strings.TrimSpace(stderr.String()) + return nil, fmt.Errorf("%s", msg) + } + + var response []string + targets := strings.Split(stdout.String(), "\n") + for _, target := range targets { + if target == "" { + continue + } + + if !strings.Contains(target, "/") { + continue + } + + response = append(response, target) + } + + return response, nil } diff --git a/server/internal/desktop/clipboard/clipboard.c b/server/internal/desktop/clipboard/clipboard.c deleted file mode 100644 index c500b33e3..000000000 --- a/server/internal/desktop/clipboard/clipboard.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "clipboard.h" - -static clipboard_c *CLIPBOARD = NULL; - -clipboard_c *getClipboard(void) { - if (CLIPBOARD == NULL) { - CLIPBOARD = clipboard_new(NULL); - } - - return CLIPBOARD; -} - -void ClipboardSet(char *src) { - clipboard_c *cb = getClipboard(); - clipboard_set_text_ex(cb, src, strlen(src), 0); -} - -char *ClipboardGet() { - clipboard_c *cb = getClipboard(); - return clipboard_text_ex(cb, NULL, 0); -} diff --git a/server/internal/desktop/clipboard/clipboard.go b/server/internal/desktop/clipboard/clipboard.go deleted file mode 100644 index 5c5d89b4d..000000000 --- a/server/internal/desktop/clipboard/clipboard.go +++ /dev/null @@ -1,35 +0,0 @@ -package clipboard - -/* -#cgo linux LDFLAGS: /usr/local/lib/libclipboard.a -lxcb - -#include "clipboard.h" -*/ -import "C" - -import ( - "sync" - "unsafe" -) - -var mu sync.Mutex - -func Read() string { - mu.Lock() - defer mu.Unlock() - - clipboardUnsafe := C.ClipboardGet() - defer C.free(unsafe.Pointer(clipboardUnsafe)) - - return C.GoString(clipboardUnsafe) -} - -func Write(data string) { - mu.Lock() - defer mu.Unlock() - - clipboardUnsafe := C.CString(data) - defer C.free(unsafe.Pointer(clipboardUnsafe)) - - C.ClipboardSet(clipboardUnsafe) -} diff --git a/server/internal/desktop/clipboard/clipboard.h b/server/internal/desktop/clipboard/clipboard.h deleted file mode 100644 index 5f5cf36a4..000000000 --- a/server/internal/desktop/clipboard/clipboard.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include -#include - -clipboard_c *getClipboard(void); - -void ClipboardSet(char *src); -char *ClipboardGet(); diff --git a/server/internal/desktop/drop.go b/server/internal/desktop/drop.go new file mode 100644 index 000000000..d222b8204 --- /dev/null +++ b/server/internal/desktop/drop.go @@ -0,0 +1,68 @@ +package desktop + +import ( + "time" + + "m1k1o/neko/pkg/drop" +) + +// repeat move event multiple times +const dropMoveRepeat = 4 + +// wait after each repeated move event +const dropMoveDelay = 100 * time.Millisecond + +func (manager *DesktopManagerCtx) DropFiles(x int, y int, files []string) bool { + mu.Lock() + defer mu.Unlock() + + drop.Emmiter.Clear() + + drop.Emmiter.Once("create", func(payload ...any) { + manager.Move(0, 0) + }) + + drop.Emmiter.Once("cursor-enter", func(payload ...any) { + //nolint + manager.ButtonDown(1) + }) + + drop.Emmiter.Once("button-press", func(payload ...any) { + manager.Move(x, y) + }) + + drop.Emmiter.Once("begin", func(payload ...any) { + for i := 0; i < dropMoveRepeat; i++ { + manager.Move(x, y) + time.Sleep(dropMoveDelay) + } + + //nolint + manager.ButtonUp(1) + }) + + finished := make(chan bool) + drop.Emmiter.Once("finish", func(payload ...any) { + b, ok := payload[0].(bool) + // workaround until https://github.com/kataras/go-events/pull/8 is merged + if !ok { + b = (payload[0].([]any))[0].(bool) + } + finished <- b + }) + + manager.ResetKeys() + go drop.OpenWindow(files) + + select { + case succeeded := <-finished: + return succeeded + case <-time.After(1 * time.Second): + drop.CloseWindow() + return false + } +} + +func (manager *DesktopManagerCtx) IsUploadDropEnabled() bool { + return manager.config.UploadDrop +} diff --git a/server/internal/desktop/filechooserdialog.go b/server/internal/desktop/filechooserdialog.go new file mode 100644 index 000000000..bed84d5b3 --- /dev/null +++ b/server/internal/desktop/filechooserdialog.go @@ -0,0 +1,102 @@ +package desktop + +import ( + "errors" + "os/exec" + + "m1k1o/neko/pkg/xorg" +) + +// name of the window that is being controlled +const fileChooserDialogName = "Open File" + +// short sleep value between fake user interactions +const fileChooserDialogShortSleep = "0.2" + +// long sleep value between fake user interactions +const fileChooserDialogLongSleep = "0.4" + +func (manager *DesktopManagerCtx) HandleFileChooserDialog(uri string) error { + mu.Lock() + defer mu.Unlock() + + // TODO: Use native API. + err1 := exec.Command( + "xdotool", + "search", "--name", fileChooserDialogName, "windowfocus", + "sleep", fileChooserDialogShortSleep, + "key", "--clearmodifiers", "ctrl+l", + "type", "--args", "1", uri+"//", + "sleep", fileChooserDialogShortSleep, + "key", "Delete", // remove autocomplete results + "sleep", fileChooserDialogShortSleep, + "key", "Return", + "sleep", fileChooserDialogLongSleep, + "key", "Down", + "key", "--clearmodifiers", "ctrl+a", + "key", "Return", + "sleep", fileChooserDialogLongSleep, + ).Run() + + if err1 != nil { + return err1 + } + + // TODO: Use native API. + err2 := exec.Command( + "xdotool", + "search", "--name", fileChooserDialogName, + ).Run() + + // if last command didn't return error, consider dialog as still open + if err2 == nil { + return errors.New("unable to select files in dialog") + } + + return nil +} + +func (manager *DesktopManagerCtx) CloseFileChooserDialog() { + for i := 0; i < 5; i++ { + mu.Lock() + + manager.logger.Debug().Msg("attempting to close file chooser dialog") + + // TODO: Use native API. + err := exec.Command( + "xdotool", + "search", "--name", fileChooserDialogName, "windowfocus", + ).Run() + + if err != nil { + mu.Unlock() + manager.logger.Info().Msg("file chooser dialog is closed") + return + } + + // custom press Alt + F4 + // because xdotool is failing to send proper Alt+F4 + + //nolint + manager.KeyPress(xorg.XK_Alt_L, xorg.XK_F4) + + mu.Unlock() + } +} + +func (manager *DesktopManagerCtx) IsFileChooserDialogEnabled() bool { + return manager.config.FileChooserDialog +} + +func (manager *DesktopManagerCtx) IsFileChooserDialogOpened() bool { + mu.Lock() + defer mu.Unlock() + + // TODO: Use native API. + err := exec.Command( + "xdotool", + "search", "--name", fileChooserDialogName, + ).Run() + + return err == nil +} diff --git a/server/internal/desktop/manager.go b/server/internal/desktop/manager.go index 918efb081..2831868ae 100644 --- a/server/internal/desktop/manager.go +++ b/server/internal/desktop/manager.go @@ -1,36 +1,47 @@ package desktop import ( - "fmt" "sync" "time" - "m1k1o/neko/internal/config" - "m1k1o/neko/internal/desktop/xevent" - "m1k1o/neko/internal/desktop/xorg" - + "github.com/kataras/go-events" "github.com/rs/zerolog" "github.com/rs/zerolog/log" + + "m1k1o/neko/internal/config" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/xevent" + "m1k1o/neko/pkg/xinput" + "m1k1o/neko/pkg/xorg" ) var mu = sync.Mutex{} type DesktopManagerCtx struct { - logger zerolog.Logger - wg sync.WaitGroup - shutdown chan struct{} - config *config.Desktop - - screenSizeChangeChannel chan bool + logger zerolog.Logger + wg sync.WaitGroup + shutdown chan struct{} + emmiter events.EventEmmiter + config *config.Desktop + screenSize types.ScreenSize // cached screen size + input xinput.Driver } func New(config *config.Desktop) *DesktopManagerCtx { - return &DesktopManagerCtx{ - logger: log.With().Str("module", "desktop").Logger(), - shutdown: make(chan struct{}), - config: config, + var input xinput.Driver + if config.UseInputDriver { + input = xinput.NewDriver(config.InputSocket) + } else { + input = xinput.NewDummy() + } - screenSizeChangeChannel: make(chan bool), + return &DesktopManagerCtx{ + logger: log.With().Str("module", "desktop").Logger(), + shutdown: make(chan struct{}), + emmiter: events.New(), + config: config, + screenSize: config.ScreenSize, + input: input, } } @@ -39,31 +50,48 @@ func (manager *DesktopManagerCtx) Start() { manager.logger.Panic().Str("display", manager.config.Display).Msg("unable to open display") } + // X11 can throw errors below, and the default error handler exits + xevent.SetupErrorHandler() + xorg.GetScreenConfigurations() - err := xorg.ChangeScreenSize(manager.config.ScreenWidth, manager.config.ScreenHeight, manager.config.ScreenRate) - manager.logger.Err(err). - Str("screen_size", fmt.Sprintf("%dx%d@%d", manager.config.ScreenWidth, manager.config.ScreenHeight, manager.config.ScreenRate)). - Msgf("setting initial screen size") + screenSize, err := xorg.ChangeScreenSize(manager.config.ScreenSize) + if err != nil { + manager.logger.Err(err). + Str("screen_size", screenSize.String()). + Msgf("unable to set initial screen size") + } else { + // cache screen size + manager.screenSize = screenSize + manager.logger.Info(). + Str("screen_size", screenSize.String()). + Msgf("setting initial screen size") + } + + err = manager.input.Connect() + if err != nil { + // TODO: fail silently to dummy driver? + manager.logger.Panic().Err(err).Msg("unable to connect to input driver") + } + // set up event listeners + xevent.Unminimize = manager.config.Unminimize + xevent.FileChooserDialog = manager.config.FileChooserDialog go xevent.EventLoop(manager.config.Display) - go func() { - for { - msg, ok := <-xevent.EventErrorChannel - if !ok { - manager.logger.Info().Msg("xevent error channel was closed") - return - } + // in case it was opened + if manager.config.FileChooserDialog { + go manager.CloseFileChooserDialog() + } - manager.logger.Warn(). - Uint8("error_code", msg.Error_code). - Str("message", msg.Message). - Uint8("request_code", msg.Request_code). - Uint8("minor_code", msg.Minor_code). - Msg("X event error occurred") - } - }() + manager.OnEventError(func(error_code uint8, message string, request_code uint8, minor_code uint8) { + manager.logger.Warn(). + Uint8("error_code", error_code). + Str("message", message). + Uint8("request_code", request_code). + Uint8("minor_code", minor_code). + Msg("X event error occured") + }) manager.wg.Add(1) @@ -73,26 +101,36 @@ func (manager *DesktopManagerCtx) Start() { ticker := time.NewTicker(1 * time.Second) defer ticker.Stop() + const debounceDuration = 10 * time.Second + for { select { case <-manager.shutdown: return case <-ticker.C: - xorg.CheckKeys(time.Second * 10) + xorg.CheckKeys(debounceDuration) + manager.input.Debounce(debounceDuration) } } }() } -func (manager *DesktopManagerCtx) GetScreenSizeChangeChannel() chan bool { - return manager.screenSizeChangeChannel +func (manager *DesktopManagerCtx) OnBeforeScreenSizeChange(listener func()) { + manager.emmiter.On("before_screen_size_change", func(payload ...any) { + listener() + }) +} + +func (manager *DesktopManagerCtx) OnAfterScreenSizeChange(listener func()) { + manager.emmiter.On("after_screen_size_change", func(payload ...any) { + listener() + }) } func (manager *DesktopManagerCtx) Shutdown() error { - manager.logger.Info().Msgf("desktop shutting down") + manager.logger.Info().Msgf("shutdown") close(manager.shutdown) - close(manager.screenSizeChangeChannel) manager.wg.Wait() xorg.DisplayClose() diff --git a/server/internal/desktop/xevent.go b/server/internal/desktop/xevent.go index b38a9e4e6..ae7fc99ca 100644 --- a/server/internal/desktop/xevent.go +++ b/server/internal/desktop/xevent.go @@ -1,18 +1,35 @@ package desktop import ( - "m1k1o/neko/internal/desktop/xevent" - "m1k1o/neko/internal/types" + "m1k1o/neko/pkg/xevent" ) -func (manager *DesktopManagerCtx) GetCursorChangedChannel() chan uint64 { - return xevent.CursorChangedChannel +func (manager *DesktopManagerCtx) OnCursorChanged(listener func(serial uint64)) { + xevent.Emmiter.On("cursor-changed", func(payload ...any) { + listener(payload[0].(uint64)) + }) } -func (manager *DesktopManagerCtx) GetClipboardUpdatedChannel() chan struct{} { - return xevent.ClipboardUpdatedChannel +func (manager *DesktopManagerCtx) OnClipboardUpdated(listener func()) { + xevent.Emmiter.On("clipboard-updated", func(payload ...any) { + listener() + }) } -func (manager *DesktopManagerCtx) GetEventErrorChannel() chan types.DesktopErrorMessage { - return xevent.EventErrorChannel +func (manager *DesktopManagerCtx) OnFileChooserDialogOpened(listener func()) { + xevent.Emmiter.On("file-chooser-dialog-opened", func(payload ...any) { + listener() + }) +} + +func (manager *DesktopManagerCtx) OnFileChooserDialogClosed(listener func()) { + xevent.Emmiter.On("file-chooser-dialog-closed", func(payload ...any) { + listener() + }) +} + +func (manager *DesktopManagerCtx) OnEventError(listener func(error_code uint8, message string, request_code uint8, minor_code uint8)) { + xevent.Emmiter.On("event-error", func(payload ...any) { + listener(payload[0].(uint8), payload[1].(string), payload[2].(uint8), payload[3].(uint8)) + }) } diff --git a/server/internal/desktop/xevent/xevent.c b/server/internal/desktop/xevent/xevent.c deleted file mode 100644 index 769429535..000000000 --- a/server/internal/desktop/xevent/xevent.c +++ /dev/null @@ -1,81 +0,0 @@ -#include "xevent.h" - -static int XEventError(Display *display, XErrorEvent *event) { - char message[100]; - - int error; - error = XGetErrorText(display, event->error_code, message, sizeof(message)); - if (error) { - goXEventError(event, "Could not get error message."); - } else { - goXEventError(event, message); - } - - return 1; -} - -void XEventLoop(char *name) { - Display *display = XOpenDisplay(name); - Window root = RootWindow(display, 0); - - int xfixes_event_base, xfixes_error_base; - if (!XFixesQueryExtension(display, &xfixes_event_base, &xfixes_error_base)) { - return; - } - - Atom WM_WINDOW_ROLE = XInternAtom(display, "WM_WINDOW_ROLE", 1); - Atom XA_CLIPBOARD = XInternAtom(display, "CLIPBOARD", 0); - XFixesSelectSelectionInput(display, root, XA_CLIPBOARD, XFixesSetSelectionOwnerNotifyMask); - XFixesSelectCursorInput(display, root, XFixesDisplayCursorNotifyMask); - XSelectInput(display, root, SubstructureNotifyMask); - - XSync(display, 0); - XSetErrorHandler(XEventError); - - while (goXEventActive()) { - XEvent event; - XNextEvent(display, &event); - - // XFixesDisplayCursorNotify - if (event.type == xfixes_event_base + 1) { - XFixesCursorNotifyEvent notifyEvent = *((XFixesCursorNotifyEvent *) &event); - if (notifyEvent.subtype == XFixesDisplayCursorNotify) { - goXEventCursorChanged(notifyEvent); - continue; - } - } - - // XFixesSelectionNotifyEvent - if (event.type == xfixes_event_base + XFixesSelectionNotify) { - XFixesSelectionNotifyEvent notifyEvent = *((XFixesSelectionNotifyEvent *) &event); - if (notifyEvent.subtype == XFixesSetSelectionOwnerNotify && notifyEvent.selection == XA_CLIPBOARD) { - goXEventClipboardUpdated(); - continue; - } - } - - // ConfigureNotify - if (event.type == ConfigureNotify) { - Window window = event.xconfigure.window; - - char *name; - XFetchName(display, window, &name); - - XTextProperty role; - XGetTextProperty(display, window, &role, WM_WINDOW_ROLE); - - goXEventConfigureNotify(display, window, name, role.value); - XFree(name); - continue; - } - - // UnmapNotify - if (event.type == UnmapNotify) { - Window window = event.xunmap.window; - goXEventUnmapNotify(window); - continue; - } - } - - XCloseDisplay(display); -} diff --git a/server/internal/desktop/xevent/xevent.go b/server/internal/desktop/xevent/xevent.go deleted file mode 100644 index 8c3553a79..000000000 --- a/server/internal/desktop/xevent/xevent.go +++ /dev/null @@ -1,78 +0,0 @@ -package xevent - -/* -#cgo LDFLAGS: -lX11 -lXfixes - -#include "xevent.h" -*/ -import "C" - -import ( - "unsafe" - - "m1k1o/neko/internal/types" -) - -var CursorChangedChannel chan uint64 -var ClipboardUpdatedChannel chan struct{} -var EventErrorChannel chan types.DesktopErrorMessage - -func init() { - CursorChangedChannel = make(chan uint64) - ClipboardUpdatedChannel = make(chan struct{}) - EventErrorChannel = make(chan types.DesktopErrorMessage) - - go func() { - for { - // TODO: Reserved for future use. - <-CursorChangedChannel - } - }() -} - -func EventLoop(display string) { - displayUnsafe := C.CString(display) - defer C.free(unsafe.Pointer(displayUnsafe)) - - C.XEventLoop(displayUnsafe) -} - -// TODO: Shutdown function. -//close(CursorChangedChannel) -//close(ClipboardUpdatedChannel) -//close(EventErrorChannel) - -//export goXEventCursorChanged -func goXEventCursorChanged(event C.XFixesCursorNotifyEvent) { - CursorChangedChannel <- uint64(event.cursor_serial) -} - -//export goXEventClipboardUpdated -func goXEventClipboardUpdated() { - ClipboardUpdatedChannel <- struct{}{} -} - -//export goXEventConfigureNotify -func goXEventConfigureNotify(display *C.Display, window C.Window, name *C.char, role *C.char) { - -} - -//export goXEventUnmapNotify -func goXEventUnmapNotify(window C.Window) { - -} - -//export goXEventError -func goXEventError(event *C.XErrorEvent, message *C.char) { - EventErrorChannel <- types.DesktopErrorMessage{ - Error_code: uint8(event.error_code), - Message: C.GoString(message), - Request_code: uint8(event.request_code), - Minor_code: uint8(event.minor_code), - } -} - -//export goXEventActive -func goXEventActive() C.int { - return C.int(1) -} diff --git a/server/internal/desktop/xinput.go b/server/internal/desktop/xinput.go new file mode 100644 index 000000000..da1e5bf2b --- /dev/null +++ b/server/internal/desktop/xinput.go @@ -0,0 +1,36 @@ +package desktop + +import "m1k1o/neko/pkg/xinput" + +func (manager *DesktopManagerCtx) inputRelToAbs(x, y int) (int, int) { + return (x * xinput.AbsX) / manager.screenSize.Width, (y * xinput.AbsY) / manager.screenSize.Height +} + +func (manager *DesktopManagerCtx) HasTouchSupport() bool { + // we assume now, that if the input driver is enabled, we have touch support + return manager.config.UseInputDriver +} + +func (manager *DesktopManagerCtx) TouchBegin(touchId uint32, x, y int, pressure uint8) error { + mu.Lock() + defer mu.Unlock() + + x, y = manager.inputRelToAbs(x, y) + return manager.input.TouchBegin(touchId, x, y, pressure) +} + +func (manager *DesktopManagerCtx) TouchUpdate(touchId uint32, x, y int, pressure uint8) error { + mu.Lock() + defer mu.Unlock() + + x, y = manager.inputRelToAbs(x, y) + return manager.input.TouchUpdate(touchId, x, y, pressure) +} + +func (manager *DesktopManagerCtx) TouchEnd(touchId uint32, x, y int, pressure uint8) error { + mu.Lock() + defer mu.Unlock() + + x, y = manager.inputRelToAbs(x, y) + return manager.input.TouchEnd(touchId, x, y, pressure) +} diff --git a/server/internal/desktop/xorg.go b/server/internal/desktop/xorg.go index 3008eaaea..91a8bb8ad 100644 --- a/server/internal/desktop/xorg.go +++ b/server/internal/desktop/xorg.go @@ -6,8 +6,8 @@ import ( "regexp" "time" - "m1k1o/neko/internal/desktop/xorg" - "m1k1o/neko/internal/types" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/xorg" ) func (manager *DesktopManagerCtx) Move(x, y int) { @@ -18,8 +18,8 @@ func (manager *DesktopManagerCtx) GetCursorPosition() (int, int) { return xorg.GetCursorPosition() } -func (manager *DesktopManagerCtx) Scroll(x, y int) { - xorg.Scroll(x, y) +func (manager *DesktopManagerCtx) Scroll(deltaX, deltaY int, controlKey bool) { + xorg.Scroll(deltaX, deltaY, controlKey) } func (manager *DesktopManagerCtx) ButtonDown(code uint32) error { @@ -66,23 +66,44 @@ func (manager *DesktopManagerCtx) ResetKeys() { xorg.ResetKeys() } -func (manager *DesktopManagerCtx) ScreenConfigurations() map[int]types.ScreenConfiguration { - return xorg.ScreenConfigurations +func (manager *DesktopManagerCtx) ScreenConfigurations() []types.ScreenSize { + var configs []types.ScreenSize + for _, size := range xorg.ScreenConfigurations { + for _, fps := range size.Rates { + // filter out all irrelevant rates + if fps > 60 || (fps > 30 && fps%10 != 0) { + continue + } + + configs = append(configs, types.ScreenSize{ + Width: size.Width, + Height: size.Height, + Rate: fps, + }) + } + } + return configs } -func (manager *DesktopManagerCtx) SetScreenSize(size types.ScreenSize) error { +func (manager *DesktopManagerCtx) SetScreenSize(screenSize types.ScreenSize) (types.ScreenSize, error) { mu.Lock() - manager.GetScreenSizeChangeChannel() <- true + manager.emmiter.Emit("before_screen_size_change") defer func() { - manager.GetScreenSizeChangeChannel() <- false + manager.emmiter.Emit("after_screen_size_change") mu.Unlock() }() - return xorg.ChangeScreenSize(size.Width, size.Height, size.Rate) + screenSize, err := xorg.ChangeScreenSize(screenSize) + if err == nil { + // cache the new screen size + manager.screenSize = screenSize + } + + return screenSize, err } -func (manager *DesktopManagerCtx) GetScreenSize() *types.ScreenSize { +func (manager *DesktopManagerCtx) GetScreenSize() types.ScreenSize { return xorg.GetScreenSize() } @@ -119,24 +140,56 @@ func (manager *DesktopManagerCtx) GetKeyboardMap() (*types.KeyboardMap, error) { } func (manager *DesktopManagerCtx) SetKeyboardModifiers(mod types.KeyboardModifiers) { - if mod.NumLock != nil { - xorg.SetKeyboardModifier(xorg.KbdModNumLock, *mod.NumLock) + if mod.Shift != nil { + xorg.SetKeyboardModifier(xorg.KbdModShift, *mod.Shift) } if mod.CapsLock != nil { xorg.SetKeyboardModifier(xorg.KbdModCapsLock, *mod.CapsLock) } + + if mod.Control != nil { + xorg.SetKeyboardModifier(xorg.KbdModControl, *mod.Control) + } + + if mod.Alt != nil { + xorg.SetKeyboardModifier(xorg.KbdModAlt, *mod.Alt) + } + + if mod.NumLock != nil { + xorg.SetKeyboardModifier(xorg.KbdModNumLock, *mod.NumLock) + } + + if mod.Meta != nil { + xorg.SetKeyboardModifier(xorg.KbdModMeta, *mod.Meta) + } + + if mod.Super != nil { + xorg.SetKeyboardModifier(xorg.KbdModSuper, *mod.Super) + } + + if mod.AltGr != nil { + xorg.SetKeyboardModifier(xorg.KbdModAltGr, *mod.AltGr) + } } func (manager *DesktopManagerCtx) GetKeyboardModifiers() types.KeyboardModifiers { modifiers := xorg.GetKeyboardModifiers() - NumLock := (modifiers & xorg.KbdModNumLock) != 0 - CapsLock := (modifiers & xorg.KbdModCapsLock) != 0 + isset := func(mod xorg.KbdMod) *bool { + x := modifiers&mod != 0 + return &x + } return types.KeyboardModifiers{ - NumLock: &NumLock, - CapsLock: &CapsLock, + Shift: isset(xorg.KbdModShift), + CapsLock: isset(xorg.KbdModCapsLock), + Control: isset(xorg.KbdModControl), + Alt: isset(xorg.KbdModAlt), + NumLock: isset(xorg.KbdModNumLock), + Meta: isset(xorg.KbdModMeta), + Super: isset(xorg.KbdModSuper), + AltGr: isset(xorg.KbdModAltGr), } } diff --git a/server/internal/http/batch.go b/server/internal/http/batch.go new file mode 100644 index 000000000..ffe7a7927 --- /dev/null +++ b/server/internal/http/batch.go @@ -0,0 +1,123 @@ +package http + +import ( + "bytes" + "encoding/json" + "io" + "net/http" + "strings" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +type BatchRequest struct { + Path string `json:"path"` + Method string `json:"method"` + Body json.RawMessage `json:"body,omitempty"` +} + +type BatchResponse struct { + Path string `json:"path"` + Method string `json:"method"` + Body json.RawMessage `json:"body,omitempty"` + Status int `json:"status"` +} + +func (b *BatchResponse) Error(httpErr *utils.HTTPError) (err error) { + b.Body, err = json.Marshal(httpErr) + b.Status = httpErr.Code + return +} + +type batchHandler struct { + Router types.Router + PathPrefix string + Excluded []string +} + +func (b *batchHandler) Handle(w http.ResponseWriter, r *http.Request) error { + var requests []BatchRequest + if err := json.NewDecoder(r.Body).Decode(&requests); err != nil { + return err + } + + responses := make([]BatchResponse, len(requests)) + for i, request := range requests { + res := BatchResponse{ + Path: request.Path, + Method: request.Method, + } + + if !strings.HasPrefix(request.Path, b.PathPrefix) { + res.Error(utils.HttpBadRequest("this path is not allowed in batch requests")) + responses[i] = res + continue + } + + if exists, _ := utils.ArrayIn(request.Path, b.Excluded); exists { + res.Error(utils.HttpBadRequest("this path is excluded from batch requests")) + responses[i] = res + continue + } + + // prepare request + req, err := http.NewRequest(request.Method, request.Path, bytes.NewBuffer(request.Body)) + if err != nil { + return err + } + + // copy headers + for k, vv := range r.Header { + for _, v := range vv { + req.Header.Add(k, v) + } + } + + // execute request + rr := newResponseRecorder() + b.Router.ServeHTTP(rr, req) + + // read response + body, err := io.ReadAll(rr.Body) + if err != nil { + return err + } + + // write response + responses[i] = BatchResponse{ + Path: request.Path, + Method: request.Method, + Body: body, + Status: rr.Code, + } + } + + return utils.HttpSuccess(w, responses) +} + +type responseRecorder struct { + Code int + HeaderMap http.Header + Body *bytes.Buffer +} + +func newResponseRecorder() *responseRecorder { + return &responseRecorder{ + Code: http.StatusOK, + HeaderMap: make(http.Header), + Body: new(bytes.Buffer), + } +} + +func (w *responseRecorder) Header() http.Header { + return w.HeaderMap +} + +func (w *responseRecorder) Write(b []byte) (int, error) { + return w.Body.Write(b) +} + +func (w *responseRecorder) WriteHeader(code int) { + w.Code = code +} diff --git a/server/internal/http/debug.go b/server/internal/http/debug.go new file mode 100644 index 000000000..f22260519 --- /dev/null +++ b/server/internal/http/debug.go @@ -0,0 +1,36 @@ +package http + +import ( + "net/http" + "net/http/pprof" + + "github.com/go-chi/chi" + + "m1k1o/neko/pkg/types" +) + +func pprofHandler(r types.Router) { + r.Get("/debug/pprof/", func(w http.ResponseWriter, r *http.Request) error { + pprof.Index(w, r) + return nil + }) + + r.Get("/debug/pprof/{action}", func(w http.ResponseWriter, r *http.Request) error { + action := chi.URLParam(r, "action") + + switch action { + case "cmdline": + pprof.Cmdline(w, r) + case "profile": + pprof.Profile(w, r) + case "symbol": + pprof.Symbol(w, r) + case "trace": + pprof.Trace(w, r) + default: + pprof.Handler(action).ServeHTTP(w, r) + } + + return nil + }) +} diff --git a/server/internal/http/http.go b/server/internal/http/http.go deleted file mode 100644 index ea50350c7..000000000 --- a/server/internal/http/http.go +++ /dev/null @@ -1,250 +0,0 @@ -package http - -import ( - "context" - "encoding/json" - "fmt" - "image/jpeg" - "io" - "net/http" - "os" - "regexp" - "strconv" - - "github.com/go-chi/chi/v5" - "github.com/go-chi/chi/v5/middleware" - "github.com/go-chi/cors" - "github.com/rs/zerolog" - "github.com/rs/zerolog/log" - - "m1k1o/neko/internal/config" - "m1k1o/neko/internal/types" -) - -const FILE_UPLOAD_BUF_SIZE = 65000 - -type Server struct { - logger zerolog.Logger - router *chi.Mux - http *http.Server - conf *config.Server -} - -func New(conf *config.Server, webSocketHandler types.WebSocketHandler, desktop types.DesktopManager) *Server { - logger := log.With().Str("module", "http").Logger() - - router := chi.NewRouter() - router.Use(middleware.RequestID) // Create a request ID for each request - if conf.Proxy { - router.Use(middleware.RealIP) - } - router.Use(middleware.RequestLogger(&logformatter{logger})) - router.Use(middleware.Recoverer) // Recover from panics without crashing server - router.Use(middleware.Compress(5, "application/octet-stream")) - - router.Use(cors.Handler(cors.Options{ - AllowOriginFunc: conf.AllowOrigin, - AllowedMethods: []string{"GET", "POST", "DELETE", "OPTIONS"}, - AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"}, - ExposedHeaders: []string{"Link"}, - AllowCredentials: true, - MaxAge: 300, // Maximum value not ignored by any of major browsers - })) - - if conf.PathPrefix != "/" { - router.Use(func(h http.Handler) http.Handler { - return http.StripPrefix(conf.PathPrefix, h) - }) - } - - router.Get("/ws", func(w http.ResponseWriter, r *http.Request) { - err := webSocketHandler.Upgrade(w, r) - if err != nil { - logger.Warn().Err(err).Msg("failed to upgrade websocket conection") - } - }) - - router.Get("/stats", func(w http.ResponseWriter, r *http.Request) { - password := r.URL.Query().Get("pwd") - isAdmin, err := webSocketHandler.IsAdmin(password) - if err != nil { - http.Error(w, err.Error(), http.StatusForbidden) - return - } - - if !isAdmin { - http.Error(w, "bad authorization", http.StatusUnauthorized) - return - } - - w.Header().Set("Content-Type", "application/json") - - stats := webSocketHandler.Stats() - if err := json.NewEncoder(w).Encode(stats); err != nil { - logger.Warn().Err(err).Msg("failed writing json error response") - } - }) - - router.Get("/screenshot.jpg", func(w http.ResponseWriter, r *http.Request) { - password := r.URL.Query().Get("pwd") - isAdmin, err := webSocketHandler.IsAdmin(password) - if err != nil { - http.Error(w, err.Error(), http.StatusForbidden) - return - } - - if !isAdmin { - http.Error(w, "bad authorization", http.StatusUnauthorized) - return - } - - if webSocketHandler.IsLocked("login") { - http.Error(w, "room is locked", http.StatusLocked) - return - } - - quality, err := strconv.Atoi(r.URL.Query().Get("quality")) - if err != nil { - quality = 90 - } - - w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") - w.Header().Set("Content-Type", "image/jpeg") - - img := desktop.GetScreenshotImage() - if err := jpeg.Encode(w, img, &jpeg.Options{Quality: quality}); err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - }) - - // allow downloading and uploading files - if webSocketHandler.FileTransferEnabled() { - router.Get("/file", func(w http.ResponseWriter, r *http.Request) { - password := r.URL.Query().Get("pwd") - isAuthorized, err := webSocketHandler.CanTransferFiles(password) - if err != nil { - http.Error(w, err.Error(), http.StatusForbidden) - return - } - - if !isAuthorized { - http.Error(w, "bad authorization", http.StatusUnauthorized) - return - } - - filename := r.URL.Query().Get("filename") - badChars, _ := regexp.MatchString(`(?m)\.\.(?:\/|$)`, filename) - if filename == "" || badChars { - http.Error(w, "bad filename", http.StatusBadRequest) - return - } - - filePath := webSocketHandler.FileTransferPath(filename) - f, err := os.Open(filePath) - if err != nil { - http.Error(w, "not found or unable to open", http.StatusNotFound) - return - } - defer f.Close() - - w.Header().Set("Content-Type", "application/octet-stream") - w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%q", filename)) - io.Copy(w, f) - }) - - router.Post("/file", func(w http.ResponseWriter, r *http.Request) { - password := r.URL.Query().Get("pwd") - isAuthorized, err := webSocketHandler.CanTransferFiles(password) - if err != nil { - http.Error(w, err.Error(), http.StatusForbidden) - return - } - - if !isAuthorized { - http.Error(w, "bad authorization", http.StatusUnauthorized) - return - } - - err = r.ParseMultipartForm(32 << 20) - if err != nil || r.MultipartForm == nil { - logger.Warn().Err(err).Msg("failed to parse multipart form") - http.Error(w, "error parsing form", http.StatusBadRequest) - return - } - - for _, formheader := range r.MultipartForm.File["files"] { - filePath := webSocketHandler.FileTransferPath(formheader.Filename) - - formfile, err := formheader.Open() - if err != nil { - logger.Warn().Err(err).Msg("failed to open formdata file") - http.Error(w, "error writing file", http.StatusInternalServerError) - return - } - defer formfile.Close() - - f, err := os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE, 0644) - if err != nil { - http.Error(w, "unable to open file for writing", http.StatusInternalServerError) - return - } - defer f.Close() - - io.Copy(f, formfile) - } - - err = r.MultipartForm.RemoveAll() - if err != nil { - logger.Warn().Err(err).Msg("failed to remove multipart form") - } - }) - } - - router.Get("/health", func(w http.ResponseWriter, r *http.Request) { - _, _ = w.Write([]byte("true")) - }) - - fs := http.FileServer(http.Dir(conf.Static)) - router.Get("/*", func(w http.ResponseWriter, r *http.Request) { - if _, err := os.Stat(conf.Static + r.URL.Path); !os.IsNotExist(err) { - fs.ServeHTTP(w, r) - } else { - http.NotFound(w, r) - } - }) - - server := &http.Server{ - Addr: conf.Bind, - Handler: router, - } - - return &Server{ - logger: logger, - router: router, - http: server, - conf: conf, - } -} - -func (s *Server) Start() { - if s.conf.Cert != "" && s.conf.Key != "" { - go func() { - if err := s.http.ListenAndServeTLS(s.conf.Cert, s.conf.Key); err != http.ErrServerClosed { - s.logger.Panic().Err(err).Msg("unable to start https server") - } - }() - s.logger.Info().Msgf("https listening on %s", s.http.Addr) - } else { - go func() { - if err := s.http.ListenAndServe(); err != http.ErrServerClosed { - s.logger.Panic().Err(err).Msg("unable to start http server") - } - }() - s.logger.Warn().Msgf("http listening on %s", s.http.Addr) - } -} - -func (s *Server) Shutdown() error { - return s.http.Shutdown(context.Background()) -} diff --git a/server/internal/types/event/events.go b/server/internal/http/legacy/event/events.go similarity index 100% rename from server/internal/types/event/events.go rename to server/internal/http/legacy/event/events.go diff --git a/server/internal/http/legacy/handler.go b/server/internal/http/legacy/handler.go new file mode 100644 index 000000000..b61517c7d --- /dev/null +++ b/server/internal/http/legacy/handler.go @@ -0,0 +1,357 @@ +package legacy + +import ( + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "net/url" + "time" + + "m1k1o/neko/internal/api" + "m1k1o/neko/internal/api/room" + oldEvent "m1k1o/neko/internal/http/legacy/event" + oldMessage "m1k1o/neko/internal/http/legacy/message" + oldTypes "m1k1o/neko/internal/http/legacy/types" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" + "m1k1o/neko/pkg/utils" + + "github.com/gorilla/websocket" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" +) + +var ( + // DefaultUpgrader specifies the parameters for upgrading an HTTP + // connection to a WebSocket connection. + DefaultUpgrader = &websocket.Upgrader{ + ReadBufferSize: 1024, + WriteBufferSize: 1024, + CheckOrigin: func(r *http.Request) bool { + return true + }, + } + + // DefaultDialer is a dialer with all fields set to the default zero values. + DefaultDialer = websocket.DefaultDialer +) + +type LegacyHandler struct { + logger zerolog.Logger + serverAddr string + startedAt time.Time +} + +func New() *LegacyHandler { + // Init + + return &LegacyHandler{ + logger: log.With().Str("module", "legacy").Logger(), + serverAddr: "127.0.0.1:8080", + startedAt: time.Now(), + } +} + +func (h *LegacyHandler) Route(r types.Router) { + r.Get("/ws", func(w http.ResponseWriter, r *http.Request) error { + s := newSession(h.logger, h.serverAddr) + + // create a new websocket connection + connClient, err := DefaultUpgrader.Upgrade(w, r, nil) + if err != nil { + return utils.HttpError(http.StatusInternalServerError). + WithInternalErr(err). + Msg("couldn't upgrade connection to websocket") + } + defer connClient.Close() + s.connClient = connClient + + // create a new session + username := r.URL.Query().Get("username") + password := r.URL.Query().Get("password") + err = s.create(username, password) + if err != nil { + h.logger.Error().Err(err).Msg("couldn't create a new session") + + s.toClient(&oldMessage.SystemMessage{ + Event: oldEvent.SYSTEM_DISCONNECT, + Title: "couldn't create a new session", + Message: err.Error(), + }) + + // we can't return HTTP error here because the connection is already upgraded + return nil + } + defer s.destroy() + + // dial to the remote backend + connBackend, _, err := DefaultDialer.Dial("ws://"+h.serverAddr+"/api/ws?token="+url.QueryEscape(s.token), nil) + if err != nil { + h.logger.Error().Err(err).Msg("couldn't dial to the remote backend") + + s.toClient(&oldMessage.SystemMessage{ + Event: oldEvent.SYSTEM_DISCONNECT, + Title: "couldn't dial to the remote backend", + Message: err.Error(), + }) + + // we can't return HTTP error here because the connection is already upgraded + return nil + } + defer connBackend.Close() + s.connBackend = connBackend + + // request signal + if err = s.toBackend(event.SIGNAL_REQUEST, message.SignalRequest{}); err != nil { + h.logger.Error().Err(err).Msg("couldn't request signal") + + s.toClient(&oldMessage.SystemMessage{ + Event: oldEvent.SYSTEM_DISCONNECT, + Title: "couldn't request signal", + Message: err.Error(), + }) + + // we can't return HTTP error here because the connection is already upgraded + return nil + } + + // copy messages between the client and the backend + errClient := make(chan error, 1) + errBackend := make(chan error, 1) + replicateWebsocketConn := func(dst, src *websocket.Conn, errc chan error, rewriteTextMessage func([]byte) error) { + for { + msgType, msg, err := src.ReadMessage() + if err != nil { + m := websocket.FormatCloseMessage(websocket.CloseNormalClosure, fmt.Sprintf("%v", err)) + if e, ok := err.(*websocket.CloseError); ok { + if e.Code != websocket.CloseNoStatusReceived { + m = websocket.FormatCloseMessage(e.Code, e.Text) + } + } + errc <- err + dst.WriteMessage(websocket.CloseMessage, m) + break + } + if msgType == websocket.TextMessage { + err = rewriteTextMessage(msg) + + if err == nil { + continue + } + + if errors.Is(err, ErrBackendRespone) { + h.logger.Error().Err(err).Msg("backend response error") + + s.toClient(&oldMessage.SystemMessage{ + Event: oldEvent.SYSTEM_ERROR, + Title: "backend response error", + Message: err.Error(), + }) + continue + } else if errors.Is(err, ErrWebsocketSend) { + errc <- err + break + } else { + h.logger.Error().Err(err).Msg("couldn't rewrite text message") + } + } + } + } + + // backend -> client + go replicateWebsocketConn(connClient, connBackend, errClient, s.wsToClient) + + // client -> backend + go replicateWebsocketConn(connBackend, connClient, errBackend, s.wsToBackend) + + var message string + select { + case err = <-errClient: + message = "websocketproxy: Error when copying from backend to client: %v" + case err = <-errBackend: + message = "websocketproxy: Error when copying from client to backend: %v" + } + + if e, ok := err.(*websocket.CloseError); !ok || e.Code == websocket.CloseAbnormalClosure { + h.logger.Error().Err(err).Msg(message) + } + + return nil + }) + + r.Get("/stats", func(w http.ResponseWriter, r *http.Request) error { + s := newSession(h.logger, h.serverAddr) + + // create a new session + username := r.URL.Query().Get("usr") + password := r.URL.Query().Get("pwd") + err := s.create(username, password) + if err != nil { + return utils.HttpForbidden(err.Error()) + } + defer s.destroy() + + if !s.isAdmin { + return utils.HttpUnauthorized().Msg("bad authorization") + } + + w.Header().Set("Content-Type", "application/json") + + // get all sessions + sessions := []api.SessionDataPayload{} + err = s.apiReq(http.MethodGet, "/api/sessions", nil, &sessions) + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + // get current control status + control := room.ControlStatusPayload{} + err = s.apiReq(http.MethodGet, "/api/room/control", nil, &control) + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + // get settings + settings := types.Settings{} + err = s.apiReq(http.MethodGet, "/api/room/settings", nil, &settings) + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + var stats oldTypes.Stats + + // create empty array so that it's not null in json + stats.Members = []*oldTypes.Member{} + + for _, session := range sessions { + if session.State.IsConnected { + stats.Connections++ + member, err := profileToMember(session.ID, session.Profile) + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + // append members + stats.Members = append(stats.Members, member) + } else if session.State.NotConnectedSince != nil { + // + // TODO: This wont work if the user is removed after the session is closed + // + // populate last admin left time + if session.Profile.IsAdmin && (stats.LastAdminLeftAt == nil || (*session.State.NotConnectedSince).After(*stats.LastAdminLeftAt)) { + stats.LastAdminLeftAt = session.State.NotConnectedSince + } + // populate last user left time + if !session.Profile.IsAdmin && (stats.LastUserLeftAt == nil || (*session.State.NotConnectedSince).After(*stats.LastUserLeftAt)) { + stats.LastUserLeftAt = session.State.NotConnectedSince + } + } + } + + locks, err := s.settingsToLocks(settings) + if err != nil { + return err + } + + stats.Host = control.HostId + // TODO: stats.Banned, not implemented yet + stats.Locked = locks + stats.ServerStartedAt = h.startedAt + stats.ControlProtection = settings.ControlProtection + stats.ImplicitControl = settings.ImplicitHosting + + return json.NewEncoder(w).Encode(stats) + }) + + r.Get("/screenshot.jpg", func(w http.ResponseWriter, r *http.Request) error { + s := newSession(h.logger, h.serverAddr) + + // create a new session + username := r.URL.Query().Get("usr") + password := r.URL.Query().Get("pwd") + err := s.create(username, password) + if err != nil { + return utils.HttpForbidden(err.Error()) + } + defer s.destroy() + + if !s.isAdmin { + return utils.HttpUnauthorized().Msg("bad authorization") + } + + quality := r.URL.Query().Get("quality") + + // get the screenshot + body, headers, err := s.req(http.MethodGet, "/api/room/screen/shot.jpg?quality="+url.QueryEscape(quality), nil, nil) + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + // copy headers + w.Header().Set("Content-Length", headers.Get("Content-Length")) + w.Header().Set("Content-Type", headers.Get("Content-Type")) + + // copy the body to the response writer + _, err = io.Copy(w, body) + return err + }) + + // allow downloading and uploading files + r.Get("/file", func(w http.ResponseWriter, r *http.Request) error { + s := newSession(h.logger, h.serverAddr) + + // create a new session + username := r.URL.Query().Get("usr") + password := r.URL.Query().Get("pwd") + err := s.create(username, password) + if err != nil { + return utils.HttpForbidden(err.Error()) + } + defer s.destroy() + + filename := r.URL.Query().Get("filename") + + body, headers, err := s.req(http.MethodGet, "/api/filetransfer?filename="+url.QueryEscape(filename), r.Header, nil) + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + // copy headers + w.Header().Set("Content-Length", headers.Get("Content-Length")) + w.Header().Set("Content-Type", headers.Get("Content-Type")) + + // copy the body to the response writer + _, err = io.Copy(w, body) + return err + }) + + r.Post("/file", func(w http.ResponseWriter, r *http.Request) error { + s := newSession(h.logger, h.serverAddr) + + // create a new session + username := r.URL.Query().Get("usr") + password := r.URL.Query().Get("pwd") + err := s.create(username, password) + if err != nil { + return utils.HttpForbidden(err.Error()) + } + defer s.destroy() + + body, _, err := s.req(http.MethodPost, "/api/filetransfer", r.Header, r.Body) + if err != nil { + return utils.HttpInternalServerError().WithInternalErr(err) + } + + // copy the body to the response writer + _, err = io.Copy(w, body) + return err + }) + + r.Get("/health", func(w http.ResponseWriter, r *http.Request) error { + _, err := w.Write([]byte("true")) + return err + }) +} diff --git a/server/internal/types/message/messages.go b/server/internal/http/legacy/message/messages.go similarity index 98% rename from server/internal/types/message/messages.go rename to server/internal/http/legacy/message/messages.go index 89552b712..de5cdc79a 100644 --- a/server/internal/types/message/messages.go +++ b/server/internal/http/legacy/message/messages.go @@ -1,7 +1,7 @@ package message import ( - "m1k1o/neko/internal/types" + "m1k1o/neko/internal/http/legacy/types" "github.com/pion/webrtc/v3" ) diff --git a/server/internal/http/legacy/session.go b/server/internal/http/legacy/session.go new file mode 100644 index 000000000..f81c064d4 --- /dev/null +++ b/server/internal/http/legacy/session.go @@ -0,0 +1,195 @@ +package legacy + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "net/http" + "strings" + + oldTypes "m1k1o/neko/internal/http/legacy/types" + + "m1k1o/neko/internal/api" + "m1k1o/neko/pkg/types" + + "github.com/gorilla/websocket" + "github.com/rs/zerolog" +) + +var ( + ErrWebsocketSend = fmt.Errorf("failed to send message to websocket") + ErrBackendRespone = fmt.Errorf("error response from backend") +) + +type memberStruct struct { + member *oldTypes.Member + connected bool + sent bool +} + +type session struct { + logger zerolog.Logger + serverAddr string + + id string + token string + name string + isAdmin bool + client *http.Client + + lastHostID string + lockedControls bool + lockedLogins bool + lockedFileTransfer bool + sessions map[string]*memberStruct + + connClient *websocket.Conn + connBackend *websocket.Conn +} + +func newSession(logger zerolog.Logger, serverAddr string) *session { + return &session{ + logger: logger, + serverAddr: serverAddr, + client: http.DefaultClient, + sessions: make(map[string]*memberStruct), + } +} + +func (s *session) req(method, path string, headers http.Header, request io.Reader) (io.ReadCloser, http.Header, error) { + req, err := http.NewRequest(method, "http://"+s.serverAddr+path, request) + if err != nil { + return nil, nil, err + } + + for k, v := range headers { + req.Header[k] = v + } + + if s.token != "" { + req.Header.Set("Authorization", "Bearer "+s.token) + } + + res, err := s.client.Do(req) + if err != nil { + return nil, nil, err + } + + if res.StatusCode < 200 || res.StatusCode >= 300 { + defer res.Body.Close() + + body, _ := io.ReadAll(res.Body) + // try to unmarsal as json error message + var apiErr struct { + Message string `json:"message"` + } + if err := json.Unmarshal(body, &apiErr); err == nil { + return nil, nil, fmt.Errorf("%w: %s", ErrBackendRespone, apiErr.Message) + } + // return raw body if failed to unmarshal + return nil, nil, fmt.Errorf("unexpected status code: %d, body: %s", res.StatusCode, strings.TrimSpace(string(body))) + } + + return res.Body, res.Header, nil +} + +func (s *session) apiReq(method, path string, request, response any) error { + reqBody, err := json.Marshal(request) + if err != nil { + return err + } + + headers := http.Header{ + "Content-Type": []string{"application/json"}, + } + + resBody, _, err := s.req(method, path, headers, bytes.NewReader(reqBody)) + if err != nil { + return err + } + defer resBody.Close() + + if resBody == nil { + return nil + } + + if response == nil { + io.Copy(io.Discard, resBody) + return nil + } + + return json.NewDecoder(resBody).Decode(response) +} + +// send message to client (in old format) +func (s *session) toClient(payload any) error { + msg, err := json.Marshal(payload) + if err != nil { + return err + } + + err = s.connClient.WriteMessage(websocket.TextMessage, msg) + if err != nil { + return fmt.Errorf("%w: %s", ErrWebsocketSend, err) + } + + return nil +} + +// send message to backend (in new format) +func (s *session) toBackend(event string, payload any) error { + rawPayload, err := json.Marshal(payload) + if err != nil { + return err + } + + msg, err := json.Marshal(&types.WebSocketMessage{ + Event: event, + Payload: rawPayload, + }) + if err != nil { + return err + } + + err = s.connBackend.WriteMessage(websocket.TextMessage, msg) + if err != nil { + return fmt.Errorf("%w: %s", ErrWebsocketSend, err) + } + + return nil +} + +func (s *session) create(username, password string) error { + data := api.SessionDataPayload{} + + err := s.apiReq(http.MethodPost, "/api/login", api.SessionLoginPayload{ + Username: username, + Password: password, + }, &data) + if err != nil { + return err + } + + s.id = data.ID + s.token = data.Token + s.name = data.Profile.Name + s.isAdmin = data.Profile.IsAdmin + + // if Cookie auth, the token will be empty + if s.token == "" { + return fmt.Errorf("token not found - make sure you are not using Cookie auth on the server") + } + + return nil +} + +func (s *session) destroy() { + defer s.client.CloseIdleConnections() + + // logout session + err := s.apiReq(http.MethodPost, "/api/logout", nil, nil) + if err != nil { + s.logger.Error().Err(err).Msg("failed to logout") + } +} diff --git a/server/internal/types/websocket.go b/server/internal/http/legacy/types/types.go similarity index 61% rename from server/internal/types/websocket.go rename to server/internal/http/legacy/types/types.go index 15b684c98..0fc4b534a 100644 --- a/server/internal/types/websocket.go +++ b/server/internal/http/legacy/types/types.go @@ -1,9 +1,6 @@ package types -import ( - "net/http" - "time" -) +import "time" type Stats struct { Connections uint32 `json:"connections"` @@ -21,24 +18,11 @@ type Stats struct { ImplicitControl bool `json:"implicit_control"` } -type WebSocket interface { - Address() string - Send(v interface{}) error - Destroy() error -} - -type WebSocketHandler interface { - Start() - Shutdown() error - Upgrade(w http.ResponseWriter, r *http.Request) error - Stats() Stats - IsLocked(resource string) bool - IsAdmin(password string) (bool, error) - - // File Transfer - CanTransferFiles(password string) (bool, error) - FileTransferPath(filename string) string - FileTransferEnabled() bool +type Member struct { + ID string `json:"id"` + Name string `json:"displayname"` + Admin bool `json:"admin"` + Muted bool `json:"muted"` } type FileListItem struct { @@ -46,3 +30,9 @@ type FileListItem struct { Type string `json:"type"` Size int64 `json:"size"` } + +type ScreenConfiguration struct { + Width int `json:"width"` + Height int `json:"height"` + Rates map[int]int16 `json:"rates"` +} diff --git a/server/internal/http/legacy/wstobackend.go b/server/internal/http/legacy/wstobackend.go new file mode 100644 index 000000000..1922ad3d9 --- /dev/null +++ b/server/internal/http/legacy/wstobackend.go @@ -0,0 +1,362 @@ +package legacy + +import ( + "encoding/json" + "fmt" + "net/http" + + "github.com/gorilla/websocket" + "github.com/pion/webrtc/v3" + + oldEvent "m1k1o/neko/internal/http/legacy/event" + oldMessage "m1k1o/neko/internal/http/legacy/message" + + "m1k1o/neko/internal/api/room" + "m1k1o/neko/internal/plugins/chat" + "m1k1o/neko/internal/plugins/filetransfer" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" +) + +func (s *session) wsToBackend(msg []byte) error { + header := oldMessage.Message{} + err := json.Unmarshal(msg, &header) + if err != nil { + return err + } + + switch header.Event { + // Signal Events + case oldEvent.SIGNAL_OFFER: + request := &oldMessage.SignalOffer{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + return s.toBackend(event.SIGNAL_OFFER, &message.SignalDescription{ + SDP: request.SDP, + }) + + case oldEvent.SIGNAL_ANSWER: + request := &oldMessage.SignalAnswer{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + if request.DisplayName != "" { + s.name = request.DisplayName + + err = s.apiReq(http.MethodPost, "/api/profile", map[string]any{ + "name": request.DisplayName, + }, nil) + if err != nil { + return err + } + } + + return s.toBackend(event.SIGNAL_ANSWER, &message.SignalDescription{ + SDP: request.SDP, + }) + + case oldEvent.SIGNAL_CANDIDATE: + request := &oldMessage.SignalCandidate{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + var candidate webrtc.ICECandidateInit + err = json.Unmarshal([]byte(request.Data), &candidate) + if err != nil { + return err + } + + return s.toBackend(event.SIGNAL_CANDIDATE, &message.SignalCandidate{ + ICECandidateInit: candidate, + }) + + // Control Events + case oldEvent.CONTROL_RELEASE: + return s.toBackend(event.CONTROL_RELEASE, nil) + + case oldEvent.CONTROL_REQUEST: + return s.toBackend(event.CONTROL_REQUEST, nil) + + case oldEvent.CONTROL_GIVE: + request := &oldMessage.Control{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + return s.apiReq(http.MethodPost, "/api/room/control/give/"+request.ID, nil, nil) + + case oldEvent.CONTROL_CLIPBOARD: + request := &oldMessage.Clipboard{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + return s.toBackend(event.CLIPBOARD_SET, &message.ClipboardData{ + Text: request.Text, + }) + + case oldEvent.CONTROL_KEYBOARD: + request := &oldMessage.Keyboard{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + if request.Layout != nil { + err = s.toBackend(event.KEYBOARD_MAP, &message.KeyboardMap{ + KeyboardMap: types.KeyboardMap{ + Layout: *request.Layout, + }, + }) + + if err != nil { + return err + } + } + + if request.CapsLock != nil || request.NumLock != nil || request.ScrollLock != nil { + err = s.toBackend(event.KEYBOARD_MODIFIERS, &message.KeyboardModifiers{ + KeyboardModifiers: types.KeyboardModifiers{ + CapsLock: request.CapsLock, + NumLock: request.NumLock, + // ScrollLock: request.ScrollLock, // ScrollLock is deprecated. + }, + }) + + if err != nil { + return err + } + } + + return nil + + // Chat Events + case oldEvent.CHAT_MESSAGE: + request := &oldMessage.ChatReceive{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + return s.toBackend(chat.CHAT_MESSAGE, &chat.Content{ + Text: request.Content, + }) + + case oldEvent.CHAT_EMOTE: + request := &oldMessage.EmoteReceive{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + // loopback emote + msg, err := json.Marshal(&oldMessage.EmoteSend{ + Event: oldEvent.CHAT_EMOTE, + ID: s.id, + Emote: request.Emote, + }) + if err != nil { + return err + } + + // loopback emote + err = s.connClient.WriteMessage(websocket.TextMessage, msg) + if err != nil { + return err + } + + // broadcast emote to other users + return s.toBackend(event.SEND_BROADCAST, &message.SendBroadcast{ + Sender: s.id, + Subject: "emote", + Body: request.Emote, + }) + + // File Transfer Events + case oldEvent.FILETRANSFER_REFRESH: + return s.toBackend(filetransfer.FILETRANSFER_UPDATE, nil) + + // Screen Events + case oldEvent.SCREEN_RESOLUTION: + response := &types.ScreenSize{} + err := s.apiReq(http.MethodGet, "/api/room/screen", nil, response) + if err != nil { + return err + } + + return s.toClient(&oldMessage.ScreenResolution{ + Event: oldEvent.SCREEN_RESOLUTION, + Width: response.Width, + Height: response.Height, + Rate: response.Rate, + }) + + case oldEvent.SCREEN_CONFIGURATIONS: + response := &[]types.ScreenSize{} + err := s.apiReq(http.MethodGet, "/api/room/screen/configurations", nil, response) + if err != nil { + return err + } + + return s.toClient(&oldMessage.ScreenConfigurations{ + Event: oldEvent.SCREEN_CONFIGURATIONS, + Configurations: screenConfigurations(*response), + }) + + case oldEvent.SCREEN_SET: + request := &oldMessage.ScreenResolution{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + return s.toBackend(event.SCREEN_SET, &message.ScreenSize{ + ScreenSize: types.ScreenSize{ + Width: request.Width, + Height: request.Height, + Rate: request.Rate, + }, + }) + + // Broadcast Events + case oldEvent.BROADCAST_CREATE: + request := &oldMessage.BroadcastCreate{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + return s.apiReq(http.MethodPost, "/api/room/broadcast/start", room.BroadcastStatusPayload{ + URL: request.URL, + IsActive: true, + }, nil) + + case oldEvent.BROADCAST_DESTROY: + return s.apiReq(http.MethodPost, "/api/room/broadcast/stop", nil, nil) + + // Admin Events + case oldEvent.ADMIN_LOCK: + request := &oldMessage.AdminLock{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + data := map[string]any{} + + switch request.Resource { + case "login": + data["locked_logins"] = true + case "control": + data["locked_controls"] = true + case "file_transfer": + data["plugins"] = map[string]any{ + "filetransfer.enabled": false, + } + default: + return fmt.Errorf("unknown resource: %s", request.Resource) + } + + return s.apiReq(http.MethodPost, "/api/room/settings", data, nil) + + case oldEvent.ADMIN_UNLOCK: + request := &oldMessage.AdminLock{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + data := map[string]any{} + + switch request.Resource { + case "login": + data["locked_logins"] = false + case "control": + data["locked_controls"] = false + case "file_transfer": + data["plugins"] = map[string]any{ + "filetransfer.enabled": true, + } + default: + return fmt.Errorf("unknown resource: %s", request.Resource) + } + + return s.apiReq(http.MethodPost, "/api/room/settings", data, nil) + + case oldEvent.ADMIN_CONTROL: + return s.apiReq(http.MethodPost, "/api/room/control/take", nil, nil) + + case oldEvent.ADMIN_RELEASE: + return s.apiReq(http.MethodPost, "/api/room/control/reset", nil, nil) + + case oldEvent.ADMIN_GIVE: + request := &oldMessage.Admin{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + return s.apiReq(http.MethodPost, "/api/room/control/give/"+request.ID, nil, nil) + + case oldEvent.ADMIN_BAN: + request := &oldMessage.Admin{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + // TODO: No WS equivalent, call HTTP API. + return fmt.Errorf("event not implemented: %s", header.Event) + + case oldEvent.ADMIN_KICK: + request := &oldMessage.Admin{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + // TODO: we need to send a message to the user before kicking them + // that they are being kicked so they will not automatically rejoin + return s.apiReq(http.MethodPost, "/api/members/"+request.ID, map[string]any{ + "can_login": false, + }, nil) + + case oldEvent.ADMIN_MUTE: + request := &oldMessage.Admin{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + return s.apiReq(http.MethodPost, "/api/members/"+request.ID, map[string]any{ + "plugins": map[string]any{ + "chat.can_send": false, + }, + }, nil) + + case oldEvent.ADMIN_UNMUTE: + request := &oldMessage.Admin{} + err := json.Unmarshal(msg, request) + if err != nil { + return err + } + + return s.apiReq(http.MethodPost, "/api/members/"+request.ID, map[string]any{ + "plugins": map[string]any{ + "chat.can_send": true, + }, + }, nil) + + default: + return fmt.Errorf("unknown event type: %s", header.Event) + } +} diff --git a/server/internal/http/legacy/wstoclient.go b/server/internal/http/legacy/wstoclient.go new file mode 100644 index 000000000..be5e4c883 --- /dev/null +++ b/server/internal/http/legacy/wstoclient.go @@ -0,0 +1,733 @@ +package legacy + +import ( + "encoding/json" + "errors" + "fmt" + + "github.com/pion/webrtc/v3" + + oldEvent "m1k1o/neko/internal/http/legacy/event" + oldMessage "m1k1o/neko/internal/http/legacy/message" + oldTypes "m1k1o/neko/internal/http/legacy/types" + + "m1k1o/neko/internal/plugins/chat" + "m1k1o/neko/internal/plugins/filetransfer" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" +) + +func profileToMember(id string, profile types.MemberProfile) (*oldTypes.Member, error) { + settings := chat.Settings{ + CanSend: true, // defaults to true + CanReceive: true, // defaults to true + } + + err := profile.Plugins.Unmarshal(chat.PluginName, &settings) + if err != nil && !errors.Is(err, types.ErrPluginSettingsNotFound) { + return nil, fmt.Errorf("unable to unmarshal %s plugin settings from global settings: %w", chat.PluginName, err) + } + + return &oldTypes.Member{ + ID: id, + Name: profile.Name, + Admin: profile.IsAdmin, + Muted: !settings.CanSend, + }, nil +} + +func screenConfigurations(screenSizes []types.ScreenSize) map[int]oldTypes.ScreenConfiguration { + rates := map[string][]int16{} + for _, size := range screenSizes { + key := fmt.Sprintf("%dx%d", size.Width, size.Height) + rates[key] = append(rates[key], size.Rate) + } + + usedScreenSizes := map[string]struct{}{} + screenSizesList := map[int]oldTypes.ScreenConfiguration{} + for i, size := range screenSizes { + key := fmt.Sprintf("%dx%d", size.Width, size.Height) + if _, ok := usedScreenSizes[key]; ok { + continue + } + + ratesMap := map[int]int16{} + for i, rate := range rates[key] { + ratesMap[i] = rate + } + + screenSizesList[i] = oldTypes.ScreenConfiguration{ + Width: size.Width, + Height: size.Height, + Rates: ratesMap, + } + } + + return screenSizesList +} + +func (s *session) settingsToLocks(settings types.Settings) (map[string]string, error) { + // + // FileTransfer + // + + filetransferSettings := filetransfer.Settings{ + Enabled: true, // defaults to true + } + + err := settings.Plugins.Unmarshal(filetransfer.PluginName, &filetransferSettings) + if err != nil && !errors.Is(err, types.ErrPluginSettingsNotFound) { + return nil, fmt.Errorf("unable to unmarshal %s plugin settings from global settings: %w", filetransfer.PluginName, err) + } + + // + // Locks + // + + locks := map[string]string{} + if settings.LockedLogins { + locks["login"] = "" // TODO: We don't know who locked the login. + s.lockedLogins = true + } + if settings.LockedControls { + locks["control"] = "" // TODO: We don't know who locked the control. + s.lockedControls = true + } + if !filetransferSettings.Enabled { + locks["file_transfer"] = "" // TODO: We don't know who locked the file transfer. + s.lockedFileTransfer = true + } + + return locks, nil +} + +func (s *session) sendControlHost(request message.ControlHost) error { + lastHostID := s.lastHostID + + if request.HasHost { + s.lastHostID = request.ID + + if request.ID == request.HostID { + if request.ID == lastHostID || lastHostID == "" { + return s.toClient(&oldMessage.Control{ + Event: oldEvent.CONTROL_LOCKED, + ID: request.HostID, + }) + } else { + return s.toClient(&oldMessage.AdminTarget{ + Event: oldEvent.ADMIN_CONTROL, + ID: request.ID, + Target: lastHostID, + }) + } + } else { + return s.toClient(&oldMessage.ControlTarget{ + Event: oldEvent.CONTROL_GIVE, + ID: request.HostID, + Target: request.ID, + }) + } + } + + if request.ID != "" { + s.lastHostID = "" + + if request.ID == lastHostID { + return s.toClient(&oldMessage.Control{ + Event: oldEvent.CONTROL_RELEASE, + ID: request.ID, + }) + } else { + return s.toClient(&oldMessage.Control{ + Event: oldEvent.ADMIN_RELEASE, + ID: request.ID, + }) + } + } + + return nil +} + +func (s *session) wsToClient(msg []byte) error { + data := types.WebSocketMessage{} + err := json.Unmarshal(msg, &data) + if err != nil { + return err + } + + switch data.Event { + // System Events + case event.SYSTEM_DISCONNECT: + request := &message.SystemDisconnect{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + return s.toClient(&oldMessage.SystemMessage{ + Event: oldEvent.SYSTEM_DISCONNECT, + Message: request.Message, + }) + + case event.SYSTEM_INIT: + request := &message.SystemInit{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + // + // MembersList + // + + membersList := []*oldTypes.Member{} + s.sessions = map[string]*memberStruct{} + for id, session := range request.Sessions { + if !session.State.IsConnected { + continue + } + member, err := profileToMember(id, session.Profile) + if err != nil { + return err + } + membersList = append(membersList, member) + s.sessions[id] = &memberStruct{ + sent: member.Name != "", + connected: true, + member: member, + } + } + + err = s.toClient(&oldMessage.MembersList{ + Event: oldEvent.MEMBER_LIST, + Members: membersList, + }) + if err != nil { + return err + } + + // + // ScreenSize + // + + err = s.toClient(&oldMessage.ScreenResolution{ + Event: oldEvent.SCREEN_RESOLUTION, + Width: request.ScreenSize.Width, + Height: request.ScreenSize.Height, + Rate: request.ScreenSize.Rate, + }) + if err != nil { + return err + } + + // actually its already set when we create the session + s.id = request.SessionId + + // + // ControlHost + // + + err = s.sendControlHost(request.ControlHost) + if err != nil { + return err + } + + locks, err := s.settingsToLocks(request.Settings) + if err != nil { + return err + } + + return s.toClient(&oldMessage.SystemInit{ + Event: oldEvent.SYSTEM_INIT, + ImplicitHosting: request.Settings.ImplicitHosting, + Locks: locks, + FileTransfer: true, // TODO: We don't know if file transfer is enabled, we would need to check the global config somehow. + }) + + case event.SYSTEM_ADMIN: + request := &message.SystemAdmin{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + // + // ScreenSizesList + // + + err = s.toClient(&oldMessage.ScreenConfigurations{ + Event: oldEvent.SCREEN_CONFIGURATIONS, + Configurations: screenConfigurations(request.ScreenSizesList), + }) + if err != nil { + return err + } + + // + // BroadcastStatus + // + + return s.toClient(&oldMessage.BroadcastStatus{ + Event: oldEvent.BROADCAST_STATUS, + URL: request.BroadcastStatus.URL, + IsActive: request.BroadcastStatus.IsActive, + }) + + // Member Events + + case event.SESSION_CREATED: + request := &message.SessionData{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + member, err := profileToMember(request.ID, request.Profile) + if err != nil { + return err + } + + // only save session - will be notified on connect + s.sessions[request.ID] = &memberStruct{ + member: member, + } + + return nil + + case event.SESSION_DELETED: + request := &message.SessionID{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + // only continue if session is in the list - should have been already removed + if _, ok := s.sessions[request.ID]; !ok { + return nil + } + + delete(s.sessions, request.ID) + + return s.toClient(&oldMessage.MemberDisconnected{ + Event: oldEvent.MEMBER_DISCONNECTED, + ID: request.ID, + }) + + case event.SESSION_PROFILE: + request := &message.MemberProfile{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + // session profile is expected to change when updating a name after connecting + m, ok := s.sessions[request.ID] + if !ok || m == nil { + return nil + } + + // update member profile + member, err := profileToMember(request.ID, request.MemberProfile) + if err != nil { + return err + } + + mutedChanged := m.member.Muted != member.Muted + m.member = member + + if m.connected && !m.sent && member.Name != "" { + m.sent = true + + // oldEvent.MEMBER_CONNECTED if not sent already + err = s.toClient(&oldMessage.Member{ + Event: oldEvent.MEMBER_CONNECTED, + Member: member, + }) + if err != nil { + return err + } + } + + if mutedChanged && member.Muted { + return s.toClient(&oldMessage.AdminTarget{ + Event: oldEvent.ADMIN_MUTE, + ID: "", // TODO: We don't know who (un)muted the user. + Target: request.ID, + }) + } else if mutedChanged && !member.Muted { + return s.toClient(&oldMessage.AdminTarget{ + Event: oldEvent.ADMIN_UNMUTE, + ID: "", // TODO: We don't know who (un)muted the user. + Target: request.ID, + }) + } + + return nil + + case event.SESSION_STATE: + request := &message.SessionState{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + m, ok := s.sessions[request.ID] + if !ok { + return nil + } + + if request.IsConnected { + m.connected = true + + if m.member.Muted { + err = s.toClient(&oldMessage.AdminTarget{ + Event: oldEvent.ADMIN_MUTE, + ID: "", // TODO: We don't know who (un)muted the user. + Target: request.ID, + }) + if err != nil { + return err + } + } + + if !m.sent && m.member.Name != "" { + m.sent = true + + // oldEvent.MEMBER_CONNECTED if not sent already + return s.toClient(&oldMessage.Member{ + Event: oldEvent.MEMBER_CONNECTED, + Member: m.member, + }) + } + } + + if !request.IsConnected { + delete(s.sessions, request.ID) + + // oldEvent.MEMBER_DISCONNECTED if nor sent already + return s.toClient(&oldMessage.MemberDisconnected{ + Event: oldEvent.MEMBER_DISCONNECTED, + ID: request.ID, + }) + } + + return nil + + // Signal Events + case event.SIGNAL_OFFER: + request := &message.SignalDescription{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + return s.toClient(&oldMessage.SignalOffer{ + Event: oldEvent.SIGNAL_OFFER, + SDP: request.SDP, + }) + + case event.SIGNAL_ANSWER: + request := &message.SignalDescription{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + return s.toClient(&oldMessage.SignalAnswer{ + Event: oldEvent.SIGNAL_ANSWER, + DisplayName: s.name, + SDP: request.SDP, + }) + + case event.SIGNAL_CANDIDATE: + request := &message.SignalCandidate{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + json, err := json.Marshal(request.ICECandidateInit) + if err != nil { + return err + } + + return s.toClient(&oldMessage.SignalCandidate{ + Event: oldEvent.SIGNAL_CANDIDATE, + Data: string(json), + }) + + case event.SIGNAL_PROVIDE: + request := &message.SignalProvide{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + iceServers := []webrtc.ICEServer{} + for _, ice := range request.ICEServers { + iceServers = append(iceServers, webrtc.ICEServer{ + URLs: ice.URLs, + Username: ice.Username, + Credential: ice.Credential, + CredentialType: webrtc.ICECredentialTypePassword, + }) + } + + return s.toClient(&oldMessage.SignalProvide{ + Event: oldEvent.SIGNAL_PROVIDE, + ID: s.id, // SessionId + SDP: request.SDP, + Lite: len(iceServers) == 0, // if no ICE servers are provided, it's a lite offer + ICE: iceServers, + }) + + // Control Events + case event.CLIPBOARD_UPDATED: + request := &message.ClipboardData{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + return s.toClient(&oldMessage.Clipboard{ + Event: oldEvent.CONTROL_CLIPBOARD, + Text: request.Text, + }) + + case event.CONTROL_HOST: + request := &message.ControlHost{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + return s.sendControlHost(*request) + + case event.CONTROL_REQUEST: + request := &message.SessionID{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + if s.id == request.ID { + // if i am the one that is requesting, send CONTROL_REQUEST to me + return s.toClient(&oldMessage.Control{ + Event: oldEvent.CONTROL_REQUEST, + ID: request.ID, + }) + } else { + // if not, let me know someone else is requesting + return s.toClient(&oldMessage.Control{ + Event: oldEvent.CONTROL_REQUESTING, + ID: request.ID, + }) + } + + // Chat Events + case chat.CHAT_MESSAGE: + request := &chat.Message{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + return s.toClient(&oldMessage.ChatSend{ + Event: oldEvent.CHAT_MESSAGE, + ID: request.ID, + Content: request.Content.Text, + }) + + case event.SEND_BROADCAST: + request := &message.SendBroadcast{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + if request.Subject == "emote" { + return s.toClient(&oldMessage.EmoteSend{ + Event: oldEvent.CHAT_EMOTE, + ID: request.Sender, + Emote: request.Body.(string), + }) + } + + return nil + + // File Transfer Events + case filetransfer.FILETRANSFER_UPDATE: + request := &filetransfer.Message{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + files := []oldTypes.FileListItem{} + for _, file := range request.Files { + var itemType string + switch file.Type { + case filetransfer.ItemTypeFile: + itemType = "file" + case filetransfer.ItemTypeDir: + itemType = "dir" + } + files = append(files, oldTypes.FileListItem{ + Filename: file.Name, + Type: itemType, + Size: file.Size, + }) + } + + return s.toClient(&oldMessage.FileTransferList{ + Event: oldEvent.FILETRANSFER_LIST, + Cwd: request.RootDir, + Files: files, + }) + + // Screen Events + case event.SCREEN_UPDATED: + request := &message.ScreenSizeUpdate{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + return s.toClient(&oldMessage.ScreenResolution{ + Event: oldEvent.SCREEN_RESOLUTION, + ID: request.ID, + Width: request.ScreenSize.Width, + Height: request.ScreenSize.Height, + Rate: request.ScreenSize.Rate, + }) + + // Broadcast Events + case event.BROADCAST_STATUS: + request := &message.BroadcastStatus{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + return s.toClient(&oldMessage.BroadcastStatus{ + Event: oldEvent.BROADCAST_STATUS, + URL: request.URL, + IsActive: request.IsActive, + }) + + // Admin Events + case event.SYSTEM_SETTINGS: + request := &message.SystemSettingsUpdate{} + err := json.Unmarshal(data.Payload, request) + if err != nil { + return err + } + + if s.lockedControls != request.LockedControls { + s.lockedControls = request.LockedControls + + if request.LockedControls { + err = s.toClient(&oldMessage.AdminLock{ + Event: oldEvent.ADMIN_LOCK, + Resource: "control", + ID: request.ID, + }) + } else { + err = s.toClient(&oldMessage.AdminLock{ + Event: oldEvent.ADMIN_UNLOCK, + Resource: "control", + ID: request.ID, + }) + } + + if err != nil { + return err + } + } + + if s.lockedLogins != request.LockedLogins { + s.lockedLogins = request.LockedLogins + + if request.LockedLogins { + err = s.toClient(&oldMessage.AdminLock{ + Event: oldEvent.ADMIN_LOCK, + Resource: "login", + ID: request.ID, + }) + } else { + err = s.toClient(&oldMessage.AdminLock{ + Event: oldEvent.ADMIN_UNLOCK, + Resource: "login", + ID: request.ID, + }) + } + + if err != nil { + return err + } + } + + // + // FileTransfer + // + + filetransferSettings := filetransfer.Settings{ + Enabled: true, // defaults to true + } + + err = request.Settings.Plugins.Unmarshal(filetransfer.PluginName, &filetransferSettings) + if err != nil && !errors.Is(err, types.ErrPluginSettingsNotFound) { + return fmt.Errorf("unable to unmarshal %s plugin settings from global settings: %w", filetransfer.PluginName, err) + } + + if s.lockedFileTransfer != !filetransferSettings.Enabled { + s.lockedFileTransfer = !filetransferSettings.Enabled + + if !filetransferSettings.Enabled { + err = s.toClient(&oldMessage.AdminLock{ + Event: oldEvent.ADMIN_LOCK, + Resource: "file_transfer", + ID: request.ID, + }) + } else { + err = s.toClient(&oldMessage.AdminLock{ + Event: oldEvent.ADMIN_UNLOCK, + Resource: "file_transfer", + ID: request.ID, + }) + } + + if err != nil { + return err + } + } + + return nil + + /* + case: + s.toClient(&oldMessage.AdminTarget{ + Event: oldEvent.ADMIN_BAN, + }) + case: + s.toClient(&oldMessage.AdminTarget{ + Event: oldEvent.ADMIN_KICK, + }) + case: + s.toClient(&oldMessage.AdminTarget{ + Event: oldEvent.ADMIN_MUTE, + }) + case: + s.toClient(&oldMessage.AdminTarget{ + Event: oldEvent.ADMIN_UNMUTE, + }) + */ + + case event.SYSTEM_HEARTBEAT: + return nil + + default: + return fmt.Errorf("unknown event type: %s", data.Event) + } +} diff --git a/server/internal/http/logger.go b/server/internal/http/logger.go index e5b1d643d..f39ad9a79 100644 --- a/server/internal/http/logger.go +++ b/server/internal/http/logger.go @@ -5,16 +5,24 @@ import ( "net/http" "time" - "github.com/go-chi/chi/v5/middleware" + "github.com/go-chi/chi/middleware" "github.com/rs/zerolog" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" ) -type logformatter struct { +type logFormatter struct { logger zerolog.Logger } -func (l *logformatter) NewLogEntry(r *http.Request) middleware.LogEntry { - req := map[string]interface{}{} +func (l *logFormatter) NewLogEntry(r *http.Request) middleware.LogEntry { + // exclude health & metrics from logs + if r.RequestURI == "/health" || r.RequestURI == "/metrics" { + return &nulllog{} + } + + req := map[string]any{} if reqID := middleware.GetReqID(r.Context()); reqID != "" { req["id"] = reqID @@ -32,43 +40,96 @@ func (l *logformatter) NewLogEntry(r *http.Request) middleware.LogEntry { req["agent"] = r.UserAgent() req["uri"] = fmt.Sprintf("%s://%s%s", scheme, r.Host, r.RequestURI) - fields := map[string]interface{}{} - fields["req"] = req + return &logEntry{ + logger: l.logger.With().Interface("req", req).Logger(), + } +} - return &logentry{ - fields: fields, - logger: l.logger, +type logEntry struct { + logger zerolog.Logger + err error + panic *logPanic + session types.Session +} + +type logPanic struct { + message string + stack string +} + +func (e *logEntry) Panic(v any, stack []byte) { + e.panic = &logPanic{ + message: fmt.Sprintf("%+v", v), + stack: string(stack), } } -type logentry struct { - logger zerolog.Logger - fields map[string]interface{} - errors []map[string]interface{} +func (e *logEntry) Error(err error) { + e.err = err } -func (e *logentry) Write(status, bytes int, header http.Header, elapsed time.Duration, extra interface{}) { - res := map[string]interface{}{} +func (e *logEntry) SetSession(session types.Session) { + e.session = session +} + +func (e *logEntry) Write(status, bytes int, header http.Header, elapsed time.Duration, extra any) { + res := map[string]any{} res["time"] = time.Now().UTC().Format(time.RFC1123) res["status"] = status res["bytes"] = bytes res["elapsed"] = float64(elapsed.Nanoseconds()) / 1000000.0 - e.fields["res"] = res - e.fields["module"] = "http" + logger := e.logger.With().Interface("res", res).Logger() + + // add session ID to logs (if exists) + if e.session != nil { + logger = logger.With().Str("session_id", e.session.ID()).Logger() + } + + // handle panic error message + if e.panic != nil { + logger.WithLevel(zerolog.PanicLevel). + Err(e.err). + Str("stack", e.panic.stack). + Msgf("request failed (%d): %s", status, e.panic.message) + return + } + + // handle panic error message + if e.err != nil { + httpErr, ok := e.err.(*utils.HTTPError) + if !ok { + logger.Err(e.err).Msgf("request failed (%d)", status) + return + } + + if httpErr.Message == "" { + httpErr.Message = http.StatusText(httpErr.Code) + } + + var logLevel zerolog.Level + if httpErr.Code < 500 { + logLevel = zerolog.WarnLevel + } else { + logLevel = zerolog.ErrorLevel + } - if len(e.errors) > 0 { - e.fields["errors"] = e.errors - e.logger.Error().Fields(e.fields).Msgf("request failed (%d)", status) - } else { - e.logger.Debug().Fields(e.fields).Msgf("request complete (%d)", status) + message := httpErr.Message + if httpErr.InternalMsg != "" { + message = httpErr.InternalMsg + } + + logger.WithLevel(logLevel).Err(httpErr.InternalErr).Msgf("request failed (%d): %s", status, message) + return } + + logger.Debug().Msgf("request complete (%d)", status) } -func (e *logentry) Panic(v interface{}, stack []byte) { - err := map[string]interface{}{} - err["message"] = fmt.Sprintf("%+v", v) - err["stack"] = string(stack) +type nulllog struct{} - e.errors = append(e.errors, err) +func (e *nulllog) Panic(v any, stack []byte) {} +func (e *nulllog) Error(err error) {} +func (e *nulllog) SetSession(session types.Session) {} +func (e *nulllog) Write(status, bytes int, header http.Header, elapsed time.Duration, extra any) { } diff --git a/server/internal/http/manager.go b/server/internal/http/manager.go new file mode 100644 index 000000000..558794a5b --- /dev/null +++ b/server/internal/http/manager.go @@ -0,0 +1,136 @@ +package http + +import ( + "context" + "net/http" + "os" + + "github.com/prometheus/client_golang/prometheus/promhttp" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + + "m1k1o/neko/internal/config" + "m1k1o/neko/internal/http/legacy" + "m1k1o/neko/pkg/types" +) + +type HttpManagerCtx struct { + logger zerolog.Logger + config *config.Server + router types.Router + http *http.Server +} + +func New(WebSocketManager types.WebSocketManager, ApiManager types.ApiManager, config *config.Server) *HttpManagerCtx { + logger := log.With().Str("module", "http").Logger() + + opts := []RouterOption{ + WithRequestID(), // create a request id for each request + } + + // use real ip if behind proxy + // before logger so it can log the real ip + if config.Proxy { + opts = append(opts, WithRealIP()) + } + + opts = append(opts, + WithLogger(logger), + WithRecoverer(), // recover from panics without crashing server + ) + + if config.HasCors() { + opts = append(opts, WithCORS(config.AllowOrigin)) + } + + if config.PathPrefix != "/" { + opts = append(opts, WithPathPrefix(config.PathPrefix)) + } + + router := newRouter(opts...) + + router.Route("/api", ApiManager.Route) + + router.Get("/api/ws", WebSocketManager.Upgrade(func(r *http.Request) bool { + return config.AllowOrigin(r.Header.Get("Origin")) + })) + + // Legacy handler + legacy.New().Route(router) + + batch := batchHandler{ + Router: router, + PathPrefix: "/api", + Excluded: []string{ + "/api/batch", // do not allow batchception + "/api/ws", + }, + } + router.Post("/api/batch", batch.Handle) + + router.Get("/health", func(w http.ResponseWriter, r *http.Request) error { + _, err := w.Write([]byte("true")) + return err + }) + + if config.Metrics { + router.Get("/metrics", func(w http.ResponseWriter, r *http.Request) error { + promhttp.Handler().ServeHTTP(w, r) + return nil + }) + } + + if config.Static != "" { + fs := http.FileServer(http.Dir(config.Static)) + router.Get("/*", func(w http.ResponseWriter, r *http.Request) error { + _, err := os.Stat(config.Static + r.URL.Path) + if err == nil { + fs.ServeHTTP(w, r) + return nil + } + if os.IsNotExist(err) { + http.NotFound(w, r) + return nil + } + return err + }) + } + + if config.PProf { + pprofHandler(router) + } + + return &HttpManagerCtx{ + logger: logger, + config: config, + router: router, + http: &http.Server{ + Addr: config.Bind, + Handler: router, + }, + } +} + +func (manager *HttpManagerCtx) Start() { + if manager.config.Cert != "" && manager.config.Key != "" { + go func() { + if err := manager.http.ListenAndServeTLS(manager.config.Cert, manager.config.Key); err != http.ErrServerClosed { + manager.logger.Panic().Err(err).Msg("unable to start https server") + } + }() + manager.logger.Info().Msgf("https listening on %s", manager.http.Addr) + } else { + go func() { + if err := manager.http.ListenAndServe(); err != http.ErrServerClosed { + manager.logger.Panic().Err(err).Msg("unable to start http server") + } + }() + manager.logger.Info().Msgf("http listening on %s", manager.http.Addr) + } +} + +func (manager *HttpManagerCtx) Shutdown() error { + manager.logger.Info().Msg("shutdown") + + return manager.http.Shutdown(context.Background()) +} diff --git a/server/internal/http/router.go b/server/internal/http/router.go new file mode 100644 index 000000000..55b0de0be --- /dev/null +++ b/server/internal/http/router.go @@ -0,0 +1,172 @@ +package http + +import ( + "net/http" + + "github.com/go-chi/chi" + "github.com/go-chi/chi/middleware" + "github.com/go-chi/cors" + "github.com/rs/zerolog" + + "m1k1o/neko/pkg/auth" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +type RouterOption func(*router) + +func WithRequestID() RouterOption { + return func(r *router) { + r.chi.Use(middleware.RequestID) + } +} + +func WithLogger(logger zerolog.Logger) RouterOption { + return func(r *router) { + r.chi.Use(middleware.RequestLogger(&logFormatter{logger})) + } +} + +func WithRecoverer() RouterOption { + return func(r *router) { + r.chi.Use(middleware.Recoverer) + } +} + +func WithCORS(allowOrigin func(origin string) bool) RouterOption { + return func(r *router) { + r.chi.Use(cors.Handler(cors.Options{ + AllowOriginFunc: func(r *http.Request, origin string) bool { + return allowOrigin(origin) + }, + AllowedMethods: []string{"GET", "POST", "DELETE", "OPTIONS"}, + AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token"}, + ExposedHeaders: []string{"Link"}, + AllowCredentials: true, + MaxAge: 300, // Maximum value not ignored by any of major browsers + })) + } +} + +func WithPathPrefix(prefix string) RouterOption { + return func(r *router) { + r.chi.Use(func(h http.Handler) http.Handler { + return http.StripPrefix(prefix, h) + }) + } +} + +func WithRealIP() RouterOption { + return func(r *router) { + r.chi.Use(middleware.RealIP) + } +} + +type router struct { + chi chi.Router +} + +func newRouter(opts ...RouterOption) types.Router { + r := &router{chi.NewRouter()} + for _, opt := range opts { + opt(r) + } + return r +} + +func (r *router) Group(fn func(types.Router)) { + r.chi.Group(func(c chi.Router) { + fn(&router{c}) + }) +} + +func (r *router) Route(pattern string, fn func(types.Router)) { + r.chi.Route(pattern, func(c chi.Router) { + fn(&router{c}) + }) +} + +func (r *router) Get(pattern string, fn types.RouterHandler) { + r.chi.Get(pattern, routeHandler(fn)) +} + +func (r *router) Post(pattern string, fn types.RouterHandler) { + r.chi.Post(pattern, routeHandler(fn)) +} + +func (r *router) Put(pattern string, fn types.RouterHandler) { + r.chi.Put(pattern, routeHandler(fn)) +} + +func (r *router) Patch(pattern string, fn types.RouterHandler) { + r.chi.Patch(pattern, routeHandler(fn)) +} + +func (r *router) Delete(pattern string, fn types.RouterHandler) { + r.chi.Delete(pattern, routeHandler(fn)) +} + +func (r *router) With(fn types.MiddlewareHandler) types.Router { + c := r.chi.With(middlewareHandler(fn)) + return &router{c} +} + +func (r *router) Use(fn types.MiddlewareHandler) { + r.chi.Use(middlewareHandler(fn)) +} + +func (r *router) ServeHTTP(w http.ResponseWriter, req *http.Request) { + r.chi.ServeHTTP(w, req) +} + +func errorHandler(err error, w http.ResponseWriter, r *http.Request) { + httpErr, ok := err.(*utils.HTTPError) + if !ok { + httpErr = utils.HttpInternalServerError().WithInternalErr(err) + } + + utils.HttpJsonResponse(w, httpErr.Code, httpErr) +} + +func routeHandler(fn types.RouterHandler) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + // get custom log entry pointer from context + logEntry, _ := r.Context().Value(middleware.LogEntryCtxKey).(*logEntry) + + if err := fn(w, r); err != nil { + logEntry.Error(err) + errorHandler(err, w, r) + } + + // set session if exits + if session, ok := auth.GetSession(r); ok { + logEntry.SetSession(session) + } + } +} + +func middlewareHandler(fn types.MiddlewareHandler) func(http.Handler) http.Handler { + return func(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // get custom log entry pointer from context + logEntry, _ := r.Context().Value(middleware.LogEntryCtxKey).(*logEntry) + + ctx, err := fn(w, r) + if err != nil { + logEntry.Error(err) + errorHandler(err, w, r) + + // set session if exits + if session, ok := auth.GetSession(r); ok { + logEntry.SetSession(session) + } + + return + } + if ctx != nil { + r = r.WithContext(ctx) + } + next.ServeHTTP(w, r) + }) + } +} diff --git a/server/internal/member/file/provider.go b/server/internal/member/file/provider.go new file mode 100644 index 000000000..f5fcc642f --- /dev/null +++ b/server/internal/member/file/provider.go @@ -0,0 +1,204 @@ +package file + +import ( + "crypto/sha256" + "encoding/base64" + "encoding/json" + "io" + "os" + + "m1k1o/neko/pkg/types" +) + +func New(config Config) types.MemberProvider { + return &MemberProviderCtx{ + config: config, + } +} + +type MemberProviderCtx struct { + config Config +} + +func (provider *MemberProviderCtx) hash(password string) string { + // if hash is disabled, return password as plain text + if !provider.config.Hash { + return password + } + + sha256 := sha256.New() + sha256.Write([]byte(password)) + hashedPassword := sha256.Sum(nil) + return base64.StdEncoding.EncodeToString(hashedPassword) +} + +func (provider *MemberProviderCtx) Connect() error { + return nil +} + +func (provider *MemberProviderCtx) Disconnect() error { + return nil +} + +func (provider *MemberProviderCtx) Authenticate(username string, password string) (string, types.MemberProfile, error) { + // id will be also username + id := username + + entry, err := provider.getEntry(id) + if err != nil { + return "", types.MemberProfile{}, err + } + + if entry.Password != provider.hash(password) { + return "", types.MemberProfile{}, types.ErrMemberInvalidPassword + } + + return id, entry.Profile, nil +} + +func (provider *MemberProviderCtx) Insert(username string, password string, profile types.MemberProfile) (string, error) { + // id will be also username + id := username + + entries, err := provider.deserialize() + if err != nil { + return "", err + } + + _, ok := entries[id] + if ok { + return "", types.ErrMemberAlreadyExists + } + + entries[id] = MemberEntry{ + Password: provider.hash(password), + Profile: profile, + } + + return id, provider.serialize(entries) +} + +func (provider *MemberProviderCtx) UpdateProfile(id string, profile types.MemberProfile) error { + entries, err := provider.deserialize() + if err != nil { + return err + } + + entry, ok := entries[id] + if !ok { + return types.ErrMemberDoesNotExist + } + + entry.Profile = profile + entries[id] = entry + + return provider.serialize(entries) +} + +func (provider *MemberProviderCtx) UpdatePassword(id string, password string) error { + entries, err := provider.deserialize() + if err != nil { + return err + } + + entry, ok := entries[id] + if !ok { + return types.ErrMemberDoesNotExist + } + + entry.Password = provider.hash(password) + entries[id] = entry + + return provider.serialize(entries) +} + +func (provider *MemberProviderCtx) Select(id string) (types.MemberProfile, error) { + entry, err := provider.getEntry(id) + if err != nil { + return types.MemberProfile{}, err + } + + return entry.Profile, nil +} + +func (provider *MemberProviderCtx) SelectAll(limit int, offset int) (map[string]types.MemberProfile, error) { + profiles := map[string]types.MemberProfile{} + + entries, err := provider.deserialize() + if err != nil { + return profiles, err + } + + i := 0 + for id, entry := range entries { + if i >= offset && (limit == 0 || i < offset+limit) { + profiles[id] = entry.Profile + } + + i = i + 1 + } + + return profiles, nil +} + +func (provider *MemberProviderCtx) Delete(id string) error { + entries, err := provider.deserialize() + if err != nil { + return err + } + + _, ok := entries[id] + if !ok { + return types.ErrMemberDoesNotExist + } + + delete(entries, id) + + return provider.serialize(entries) +} + +func (provider *MemberProviderCtx) deserialize() (map[string]MemberEntry, error) { + file, err := os.OpenFile(provider.config.Path, os.O_RDONLY|os.O_CREATE, os.ModePerm) + if err != nil { + return nil, err + } + + raw, err := io.ReadAll(file) + if err != nil { + return nil, err + } + + if len(raw) == 0 { + return map[string]MemberEntry{}, nil + } + + var entries map[string]MemberEntry + if err := json.Unmarshal([]byte(raw), &entries); err != nil { + return nil, err + } + + return entries, nil +} + +func (provider *MemberProviderCtx) getEntry(id string) (MemberEntry, error) { + entries, err := provider.deserialize() + if err != nil { + return MemberEntry{}, err + } + + entry, ok := entries[id] + if !ok { + return MemberEntry{}, types.ErrMemberDoesNotExist + } + + return entry, nil +} + +func (provider *MemberProviderCtx) serialize(data map[string]MemberEntry) error { + raw, err := json.Marshal(data) + if err != nil { + return err + } + + return os.WriteFile(provider.config.Path, raw, os.ModePerm) +} diff --git a/server/internal/member/file/provider_test.go b/server/internal/member/file/provider_test.go new file mode 100644 index 000000000..fc1e461bc --- /dev/null +++ b/server/internal/member/file/provider_test.go @@ -0,0 +1,48 @@ +package file + +import ( + "encoding/json" + "testing" + + "m1k1o/neko/pkg/utils" +) + +// Ensure that hashes are the same after encoding and decoding using json +func TestMemberProviderCtx_hash(t *testing.T) { + provider := &MemberProviderCtx{ + config: Config{ + Hash: true, + }, + } + + // generate random strings + passwords := []string{} + for i := 0; i < 10; i++ { + password, err := utils.NewUID(32) + if err != nil { + t.Errorf("utils.NewUID() returned error: %s", err) + } + passwords = append(passwords, password) + } + + for _, password := range passwords { + hashedPassword := provider.hash(password) + + // json encode password hash + hashedPasswordJSON, err := json.Marshal(hashedPassword) + if err != nil { + t.Errorf("json.Marshal() returned error: %s", err) + } + + // json decode password hash json + var hashedPasswordStr string + err = json.Unmarshal(hashedPasswordJSON, &hashedPasswordStr) + if err != nil { + t.Errorf("json.Unmarshal() returned error: %s", err) + } + + if hashedPasswordStr != hashedPassword { + t.Errorf("hashedPasswordStr: %s != hashedPassword: %s", hashedPasswordStr, hashedPassword) + } + } +} diff --git a/server/internal/member/file/types.go b/server/internal/member/file/types.go new file mode 100644 index 000000000..979aa64bf --- /dev/null +++ b/server/internal/member/file/types.go @@ -0,0 +1,15 @@ +package file + +import ( + "m1k1o/neko/pkg/types" +) + +type MemberEntry struct { + Password string `json:"password"` + Profile types.MemberProfile `json:"profile"` +} + +type Config struct { + Path string + Hash bool +} diff --git a/server/internal/member/manager.go b/server/internal/member/manager.go new file mode 100644 index 000000000..86f23ee5f --- /dev/null +++ b/server/internal/member/manager.go @@ -0,0 +1,168 @@ +package member + +import ( + "errors" + "sync" + + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + + "m1k1o/neko/internal/config" + "m1k1o/neko/internal/member/file" + "m1k1o/neko/internal/member/multiuser" + "m1k1o/neko/internal/member/noauth" + "m1k1o/neko/internal/member/object" + "m1k1o/neko/pkg/types" +) + +func New(sessions types.SessionManager, config *config.Member) *MemberManagerCtx { + manager := &MemberManagerCtx{ + logger: log.With().Str("module", "member").Logger(), + sessions: sessions, + config: config, + } + + switch config.Provider { + case "file": + manager.provider = file.New(config.File) + case "object": + manager.provider = object.New(config.Object) + case "multiuser": + manager.provider = multiuser.New(config.Multiuser) + case "noauth": + fallthrough + default: + manager.provider = noauth.New() + } + + return manager +} + +type MemberManagerCtx struct { + logger zerolog.Logger + sessions types.SessionManager + config *config.Member + providerMu sync.Mutex + provider types.MemberProvider + loginMu sync.Mutex +} + +func (manager *MemberManagerCtx) Connect() error { + manager.providerMu.Lock() + defer manager.providerMu.Unlock() + + return manager.provider.Connect() +} + +func (manager *MemberManagerCtx) Disconnect() error { + manager.providerMu.Lock() + defer manager.providerMu.Unlock() + + return manager.provider.Disconnect() +} + +func (manager *MemberManagerCtx) Authenticate(username string, password string) (string, types.MemberProfile, error) { + manager.providerMu.Lock() + defer manager.providerMu.Unlock() + + return manager.provider.Authenticate(username, password) +} + +func (manager *MemberManagerCtx) Insert(username string, password string, profile types.MemberProfile) (string, error) { + manager.providerMu.Lock() + defer manager.providerMu.Unlock() + + return manager.provider.Insert(username, password, profile) +} + +func (manager *MemberManagerCtx) Select(id string) (types.MemberProfile, error) { + manager.providerMu.Lock() + defer manager.providerMu.Unlock() + + // get primarily from corresponding session, if exists + session, ok := manager.sessions.Get(id) + if ok { + return session.Profile(), nil + } + + return manager.provider.Select(id) +} + +func (manager *MemberManagerCtx) SelectAll(limit int, offset int) (map[string]types.MemberProfile, error) { + manager.providerMu.Lock() + defer manager.providerMu.Unlock() + + return manager.provider.SelectAll(limit, offset) +} + +func (manager *MemberManagerCtx) UpdateProfile(id string, profile types.MemberProfile) error { + manager.providerMu.Lock() + defer manager.providerMu.Unlock() + + // update corresponding session, if exists + err := manager.sessions.Update(id, profile) + if err != nil && !errors.Is(err, types.ErrSessionNotFound) { + manager.logger.Err(err).Msg("error while updating session") + } + + return manager.provider.UpdateProfile(id, profile) +} + +func (manager *MemberManagerCtx) UpdatePassword(id string, password string) error { + manager.providerMu.Lock() + defer manager.providerMu.Unlock() + + return manager.provider.UpdatePassword(id, password) +} + +func (manager *MemberManagerCtx) Delete(id string) error { + manager.providerMu.Lock() + defer manager.providerMu.Unlock() + + // destroy corresponding session, if exists + err := manager.sessions.Delete(id) + if err != nil && !errors.Is(err, types.ErrSessionNotFound) { + manager.logger.Err(err).Msg("error while deleting session") + } + + return manager.provider.Delete(id) +} + +// +// member -> session +// + +func (manager *MemberManagerCtx) Login(username string, password string) (types.Session, string, error) { + manager.loginMu.Lock() + defer manager.loginMu.Unlock() + + id, profile, err := manager.provider.Authenticate(username, password) + if err != nil { + return nil, "", err + } + + if !profile.IsAdmin && manager.sessions.Settings().LockedLogins { + return nil, "", types.ErrSessionLoginsLocked + } + + session, ok := manager.sessions.Get(id) + if ok { + if session.State().IsConnected { + return nil, "", types.ErrSessionAlreadyConnected + } + + // TODO: Replace session. + if err := manager.sessions.Delete(id); err != nil { + return nil, "", err + } + } + + return manager.sessions.Create(id, profile) +} + +func (manager *MemberManagerCtx) Logout(id string) error { + manager.loginMu.Lock() + defer manager.loginMu.Unlock() + + return manager.sessions.Delete(id) +} diff --git a/server/internal/member/multiuser/provider.go b/server/internal/member/multiuser/provider.go new file mode 100644 index 000000000..fe1f258e1 --- /dev/null +++ b/server/internal/member/multiuser/provider.go @@ -0,0 +1,82 @@ +package multiuser + +import ( + "errors" + "fmt" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +func New(config Config) types.MemberProvider { + return &MemberProviderCtx{ + config: config, + } +} + +type MemberProviderCtx struct { + config Config +} + +func (provider *MemberProviderCtx) Connect() error { + return nil +} + +func (provider *MemberProviderCtx) Disconnect() error { + return nil +} + +func (provider *MemberProviderCtx) Authenticate(username string, password string) (string, types.MemberProfile, error) { + // generate random token + token, err := utils.NewUID(5) + if err != nil { + return "", types.MemberProfile{}, err + } + + // id is username with token + id := fmt.Sprintf("%s-%s", username, token) + + // if logged in as administrator + if provider.config.AdminPassword == password { + profile := provider.config.AdminProfile + if profile.Name == "" { + profile.Name = username + } + return id, profile, nil + } + + // if logged in as user + if provider.config.UserPassword == password { + profile := provider.config.UserProfile + if profile.Name == "" { + profile.Name = username + } + return id, profile, nil + } + + return "", types.MemberProfile{}, types.ErrMemberInvalidPassword +} + +func (provider *MemberProviderCtx) Insert(username string, password string, profile types.MemberProfile) (string, error) { + return "", errors.New("new user is created on first login in multiuser mode") +} + +func (provider *MemberProviderCtx) UpdateProfile(id string, profile types.MemberProfile) error { + return nil +} + +func (provider *MemberProviderCtx) UpdatePassword(id string, password string) error { + return errors.New("password can only be modified in config while in multiuser mode") +} + +func (provider *MemberProviderCtx) Select(id string) (types.MemberProfile, error) { + return types.MemberProfile{}, errors.New("cannot select user in multiuser mode") +} + +func (provider *MemberProviderCtx) SelectAll(limit int, offset int) (map[string]types.MemberProfile, error) { + return map[string]types.MemberProfile{}, nil +} + +func (provider *MemberProviderCtx) Delete(id string) error { + return errors.New("cannot delete user in multiuser mode") +} diff --git a/server/internal/member/multiuser/types.go b/server/internal/member/multiuser/types.go new file mode 100644 index 000000000..980209629 --- /dev/null +++ b/server/internal/member/multiuser/types.go @@ -0,0 +1,10 @@ +package multiuser + +import "m1k1o/neko/pkg/types" + +type Config struct { + AdminPassword string + UserPassword string + AdminProfile types.MemberProfile + UserProfile types.MemberProfile +} diff --git a/server/internal/member/noauth/provider.go b/server/internal/member/noauth/provider.go new file mode 100644 index 000000000..dc664c4e1 --- /dev/null +++ b/server/internal/member/noauth/provider.go @@ -0,0 +1,75 @@ +package noauth + +import ( + "errors" + "fmt" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +func New() types.MemberProvider { + return &MemberProviderCtx{ + profile: types.MemberProfile{ + IsAdmin: true, + CanLogin: true, + CanConnect: true, + CanWatch: true, + CanHost: true, + CanShareMedia: true, + CanAccessClipboard: true, + SendsInactiveCursor: true, + CanSeeInactiveCursors: true, + }, + } +} + +type MemberProviderCtx struct { + profile types.MemberProfile +} + +func (provider *MemberProviderCtx) Connect() error { + return nil +} + +func (provider *MemberProviderCtx) Disconnect() error { + return nil +} + +func (provider *MemberProviderCtx) Authenticate(username string, password string) (string, types.MemberProfile, error) { + // generate random token + token, err := utils.NewUID(5) + if err != nil { + return "", types.MemberProfile{}, err + } + + // id is username with token + id := fmt.Sprintf("%s-%s", username, token) + + provider.profile.Name = username + return id, provider.profile, nil +} + +func (provider *MemberProviderCtx) Insert(username string, password string, profile types.MemberProfile) (string, error) { + return "", errors.New("new user is created on first login in noauth mode") +} + +func (provider *MemberProviderCtx) UpdateProfile(id string, profile types.MemberProfile) error { + return nil +} + +func (provider *MemberProviderCtx) UpdatePassword(id string, password string) error { + return errors.New("noauth mode does not have password") +} + +func (provider *MemberProviderCtx) Select(id string) (types.MemberProfile, error) { + return types.MemberProfile{}, errors.New("cannot select user in noauth mode") +} + +func (provider *MemberProviderCtx) SelectAll(limit int, offset int) (map[string]types.MemberProfile, error) { + return map[string]types.MemberProfile{}, nil +} + +func (provider *MemberProviderCtx) Delete(id string) error { + return errors.New("cannot delete user in noauth mode") +} diff --git a/server/internal/member/object/provider.go b/server/internal/member/object/provider.go new file mode 100644 index 000000000..e2f0c6498 --- /dev/null +++ b/server/internal/member/object/provider.go @@ -0,0 +1,124 @@ +package object + +import ( + "m1k1o/neko/pkg/types" +) + +func New(config Config) types.MemberProvider { + return &MemberProviderCtx{ + config: config, + entries: make(map[string]*memberEntry), + } +} + +type MemberProviderCtx struct { + config Config + entries map[string]*memberEntry +} + +func (provider *MemberProviderCtx) Connect() error { + var err error + + for _, entry := range provider.config.Users { + _, err = provider.Insert(entry.Username, entry.Password, entry.Profile) + } + + return err +} + +func (provider *MemberProviderCtx) Disconnect() error { + return nil +} + +func (provider *MemberProviderCtx) Authenticate(username string, password string) (string, types.MemberProfile, error) { + // id will be also username + id := username + + entry, ok := provider.entries[id] + if !ok { + return "", types.MemberProfile{}, types.ErrMemberDoesNotExist + } + + // TODO: Use hash function. + if !entry.CheckPassword(password) { + return "", types.MemberProfile{}, types.ErrMemberInvalidPassword + } + + return id, entry.profile, nil +} + +func (provider *MemberProviderCtx) Insert(username string, password string, profile types.MemberProfile) (string, error) { + // id will be also username + id := username + + _, ok := provider.entries[id] + if ok { + return "", types.ErrMemberAlreadyExists + } + + provider.entries[id] = &memberEntry{ + // TODO: Use hash function. + password: password, + profile: profile, + } + + return id, nil +} + +func (provider *MemberProviderCtx) UpdateProfile(id string, profile types.MemberProfile) error { + entry, ok := provider.entries[id] + if !ok { + return types.ErrMemberDoesNotExist + } + + entry.profile = profile + + return nil +} + +func (provider *MemberProviderCtx) UpdatePassword(id string, password string) error { + entry, ok := provider.entries[id] + if !ok { + return types.ErrMemberDoesNotExist + } + + // TODO: Use hash function. + entry.password = password + + return nil +} + +func (provider *MemberProviderCtx) Select(id string) (types.MemberProfile, error) { + entry, ok := provider.entries[id] + if !ok { + return types.MemberProfile{}, types.ErrMemberDoesNotExist + } + + return entry.profile, nil +} + +func (provider *MemberProviderCtx) SelectAll(limit int, offset int) (map[string]types.MemberProfile, error) { + profiles := make(map[string]types.MemberProfile) + + i := 0 + for id, entry := range provider.entries { + if i >= offset && (limit == 0 || i < offset+limit) { + profiles[id] = entry.profile + } + + i = i + 1 + } + + return profiles, nil +} + +func (provider *MemberProviderCtx) Delete(id string) error { + _, ok := provider.entries[id] + if !ok { + return types.ErrMemberDoesNotExist + } + + delete(provider.entries, id) + + return nil +} diff --git a/server/internal/member/object/types.go b/server/internal/member/object/types.go new file mode 100644 index 000000000..ab7096d71 --- /dev/null +++ b/server/internal/member/object/types.go @@ -0,0 +1,24 @@ +package object + +import ( + "m1k1o/neko/pkg/types" +) + +type memberEntry struct { + password string + profile types.MemberProfile +} + +func (m *memberEntry) CheckPassword(password string) bool { + return m.password == password +} + +type User struct { + Username string + Password string + Profile types.MemberProfile +} + +type Config struct { + Users []User +} diff --git a/server/internal/plugins/chat/config.go b/server/internal/plugins/chat/config.go new file mode 100644 index 000000000..dd24835cb --- /dev/null +++ b/server/internal/plugins/chat/config.go @@ -0,0 +1,23 @@ +package chat + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +type Config struct { + Enabled bool +} + +func (Config) Init(cmd *cobra.Command) error { + cmd.PersistentFlags().Bool("chat.enabled", true, "whether to enable chat plugin") + if err := viper.BindPFlag("chat.enabled", cmd.PersistentFlags().Lookup("chat.enabled")); err != nil { + return err + } + + return nil +} + +func (s *Config) Set() { + s.Enabled = viper.GetBool("chat.enabled") +} diff --git a/server/internal/plugins/chat/manager.go b/server/internal/plugins/chat/manager.go new file mode 100644 index 000000000..370697257 --- /dev/null +++ b/server/internal/plugins/chat/manager.go @@ -0,0 +1,162 @@ +package chat + +import ( + "encoding/json" + "errors" + "fmt" + "net/http" + "time" + + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + + "m1k1o/neko/pkg/auth" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +func NewManager( + sessions types.SessionManager, + config *Config, +) *Manager { + logger := log.With().Str("module", "chat").Logger() + + return &Manager{ + logger: logger, + config: config, + sessions: sessions, + } +} + +type Manager struct { + logger zerolog.Logger + config *Config + sessions types.SessionManager +} + +type Settings struct { + CanSend bool `json:"can_send" mapstructure:"can_send"` + CanReceive bool `json:"can_receive" mapstructure:"can_receive"` +} + +func (m *Manager) settingsForSession(session types.Session) (Settings, error) { + settings := Settings{ + CanSend: true, // defaults to true + CanReceive: true, // defaults to true + } + err := m.sessions.Settings().Plugins.Unmarshal(PluginName, &settings) + if err != nil && !errors.Is(err, types.ErrPluginSettingsNotFound) { + return Settings{}, fmt.Errorf("unable to unmarshal %s plugin settings from global settings: %w", PluginName, err) + } + + profile := Settings{ + CanSend: true, // defaults to true + CanReceive: true, // defaults to true + } + + err = session.Profile().Plugins.Unmarshal(PluginName, &profile) + if err != nil && !errors.Is(err, types.ErrPluginSettingsNotFound) { + return Settings{}, fmt.Errorf("unable to unmarshal %s plugin settings from profile: %w", PluginName, err) + } + + return Settings{ + CanSend: m.config.Enabled && (settings.CanSend || session.Profile().IsAdmin) && profile.CanSend, + CanReceive: m.config.Enabled && (settings.CanReceive || session.Profile().IsAdmin) && profile.CanReceive, + }, nil +} + +func (m *Manager) sendMessage(session types.Session, content Content) { + now := time.Now() + + // get all sessions that have chat enabled + var sessions []types.Session + m.sessions.Range(func(s types.Session) bool { + if settings, err := m.settingsForSession(s); err == nil && settings.CanReceive { + sessions = append(sessions, s) + } + // continue iteration over all sessions + return true + }) + + // send content to all sessions + for _, s := range sessions { + s.Send(CHAT_MESSAGE, Message{ + ID: session.ID(), + Created: now, + Content: content, + }) + } +} + +func (m *Manager) Start() error { + // send init message once a user connects + m.sessions.OnConnected(func(session types.Session) { + session.Send(CHAT_INIT, Init{ + Enabled: m.config.Enabled, + }) + }) + + return nil +} + +func (m *Manager) Shutdown() error { + return nil +} + +func (m *Manager) Route(r types.Router) { + r.With(auth.AdminsOnly).Post("/", m.sendMessageHandler) +} + +func (m *Manager) WebSocketHandler(session types.Session, msg types.WebSocketMessage) bool { + switch msg.Event { + case CHAT_MESSAGE: + var content Content + if err := json.Unmarshal(msg.Payload, &content); err != nil { + m.logger.Error().Err(err).Msg("failed to unmarshal chat message") + // we processed the message, return true + return true + } + + settings, err := m.settingsForSession(session) + if err != nil { + m.logger.Error().Err(err).Msg("error checking chat permissions for this session") + // we processed the message, return true + return true + } + if !settings.CanSend { + m.logger.Warn().Msg("not allowed to send chat messages") + // we processed the message, return true + return true + } + + m.sendMessage(session, content) + return true + } + return false +} + +func (m *Manager) sendMessageHandler(w http.ResponseWriter, r *http.Request) error { + session, ok := auth.GetSession(r) + if !ok { + return utils.HttpUnauthorized("session not found") + } + + settings, err := m.settingsForSession(session) + if err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + Msg("error checking chat permissions for this session") + } + + if !settings.CanSend { + return utils.HttpForbidden("not allowed to send chat messages") + } + + content := Content{} + if err := utils.HttpJsonRequest(w, r, &content); err != nil { + return err + } + + m.sendMessage(session, content) + return utils.HttpSuccess(w) +} diff --git a/server/internal/plugins/chat/plugin.go b/server/internal/plugins/chat/plugin.go new file mode 100644 index 000000000..8e278ccc0 --- /dev/null +++ b/server/internal/plugins/chat/plugin.go @@ -0,0 +1,35 @@ +package chat + +import ( + "m1k1o/neko/pkg/types" +) + +type Plugin struct { + config *Config + manager *Manager +} + +func NewPlugin() *Plugin { + return &Plugin{ + config: &Config{}, + } +} + +func (p *Plugin) Name() string { + return PluginName +} + +func (p *Plugin) Config() types.PluginConfig { + return p.config +} + +func (p *Plugin) Start(m types.PluginManagers) error { + p.manager = NewManager(m.SessionManager, p.config) + m.ApiManager.AddRouter("/chat", p.manager.Route) + m.WebSocketManager.AddHandler(p.manager.WebSocketHandler) + return p.manager.Start() +} + +func (p *Plugin) Shutdown() error { + return p.manager.Shutdown() +} diff --git a/server/internal/plugins/chat/types.go b/server/internal/plugins/chat/types.go new file mode 100644 index 000000000..33e9d11aa --- /dev/null +++ b/server/internal/plugins/chat/types.go @@ -0,0 +1,24 @@ +package chat + +import "time" + +const PluginName = "chat" + +const ( + CHAT_INIT = "chat/init" + CHAT_MESSAGE = "chat/message" +) + +type Init struct { + Enabled bool `json:"enabled"` +} + +type Content struct { + Text string `json:"text"` +} + +type Message struct { + ID string `json:"id"` + Created time.Time `json:"created"` + Content Content `json:"content"` +} diff --git a/server/internal/plugins/dependency.go b/server/internal/plugins/dependency.go new file mode 100644 index 000000000..ec4524ca6 --- /dev/null +++ b/server/internal/plugins/dependency.go @@ -0,0 +1,133 @@ +package plugins + +import ( + "fmt" + + "github.com/rs/zerolog" + + "m1k1o/neko/pkg/types" +) + +type dependency struct { + plugin types.Plugin + dependsOn []*dependency + invoked bool + logger zerolog.Logger +} + +func (a *dependency) findPlugin(name string) (*dependency, bool) { + if a == nil { + return nil, false + } + + if a.plugin.Name() == name { + return a, true + } + + for _, dep := range a.dependsOn { + plug, ok := dep.findPlugin(name) + if ok { + return plug, true + } + } + + return nil, false +} + +func (a *dependency) startPlugin(pm types.PluginManagers) error { + if a.invoked { + return nil + } + + a.invoked = true + + for _, do := range a.dependsOn { + if err := do.startPlugin(pm); err != nil { + return fmt.Errorf("plugin's '%s' dependency: %w", a.plugin.Name(), err) + } + } + + err := a.plugin.Start(pm) + if err != nil { + return fmt.Errorf("plugin '%s' failed to start: %w", a.plugin.Name(), err) + } + + a.logger.Info().Str("plugin", a.plugin.Name()).Msg("plugin started") + return nil +} + +type dependiencies struct { + deps map[string]*dependency + logger zerolog.Logger +} + +func (d *dependiencies) addPlugin(plugin types.Plugin) error { + pluginName := plugin.Name() + + plug, ok := d.deps[pluginName] + if !ok { + plug = &dependency{} + } else if plug.plugin != nil { + return fmt.Errorf("plugin '%s' already added", pluginName) + } + + plug.plugin = plugin + plug.logger = d.logger + d.deps[pluginName] = plug + + dplug, ok := plugin.(types.DependablePlugin) + if !ok { + return nil + } + + for _, depName := range dplug.DependsOn() { + dependsOn, ok := d.deps[depName] + if !ok { + dependsOn = &dependency{} + } else if dependsOn.plugin != nil { + // if there is a cyclical dependency, break it and return error + if tdep, ok := dependsOn.findPlugin(pluginName); ok { + dependsOn.dependsOn = nil + delete(d.deps, pluginName) + return fmt.Errorf("cyclical dependency detected: '%s' <-> '%s'", pluginName, tdep.plugin.Name()) + } + } + + plug.dependsOn = append(plug.dependsOn, dependsOn) + d.deps[depName] = dependsOn + } + + return nil +} + +func (d *dependiencies) findPlugin(name string) (*dependency, bool) { + for _, dep := range d.deps { + plug, ok := dep.findPlugin(name) + if ok { + return plug, true + } + } + return nil, false +} + +func (d *dependiencies) start(pm types.PluginManagers) error { + for _, dep := range d.deps { + if err := dep.startPlugin(pm); err != nil { + return err + } + } + return nil +} + +func (d *dependiencies) forEach(f func(*dependency) error) error { + for _, dep := range d.deps { + if err := f(dep); err != nil { + return err + } + } + return nil +} + +func (d *dependiencies) len() int { + return len(d.deps) +} diff --git a/server/internal/plugins/dependency_test.go b/server/internal/plugins/dependency_test.go new file mode 100644 index 000000000..dbeb959a7 --- /dev/null +++ b/server/internal/plugins/dependency_test.go @@ -0,0 +1,630 @@ +package plugins + +import ( + "reflect" + "testing" + + "m1k1o/neko/pkg/types" +) + +func Test_deps_addPlugin(t *testing.T) { + type args struct { + p []types.Plugin + } + tests := []struct { + name string + args args + want map[string]*dependency + skipRun bool + wantErr1 bool + wantErr2 bool + }{ + { + name: "three plugins - no dependencies", + args: args{ + p: []types.Plugin{ + &dummyPlugin{name: "first"}, + &dummyPlugin{name: "second"}, + &dummyPlugin{name: "third"}, + }, + }, + want: map[string]*dependency{ + "first": { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: true, + dependsOn: nil, + }, + "second": { + plugin: &dummyPlugin{name: "second", idx: 0}, + invoked: true, + dependsOn: nil, + }, + "third": { + plugin: &dummyPlugin{name: "third", idx: 0}, + invoked: true, + dependsOn: nil, + }, + }, + }, { + name: "three plugins - one dependency", + args: args{ + p: []types.Plugin{ + &dummyPlugin{name: "third", dep: []string{"second"}}, + &dummyPlugin{name: "first"}, + &dummyPlugin{name: "second"}, + }, + }, + want: map[string]*dependency{ + "first": { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: true, + dependsOn: nil, + }, + "second": { + plugin: &dummyPlugin{name: "second", idx: 0}, + invoked: true, + dependsOn: nil, + }, + "third": { + plugin: &dummyPlugin{name: "third", dep: []string{"second"}, idx: 1}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "second", idx: 0}, + invoked: true, + dependsOn: nil, + }, + }, + }, + }, + }, { + name: "three plugins - one double dependency", + args: args{ + p: []types.Plugin{ + &dummyPlugin{name: "third", dep: []string{"first", "second"}}, + &dummyPlugin{name: "first"}, + &dummyPlugin{name: "second"}, + }, + }, + want: map[string]*dependency{ + "first": { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: true, + dependsOn: nil, + }, + "second": { + plugin: &dummyPlugin{name: "second", idx: 0}, + invoked: true, + dependsOn: nil, + }, + "third": { + plugin: &dummyPlugin{name: "third", dep: []string{"first", "second"}, idx: 1}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: true, + dependsOn: nil, + }, + { + plugin: &dummyPlugin{name: "second", idx: 0}, + invoked: true, + dependsOn: nil, + }, + }, + }, + }, + }, { + name: "three plugins - two dependencies", + args: args{ + p: []types.Plugin{ + &dummyPlugin{name: "third", dep: []string{"first"}}, + &dummyPlugin{name: "first"}, + &dummyPlugin{name: "second", dep: []string{"first"}}, + }, + }, + want: map[string]*dependency{ + "first": { + plugin: &dummyPlugin{name: "first"}, + invoked: false, + dependsOn: nil, + }, + "third": { + plugin: &dummyPlugin{name: "third", dep: []string{"first"}}, + invoked: false, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "first"}, + invoked: false, + dependsOn: nil, + }, + }, + }, + "second": { + plugin: &dummyPlugin{name: "second", dep: []string{"first"}}, + invoked: false, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "first"}, + invoked: false, + dependsOn: nil, + }, + }, + }, + }, + skipRun: true, + }, { + name: "three plugins - three dependencies", + args: args{ + p: []types.Plugin{ + &dummyPlugin{name: "third", dep: []string{"second"}}, + &dummyPlugin{name: "first"}, + &dummyPlugin{name: "second", dep: []string{"first"}}, + }, + }, + want: map[string]*dependency{ + "first": { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: true, + dependsOn: nil, + }, + "second": { + plugin: &dummyPlugin{name: "second", dep: []string{"first"}, idx: 1}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: true, + dependsOn: nil, + }, + }, + }, + "third": { + plugin: &dummyPlugin{name: "third", dep: []string{"second"}, idx: 2}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "second", dep: []string{"first"}, idx: 1}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: true, + dependsOn: nil, + }, + }, + }, + }, + }, + }, + }, { + name: "four plugins - added in reverse order, with dependencies", + args: args{ + p: []types.Plugin{ + &dummyPlugin{name: "forth", dep: []string{"third"}}, + &dummyPlugin{name: "third", dep: []string{"second"}}, + &dummyPlugin{name: "second", dep: []string{"first"}}, + &dummyPlugin{name: "first"}, + }, + }, + want: map[string]*dependency{ + "first": { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: false, + dependsOn: nil, + }, + "second": { + plugin: &dummyPlugin{name: "second", dep: []string{"first"}, idx: 0}, + invoked: false, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: false, + dependsOn: nil, + }, + }, + }, + "third": { + plugin: &dummyPlugin{name: "third", dep: []string{"second"}, idx: 0}, + invoked: false, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "second", dep: []string{"first"}, idx: 0}, + invoked: false, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: false, + dependsOn: nil, + }, + }, + }, + }, + }, + "forth": { + plugin: &dummyPlugin{name: "forth", dep: []string{"third"}, idx: 0}, + invoked: false, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "third", dep: []string{"second"}, idx: 0}, + invoked: false, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "second", dep: []string{"first"}, idx: 0}, + invoked: false, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: false, + dependsOn: nil, + }, + }, + }, + }, + }, + }, + }, + }, + skipRun: true, + }, { + name: "four plugins - two double dependencies", + args: args{ + p: []types.Plugin{ + &dummyPlugin{name: "forth", dep: []string{"first", "third"}}, + &dummyPlugin{name: "third", dep: []string{"first", "second"}}, + &dummyPlugin{name: "second"}, + &dummyPlugin{name: "first"}, + }, + }, + want: map[string]*dependency{ + "first": { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: true, + dependsOn: nil, + }, + "second": { + plugin: &dummyPlugin{name: "second", idx: 0}, + invoked: true, + dependsOn: nil, + }, + "third": { + plugin: &dummyPlugin{name: "third", dep: []string{"first", "second"}, idx: 1}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: true, + dependsOn: nil, + }, + { + plugin: &dummyPlugin{name: "second", idx: 0}, + invoked: true, + dependsOn: nil, + }, + }, + }, + "forth": { + plugin: &dummyPlugin{name: "forth", dep: []string{"first", "third"}, idx: 2}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: true, + dependsOn: nil, + }, + { + plugin: &dummyPlugin{name: "third", dep: []string{"first", "second"}, idx: 1}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "first", idx: 0}, + invoked: true, + dependsOn: nil, + }, + { + plugin: &dummyPlugin{name: "second", idx: 0}, + invoked: true, + dependsOn: nil, + }, + }, + }, + }, + }, + }, + }, { + // So, when we have plugin A in the list and want to add plugin C we can't determine the proper order without + // resolving their direct dependiencies first: + // + // Can be C->D->A->B if D depends on A + // + // So to do it properly I would imagine tht we need to resolve all direct dependiencies first and build multiple lists: + // + // i.e. A->B->C D F->G + // + // and then join these lists in any order. + name: "add indirect dependency CDAB", + args: args{ + p: []types.Plugin{ + &dummyPlugin{name: "A", dep: []string{"B"}}, + &dummyPlugin{name: "C", dep: []string{"D"}}, + &dummyPlugin{name: "B"}, + &dummyPlugin{name: "D", dep: []string{"A"}}, + }, + }, + want: map[string]*dependency{ + "B": { + plugin: &dummyPlugin{name: "B", idx: 0}, + invoked: true, + dependsOn: nil, + }, + "A": { + plugin: &dummyPlugin{name: "A", dep: []string{"B"}, idx: 1}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "B", idx: 0}, + invoked: true, + dependsOn: nil, + }, + }, + }, + "D": { + plugin: &dummyPlugin{name: "D", dep: []string{"A"}, idx: 2}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "A", dep: []string{"B"}, idx: 1}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "B", idx: 0}, + invoked: true, + dependsOn: nil, + }, + }, + }, + }, + }, + "C": { + plugin: &dummyPlugin{name: "C", dep: []string{"D"}, idx: 3}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "D", dep: []string{"A"}, idx: 2}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "A", dep: []string{"B"}, idx: 1}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "B", idx: 0}, + invoked: true, + dependsOn: nil, + }, + }, + }, + }, + }, + }, + }, + }, + }, { + // So, when we have plugin A in the list and want to add plugin C we can't determine the proper order without + // resolving their direct dependiencies first: + // + // Can be A->B->C->D (in this test) if B depends on C + // + // So to do it properly I would imagine tht we need to resolve all direct dependiencies first and build multiple lists: + // + // i.e. A->B->C D F->G + // + // and then join these lists in any order. + name: "add indirect dependency ABCD", + args: args{ + p: []types.Plugin{ + &dummyPlugin{name: "C", dep: []string{"D"}}, + &dummyPlugin{name: "D"}, + &dummyPlugin{name: "B", dep: []string{"C"}}, + &dummyPlugin{name: "A", dep: []string{"B"}}, + }, + }, + want: map[string]*dependency{ + "D": { + plugin: &dummyPlugin{name: "D", idx: 0}, + invoked: true, + dependsOn: nil, + }, + "C": { + plugin: &dummyPlugin{name: "C", dep: []string{"D"}, idx: 1}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "D", idx: 0}, + invoked: true, + dependsOn: nil, + }, + }, + }, + "B": { + plugin: &dummyPlugin{name: "B", dep: []string{"C"}, idx: 2}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "C", dep: []string{"D"}, idx: 1}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "D", idx: 0}, + invoked: true, + dependsOn: nil, + }, + }, + }, + }, + }, + "A": { + plugin: &dummyPlugin{name: "A", dep: []string{"B"}, idx: 3}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "B", dep: []string{"C"}, idx: 2}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "C", dep: []string{"D"}, idx: 1}, + invoked: true, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "D", idx: 0}, + invoked: true, + dependsOn: nil, + }, + }, + }, + }, + }, + }, + }, + }, + }, { + name: "add duplicate plugin", + args: args{ + p: []types.Plugin{ + &dummyPlugin{name: "first"}, + &dummyPlugin{name: "first"}, + }, + }, + want: map[string]*dependency{ + "first": {plugin: &dummyPlugin{name: "first", idx: 0}, invoked: true}, + }, + wantErr1: true, + }, { + name: "cyclical dependency", + args: args{ + p: []types.Plugin{ + &dummyPlugin{name: "first", dep: []string{"second"}}, + &dummyPlugin{name: "second", dep: []string{"first"}}, + }, + }, + want: map[string]*dependency{ + "first": { + plugin: &dummyPlugin{name: "first", dep: []string{"second"}, idx: 1}, + invoked: true, + }, + }, + wantErr1: true, + }, { + name: "four plugins - cyclical transitive dependencies in reverse order", + args: args{ + p: []types.Plugin{ + &dummyPlugin{name: "forth", dep: []string{"third"}}, + &dummyPlugin{name: "third", dep: []string{"second"}}, + &dummyPlugin{name: "second", dep: []string{"first"}}, + &dummyPlugin{name: "first", dep: []string{"forth"}}, + }, + }, + want: map[string]*dependency{ + "second": { + plugin: &dummyPlugin{name: "second", dep: []string{"first"}, idx: 0}, + invoked: false, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "first", dep: []string{"forth"}, idx: 0}, + invoked: false, + dependsOn: nil, + }, + }, + }, + "third": { + plugin: &dummyPlugin{name: "third", dep: []string{"second"}, idx: 0}, + invoked: false, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "second", dep: []string{"first"}, idx: 0}, + invoked: false, + dependsOn: []*dependency{ + { + plugin: &dummyPlugin{name: "first", dep: []string{"forth"}, idx: 0}, + invoked: false, + dependsOn: nil, + }, + }, + }, + }, + }, + "forth": { + plugin: &dummyPlugin{name: "forth", dep: []string{"third"}, idx: 0}, + invoked: false, + dependsOn: nil, + }, + }, + wantErr1: true, + skipRun: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + d := &dependiencies{deps: make(map[string]*dependency)} + + var ( + err error + counter int + ) + for _, p := range tt.args.p { + if !tt.skipRun { + p.(*dummyPlugin).counter = &counter + } + if err = d.addPlugin(p); err != nil { + break + } + } + if err != nil != tt.wantErr1 { + t.Errorf("dependiencies.addPlugin() error = %v, wantErr1 %v", err, tt.wantErr1) + return + } + + if !tt.skipRun { + if err := d.start(types.PluginManagers{}); (err != nil) != tt.wantErr2 { + t.Errorf("dependiencies.start() error = %v, wantErr1 %v", err, tt.wantErr2) + } + } + + if !reflect.DeepEqual(d.deps, tt.want) { + t.Errorf("deps = %v, want %v", d.deps, tt.want) + } + }) + } +} + +type dummyPlugin struct { + name string + dep []string + idx int + counter *int +} + +func (d dummyPlugin) Name() string { + return d.name +} + +func (d dummyPlugin) DependsOn() []string { + return d.dep +} + +func (d dummyPlugin) Config() types.PluginConfig { + return nil +} + +func (d *dummyPlugin) Start(types.PluginManagers) error { + if len(d.dep) > 0 { + *d.counter++ + d.idx = *d.counter + } + d.counter = nil + return nil +} + +func (d dummyPlugin) Shutdown() error { + return nil +} diff --git a/server/internal/plugins/filetransfer/config.go b/server/internal/plugins/filetransfer/config.go new file mode 100644 index 000000000..04ed81094 --- /dev/null +++ b/server/internal/plugins/filetransfer/config.go @@ -0,0 +1,63 @@ +package filetransfer + +import ( + "path/filepath" + "time" + + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +type Config struct { + Enabled bool + RootDir string + RefreshInterval time.Duration +} + +func (Config) Init(cmd *cobra.Command) error { + cmd.PersistentFlags().Bool("filetransfer.enabled", false, "whether file transfer is enabled") + if err := viper.BindPFlag("filetransfer.enabled", cmd.PersistentFlags().Lookup("filetransfer.enabled")); err != nil { + return err + } + + cmd.PersistentFlags().String("filetransfer.dir", "/home/neko/Downloads", "root directory for file transfer") + if err := viper.BindPFlag("filetransfer.dir", cmd.PersistentFlags().Lookup("filetransfer.dir")); err != nil { + return err + } + + cmd.PersistentFlags().Duration("filetransfer.refresh_interval", 30*time.Second, "interval to refresh file list") + if err := viper.BindPFlag("filetransfer.refresh_interval", cmd.PersistentFlags().Lookup("filetransfer.refresh_interval")); err != nil { + return err + } + + // v2 config + + cmd.PersistentFlags().Bool("file_transfer_enabled", false, "enable file transfer feature") + if err := viper.BindPFlag("file_transfer_enabled", cmd.PersistentFlags().Lookup("file_transfer_enabled")); err != nil { + return err + } + + cmd.PersistentFlags().String("file_transfer_path", "", "path to use for file transfer") + if err := viper.BindPFlag("file_transfer_path", cmd.PersistentFlags().Lookup("file_transfer_path")); err != nil { + return err + } + + return nil +} + +func (s *Config) Set() { + s.Enabled = viper.GetBool("filetransfer.enabled") + rootDir := viper.GetString("filetransfer.dir") + s.RootDir = filepath.Clean(rootDir) + s.RefreshInterval = viper.GetDuration("filetransfer.refresh_interval") + + // v2 config + + if viper.IsSet("file_transfer_enabled") { + s.Enabled = viper.GetBool("file_transfer_enabled") + } + if viper.IsSet("file_transfer_path") { + rootDir = viper.GetString("file_transfer_path") + s.RootDir = filepath.Clean(rootDir) + } +} diff --git a/server/internal/plugins/filetransfer/manager.go b/server/internal/plugins/filetransfer/manager.go new file mode 100644 index 000000000..555c8c9e4 --- /dev/null +++ b/server/internal/plugins/filetransfer/manager.go @@ -0,0 +1,333 @@ +package filetransfer + +import ( + "errors" + "fmt" + "io" + "net/http" + "os" + "path/filepath" + "regexp" + "sync" + "time" + + "m1k1o/neko/pkg/auth" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" + + "github.com/fsnotify/fsnotify" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" +) + +const MULTIPART_FORM_MAX_MEMORY = 32 << 20 + +func NewManager( + sessions types.SessionManager, + config *Config, +) *Manager { + logger := log.With().Str("module", "filetransfer").Logger() + + return &Manager{ + logger: logger, + config: config, + sessions: sessions, + shutdown: make(chan struct{}), + } +} + +type Manager struct { + logger zerolog.Logger + config *Config + sessions types.SessionManager + shutdown chan struct{} + mu sync.RWMutex + fileList []Item +} + +func (m *Manager) isEnabledForSession(session types.Session) (bool, error) { + settings := Settings{ + Enabled: true, // defaults to true + } + err := m.sessions.Settings().Plugins.Unmarshal(PluginName, &settings) + if err != nil && !errors.Is(err, types.ErrPluginSettingsNotFound) { + return false, fmt.Errorf("unable to unmarshal %s plugin settings from global settings: %w", PluginName, err) + } + + profile := Settings{ + Enabled: true, // defaults to true + } + + err = session.Profile().Plugins.Unmarshal(PluginName, &profile) + if err != nil && !errors.Is(err, types.ErrPluginSettingsNotFound) { + return false, fmt.Errorf("unable to unmarshal %s plugin settings from profile: %w", PluginName, err) + } + + return m.config.Enabled && (settings.Enabled || session.Profile().IsAdmin) && profile.Enabled, nil +} + +func (m *Manager) refresh() (error, bool) { + // if file transfer is disabled, return immediately without refreshing + if !m.config.Enabled { + return nil, false + } + + files, err := ListFiles(m.config.RootDir) + if err != nil { + return err, false + } + + m.mu.Lock() + defer m.mu.Unlock() + + // check if file list has changed (todo: use hash instead of comparing all fields) + changed := false + if len(files) == len(m.fileList) { + for i, file := range files { + if file.Name != m.fileList[i].Name || file.Size != m.fileList[i].Size { + changed = true + break + } + } + } else { + changed = true + } + + m.fileList = files + return nil, changed +} + +func (m *Manager) broadcastUpdate() { + m.mu.RLock() + fileList := m.fileList + m.mu.RUnlock() + + m.sessions.Broadcast(FILETRANSFER_UPDATE, Message{ + Enabled: m.config.Enabled, + RootDir: m.config.RootDir, + Files: fileList, + }) +} + +func (m *Manager) sendUpdate(session types.Session) { + m.mu.RLock() + fileList := m.fileList + m.mu.RUnlock() + + session.Send(FILETRANSFER_UPDATE, Message{ + Enabled: m.config.Enabled, + RootDir: m.config.RootDir, + Files: fileList, + }) +} + +func (m *Manager) Start() error { + // send init message once a user connects + m.sessions.OnConnected(func(session types.Session) { + m.sendUpdate(session) + }) + + // if file transfer is disabled, return immediately without starting the watcher + if !m.config.Enabled { + return nil + } + + if _, err := os.Stat(m.config.RootDir); os.IsNotExist(err) { + err = os.Mkdir(m.config.RootDir, os.ModePerm) + m.logger.Err(err).Msg("creating file transfer directory") + } + + watcher, err := fsnotify.NewWatcher() + if err != nil { + return fmt.Errorf("unable to start file transfer dir watcher: %w", err) + } + + go func() { + defer watcher.Close() + + // periodically refresh file list + ticker := time.NewTicker(m.config.RefreshInterval) + defer ticker.Stop() + + for { + select { + case <-m.shutdown: + m.logger.Info().Msg("shutting down file transfer manager") + return + case <-ticker.C: + err, changed := m.refresh() + if err != nil { + m.logger.Err(err).Msg("unable to refresh file transfer list") + } + if changed { + m.broadcastUpdate() + } + case e, ok := <-watcher.Events: + if !ok { + m.logger.Info().Msg("file transfer dir watcher closed") + return + } + + if e.Has(fsnotify.Create) || e.Has(fsnotify.Remove) || e.Has(fsnotify.Rename) { + m.logger.Debug().Str("event", e.String()).Msg("file transfer dir watcher event") + + err, changed := m.refresh() + if err != nil { + m.logger.Err(err).Msg("unable to refresh file transfer list") + } + + if changed { + m.broadcastUpdate() + } + } + case err := <-watcher.Errors: + m.logger.Err(err).Msg("error in file transfer dir watcher") + } + } + }() + + if err := watcher.Add(m.config.RootDir); err != nil { + return fmt.Errorf("unable to watch file transfer dir: %w", err) + } + + // initial refresh + err, changed := m.refresh() + if err != nil { + return fmt.Errorf("unable to refresh file transfer list: %w", err) + } + if changed { + m.broadcastUpdate() + } + + return nil +} + +func (m *Manager) Shutdown() error { + close(m.shutdown) + return nil +} + +func (m *Manager) Route(r types.Router) { + r.With(auth.AdminsOnly).Get("/", m.downloadFileHandler) + r.With(auth.AdminsOnly).Post("/", m.uploadFileHandler) +} + +func (m *Manager) WebSocketHandler(session types.Session, msg types.WebSocketMessage) bool { + switch msg.Event { + case FILETRANSFER_UPDATE: + err, changed := m.refresh() + if err != nil { + m.logger.Err(err).Msg("unable to refresh file transfer list") + } + + if changed { + // broadcast update message to all clients + m.broadcastUpdate() + } else { + // send update message to this client only + m.sendUpdate(session) + } + return true + } + + // not handled by this plugin + return false +} + +func (m *Manager) downloadFileHandler(w http.ResponseWriter, r *http.Request) error { + session, ok := auth.GetSession(r) + if !ok { + return utils.HttpUnauthorized("session not found") + } + + enabled, err := m.isEnabledForSession(session) + if err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + Msg("error checking file transfer permissions") + } + + if !enabled { + return utils.HttpForbidden("file transfer is disabled") + } + + filename := r.URL.Query().Get("filename") + badChars, err := regexp.MatchString(`(?m)\.\.(?:\/|$)`, filename) + if filename == "" || badChars || err != nil { + return utils.HttpBadRequest(). + WithInternalErr(err). + Msg("bad filename") + } + + // ensure filename is clean and only contains the basename + filename = filepath.Clean(filename) + filename = filepath.Base(filename) + filePath := filepath.Join(m.config.RootDir, filename) + + http.ServeFile(w, r, filePath) + return nil +} + +func (m *Manager) uploadFileHandler(w http.ResponseWriter, r *http.Request) error { + session, ok := auth.GetSession(r) + if !ok { + return utils.HttpUnauthorized("session not found") + } + + enabled, err := m.isEnabledForSession(session) + if err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + Msg("error checking file transfer permissions") + } + + if !enabled { + return utils.HttpForbidden("file transfer is disabled") + } + + err = r.ParseMultipartForm(MULTIPART_FORM_MAX_MEMORY) + if err != nil || r.MultipartForm == nil { + return utils.HttpBadRequest(). + WithInternalErr(err). + Msg("error parsing form") + } + + defer func() { + err = r.MultipartForm.RemoveAll() + if err != nil { + m.logger.Warn().Err(err).Msg("failed to clean up multipart form") + } + }() + + for _, formheader := range r.MultipartForm.File["files"] { + // ensure filename is clean and only contains the basename + filename := filepath.Clean(formheader.Filename) + filename = filepath.Base(filename) + filePath := filepath.Join(m.config.RootDir, filename) + + formfile, err := formheader.Open() + if err != nil { + return utils.HttpBadRequest(). + WithInternalErr(err). + Msg("error opening formdata file") + } + defer formfile.Close() + + f, err := os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE, 0644) + if err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + Msg("error opening file for writing") + } + defer f.Close() + + _, err = io.Copy(f, formfile) + if err != nil { + return utils.HttpInternalServerError(). + WithInternalErr(err). + Msg("error writing file") + } + } + + return nil +} diff --git a/server/internal/plugins/filetransfer/plugin.go b/server/internal/plugins/filetransfer/plugin.go new file mode 100644 index 000000000..44cda5012 --- /dev/null +++ b/server/internal/plugins/filetransfer/plugin.go @@ -0,0 +1,35 @@ +package filetransfer + +import ( + "m1k1o/neko/pkg/types" +) + +type Plugin struct { + config *Config + manager *Manager +} + +func NewPlugin() *Plugin { + return &Plugin{ + config: &Config{}, + } +} + +func (p *Plugin) Name() string { + return PluginName +} + +func (p *Plugin) Config() types.PluginConfig { + return p.config +} + +func (p *Plugin) Start(m types.PluginManagers) error { + p.manager = NewManager(m.SessionManager, p.config) + m.ApiManager.AddRouter("/filetransfer", p.manager.Route) + m.WebSocketManager.AddHandler(p.manager.WebSocketHandler) + return p.manager.Start() +} + +func (p *Plugin) Shutdown() error { + return p.manager.Shutdown() +} diff --git a/server/internal/plugins/filetransfer/types.go b/server/internal/plugins/filetransfer/types.go new file mode 100644 index 000000000..32748d464 --- /dev/null +++ b/server/internal/plugins/filetransfer/types.go @@ -0,0 +1,30 @@ +package filetransfer + +const PluginName = "filetransfer" + +type Settings struct { + Enabled bool `json:"enabled" mapstructure:"enabled"` +} + +const ( + FILETRANSFER_UPDATE = "filetransfer/update" +) + +type Message struct { + Enabled bool `json:"enabled"` + RootDir string `json:"root_dir"` + Files []Item `json:"files"` +} + +type ItemType string + +const ( + ItemTypeFile ItemType = "file" + ItemTypeDir ItemType = "dir" +) + +type Item struct { + Name string `json:"name"` + Type ItemType `json:"type"` + Size int64 `json:"size,omitempty"` +} diff --git a/server/internal/plugins/filetransfer/utils.go b/server/internal/plugins/filetransfer/utils.go new file mode 100644 index 000000000..c4c828aef --- /dev/null +++ b/server/internal/plugins/filetransfer/utils.go @@ -0,0 +1,32 @@ +package filetransfer + +import "os" + +func ListFiles(path string) ([]Item, error) { + items, err := os.ReadDir(path) + if err != nil { + return nil, err + } + + out := make([]Item, len(items)) + for i, item := range items { + var itemType ItemType + var size int64 = 0 + if item.IsDir() { + itemType = ItemTypeDir + } else { + itemType = ItemTypeFile + info, err := item.Info() + if err == nil { + size = info.Size() + } + } + out[i] = Item{ + Name: item.Name(), + Type: itemType, + Size: size, + } + } + + return out, nil +} diff --git a/server/internal/plugins/manager.go b/server/internal/plugins/manager.go new file mode 100644 index 000000000..14f7f4af4 --- /dev/null +++ b/server/internal/plugins/manager.go @@ -0,0 +1,183 @@ +package plugins + +import ( + "fmt" + "os" + "path/filepath" + "plugin" + + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + "github.com/spf13/cobra" + + "m1k1o/neko/internal/config" + "m1k1o/neko/internal/plugins/chat" + "m1k1o/neko/internal/plugins/filetransfer" + "m1k1o/neko/pkg/types" +) + +type ManagerCtx struct { + logger zerolog.Logger + config *config.Plugins + plugins dependiencies +} + +func New(config *config.Plugins) *ManagerCtx { + manager := &ManagerCtx{ + logger: log.With().Str("module", "plugins").Logger(), + config: config, + plugins: dependiencies{ + deps: make(map[string]*dependency), + }, + } + + manager.plugins.logger = manager.logger + + if config.Enabled { + err := manager.loadDir(config.Dir) + + // only log error if plugin is not required + if err != nil && config.Required { + manager.logger.Fatal().Err(err).Msg("error loading plugins") + } + + manager.logger.Info().Msgf("loading finished, total %d plugins", manager.plugins.len()) + } + + // add built-in plugins + manager.plugins.addPlugin(filetransfer.NewPlugin()) + manager.plugins.addPlugin(chat.NewPlugin()) + + return manager +} + +func (manager *ManagerCtx) loadDir(dir string) error { + return filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + if info.IsDir() { + return nil + } + + err = manager.load(path) + + // return error if plugin is required + if err != nil && manager.config.Required { + return err + } + + // otherwise only log error if plugin is not required + manager.logger.Err(err).Str("plugin", path).Msg("loading a plugin") + return nil + }) +} + +func (manager *ManagerCtx) load(path string) error { + pl, err := plugin.Open(path) + if err != nil { + return err + } + + sym, err := pl.Lookup("Plugin") + if err != nil { + return err + } + + p, ok := sym.(types.Plugin) + if !ok { + return fmt.Errorf("not a valid plugin") + } + + if err = manager.plugins.addPlugin(p); err != nil { + return fmt.Errorf("failed to add plugin: %w", err) + } + + return nil +} + +func (manager *ManagerCtx) InitConfigs(cmd *cobra.Command) { + _ = manager.plugins.forEach(func(d *dependency) error { + if err := d.plugin.Config().Init(cmd); err != nil { + log.Err(err).Str("plugin", d.plugin.Name()).Msg("unable to initialize configuration") + } + return nil + }) +} + +func (manager *ManagerCtx) SetConfigs() { + _ = manager.plugins.forEach(func(d *dependency) error { + d.plugin.Config().Set() + return nil + }) +} + +func (manager *ManagerCtx) Start( + sessionManager types.SessionManager, + webSocketManager types.WebSocketManager, + apiManager types.ApiManager, +) { + err := manager.plugins.start(types.PluginManagers{ + SessionManager: sessionManager, + WebSocketManager: webSocketManager, + ApiManager: apiManager, + LoadServiceFromPlugin: manager.LookupService, + }) + + if err != nil { + if manager.config.Required { + manager.logger.Fatal().Err(err).Msg("failed to start plugins, exiting...") + } else { + manager.logger.Err(err).Msg("failed to start plugins, skipping...") + } + } +} + +func (manager *ManagerCtx) Shutdown() error { + _ = manager.plugins.forEach(func(d *dependency) error { + err := d.plugin.Shutdown() + manager.logger.Err(err).Str("plugin", d.plugin.Name()).Msg("plugin shutdown") + return nil + }) + return nil +} + +func (manager *ManagerCtx) LookupService(pluginName string) (any, error) { + plug, ok := manager.plugins.findPlugin(pluginName) + if !ok { + return nil, fmt.Errorf("plugin '%s' not found", pluginName) + } + + expPlug, ok := plug.plugin.(types.ExposablePlugin) + if !ok { + return nil, fmt.Errorf("plugin '%s' is not exposable", pluginName) + } + + return expPlug.ExposeService(), nil +} + +func (manager *ManagerCtx) Metadata() []types.PluginMetadata { + var plugins []types.PluginMetadata + + _ = manager.plugins.forEach(func(d *dependency) error { + dependsOn := make([]string, 0) + deps, isDependalbe := d.plugin.(types.DependablePlugin) + if isDependalbe { + dependsOn = deps.DependsOn() + } + + _, isExposable := d.plugin.(types.ExposablePlugin) + + plugins = append(plugins, types.PluginMetadata{ + Name: d.plugin.Name(), + IsDependable: isDependalbe, + IsExposable: isExposable, + DependsOn: dependsOn, + }) + + return nil + }) + + return plugins +} diff --git a/server/internal/session/auth.go b/server/internal/session/auth.go new file mode 100644 index 000000000..682c03bb4 --- /dev/null +++ b/server/internal/session/auth.go @@ -0,0 +1,80 @@ +package session + +import ( + "errors" + "net/http" + "strings" + "time" + + "m1k1o/neko/pkg/types" +) + +func (manager *SessionManagerCtx) CookieSetToken(w http.ResponseWriter, token string) { + sameSite := http.SameSiteDefaultMode + if manager.config.CookieSecure { + sameSite = http.SameSiteNoneMode + } + + http.SetCookie(w, &http.Cookie{ + Name: manager.config.CookieName, + Value: token, + Expires: time.Now().Add(manager.config.CookieExpiration), + Secure: manager.config.CookieSecure, + SameSite: sameSite, + HttpOnly: true, + }) +} + +func (manager *SessionManagerCtx) CookieClearToken(w http.ResponseWriter, r *http.Request) { + cookie, err := r.Cookie(manager.config.CookieName) + if err != nil { + return + } + + cookie.Value = "" + cookie.Expires = time.Unix(0, 0) + http.SetCookie(w, cookie) +} + +func (manager *SessionManagerCtx) Authenticate(r *http.Request) (types.Session, error) { + token, ok := manager.getToken(r) + if !ok { + return nil, errors.New("no authentication provided") + } + + session, ok := manager.GetByToken(token) + if !ok { + return nil, types.ErrSessionNotFound + } + + if !session.Profile().CanLogin { + return nil, types.ErrSessionLoginDisabled + } + + return session, nil +} + +func (manager *SessionManagerCtx) getToken(r *http.Request) (string, bool) { + if manager.CookieEnabled() { + // get from Cookie + cookie, err := r.Cookie(manager.config.CookieName) + if err == nil { + return cookie.Value, true + } + } + + // get from Header + reqToken := r.Header.Get("Authorization") + splitToken := strings.Split(reqToken, "Bearer ") + if len(splitToken) == 2 { + return strings.TrimSpace(splitToken[1]), true + } + + // get from URL + token := r.URL.Query().Get("token") + if token != "" { + return token, true + } + + return "", false +} diff --git a/server/internal/session/manager.go b/server/internal/session/manager.go index cd93927a4..aa0d63b59 100644 --- a/server/internal/session/manager.go +++ b/server/internal/session/manager.go @@ -1,241 +1,470 @@ package session import ( - "fmt" + "errors" "sync" + "sync/atomic" + "github.com/kataras/go-events" "github.com/rs/zerolog" "github.com/rs/zerolog/log" - "m1k1o/neko/internal/types" - "m1k1o/neko/internal/utils" + "m1k1o/neko/internal/config" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" ) -func New(capture types.CaptureManager) *SessionManager { - return &SessionManager{ - logger: log.With().Str("module", "session").Logger(), - host: "", - capture: capture, - eventsChannel: make(chan types.SessionEvent, 10), - members: make(map[string]*Session), +func New(config *config.Session) *SessionManagerCtx { + manager := &SessionManagerCtx{ + logger: log.With().Str("module", "session").Logger(), + config: config, + settings: types.Settings{ + PrivateMode: config.PrivateMode, + LockedLogins: config.LockedLogins, + LockedControls: config.LockedControls || config.ControlProtection, + ControlProtection: config.ControlProtection, + ImplicitHosting: config.ImplicitHosting, + InactiveCursors: config.InactiveCursors, + MercifulReconnect: config.MercifulReconnect, + }, + tokens: make(map[string]string), + sessions: make(map[string]*SessionCtx), + cursors: make(map[types.Session][]types.Cursor), + emmiter: events.New(), } + + // create API session + if config.APIToken != "" { + manager.apiSession = &SessionCtx{ + id: "API", + token: config.APIToken, + manager: manager, + logger: manager.logger.With().Str("session_id", "API").Logger(), + profile: types.MemberProfile{ + Name: "API Session", + IsAdmin: true, + CanLogin: true, + CanConnect: false, + CanWatch: true, + CanHost: true, + CanAccessClipboard: true, + }, + } + } + + // try to load sessions from file + manager.load() + + return manager +} + +type SessionManagerCtx struct { + logger zerolog.Logger + config *config.Session + + settings types.Settings + settingsMu sync.Mutex + + tokens map[string]string + sessions map[string]*SessionCtx + sessionsMu sync.Mutex + + hostId atomic.Value + + cursors map[types.Session][]types.Cursor + cursorsMu sync.Mutex + + emmiter events.EventEmmiter + apiSession *SessionCtx +} + +func (manager *SessionManagerCtx) Create(id string, profile types.MemberProfile) (types.Session, string, error) { + token, err := utils.NewUID(64) + if err != nil { + return nil, "", err + } + + manager.sessionsMu.Lock() + if _, ok := manager.sessions[id]; ok { + manager.sessionsMu.Unlock() + return nil, "", types.ErrSessionAlreadyExists + } + + if _, ok := manager.tokens[token]; ok { + manager.sessionsMu.Unlock() + return nil, "", errors.New("session token already exists") + } + + session := &SessionCtx{ + id: id, + token: token, + manager: manager, + logger: manager.logger.With().Str("session_id", id).Logger(), + profile: profile, + } + + manager.tokens[token] = id + manager.sessions[id] = session + manager.sessionsMu.Unlock() + + manager.emmiter.Emit("created", session) + manager.save() + + return session, token, nil } -type SessionManager struct { - mu sync.Mutex - logger zerolog.Logger - host string - capture types.CaptureManager - members map[string]*Session - eventsChannel chan types.SessionEvent - // TODO: Handle locks in sessions as flags. - controlLocked bool +func (manager *SessionManagerCtx) Update(id string, profile types.MemberProfile) error { + manager.sessionsMu.Lock() + + session, ok := manager.sessions[id] + if !ok { + manager.sessionsMu.Unlock() + return types.ErrSessionNotFound + } + + old := session.profile + session.profile = profile + manager.sessionsMu.Unlock() + + manager.emmiter.Emit("profile_changed", session, profile, old) + manager.save() + + session.profileChanged() + return nil } -func (manager *SessionManager) New(id string, admin bool, socket types.WebSocket) types.Session { - session := &Session{ - id: id, - admin: admin, - manager: manager, - socket: socket, - logger: manager.logger.With().Str("id", id).Logger(), - connected: false, +func (manager *SessionManagerCtx) Delete(id string) error { + manager.sessionsMu.Lock() + session, ok := manager.sessions[id] + if !ok { + manager.sessionsMu.Unlock() + return types.ErrSessionNotFound } - manager.mu.Lock() - manager.members[id] = session - manager.capture.Audio().AddListener() - manager.capture.Video().AddListener() - manager.mu.Unlock() + delete(manager.tokens, session.token) + delete(manager.sessions, id) + manager.sessionsMu.Unlock() - manager.eventsChannel <- types.SessionEvent{ - Type: types.SESSION_CREATED, - Id: id, - Session: session, + if session.State().IsConnected { + session.DestroyWebSocketPeer("session deleted") } - return session + if session.State().IsWatching { + session.GetWebRTCPeer().Destroy() + } + + manager.emmiter.Emit("deleted", session) + manager.save() + + return nil } -func (manager *SessionManager) HasHost() bool { - return manager.host != "" +func (manager *SessionManagerCtx) Disconnect(id string) error { + manager.sessionsMu.Lock() + session, ok := manager.sessions[id] + if !ok { + manager.sessionsMu.Unlock() + return types.ErrSessionNotFound + } + manager.sessionsMu.Unlock() + + if session.State().IsConnected { + session.DestroyWebSocketPeer("session disconnected") + } + + if session.State().IsWatching { + session.GetWebRTCPeer().Destroy() + } + + return nil } -func (manager *SessionManager) IsHost(id string) bool { - return manager.host == id +func (manager *SessionManagerCtx) Get(id string) (types.Session, bool) { + manager.sessionsMu.Lock() + defer manager.sessionsMu.Unlock() + + session, ok := manager.sessions[id] + return session, ok } -func (manager *SessionManager) SetHost(id string) error { - manager.mu.Lock() - _, ok := manager.members[id] - manager.mu.Unlock() +func (manager *SessionManagerCtx) GetByToken(token string) (types.Session, bool) { + manager.sessionsMu.Lock() + id, ok := manager.tokens[token] + manager.sessionsMu.Unlock() if ok { - manager.host = id - - manager.eventsChannel <- types.SessionEvent{ - Type: types.SESSION_HOST_SET, - Id: id, - } + return manager.Get(id) + } - return nil + // is API session + if manager.apiSession != nil && manager.apiSession.token == token { + return manager.apiSession, true } - return fmt.Errorf("invalid session id %s", id) + return nil, false } -func (manager *SessionManager) GetHost() (types.Session, bool) { - manager.mu.Lock() - defer manager.mu.Unlock() +func (manager *SessionManagerCtx) List() []types.Session { + manager.sessionsMu.Lock() + defer manager.sessionsMu.Unlock() + + var sessions []types.Session + for _, session := range manager.sessions { + sessions = append(sessions, session) + } - host, ok := manager.members[manager.host] - return host, ok + return sessions } -func (manager *SessionManager) ClearHost() { - id := manager.host - manager.host = "" +func (manager *SessionManagerCtx) Range(f func(session types.Session) bool) { + manager.sessionsMu.Lock() + defer manager.sessionsMu.Unlock() - manager.eventsChannel <- types.SessionEvent{ - Type: types.SESSION_HOST_CLEARED, - Id: id, + for _, session := range manager.sessions { + if !f(session) { + return + } } } -func (manager *SessionManager) Has(id string) bool { - manager.mu.Lock() - defer manager.mu.Unlock() +// --- +// host +// --- + +func (manager *SessionManagerCtx) setHost(session, host types.Session) { + var hostId string + if host != nil { + hostId = host.ID() + } - _, ok := manager.members[id] - return ok + manager.hostId.Store(hostId) + manager.emmiter.Emit("host_changed", session, host) } -func (manager *SessionManager) Get(id string) (types.Session, bool) { - manager.mu.Lock() - defer manager.mu.Unlock() +func (manager *SessionManagerCtx) GetHost() (types.Session, bool) { + hostId, ok := manager.hostId.Load().(string) + if !ok || hostId == "" { + return nil, false + } - session, ok := manager.members[id] - return session, ok + return manager.Get(hostId) +} + +func (manager *SessionManagerCtx) isHost(host types.Session) bool { + hostId, ok := manager.hostId.Load().(string) + return ok && hostId == host.ID() } -// TODO: Handle locks in sessions as flags. -func (manager *SessionManager) SetControlLocked(locked bool) { - manager.controlLocked = locked +// --- +// cursors +// --- + +func (manager *SessionManagerCtx) SetCursor(cursor types.Cursor, session types.Session) { + manager.cursorsMu.Lock() + defer manager.cursorsMu.Unlock() + + list, ok := manager.cursors[session] + if !ok { + list = []types.Cursor{} + } + + list = append(list, cursor) + manager.cursors[session] = list } -func (manager *SessionManager) CanControl(id string) bool { - session, ok := manager.Get(id) - return ok && (!manager.controlLocked || session.Admin()) +func (manager *SessionManagerCtx) PopCursors() map[types.Session][]types.Cursor { + manager.cursorsMu.Lock() + defer manager.cursorsMu.Unlock() + + cursors := manager.cursors + manager.cursors = make(map[types.Session][]types.Cursor) + + return cursors } -func (manager *SessionManager) Admins() []*types.Member { - manager.mu.Lock() - defer manager.mu.Unlock() +// --- +// broadcasts +// --- - members := []*types.Member{} - for _, session := range manager.members { - if !session.connected || !session.admin { +func (manager *SessionManagerCtx) Broadcast(event string, payload any, exclude ...string) { + for _, session := range manager.List() { + if !session.State().IsConnected { continue } - member := session.Member() - if member != nil { - members = append(members, member) + if len(exclude) > 0 { + if in, _ := utils.ArrayIn(session.ID(), exclude); in { + continue + } } - } - return members + session.Send(event, payload) + } } -func (manager *SessionManager) Members() []*types.Member { - manager.mu.Lock() - defer manager.mu.Unlock() - - members := []*types.Member{} - for _, session := range manager.members { - if !session.connected { +func (manager *SessionManagerCtx) AdminBroadcast(event string, payload any, exclude ...string) { + for _, session := range manager.List() { + if !session.State().IsConnected || !session.Profile().IsAdmin { continue } - member := session.Member() - if member != nil { - members = append(members, member) + if len(exclude) > 0 { + if in, _ := utils.ArrayIn(session.ID(), exclude); in { + continue + } } + + session.Send(event, payload) } - return members } -func (manager *SessionManager) Destroy(id string) { - manager.mu.Lock() - session, ok := manager.members[id] - if ok { - err := session.destroy() - delete(manager.members, id) - - manager.capture.Audio().RemoveListener() - manager.capture.Video().RemoveListener() - manager.mu.Unlock() +func (manager *SessionManagerCtx) InactiveCursorsBroadcast(event string, payload any, exclude ...string) { + for _, session := range manager.List() { + if !session.State().IsConnected || !session.Profile().CanSeeInactiveCursors { + continue + } - manager.eventsChannel <- types.SessionEvent{ - Type: types.SESSION_DESTROYED, - Id: id, - Session: session, + if len(exclude) > 0 { + if in, _ := utils.ArrayIn(session.ID(), exclude); in { + continue + } } - manager.logger.Err(err).Str("session_id", id).Msg("destroying session") - return + + session.Send(event, payload) } +} - manager.mu.Unlock() +// --- +// events +// --- + +func (manager *SessionManagerCtx) OnCreated(listener func(session types.Session)) { + manager.emmiter.On("created", func(payload ...any) { + listener(payload[0].(*SessionCtx)) + }) } -func (manager *SessionManager) Clear() error { - return nil +func (manager *SessionManagerCtx) OnDeleted(listener func(session types.Session)) { + manager.emmiter.On("deleted", func(payload ...any) { + listener(payload[0].(*SessionCtx)) + }) } -func (manager *SessionManager) Broadcast(v interface{}, exclude []string) error { - manager.mu.Lock() - defer manager.mu.Unlock() +func (manager *SessionManagerCtx) OnConnected(listener func(session types.Session)) { + manager.emmiter.On("connected", func(payload ...any) { + listener(payload[0].(*SessionCtx)) + }) +} - for id, session := range manager.members { - if !session.connected { - continue - } +func (manager *SessionManagerCtx) OnDisconnected(listener func(session types.Session)) { + manager.emmiter.On("disconnected", func(payload ...any) { + listener(payload[0].(*SessionCtx)) + }) +} - if in, _ := utils.ArrayIn(id, exclude); in { - continue - } +func (manager *SessionManagerCtx) OnProfileChanged(listener func(session types.Session, new, old types.MemberProfile)) { + manager.emmiter.On("profile_changed", func(payload ...any) { + listener(payload[0].(*SessionCtx), payload[1].(types.MemberProfile), payload[2].(types.MemberProfile)) + }) +} - if err := session.Send(v); err != nil { - return err +func (manager *SessionManagerCtx) OnStateChanged(listener func(session types.Session)) { + manager.emmiter.On("state_changed", func(payload ...any) { + listener(payload[0].(*SessionCtx)) + }) +} + +func (manager *SessionManagerCtx) OnHostChanged(listener func(session, host types.Session)) { + manager.emmiter.On("host_changed", func(payload ...any) { + if payload[1] == nil { + listener(payload[0].(*SessionCtx), nil) + } else { + listener(payload[0].(*SessionCtx), payload[1].(*SessionCtx)) } - } + }) +} - return nil +func (manager *SessionManagerCtx) OnSettingsChanged(listener func(session types.Session, new, old types.Settings)) { + manager.emmiter.On("settings_changed", func(payload ...any) { + listener(payload[0].(types.Session), payload[1].(types.Settings), payload[2].(types.Settings)) + }) } -func (manager *SessionManager) AdminBroadcast(v interface{}, exclude []string) error { - manager.mu.Lock() - defer manager.mu.Unlock() +// --- +// settings +// --- + +func (manager *SessionManagerCtx) UpdateSettingsFunc(session types.Session, f func(settings *types.Settings) bool) { + manager.settingsMu.Lock() + new := manager.settings + if f(&new) { + old := manager.settings + manager.settings = new + manager.settingsMu.Unlock() + manager.updateSettings(session, new, old) + return + } + manager.settingsMu.Unlock() +} - for id, session := range manager.members { - if !session.connected || !session.admin { - continue +func (manager *SessionManagerCtx) updateSettings(session types.Session, new, old types.Settings) { + // if private mode changed + if old.PrivateMode != new.PrivateMode { + // update webrtc paused state for all sessions + for _, s := range manager.List() { + enabled := s.PrivateModeEnabled() + + // if session had control, it must release it + if enabled && s.IsHost() { + session.ClearHost() + } + + // its webrtc connection will be paused or unpaused + if webrtcPeer := s.GetWebRTCPeer(); webrtcPeer != nil { + webrtcPeer.SetPaused(enabled) + } } + } - if in, _ := utils.ArrayIn(id, exclude); in { - continue + // if control protection changed and controls are not locked + if old.ControlProtection != new.ControlProtection && new.ControlProtection && !new.LockedControls { + // if there is no admin, lock controls + hasAdmin := false + manager.Range(func(session types.Session) bool { + if session.Profile().IsAdmin && session.State().IsConnected { + hasAdmin = true + return false + } + return true + }) + + if !hasAdmin { + manager.settingsMu.Lock() + manager.settings.LockedControls = true + new.LockedControls = true + manager.settingsMu.Unlock() } + } - if err := session.Send(v); err != nil { - return err + // if contols have been locked + if old.LockedControls != new.LockedControls && new.LockedControls { + // if the host is not admin, it must release controls + host, hasHost := manager.GetHost() + if hasHost && !host.Profile().IsAdmin { + session.ClearHost() } } - return nil + manager.emmiter.Emit("settings_changed", session, new, old) } -func (manager *SessionManager) GetEventsChannel() chan types.SessionEvent { - return manager.eventsChannel +func (manager *SessionManagerCtx) Settings() types.Settings { + manager.settingsMu.Lock() + defer manager.settingsMu.Unlock() + + return manager.settings } -var _ types.SessionManager = (*SessionManager)(nil) +func (manager *SessionManagerCtx) CookieEnabled() bool { + return manager.config.CookieEnabled +} diff --git a/server/internal/session/serialize.go b/server/internal/session/serialize.go new file mode 100644 index 000000000..9d3b7607d --- /dev/null +++ b/server/internal/session/serialize.go @@ -0,0 +1,97 @@ +package session + +import ( + "encoding/json" + "errors" + "os" + + "m1k1o/neko/pkg/types" +) + +func (manager *SessionManagerCtx) save() { + if manager.config.File == "" { + return + } + + // serialize sessions + sessions := make([]types.SessionProfile, 0, len(manager.sessions)) + for _, session := range manager.sessions { + sessions = append(sessions, types.SessionProfile{ + Id: session.id, + Token: session.token, + Profile: session.profile, + }) + } + + // convert to json + data, err := json.Marshal(sessions) + if err != nil { + manager.logger.Error().Err(err).Msg("failed to marshal sessions") + return + } + + // write to file + err = os.WriteFile(manager.config.File, data, 0644) + if err != nil { + manager.logger.Error().Err(err). + Str("file", manager.config.File). + Msg("failed to write sessions to a file") + } +} + +func (manager *SessionManagerCtx) load() { + if manager.config.File == "" { + return + } + + // read file + data, err := os.ReadFile(manager.config.File) + if err != nil { + // if file does not exist + if errors.Is(err, os.ErrNotExist) { + manager.logger.Info(). + Str("file", manager.config.File). + Msg("sessions file does not exist") + return + } + manager.logger.Error().Err(err). + Str("file", manager.config.File). + Msg("failed to read sessions from a file") + return + } + + // if file is empty + if len(data) == 0 { + manager.logger.Info(). + Str("file", manager.config.File). + Msg("sessions file is empty") + return + } + + // deserialize sessions + sessions := make([]types.SessionProfile, 0) + err = json.Unmarshal(data, &sessions) + if err != nil { + manager.logger.Error().Err(err).Msg("failed to unmarshal sessions") + return + } + + // create sessions + manager.sessionsMu.Lock() + for _, session := range sessions { + manager.tokens[session.Token] = session.Id + manager.sessions[session.Id] = &SessionCtx{ + id: session.Id, + token: session.Token, + manager: manager, + logger: manager.logger.With().Str("session_id", session.Id).Logger(), + profile: session.Profile, + } + } + manager.sessionsMu.Unlock() + + manager.logger.Info(). + Int("sessions", len(sessions)). + Str("file", manager.config.File). + Msg("loaded sessions from a file") +} diff --git a/server/internal/session/session.go b/server/internal/session/session.go index 3f964c4d0..93a6a2208 100644 --- a/server/internal/session/session.go +++ b/server/internal/session/session.go @@ -1,190 +1,289 @@ package session import ( - "m1k1o/neko/internal/types" - "m1k1o/neko/internal/types/event" - "m1k1o/neko/internal/types/message" + "sync" + "time" "github.com/rs/zerolog" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" ) -type Session struct { - logger zerolog.Logger - id string - name string - admin bool - muted bool - connected bool - manager *SessionManager - socket types.WebSocket - peer types.Peer +// client is expected to reconnect within 5 second +// if some unexpected websocket disconnect happens +const WS_DELAYED_DURATION = 5 * time.Second + +type SessionCtx struct { + id string + token string + logger zerolog.Logger + manager *SessionManagerCtx + profile types.MemberProfile + state types.SessionState + + websocketPeer types.WebSocketPeer + websocketMu sync.Mutex + + // websocket delayed set connected events + wsDelayedMu sync.Mutex + wsDelayedTimer *time.Timer + + webrtcPeer types.WebRTCPeer + webrtcMu sync.Mutex } -func (session *Session) ID() string { +func (session *SessionCtx) ID() string { return session.id } -func (session *Session) Name() string { - return session.name +func (session *SessionCtx) Profile() types.MemberProfile { + return session.profile } -func (session *Session) Admin() bool { - return session.admin +func (session *SessionCtx) profileChanged() { + if !session.profile.CanHost && session.IsHost() { + session.ClearHost() + } + + if (!session.profile.CanConnect || !session.profile.CanLogin || !session.profile.CanWatch) && session.state.IsWatching { + session.GetWebRTCPeer().Destroy() + } + + if (!session.profile.CanConnect || !session.profile.CanLogin) && session.state.IsConnected { + session.DestroyWebSocketPeer("profile changed") + } + + // update webrtc paused state + if webrtcPeer := session.GetWebRTCPeer(); webrtcPeer != nil { + webrtcPeer.SetPaused(session.PrivateModeEnabled()) + } } -func (session *Session) Muted() bool { - return session.muted +func (session *SessionCtx) State() types.SessionState { + return session.state } -func (session *Session) Connected() bool { - return session.connected +func (session *SessionCtx) IsHost() bool { + return session.manager.isHost(session) } -func (session *Session) Address() string { - if session.socket == nil { - return "" - } - return session.socket.Address() +// only needed for legacy webrtc handler +func (session *SessionCtx) LegacyIsHost() bool { + implicitHosting := session.manager.Settings().ImplicitHosting + return !(!implicitHosting && !session.manager.isHost(session)) || (implicitHosting && !session.profile.CanHost) } -func (session *Session) Member() *types.Member { - return &types.Member{ - ID: session.id, - Name: session.name, - Admin: session.admin, - Muted: session.muted, - } +func (session *SessionCtx) SetAsHost() { + session.manager.setHost(session, session) } -func (session *Session) SetMuted(muted bool) { - session.muted = muted +func (session *SessionCtx) SetAsHostBy(host types.Session) { + session.manager.setHost(session, host) } -func (session *Session) SetName(name string) error { - session.name = name - return nil +func (session *SessionCtx) ClearHost() { + session.manager.setHost(session, nil) } -func (session *Session) SetSocket(socket types.WebSocket) error { - session.socket = socket - return nil +func (session *SessionCtx) PrivateModeEnabled() bool { + return session.manager.Settings().PrivateMode && !session.profile.IsAdmin } -func (session *Session) SetPeer(peer types.Peer) error { - session.peer = peer - return nil +func (session *SessionCtx) SetCursor(cursor types.Cursor) { + if session.manager.Settings().InactiveCursors && session.profile.SendsInactiveCursor { + session.manager.SetCursor(cursor, session) + } } -func (session *Session) SetConnected(connected bool) error { - session.connected = connected - if connected { - session.manager.eventsChannel <- types.SessionEvent{ - Type: types.SESSION_CONNECTED, - Id: session.id, - Session: session, - } +// --- +// websocket +// --- + +// Connect WebSocket peer sets current peer and emits connected event. It also destroys the +// previous peer, if there was one. If the peer is already set, it will be ignored. +func (session *SessionCtx) ConnectWebSocketPeer(websocketPeer types.WebSocketPeer) { + session.websocketMu.Lock() + isCurrentPeer := websocketPeer == session.websocketPeer + session.websocketPeer, websocketPeer = websocketPeer, session.websocketPeer + session.websocketMu.Unlock() + + // ignore if already set + if isCurrentPeer { + return + } + + session.logger.Info().Msg("set websocket connected") + + // update state + now := time.Now() + session.state.IsConnected = true + session.state.ConnectedSince = &now + session.state.NotConnectedSince = nil + + session.manager.emmiter.Emit("connected", session) + + // if there is a previous peer, destroy it + if websocketPeer != nil { + websocketPeer.Destroy("connection replaced") } - return nil } -func (session *Session) Kick(reason string) error { - if session.socket == nil { - return nil +// Disconnect WebSocket peer sets current peer to nil and emits disconnected event. It also +// allows for a delayed disconnect. That means, the peer will not be disconnected immediately, +// but after a delay. If the peer is connected again before the delay, the disconnect will be +// cancelled. +// +// If the peer is not the current peer or the peer is nil, it will be ignored. +func (session *SessionCtx) DisconnectWebSocketPeer(websocketPeer types.WebSocketPeer, delayed bool) { + session.websocketMu.Lock() + isCurrentPeer := websocketPeer == session.websocketPeer && websocketPeer != nil + session.websocketMu.Unlock() + + // ignore if not current peer + if !isCurrentPeer { + return } - if err := session.socket.Send(&message.SystemMessage{ - Event: event.SYSTEM_DISCONNECT, - Message: reason, - }); err != nil { - return err + + // + // ws delayed + // + + var wsDelayedTimer *time.Timer + + if delayed { + wsDelayedTimer = time.AfterFunc(WS_DELAYED_DURATION, func() { + session.DisconnectWebSocketPeer(websocketPeer, false) + }) } - return session.destroy() -} + session.wsDelayedMu.Lock() + if session.wsDelayedTimer != nil { + session.wsDelayedTimer.Stop() + } + session.wsDelayedTimer = wsDelayedTimer + session.wsDelayedMu.Unlock() -func (session *Session) Send(v interface{}) error { - if session.socket == nil { - return nil + if delayed { + session.logger.Info().Msg("delayed websocket disconnected") + return } - return session.socket.Send(v) -} -func (session *Session) SignalLocalOffer(sdp string) error { - if session.peer == nil { - return nil + // + // not delayed + // + + session.logger.Info().Msg("set websocket disconnected") + + now := time.Now() + session.state.IsConnected = false + session.state.ConnectedSince = nil + session.state.NotConnectedSince = &now + + session.manager.emmiter.Emit("disconnected", session) + + session.websocketMu.Lock() + if websocketPeer == session.websocketPeer { + session.websocketPeer = nil } - session.logger.Info().Msg("signal update - LocalOffer") - return session.socket.Send(&message.SignalOffer{ - Event: event.SIGNAL_OFFER, - SDP: sdp, - }) + session.websocketMu.Unlock() } -func (session *Session) SignalLocalAnswer(sdp string) error { - if session.peer == nil { - return nil +// Destroy WebSocket peer disconnects the peer and destroys it. It ensures that the peer is +// disconnected immediately even though normal flow would be to disconnect it delayed. +func (session *SessionCtx) DestroyWebSocketPeer(reason string) { + session.websocketMu.Lock() + peer := session.websocketPeer + session.websocketMu.Unlock() + + if peer == nil { + return } - session.logger.Info().Msg("signal update - LocalAnswer") - return session.socket.Send(&message.SignalAnswer{ - Event: event.SIGNAL_ANSWER, - SDP: sdp, - }) + // disconnect peer first, so that it is not used anymore + session.DisconnectWebSocketPeer(peer, false) + + // destroy it afterwards + peer.Destroy(reason) } -func (session *Session) SignalLocalCandidate(data string) error { - if session.socket == nil { - return nil +// Send event to websocket peer. +func (session *SessionCtx) Send(event string, payload any) { + session.websocketMu.Lock() + peer := session.websocketPeer + session.websocketMu.Unlock() + + if peer != nil { + peer.Send(event, payload) } - session.logger.Info().Msg("signal update - LocalCandidate") - return session.socket.Send(&message.SignalCandidate{ - Event: event.SIGNAL_CANDIDATE, - Data: data, - }) } -func (session *Session) SignalRemoteOffer(sdp string) error { - if session.peer == nil { - return nil - } - if err := session.peer.SetOffer(sdp); err != nil { - return err - } - sdp, err := session.peer.CreateAnswer() - if err != nil { - return err +// --- +// webrtc +// --- + +// Set webrtc peer and destroy the old one, if there is old one. +func (session *SessionCtx) SetWebRTCPeer(webrtcPeer types.WebRTCPeer) { + session.webrtcMu.Lock() + session.webrtcPeer, webrtcPeer = webrtcPeer, session.webrtcPeer + session.webrtcMu.Unlock() + + if webrtcPeer != nil && webrtcPeer != session.webrtcPeer { + webrtcPeer.Destroy() } - session.logger.Info().Msg("signal update - RemoteOffer") - return session.SignalLocalAnswer(sdp) } -func (session *Session) SignalRemoteAnswer(sdp string) error { - if session.peer == nil { - return nil +// Set if current webrtc peer is connected or not. Since there might be lefover calls from +// webrtc peer, that are not used anymore, we need to check if the webrtc peer is still the +// same as the one we are setting the connected state for. +// +// If webrtc peer is disconnected, we don't expect it to be reconnected, so we set it to nil +// and send a signal close to the client. New connection is expected to use a new webrtc peer. +func (session *SessionCtx) SetWebRTCConnected(webrtcPeer types.WebRTCPeer, connected bool) { + session.webrtcMu.Lock() + isCurrentPeer := webrtcPeer == session.webrtcPeer + session.webrtcMu.Unlock() + + if !isCurrentPeer { + return } - session.logger.Info().Msg("signal update - RemoteAnswer") - return session.peer.SetAnswer(sdp) -} -func (session *Session) SignalRemoteCandidate(data string) error { - if session.socket == nil { - return nil + session.logger.Info(). + Bool("connected", connected). + Msg("set webrtc connected") + + // update state + session.state.IsWatching = connected + if now := time.Now(); connected { + session.state.WatchingSince = &now + session.state.NotWatchingSince = nil + } else { + session.state.WatchingSince = nil + session.state.NotWatchingSince = &now } - session.logger.Info().Msg("signal update - RemoteCandidate") - return session.peer.SetCandidate(data) -} -func (session *Session) destroy() error { - if session.socket != nil { - if err := session.socket.Destroy(); err != nil { - return err - } + session.manager.emmiter.Emit("state_changed", session) + + if connected { + return + } + + session.webrtcMu.Lock() + isCurrentPeer = webrtcPeer == session.webrtcPeer + if isCurrentPeer { + session.webrtcPeer = nil } + session.webrtcMu.Unlock() - if session.peer != nil { - if err := session.peer.Destroy(); err != nil { - return err - } + if isCurrentPeer { + session.Send(event.SIGNAL_CLOSE, nil) } +} + +// Get current WebRTC peer. Nil if not connected. +func (session *SessionCtx) GetWebRTCPeer() types.WebRTCPeer { + session.webrtcMu.Lock() + defer session.webrtcMu.Unlock() - return nil + return session.webrtcPeer } diff --git a/server/internal/types/capture.go b/server/internal/types/capture.go deleted file mode 100644 index 36e54b8b3..000000000 --- a/server/internal/types/capture.go +++ /dev/null @@ -1,38 +0,0 @@ -package types - -import ( - "errors" - - "m1k1o/neko/internal/types/codec" -) - -var ( - ErrCapturePipelineAlreadyExists = errors.New("capture pipeline already exists") -) - -type BroadcastManager interface { - Start(url string) error - Stop() - Started() bool - Url() string -} - -type StreamSinkManager interface { - Codec() codec.RTPCodec - - AddListener() error - RemoveListener() error - - ListenersCount() int - Started() bool - GetSampleChannel() chan Sample -} - -type CaptureManager interface { - Start() - Shutdown() error - - Broadcast() BroadcastManager - Audio() StreamSinkManager - Video() StreamSinkManager -} diff --git a/server/internal/types/desktop.go b/server/internal/types/desktop.go deleted file mode 100644 index e70e370ad..000000000 --- a/server/internal/types/desktop.go +++ /dev/null @@ -1,77 +0,0 @@ -package types - -import "image" - -type CursorImage struct { - Width uint16 - Height uint16 - Xhot uint16 - Yhot uint16 - Serial uint64 - Image *image.RGBA -} - -type ScreenSize struct { - Width int `json:"width"` - Height int `json:"height"` - Rate int16 `json:"rate"` -} - -type ScreenConfiguration struct { - Width int `json:"width"` - Height int `json:"height"` - Rates map[int]int16 `json:"rates"` -} - -type KeyboardModifiers struct { - NumLock *bool - CapsLock *bool -} - -type KeyboardMap struct { - Layout string - Variant string -} - -type DesktopErrorMessage struct { - Error_code uint8 - Message string - Request_code uint8 - Minor_code uint8 -} - -type DesktopManager interface { - Start() - Shutdown() error - GetScreenSizeChangeChannel() (before chan bool) // true - before, false - after - - // clipboard - ReadClipboard() string - WriteClipboard(data string) - - // xorg - Move(x, y int) - GetCursorPosition() (int, int) - Scroll(x, y int) - ButtonDown(code uint32) error - KeyDown(code uint32) error - ButtonUp(code uint32) error - KeyUp(code uint32) error - ButtonPress(code uint32) error - KeyPress(codes ...uint32) error - ResetKeys() - ScreenConfigurations() map[int]ScreenConfiguration - SetScreenSize(ScreenSize) error - GetScreenSize() *ScreenSize - SetKeyboardMap(KeyboardMap) error - GetKeyboardMap() (*KeyboardMap, error) - SetKeyboardModifiers(mod KeyboardModifiers) - GetKeyboardModifiers() KeyboardModifiers - GetCursorImage() *CursorImage - GetScreenshotImage() *image.RGBA - - // xevent - GetCursorChangedChannel() chan uint64 - GetClipboardUpdatedChannel() chan struct{} - GetEventErrorChannel() chan DesktopErrorMessage -} diff --git a/server/internal/types/session.go b/server/internal/types/session.go deleted file mode 100644 index d90faea5d..000000000 --- a/server/internal/types/session.go +++ /dev/null @@ -1,67 +0,0 @@ -package types - -type Member struct { - ID string `json:"id"` - Name string `json:"displayname"` - Admin bool `json:"admin"` - Muted bool `json:"muted"` -} - -type SessionEventType int - -const ( - SESSION_CREATED SessionEventType = iota - SESSION_CONNECTED - SESSION_DESTROYED - SESSION_HOST_SET - SESSION_HOST_CLEARED -) - -type SessionEvent struct { - Type SessionEventType - Id string - Session Session -} - -type Session interface { - ID() string - Name() string - Admin() bool - Muted() bool - Connected() bool - Member() *Member - SetMuted(muted bool) - SetName(name string) error - SetConnected(connected bool) error - SetSocket(socket WebSocket) error - SetPeer(peer Peer) error - Address() string - Kick(message string) error - Send(v interface{}) error - SignalLocalOffer(sdp string) error - SignalLocalAnswer(sdp string) error - SignalLocalCandidate(data string) error - SignalRemoteOffer(sdp string) error - SignalRemoteAnswer(sdp string) error - SignalRemoteCandidate(data string) error -} - -type SessionManager interface { - New(id string, admin bool, socket WebSocket) Session - HasHost() bool - IsHost(id string) bool - SetHost(id string) error - GetHost() (Session, bool) - ClearHost() - Has(id string) bool - Get(id string) (Session, bool) - SetControlLocked(locked bool) - CanControl(id string) bool - Members() []*Member - Admins() []*Member - Destroy(id string) - Clear() error - Broadcast(v interface{}, exclude []string) error - AdminBroadcast(v interface{}, exclude []string) error - GetEventsChannel() chan SessionEvent -} diff --git a/server/internal/types/webrtc.go b/server/internal/types/webrtc.go deleted file mode 100644 index 7db122c91..000000000 --- a/server/internal/types/webrtc.go +++ /dev/null @@ -1,27 +0,0 @@ -package types - -import ( - "github.com/pion/webrtc/v3" - "github.com/pion/webrtc/v3/pkg/media" -) - -type Sample media.Sample - -type WebRTCManager interface { - Start() - Shutdown() error - CreatePeer(id string, session Session) (Peer, error) - ICELite() bool - ICEServers() []webrtc.ICEServer - ImplicitControl() bool -} - -type Peer interface { - CreateOffer() (string, error) - CreateAnswer() (string, error) - SetOffer(sdp string) error - SetAnswer(sdp string) error - SetCandidate(candidateString string) error - WriteData(v interface{}) error - Destroy() error -} diff --git a/server/internal/utils/files.go b/server/internal/utils/files.go deleted file mode 100644 index d9f24db7a..000000000 --- a/server/internal/utils/files.go +++ /dev/null @@ -1,36 +0,0 @@ -package utils - -import ( - "os" - - "m1k1o/neko/internal/types" -) - -func ListFiles(path string) ([]types.FileListItem, error) { - items, err := os.ReadDir(path) - if err != nil { - return nil, err - } - - out := make([]types.FileListItem, len(items)) - for i, item := range items { - var itemType string = "" - var size int64 = 0 - if item.IsDir() { - itemType = "dir" - } else { - itemType = "file" - info, err := item.Info() - if err == nil { - size = info.Size() - } - } - out[i] = types.FileListItem{ - Filename: item.Name(), - Type: itemType, - Size: size, - } - } - - return out, nil -} diff --git a/server/internal/utils/ip.go b/server/internal/utils/ip.go deleted file mode 100644 index 40239355a..000000000 --- a/server/internal/utils/ip.go +++ /dev/null @@ -1,40 +0,0 @@ -package utils - -import ( - "bytes" - "io" - "net" - "net/http" - "time" -) - -// dig @resolver1.opendns.com ANY myip.opendns.com +short -4 - -func GetIP(serverUrl string) (string, error) { - tr := &http.Transport{ - Proxy: nil, // ignore proxy - DialContext: (&net.Dialer{ - Timeout: 10 * time.Second, - KeepAlive: 30 * time.Second, - DualStack: true, - }).DialContext, - MaxIdleConns: 30, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 15 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - } - - client := &http.Client{Transport: tr} - rsp, err := client.Get(serverUrl) - if err != nil { - return "", err - } - defer rsp.Body.Close() - - buf, err := io.ReadAll(rsp.Body) - if err != nil { - return "", err - } - - return string(bytes.TrimSpace(buf)), nil -} diff --git a/server/internal/utils/json.go b/server/internal/utils/json.go deleted file mode 100644 index 7ea0494d6..000000000 --- a/server/internal/utils/json.go +++ /dev/null @@ -1,10 +0,0 @@ -package utils - -import "encoding/json" - -func Unmarshal(in interface{}, raw []byte, callback func() error) error { - if err := json.Unmarshal(raw, &in); err != nil { - return err - } - return callback() -} diff --git a/server/internal/webrtc/cursor/image.go b/server/internal/webrtc/cursor/image.go new file mode 100644 index 000000000..ba134b022 --- /dev/null +++ b/server/internal/webrtc/cursor/image.go @@ -0,0 +1,168 @@ +package cursor + +import ( + "reflect" + "sync" + + "github.com/rs/zerolog" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +type ImageListener interface { + SendCursorImage(cur *types.CursorImage, img []byte) error +} + +type Image interface { + Start() + Shutdown() + GetCurrent() (cur *types.CursorImage, img []byte, err error) + AddListener(listener ImageListener) + RemoveListener(listener ImageListener) +} + +type imageEntry struct { + *types.CursorImage + ImagePNG []byte +} + +type image struct { + logger zerolog.Logger + desktop types.DesktopManager + + listeners map[uintptr]ImageListener + listenersMu sync.RWMutex + + cache map[uint64]*imageEntry + cacheMu sync.RWMutex + current *imageEntry + maxSerial uint64 +} + +func NewImage(logger zerolog.Logger, desktop types.DesktopManager) *image { + return &image{ + logger: logger.With().Str("submodule", "cursor-image").Logger(), + desktop: desktop, + listeners: map[uintptr]ImageListener{}, + cache: map[uint64]*imageEntry{}, + maxSerial: 300, // TODO: Cleanup? + } +} + +func (manager *image) Start() { + manager.desktop.OnCursorChanged(func(serial uint64) { + entry, err := manager.getCached(serial) + if err != nil { + manager.logger.Err(err).Msg("failed to get cursor image") + return + } + + manager.current = entry + + manager.listenersMu.RLock() + for _, l := range manager.listeners { + if err := l.SendCursorImage(entry.CursorImage, entry.ImagePNG); err != nil { + manager.logger.Err(err).Msg("failed to set cursor image") + } + } + manager.listenersMu.RUnlock() + }) + + manager.logger.Info().Msg("starting") +} + +func (manager *image) Shutdown() { + manager.logger.Info().Msg("shutdown") + + manager.listenersMu.Lock() + for key := range manager.listeners { + delete(manager.listeners, key) + } + manager.listenersMu.Unlock() +} + +func (manager *image) getCached(serial uint64) (*imageEntry, error) { + // zero means no serial available + if serial == 0 || serial > manager.maxSerial { + manager.logger.Debug().Uint64("serial", serial).Msg("cache bypass") + return manager.fetchEntry() + } + + manager.cacheMu.RLock() + entry, ok := manager.cache[serial] + manager.cacheMu.RUnlock() + + if ok { + return entry, nil + } + + manager.logger.Debug().Uint64("serial", serial).Msg("cache miss") + + entry, err := manager.fetchEntry() + if err != nil { + return nil, err + } + + manager.cacheMu.Lock() + manager.cache[entry.Serial] = entry + manager.cacheMu.Unlock() + + if entry.Serial != serial { + manager.logger.Warn(). + Uint64("expected-serial", serial). + Uint64("received-serial", entry.Serial). + Msg("serial mismatch") + } + + return entry, nil +} + +func (manager *image) GetCurrent() (cur *types.CursorImage, img []byte, err error) { + if manager.current != nil { + return manager.current.CursorImage, manager.current.ImagePNG, nil + } + + entry, err := manager.fetchEntry() + if err != nil { + return nil, nil, err + } + + manager.current = entry + return entry.CursorImage, entry.ImagePNG, nil +} + +func (manager *image) AddListener(listener ImageListener) { + manager.listenersMu.Lock() + defer manager.listenersMu.Unlock() + + if listener != nil { + ptr := reflect.ValueOf(listener).Pointer() + manager.listeners[ptr] = listener + } +} + +func (manager *image) RemoveListener(listener ImageListener) { + manager.listenersMu.Lock() + defer manager.listenersMu.Unlock() + + if listener != nil { + ptr := reflect.ValueOf(listener).Pointer() + delete(manager.listeners, ptr) + } +} + +func (manager *image) fetchEntry() (*imageEntry, error) { + cur := manager.desktop.GetCursorImage() + + img, err := utils.CreatePNGImage(cur.Image) + if err != nil { + return nil, err + } + cur.Image = nil // free memory + + return &imageEntry{ + CursorImage: cur, + ImagePNG: img, + }, nil +} diff --git a/server/internal/webrtc/cursor/position.go b/server/internal/webrtc/cursor/position.go new file mode 100644 index 000000000..ac1147bc4 --- /dev/null +++ b/server/internal/webrtc/cursor/position.go @@ -0,0 +1,74 @@ +package cursor + +import ( + "reflect" + "sync" + + "github.com/rs/zerolog" +) + +type PositionListener interface { + SendCursorPosition(x, y int) error +} + +type Position interface { + Shutdown() + Set(x, y int) + AddListener(listener PositionListener) + RemoveListener(listener PositionListener) +} + +type position struct { + logger zerolog.Logger + + listeners map[uintptr]PositionListener + listenersMu sync.RWMutex +} + +func NewPosition(logger zerolog.Logger) *position { + return &position{ + logger: logger.With().Str("submodule", "cursor-position").Logger(), + listeners: map[uintptr]PositionListener{}, + } +} + +func (manager *position) Shutdown() { + manager.logger.Info().Msg("shutdown") + + manager.listenersMu.Lock() + for key := range manager.listeners { + delete(manager.listeners, key) + } + manager.listenersMu.Unlock() +} + +func (manager *position) Set(x, y int) { + manager.listenersMu.RLock() + defer manager.listenersMu.RUnlock() + + for _, l := range manager.listeners { + if err := l.SendCursorPosition(x, y); err != nil { + manager.logger.Err(err).Msg("failed to set cursor position") + } + } +} + +func (manager *position) AddListener(listener PositionListener) { + manager.listenersMu.Lock() + defer manager.listenersMu.Unlock() + + if listener != nil { + ptr := reflect.ValueOf(listener).Pointer() + manager.listeners[ptr] = listener + } +} + +func (manager *position) RemoveListener(listener PositionListener) { + manager.listenersMu.Lock() + defer manager.listenersMu.Unlock() + + if listener != nil { + ptr := reflect.ValueOf(listener).Pointer() + delete(manager.listeners, ptr) + } +} diff --git a/server/internal/webrtc/handler.go b/server/internal/webrtc/handler.go new file mode 100644 index 000000000..c7a69ce5f --- /dev/null +++ b/server/internal/webrtc/handler.go @@ -0,0 +1,206 @@ +package webrtc + +import ( + "bytes" + "encoding/binary" + "math" + "time" + + "m1k1o/neko/internal/webrtc/payload" + "m1k1o/neko/pkg/types" + + "github.com/pion/webrtc/v3" + "github.com/rs/zerolog" +) + +func (manager *WebRTCManagerCtx) handle( + logger zerolog.Logger, data []byte, + dataChannel *webrtc.DataChannel, + session types.Session, +) error { + isHost := session.IsHost() + + // + // parse header + // + + buffer := bytes.NewBuffer(data) + + header := &payload.Header{} + if err := binary.Read(buffer, binary.BigEndian, header); err != nil { + return err + } + + // + // parse body + // + + // handle cursor move event + if header.Event == payload.OP_MOVE { + payload := &payload.Move{} + if err := binary.Read(buffer, binary.BigEndian, payload); err != nil { + return err + } + + x, y := int(payload.X), int(payload.Y) + if isHost { + // handle active cursor movement + manager.desktop.Move(x, y) + manager.curPosition.Set(x, y) + } else { + // handle inactive cursor movement + session.SetCursor(types.Cursor{ + X: x, + Y: y, + }) + } + + return nil + } else if header.Event == payload.OP_PING { + ping := &payload.Ping{} + if err := binary.Read(buffer, binary.BigEndian, ping); err != nil { + return err + } + + // create pong header + header := payload.Header{ + Event: payload.OP_PONG, + Length: 19, + } + + // generate server timestamp + serverTs := uint64(time.Now().UnixMilli()) + + // generate pong payload + pong := payload.Pong{ + Ping: *ping, + ServerTs1: uint32(serverTs / math.MaxUint32), + ServerTs2: uint32(serverTs % math.MaxUint32), + } + + buffer := &bytes.Buffer{} + + if err := binary.Write(buffer, binary.BigEndian, header); err != nil { + return err + } + + if err := binary.Write(buffer, binary.BigEndian, pong); err != nil { + return err + } + + return dataChannel.Send(buffer.Bytes()) + } + + // continue only if session is host + if !isHost { + return nil + } + + switch header.Event { + case payload.OP_SCROLL: + // TODO: remove this once the client is fixed + if header.Length == 4 { + payload := &payload.Scroll_Old{} + if err := binary.Read(buffer, binary.BigEndian, payload); err != nil { + return err + } + + manager.desktop.Scroll(int(payload.X), int(payload.Y), false) + logger.Trace(). + Int16("x", payload.X). + Int16("y", payload.Y). + Msg("scroll") + } else { + payload := &payload.Scroll{} + if err := binary.Read(buffer, binary.BigEndian, payload); err != nil { + return err + } + + manager.desktop.Scroll(int(payload.DeltaX), int(payload.DeltaY), payload.ControlKey) + logger.Trace(). + Int16("deltaX", payload.DeltaX). + Int16("deltaY", payload.DeltaY). + Bool("controlKey", payload.ControlKey). + Msg("scroll") + } + case payload.OP_KEY_DOWN: + payload := &payload.Key{} + if err := binary.Read(buffer, binary.BigEndian, payload); err != nil { + return err + } + + if err := manager.desktop.KeyDown(payload.Key); err != nil { + logger.Warn().Err(err).Uint32("key", payload.Key).Msg("key down failed") + } else { + logger.Trace().Uint32("key", payload.Key).Msg("key down") + } + case payload.OP_KEY_UP: + payload := &payload.Key{} + if err := binary.Read(buffer, binary.BigEndian, payload); err != nil { + return err + } + + if err := manager.desktop.KeyUp(payload.Key); err != nil { + logger.Warn().Err(err).Uint32("key", payload.Key).Msg("key up failed") + } else { + logger.Trace().Uint32("key", payload.Key).Msg("key up") + } + case payload.OP_BTN_DOWN: + payload := &payload.Key{} + if err := binary.Read(buffer, binary.BigEndian, payload); err != nil { + return err + } + + if err := manager.desktop.ButtonDown(payload.Key); err != nil { + logger.Warn().Err(err).Uint32("key", payload.Key).Msg("button down failed") + } else { + logger.Trace().Uint32("key", payload.Key).Msg("button down") + } + case payload.OP_BTN_UP: + payload := &payload.Key{} + if err := binary.Read(buffer, binary.BigEndian, payload); err != nil { + return err + } + + if err := manager.desktop.ButtonUp(payload.Key); err != nil { + logger.Warn().Err(err).Uint32("key", payload.Key).Msg("button up failed") + } else { + logger.Trace().Uint32("key", payload.Key).Msg("button up") + } + case payload.OP_TOUCH_BEGIN: + payload := &payload.Touch{} + if err := binary.Read(buffer, binary.BigEndian, payload); err != nil { + return err + } + + if err := manager.desktop.TouchBegin(payload.TouchId, int(payload.X), int(payload.Y), payload.Pressure); err != nil { + logger.Warn().Err(err).Uint32("touchId", payload.TouchId).Msg("touch begin failed") + } else { + logger.Trace().Uint32("touchId", payload.TouchId).Msg("touch begin") + } + case payload.OP_TOUCH_UPDATE: + payload := &payload.Touch{} + if err := binary.Read(buffer, binary.BigEndian, payload); err != nil { + return err + } + + if err := manager.desktop.TouchUpdate(payload.TouchId, int(payload.X), int(payload.Y), payload.Pressure); err != nil { + logger.Warn().Err(err).Uint32("touchId", payload.TouchId).Msg("touch update failed") + } else { + logger.Trace().Uint32("touchId", payload.TouchId).Msg("touch update") + } + case payload.OP_TOUCH_END: + payload := &payload.Touch{} + if err := binary.Read(buffer, binary.BigEndian, payload); err != nil { + return err + } + + if err := manager.desktop.TouchEnd(payload.TouchId, int(payload.X), int(payload.Y), payload.Pressure); err != nil { + logger.Warn().Err(err).Uint32("touchId", payload.TouchId).Msg("touch end failed") + } else { + logger.Trace().Uint32("touchId", payload.TouchId).Msg("touch end") + } + } + + return nil +} diff --git a/server/internal/webrtc/handle.go b/server/internal/webrtc/legacyhandler.go similarity index 68% rename from server/internal/webrtc/handle.go rename to server/internal/webrtc/legacyhandler.go index 89e921259..01c5284a9 100644 --- a/server/internal/webrtc/handle.go +++ b/server/internal/webrtc/legacyhandler.go @@ -5,7 +5,9 @@ import ( "encoding/binary" "strconv" - "github.com/pion/webrtc/v3" + "m1k1o/neko/pkg/types" + + "github.com/rs/zerolog" ) const ( @@ -38,12 +40,16 @@ type PayloadKey struct { Key uint64 // TODO: uint32 } -func (manager *WebRTCManager) handle(id string, msg webrtc.DataChannelMessage) error { - if (!manager.config.ImplicitControl && !manager.sessions.IsHost(id)) || (manager.config.ImplicitControl && !manager.sessions.CanControl(id)) { +func (manager *WebRTCManagerCtx) handleLegacy( + logger zerolog.Logger, data []byte, + session types.Session, +) error { + // continue only if session is host + if !session.LegacyIsHost() { return nil } - buffer := bytes.NewBuffer(msg.Data) + buffer := bytes.NewBuffer(data) header := &PayloadHeader{} hbytes := make([]byte, 3) @@ -55,7 +61,7 @@ func (manager *WebRTCManager) handle(id string, msg webrtc.DataChannelMessage) e return err } - buffer = bytes.NewBuffer(msg.Data) + buffer = bytes.NewBuffer(data) switch header.Event { case OP_MOVE: @@ -71,13 +77,13 @@ func (manager *WebRTCManager) handle(id string, msg webrtc.DataChannelMessage) e return err } - manager.logger. + logger. Debug(). Str("x", strconv.Itoa(int(payload.X))). Str("y", strconv.Itoa(int(payload.Y))). Msg("scroll") - manager.desktop.Scroll(int(payload.X), int(payload.Y)) + manager.desktop.Scroll(int(payload.X), int(payload.Y), false) case OP_KEY_DOWN: payload := &PayloadKey{} if err := binary.Read(buffer, binary.LittleEndian, payload); err != nil { @@ -87,19 +93,19 @@ func (manager *WebRTCManager) handle(id string, msg webrtc.DataChannelMessage) e if payload.Key < 8 { err := manager.desktop.ButtonDown(uint32(payload.Key)) if err != nil { - manager.logger.Warn().Err(err).Msg("button down failed") + logger.Warn().Err(err).Msg("button down failed") return nil } - manager.logger.Debug().Msgf("button down %d", payload.Key) + logger.Debug().Msgf("button down %d", payload.Key) } else { err := manager.desktop.KeyDown(uint32(payload.Key)) if err != nil { - manager.logger.Warn().Err(err).Msg("key down failed") + logger.Warn().Err(err).Msg("key down failed") return nil } - manager.logger.Debug().Msgf("key down %d", payload.Key) + logger.Debug().Msgf("key down %d", payload.Key) } case OP_KEY_UP: payload := &PayloadKey{} @@ -111,19 +117,19 @@ func (manager *WebRTCManager) handle(id string, msg webrtc.DataChannelMessage) e if payload.Key < 8 { err := manager.desktop.ButtonUp(uint32(payload.Key)) if err != nil { - manager.logger.Warn().Err(err).Msg("button up failed") + logger.Warn().Err(err).Msg("button up failed") return nil } - manager.logger.Debug().Msgf("button up %d", payload.Key) + logger.Debug().Msgf("button up %d", payload.Key) } else { err := manager.desktop.KeyUp(uint32(payload.Key)) if err != nil { - manager.logger.Warn().Err(err).Msg("key up failed") + logger.Warn().Err(err).Msg("key up failed") return nil } - manager.logger.Debug().Msgf("key up %d", payload.Key) + logger.Debug().Msgf("key up %d", payload.Key) } case OP_KEY_CLK: // unused diff --git a/server/internal/webrtc/manager.go b/server/internal/webrtc/manager.go new file mode 100644 index 000000000..4c514a910 --- /dev/null +++ b/server/internal/webrtc/manager.go @@ -0,0 +1,591 @@ +package webrtc + +import ( + "fmt" + "net" + "strings" + "sync" + "sync/atomic" + "time" + + "github.com/pion/ice/v2" + "github.com/pion/interceptor" + "github.com/pion/interceptor/pkg/cc" + "github.com/pion/interceptor/pkg/gcc" + "github.com/pion/rtcp" + "github.com/pion/webrtc/v3" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + + "m1k1o/neko/internal/config" + "m1k1o/neko/internal/webrtc/cursor" + "m1k1o/neko/internal/webrtc/pionlog" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/codec" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" + "m1k1o/neko/pkg/utils" +) + +const ( + // size of receiving channel used to buffer incoming TCP packets + tcpReadChanBufferSize = 50 + + // size of buffer used to buffer outgoing TCP packets. Default is 4MB + tcpWriteBufferSizeInBytes = 4 * 1024 * 1024 + + // the duration without network activity before a Agent is considered disconnected. Default is 5 Seconds + disconnectedTimeout = 4 * time.Second + + // the duration without network activity before a Agent is considered failed after disconnected. Default is 25 Seconds + failedTimeout = 6 * time.Second + + // how often the ICE Agent sends extra traffic if there is no activity, if media is flowing no traffic will be sent. Default is 2 seconds + keepAliveInterval = 2 * time.Second + + // send a PLI on an interval so that the publisher is pushing a keyframe every rtcpPLIInterval + rtcpPLIInterval = 3 * time.Second +) + +func New(desktop types.DesktopManager, capture types.CaptureManager, config *config.WebRTC) *WebRTCManagerCtx { + logger := log.With().Str("module", "webrtc").Logger() + + configuration := webrtc.Configuration{ + SDPSemantics: webrtc.SDPSemanticsUnifiedPlan, + } + + if !config.ICELite { + ICEServers := []webrtc.ICEServer{} + for _, server := range config.ICEServersBackend { + var credential any + if server.Credential != "" { + credential = server.Credential + } else { + credential = false + } + + ICEServers = append(ICEServers, webrtc.ICEServer{ + URLs: server.URLs, + Username: server.Username, + Credential: credential, + }) + } + + configuration.ICEServers = ICEServers + } + + return &WebRTCManagerCtx{ + logger: logger, + config: config, + metrics: newMetricsManager(), + + webrtcConfiguration: configuration, + + desktop: desktop, + capture: capture, + curImage: cursor.NewImage(logger, desktop), + curPosition: cursor.NewPosition(logger), + } +} + +type WebRTCManagerCtx struct { + logger zerolog.Logger + config *config.WebRTC + metrics *metricsManager + peerId int32 + + desktop types.DesktopManager + capture types.CaptureManager + curImage cursor.Image + curPosition cursor.Position + + webrtcConfiguration webrtc.Configuration + + tcpMux ice.TCPMux + udpMux ice.UDPMux + + camStop, micStop *func() +} + +func (manager *WebRTCManagerCtx) Start() { + manager.curImage.Start() + + logger := pionlog.New(manager.logger) + + // add TCP Mux listener + if manager.config.TCPMux > 0 { + tcpListener, err := net.ListenTCP("tcp", &net.TCPAddr{ + IP: net.IP{0, 0, 0, 0}, + Port: manager.config.TCPMux, + }) + + if err != nil { + manager.logger.Fatal().Err(err).Msg("unable to setup ice TCP mux") + } + + manager.tcpMux = ice.NewTCPMuxDefault(ice.TCPMuxParams{ + Listener: tcpListener, + Logger: logger.NewLogger("ice-tcp"), + ReadBufferSize: tcpReadChanBufferSize, + WriteBufferSize: tcpWriteBufferSizeInBytes, + }) + } + + // add UDP Mux listener + if manager.config.UDPMux > 0 { + var err error + manager.udpMux, err = ice.NewMultiUDPMuxFromPort(manager.config.UDPMux, + ice.UDPMuxFromPortWithLogger(logger.NewLogger("ice-udp")), + ) + + if err != nil { + manager.logger.Fatal().Err(err).Msg("unable to setup ice UDP mux") + } + } + + manager.logger.Info(). + Bool("icelite", manager.config.ICELite). + Bool("icetrickle", manager.config.ICETrickle). + Interface("iceservers-frontend", manager.config.ICEServersFrontend). + Interface("iceservers-backend", manager.config.ICEServersBackend). + Str("nat1to1", strings.Join(manager.config.NAT1To1IPs, ",")). + Str("epr", fmt.Sprintf("%d-%d", manager.config.EphemeralMin, manager.config.EphemeralMax)). + Int("tcpmux", manager.config.TCPMux). + Int("udpmux", manager.config.UDPMux). + Msg("webrtc starting") +} + +func (manager *WebRTCManagerCtx) Shutdown() error { + manager.logger.Info().Msg("shutdown") + + manager.curImage.Shutdown() + manager.curPosition.Shutdown() + + return nil +} + +func (manager *WebRTCManagerCtx) ICEServers() []types.ICEServer { + return manager.config.ICEServersFrontend +} + +func (manager *WebRTCManagerCtx) newPeerConnection(logger zerolog.Logger, codecs []codec.RTPCodec) (*webrtc.PeerConnection, cc.BandwidthEstimator, error) { + // create media engine + engine := &webrtc.MediaEngine{} + for _, codec := range codecs { + if err := codec.Register(engine); err != nil { + return nil, nil, err + } + } + + // create setting engine + settings := webrtc.SettingEngine{ + LoggerFactory: pionlog.New(logger), + } + + settings.DisableMediaEngineCopy(true) + settings.SetICETimeouts(disconnectedTimeout, failedTimeout, keepAliveInterval) + settings.SetNAT1To1IPs(manager.config.NAT1To1IPs, webrtc.ICECandidateTypeHost) + settings.SetLite(manager.config.ICELite) + // make sure server answer sdp setup as passive, to not force DTLS renegotiation + // otherwise iOS renegotiation fails with: Failed to set SSL role for the transport. + settings.SetAnsweringDTLSRole(webrtc.DTLSRoleServer) + + var networkType []webrtc.NetworkType + + // udp candidates + if manager.udpMux != nil { + settings.SetICEUDPMux(manager.udpMux) + networkType = append(networkType, + webrtc.NetworkTypeUDP4, + webrtc.NetworkTypeUDP6, + ) + } else if manager.config.EphemeralMax != 0 { + _ = settings.SetEphemeralUDPPortRange(manager.config.EphemeralMin, manager.config.EphemeralMax) + networkType = append(networkType, + webrtc.NetworkTypeUDP4, + webrtc.NetworkTypeUDP6, + ) + } + + // tcp candidates + if manager.tcpMux != nil { + settings.SetICETCPMux(manager.tcpMux) + networkType = append(networkType, + webrtc.NetworkTypeTCP4, + webrtc.NetworkTypeTCP6, + ) + } + + // enable support for TCP and UDP ICE candidates + settings.SetNetworkTypes(networkType) + + // create interceptor registry + registry := &interceptor.Registry{} + + // create bandwidth estimator + estimatorChan := make(chan cc.BandwidthEstimator, 1) + if manager.config.Estimator.Enabled { + congestionController, err := cc.NewInterceptor(func() (cc.BandwidthEstimator, error) { + return gcc.NewSendSideBWE( + gcc.SendSideBWEInitialBitrate(manager.config.Estimator.InitialBitrate), + gcc.SendSideBWEPacer(gcc.NewNoOpPacer()), + ) + }) + if err != nil { + return nil, nil, err + } + + congestionController.OnNewPeerConnection(func(id string, estimator cc.BandwidthEstimator) { + estimatorChan <- estimator + }) + + registry.Add(congestionController) + if err = webrtc.ConfigureTWCCHeaderExtensionSender(engine, registry); err != nil { + return nil, nil, err + } + } else { + // no estimator, send nil + estimatorChan <- nil + } + + if err := webrtc.RegisterDefaultInterceptors(engine, registry); err != nil { + return nil, nil, err + } + + // create new API + api := webrtc.NewAPI( + webrtc.WithMediaEngine(engine), + webrtc.WithSettingEngine(settings), + webrtc.WithInterceptorRegistry(registry), + ) + + // create new peer connection + configuration := manager.webrtcConfiguration + connection, err := api.NewPeerConnection(configuration) + return connection, <-estimatorChan, err +} + +func (manager *WebRTCManagerCtx) CreatePeer(session types.Session) (*webrtc.SessionDescription, types.WebRTCPeer, error) { + id := atomic.AddInt32(&manager.peerId, 1) + + // get metrics for session + metrics := manager.metrics.getBySession(session) + metrics.NewConnection() + + // add session id to logger context + logger := manager.logger.With().Str("session_id", session.ID()).Int32("peer_id", id).Logger() + logger.Info().Msg("creating webrtc peer") + + // all audios must have the same codec + audio := manager.capture.Audio() + audioCodec := audio.Codec() + + // all videos must have the same codec + video := manager.capture.Video() + videoCodec := video.Codec() + + connection, estimator, err := manager.newPeerConnection( + logger, []codec.RTPCodec{audioCodec, videoCodec}) + if err != nil { + return nil, nil, err + } + + // asynchronously send local ICE Candidates + if manager.config.ICETrickle { + connection.OnICECandidate(func(candidate *webrtc.ICECandidate) { + if candidate == nil { + logger.Debug().Msg("all local ice candidates sent") + return + } + + session.Send( + event.SIGNAL_CANDIDATE, + message.SignalCandidate{ + ICECandidateInit: candidate.ToJSON(), + }) + }) + } + + // audio track + audioTrack, err := NewTrack(logger, audioCodec, connection) + if err != nil { + return nil, nil, err + } + + // we disable audio by default manually + audioTrack.SetPaused(true) + + // set stream for audio track + _, err = audioTrack.SetStream(audio) + if err != nil { + return nil, nil, err + } + + // video track + videoRtcp := make(chan []rtcp.Packet, 1) + videoTrack, err := NewTrack(logger, videoCodec, connection, WithRtcpChan(videoRtcp)) + if err != nil { + return nil, nil, err + } + + // + // stream for video track will be set later + // + + // data channel + + dataChannel, err := connection.CreateDataChannel("data", nil) + if err != nil { + return nil, nil, err + } + + peer := &WebRTCPeerCtx{ + logger: logger, + session: session, + metrics: metrics, + connection: connection, + // bandwidth estimator + estimator: estimator, + estimateTrend: utils.NewTrendDetector( + utils.TrendDetectorParams{ + // Probing + //RequiredSamples: 3, + //DownwardTrendThreshold: 0.0, + //CollapseValues: false, + // Non-Probing + RequiredSamples: 8, + DownwardTrendThreshold: -0.5, + CollapseValues: true, + }), + // stream selectors + video: video, + audio: audio, + // tracks & channels + audioTrack: audioTrack, + videoTrack: videoTrack, + dataChannel: dataChannel, + rtcpChannel: videoRtcp, + // config + iceTrickle: manager.config.ICETrickle, + estimatorConfig: manager.config.Estimator, + audioDisabled: true, // we disable audio by default manually + } + + connection.OnTrack(func(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) { + logger := logger.With(). + Str("kind", track.Kind().String()). + Str("mime", track.Codec().RTPCodecCapability.MimeType). + Logger() + + logger.Info().Msgf("received new remote track") + + if !session.Profile().CanShareMedia { + err := receiver.Stop() + logger.Warn().Err(err).Msg("media sharing is disabled for this session") + return + } + + // parse codec from remote track + codec, ok := codec.ParseRTC(track.Codec()) + if !ok { + err := receiver.Stop() + logger.Warn().Err(err).Msg("remote track with unknown codec") + return + } + + var srcManager types.StreamSrcManager + + stopped := false + stopFn := func() { + if stopped { + return + } + + stopped = true + err := receiver.Stop() + srcManager.Stop() + logger.Err(err).Msg("remote track stopped") + } + + if track.Kind() == webrtc.RTPCodecTypeAudio { + // audio -> microphone + srcManager = manager.capture.Microphone() + defer stopFn() + + if manager.micStop != nil { + (*manager.micStop)() + } + manager.micStop = &stopFn + } else if track.Kind() == webrtc.RTPCodecTypeVideo { + // video -> webcam + srcManager = manager.capture.Webcam() + defer stopFn() + + if manager.camStop != nil { + (*manager.camStop)() + } + manager.camStop = &stopFn + } else { + err := receiver.Stop() + logger.Warn().Err(err).Msg("remote track with unsupported codec type") + return + } + + err := srcManager.Start(codec) + if err != nil { + logger.Err(err).Msg("failed to start pipeline") + return + } + + ticker := time.NewTicker(rtcpPLIInterval) + defer ticker.Stop() + + go func() { + for range ticker.C { + err := connection.WriteRTCP([]rtcp.Packet{ + &rtcp.PictureLossIndication{ + MediaSSRC: uint32(track.SSRC()), + }, + }) + + if err != nil { + logger.Err(err).Msg("remote track rtcp send err") + } + } + }() + + buf := make([]byte, 1400) + for { + i, _, err := track.Read(buf) + if err != nil { + logger.Warn().Err(err).Msg("failed read from remote track") + break + } + + srcManager.Push(buf[:i]) + } + + logger.Info().Msg("remote track data finished") + }) + + connection.OnDataChannel(func(dc *webrtc.DataChannel) { + logger.Info().Interface("data_channel", dc).Msg("got remote data channel") + + // + // old implementation created a new data channel on client side + // new implementation creates a new data channel on server side + // + + // handle legacy data channel + dc.OnMessage(func(message webrtc.DataChannelMessage) { + if err := manager.handleLegacy(logger, message.Data, session); err != nil { + logger.Err(err).Msg("data handle failed") + } + }) + + // handle legacy data channel + peer.dataChannel = dc + }) + + var once sync.Once + connection.OnConnectionStateChange(func(state webrtc.PeerConnectionState) { + switch state { + case webrtc.PeerConnectionStateConnected: + session.SetWebRTCConnected(peer, true) + case webrtc.PeerConnectionStateDisconnected, + webrtc.PeerConnectionStateFailed: + peer.Destroy() + case webrtc.PeerConnectionStateClosed: + // ensure we only run this once + once.Do(func() { + session.SetWebRTCConnected(peer, false) + // + // TODO: Shutdown peer? + // + audioTrack.Shutdown() + videoTrack.Shutdown() + close(videoRtcp) + }) + } + + metrics.SetState(state) + }) + + dataChannel.OnOpen(func() { + manager.curImage.AddListener(peer) + manager.curPosition.AddListener(peer) + + // send initial cursor image + cur, img, err := manager.curImage.GetCurrent() + if err == nil { + err := peer.SendCursorImage(cur, img) + if err != nil { + logger.Err(err).Msg("failed to set cursor image") + } + } else { + logger.Err(err).Msg("failed to get cursor image") + } + + // send initial cursor position + x, y := manager.desktop.GetCursorPosition() + err = peer.SendCursorPosition(x, y) + if err != nil { + logger.Err(err).Msg("failed to set cursor position") + } + }) + + dataChannel.OnClose(func() { + manager.curImage.RemoveListener(peer) + manager.curPosition.RemoveListener(peer) + }) + + dataChannel.OnMessage(func(message webrtc.DataChannelMessage) { + if err := manager.handle(logger, message.Data, dataChannel, session); err != nil { + logger.Err(err).Msg("data handle failed") + } + }) + + session.SetWebRTCPeer(peer) + + offer, err := peer.CreateOffer(false) + if err != nil { + return nil, nil, err + } + + // on negotiation needed handler must be registered after creating initial + // offer, otherwise it can fire and intercept sucessful negotiation + + connection.OnNegotiationNeeded(func() { + logger.Warn().Msg("negotiation is needed") + + if connection.SignalingState() != webrtc.SignalingStateStable { + logger.Warn().Msg("connection isn't stable yet; postponing...") + return + } + + offer, err := peer.CreateOffer(false) + if err != nil { + logger.Err(err).Msg("sdp offer failed") + return + } + + session.Send( + event.SIGNAL_OFFER, + message.SignalDescription{ + SDP: offer.SDP, + }) + }) + + // start metrics collectors + go metrics.rtcpReceiver(videoRtcp) + go metrics.connectionStats(connection) + + // start estimator reader + go peer.estimatorReader() + + return offer, peer, nil +} + +func (manager *WebRTCManagerCtx) SetCursorPosition(x, y int) { + manager.curPosition.Set(x, y) +} diff --git a/server/internal/webrtc/metrics.go b/server/internal/webrtc/metrics.go new file mode 100644 index 000000000..0841cd10c --- /dev/null +++ b/server/internal/webrtc/metrics.go @@ -0,0 +1,459 @@ +package webrtc + +import ( + "sync" + "time" + + "m1k1o/neko/pkg/types" + + "github.com/pion/rtcp" + "github.com/pion/webrtc/v3" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" +) + +const ( + // how often to read and process webrtc connection stats + connectionStatsInterval = 5 * time.Second +) + +type metricsManager struct { + mu sync.Mutex + + sessions map[string]*metrics +} + +func newMetricsManager() *metricsManager { + return &metricsManager{ + sessions: map[string]*metrics{}, + } +} + +func (m *metricsManager) getBySession(session types.Session) *metrics { + m.mu.Lock() + defer m.mu.Unlock() + + sessionId := session.ID() + + met, ok := m.sessions[sessionId] + if ok { + return met + } + + met = &metrics{ + sessionId: sessionId, + + connectionState: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "connection_state", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Connection state of session.", + ConstLabels: map[string]string{ + "session_id": sessionId, + }, + }), + connectionStateCount: promauto.NewCounter(prometheus.CounterOpts{ + Name: "connection_state_count", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Count of connection state changes for a session.", + ConstLabels: map[string]string{ + "session_id": sessionId, + }, + }), + connectionCount: promauto.NewCounter(prometheus.CounterOpts{ + Name: "connection_count", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Connection count of a session.", + ConstLabels: map[string]string{ + "session_id": sessionId, + }, + }), + + iceCandidates: map[string]struct{}{}, + iceCandidatesMu: &sync.Mutex{}, + iceCandidatesUdpCount: promauto.NewCounter(prometheus.CounterOpts{ + Name: "ice_candidates_count", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Count of ICE candidates sent by a remote client.", + ConstLabels: map[string]string{ + "session_id": sessionId, + "protocol": "udp", + }, + }), + iceCandidatesTcpCount: promauto.NewCounter(prometheus.CounterOpts{ + Name: "ice_candidates_count", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Count of ICE candidates sent by a remote client.", + ConstLabels: map[string]string{ + "session_id": sessionId, + "protocol": "tcp", + }, + }), + + iceCandidatesUsedUdp: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "ice_candidates_used", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Used ICE candidates that are currently in use.", + ConstLabels: map[string]string{ + "session_id": sessionId, + "protocol": "udp", + }, + }), + iceCandidatesUsedTcp: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "ice_candidates_used", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Used ICE candidates that are currently in use.", + ConstLabels: map[string]string{ + "session_id": sessionId, + "protocol": "tcp", + }, + }), + + videoIds: map[string]prometheus.Gauge{}, + videoIdsMu: &sync.Mutex{}, + + receiverEstimatedMaximumBitrate: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "receiver_estimated_maximum_bitrate", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Receiver Estimated Maximum Bitrate from RTCP.", + ConstLabels: map[string]string{ + "session_id": sessionId, + }, + }), + receiverEstimatedTargetBitrate: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "receiver_estimated_target_bitrate", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Receiver Estimated Target Bitrate using Google's congestion control.", + ConstLabels: map[string]string{ + "session_id": sessionId, + }, + }), + + receiverReportDelay: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "receiver_report_delay", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Receiver Report Delay from RTCP, expressed in units of 1/65536 seconds.", + ConstLabels: map[string]string{ + "session_id": sessionId, + }, + }), + receiverReportJitter: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "receiver_report_jitter", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Receiver Report Jitter from RTCP.", + ConstLabels: map[string]string{ + "session_id": sessionId, + }, + }), + receiverReportTotalLost: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "receiver_report_total_lost", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Receiver Report Total Lost from RTCP.", + ConstLabels: map[string]string{ + "session_id": sessionId, + }, + }), + + transportLayerNacks: promauto.NewCounter(prometheus.CounterOpts{ + Name: "transport_layer_nacks", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Transport Layer NACKs from RTCP.", + ConstLabels: map[string]string{ + "session_id": sessionId, + }, + }), + + iceBytesSent: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "bytes_sent", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Sent bytes to a session.", + ConstLabels: map[string]string{ + "session_id": sessionId, + "transport": "ice", + }, + }), + iceBytesReceived: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "bytes_received", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Received bytes from a session.", + ConstLabels: map[string]string{ + "session_id": sessionId, + "transport": "ice", + }, + }), + + sctpBytesSent: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "bytes_sent", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Sent bytes to a session.", + ConstLabels: map[string]string{ + "session_id": sessionId, + "transport": "sctp", + }, + }), + sctpBytesReceived: promauto.NewGauge(prometheus.GaugeOpts{ + Name: "bytes_received", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Received bytes from a session.", + ConstLabels: map[string]string{ + "session_id": sessionId, + "transport": "sctp", + }, + }), + } + + m.sessions[sessionId] = met + return met +} + +type metrics struct { + sessionId string + + connectionState prometheus.Gauge + connectionStateCount prometheus.Counter + connectionCount prometheus.Counter + + iceCandidates map[string]struct{} + iceCandidatesMu *sync.Mutex + iceCandidatesUdpCount prometheus.Counter + iceCandidatesTcpCount prometheus.Counter + + iceCandidatesUsedUdp prometheus.Gauge + iceCandidatesUsedTcp prometheus.Gauge + + videoIds map[string]prometheus.Gauge + videoIdsMu *sync.Mutex + + receiverEstimatedMaximumBitrate prometheus.Gauge + receiverEstimatedTargetBitrate prometheus.Gauge + + receiverReportDelay prometheus.Gauge + receiverReportJitter prometheus.Gauge + receiverReportTotalLost prometheus.Gauge + + transportLayerNacks prometheus.Counter + + iceBytesSent prometheus.Gauge + iceBytesReceived prometheus.Gauge + sctpBytesSent prometheus.Gauge + sctpBytesReceived prometheus.Gauge +} + +func (met *metrics) reset() { + met.videoIdsMu.Lock() + for _, entry := range met.videoIds { + entry.Set(0) + } + met.videoIdsMu.Unlock() + + met.iceCandidatesUsedUdp.Set(float64(0)) + met.iceCandidatesUsedTcp.Set(float64(0)) + + met.receiverEstimatedMaximumBitrate.Set(0) + + met.receiverReportDelay.Set(0) + met.receiverReportJitter.Set(0) +} + +func (met *metrics) NewConnection() { + met.connectionCount.Add(1) +} + +func (met *metrics) NewICECandidate(candidate webrtc.ICECandidateStats) { + met.iceCandidatesMu.Lock() + defer met.iceCandidatesMu.Unlock() + + if _, found := met.iceCandidates[candidate.ID]; found { + return + } + + met.iceCandidates[candidate.ID] = struct{}{} + if candidate.Protocol == "udp" { + met.iceCandidatesUdpCount.Add(1) + } else if candidate.Protocol == "tcp" { + met.iceCandidatesTcpCount.Add(1) + } +} + +func (met *metrics) SetICECandidatesUsed(candidates []webrtc.ICECandidateStats) { + udp, tcp := 0, 0 + for _, candidate := range candidates { + if candidate.Protocol == "udp" { + udp++ + } else if candidate.Protocol == "tcp" { + tcp++ + } + } + + met.iceCandidatesUsedUdp.Set(float64(udp)) + met.iceCandidatesUsedTcp.Set(float64(tcp)) +} + +func (met *metrics) SetState(state webrtc.PeerConnectionState) { + switch state { + case webrtc.PeerConnectionStateNew: + met.connectionState.Set(0) + case webrtc.PeerConnectionStateConnecting: + met.connectionState.Set(4) + case webrtc.PeerConnectionStateConnected: + met.connectionState.Set(5) + case webrtc.PeerConnectionStateDisconnected: + met.connectionState.Set(3) + case webrtc.PeerConnectionStateFailed: + met.connectionState.Set(2) + case webrtc.PeerConnectionStateClosed: + met.connectionState.Set(1) + met.reset() + default: + met.connectionState.Set(-1) + } + + met.connectionStateCount.Add(1) +} + +func (met *metrics) SetVideoID(videoId string) { + met.videoIdsMu.Lock() + defer met.videoIdsMu.Unlock() + + if _, found := met.videoIds[videoId]; !found { + met.videoIds[videoId] = promauto.NewGauge(prometheus.GaugeOpts{ + Name: "video_listeners", + Namespace: "neko", + Subsystem: "webrtc", + Help: "Listeners for Video pipelines by a session.", + ConstLabels: map[string]string{ + "session_id": met.sessionId, + "video_id": videoId, + }, + }) + } + + for id, entry := range met.videoIds { + if id == videoId { + entry.Set(1) + } else { + entry.Set(0) + } + } +} + +func (met *metrics) SetReceiverEstimatedMaximumBitrate(bitrate float32) { + met.receiverEstimatedMaximumBitrate.Set(float64(bitrate)) +} + +func (met *metrics) SetReceiverEstimatedTargetBitrate(bitrate float64) { + met.receiverEstimatedTargetBitrate.Set(bitrate) +} + +func (met *metrics) SetReceiverReport(report rtcp.ReceptionReport) { + met.receiverReportDelay.Set(float64(report.Delay)) + met.receiverReportJitter.Set(float64(report.Jitter)) + met.receiverReportTotalLost.Set(float64(report.TotalLost)) +} + +func (met *metrics) SetIceTransportStats(data webrtc.TransportStats) { + met.iceBytesSent.Set(float64(data.BytesSent)) + met.iceBytesReceived.Set(float64(data.BytesReceived)) +} + +func (met *metrics) SetSctpTransportStats(data webrtc.TransportStats) { + met.sctpBytesSent.Set(float64(data.BytesSent)) + met.sctpBytesReceived.Set(float64(data.BytesReceived)) +} + +// +// collectors +// + +func (met *metrics) rtcpReceiver(rtcpCh chan []rtcp.Packet) { + for { + packets, ok := <-rtcpCh + if !ok { + break + } + + for _, p := range packets { + switch rtcpPacket := p.(type) { + case *rtcp.ReceiverEstimatedMaximumBitrate: // TODO: Deprecated. + met.SetReceiverEstimatedMaximumBitrate(rtcpPacket.Bitrate) + + case *rtcp.ReceiverReport: + l := len(rtcpPacket.Reports) + if l > 0 { + // use only last report + met.SetReceiverReport(rtcpPacket.Reports[l-1]) + } + case *rtcp.TransportLayerNack: + for _, pair := range rtcpPacket.Nacks { + packetList := pair.PacketList() + met.transportLayerNacks.Add(float64(len(packetList))) + } + } + } + } +} + +func (met *metrics) connectionStats(connection *webrtc.PeerConnection) { + ticker := time.NewTicker(connectionStatsInterval) + defer ticker.Stop() + + for range ticker.C { + if connection.ConnectionState() == webrtc.PeerConnectionStateClosed { + break + } + + stats := connection.GetStats() + + data, ok := stats["iceTransport"].(webrtc.TransportStats) + if ok { + met.SetIceTransportStats(data) + } + + data, ok = stats["sctpTransport"].(webrtc.TransportStats) + if ok { + met.SetSctpTransportStats(data) + } + + remoteCandidates := map[string]webrtc.ICECandidateStats{} + nominatedRemoteCandidates := map[string]struct{}{} + for _, entry := range stats { + // only remote ice candidate stats + candidate, ok := entry.(webrtc.ICECandidateStats) + if ok && candidate.Type == webrtc.StatsTypeRemoteCandidate { + met.NewICECandidate(candidate) + remoteCandidates[candidate.ID] = candidate + } + + // only nominated ice candidate pair stats + pair, ok := entry.(webrtc.ICECandidatePairStats) + if ok && pair.Nominated { + nominatedRemoteCandidates[pair.RemoteCandidateID] = struct{}{} + } + } + + iceCandidatesUsed := []webrtc.ICECandidateStats{} + for id := range nominatedRemoteCandidates { + if candidate, ok := remoteCandidates[id]; ok { + iceCandidatesUsed = append(iceCandidatesUsed, candidate) + } + } + + met.SetICECandidatesUsed(iceCandidatesUsed) + } +} diff --git a/server/internal/webrtc/payload/receive.go b/server/internal/webrtc/payload/receive.go new file mode 100644 index 000000000..ee5deda91 --- /dev/null +++ b/server/internal/webrtc/payload/receive.go @@ -0,0 +1,55 @@ +package payload + +import "math" + +const ( + OP_MOVE = 0x01 + OP_SCROLL = 0x02 + OP_KEY_DOWN = 0x03 + OP_KEY_UP = 0x04 + OP_BTN_DOWN = 0x05 + OP_BTN_UP = 0x06 + OP_PING = 0x07 + // touch events + OP_TOUCH_BEGIN = 0x08 + OP_TOUCH_UPDATE = 0x09 + OP_TOUCH_END = 0x0a +) + +type Move struct { + X uint16 + Y uint16 +} + +// TODO: remove this once the client is fixed +type Scroll_Old struct { + X int16 + Y int16 +} + +type Scroll struct { + DeltaX int16 + DeltaY int16 + ControlKey bool +} + +type Key struct { + Key uint32 +} + +type Ping struct { + // client's timestamp split into two uint32 + ClientTs1 uint32 + ClientTs2 uint32 +} + +func (p Ping) ClientTs() uint64 { + return (uint64(p.ClientTs1) * uint64(math.MaxUint32)) + uint64(p.ClientTs2) +} + +type Touch struct { + TouchId uint32 + X int32 + Y int32 + Pressure uint8 +} diff --git a/server/internal/webrtc/payload/send.go b/server/internal/webrtc/payload/send.go new file mode 100644 index 000000000..949e27a36 --- /dev/null +++ b/server/internal/webrtc/payload/send.go @@ -0,0 +1,33 @@ +package payload + +import "math" + +const ( + OP_CURSOR_POSITION = 0x01 + OP_CURSOR_IMAGE = 0x02 + OP_PONG = 0x03 +) + +type CursorPosition struct { + X uint16 + Y uint16 +} + +type CursorImage struct { + Width uint16 + Height uint16 + Xhot uint16 + Yhot uint16 +} + +type Pong struct { + Ping + + // server's timestamp split into two uint32 + ServerTs1 uint32 + ServerTs2 uint32 +} + +func (p Pong) ServerTs() uint64 { + return (uint64(p.ServerTs1) * uint64(math.MaxUint32)) + uint64(p.ServerTs2) +} diff --git a/server/internal/webrtc/payload/types.go b/server/internal/webrtc/payload/types.go new file mode 100644 index 000000000..1395caed4 --- /dev/null +++ b/server/internal/webrtc/payload/types.go @@ -0,0 +1,6 @@ +package payload + +type Header struct { + Event uint8 + Length uint16 +} diff --git a/server/internal/webrtc/peer.go b/server/internal/webrtc/peer.go index e109eba1c..0439d5a1c 100644 --- a/server/internal/webrtc/peer.go +++ b/server/internal/webrtc/peer.go @@ -1,77 +1,543 @@ package webrtc import ( - "encoding/json" + "bytes" + "encoding/binary" "sync" + "time" + "github.com/pion/interceptor/pkg/cc" + "github.com/pion/rtcp" "github.com/pion/webrtc/v3" + "github.com/rs/zerolog" + + "m1k1o/neko/internal/config" + "m1k1o/neko/internal/webrtc/payload" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/utils" ) -type Peer struct { - id string +type WebRTCPeerCtx struct { mu sync.Mutex - manager *WebRTCManager + logger zerolog.Logger + session types.Session + metrics *metrics connection *webrtc.PeerConnection + // bandwidth estimator + estimator cc.BandwidthEstimator + estimateTrend *utils.TrendDetector + // stream selectors + video types.StreamSelectorManager + audio types.StreamSinkManager + // tracks & channels + audioTrack *Track + videoTrack *Track + dataChannel *webrtc.DataChannel + rtcpChannel chan []rtcp.Packet + // config + iceTrickle bool + estimatorConfig config.WebRTCEstimator + paused bool + videoAuto bool + videoDisabled bool + audioDisabled bool } -func (peer *Peer) CreateOffer() (string, error) { - desc, err := peer.connection.CreateOffer(nil) - if err != nil { - return "", err - } +// +// connection +// + +func (peer *WebRTCPeerCtx) CreateOffer(ICERestart bool) (*webrtc.SessionDescription, error) { + peer.mu.Lock() + defer peer.mu.Unlock() - err = peer.connection.SetLocalDescription(desc) + offer, err := peer.connection.CreateOffer(&webrtc.OfferOptions{ + ICERestart: ICERestart, + }) if err != nil { - return "", err + return nil, err } - return desc.SDP, nil + return peer.setLocalDescription(offer) } -func (peer *Peer) CreateAnswer() (string, error) { - desc, err := peer.connection.CreateAnswer(nil) +func (peer *WebRTCPeerCtx) CreateAnswer() (*webrtc.SessionDescription, error) { + peer.mu.Lock() + defer peer.mu.Unlock() + + answer, err := peer.connection.CreateAnswer(nil) if err != nil { - return "", err + return nil, err } - err = peer.connection.SetLocalDescription(desc) - if err != nil { - return "", nil + return peer.setLocalDescription(answer) +} + +func (peer *WebRTCPeerCtx) setLocalDescription(description webrtc.SessionDescription) (*webrtc.SessionDescription, error) { + if !peer.iceTrickle { + // Create channel that is blocked until ICE Gathering is complete + gatherComplete := webrtc.GatheringCompletePromise(peer.connection) + + if err := peer.connection.SetLocalDescription(description); err != nil { + return nil, err + } + + <-gatherComplete + } else { + if err := peer.connection.SetLocalDescription(description); err != nil { + return nil, err + } } - return desc.SDP, nil + return peer.connection.LocalDescription(), nil } -func (peer *Peer) SetOffer(sdp string) error { - return peer.connection.SetRemoteDescription(webrtc.SessionDescription{SDP: sdp, Type: webrtc.SDPTypeOffer}) +func (peer *WebRTCPeerCtx) SetRemoteDescription(desc webrtc.SessionDescription) error { + peer.mu.Lock() + defer peer.mu.Unlock() + + return peer.connection.SetRemoteDescription(desc) } -func (peer *Peer) SetAnswer(sdp string) error { - return peer.connection.SetRemoteDescription(webrtc.SessionDescription{SDP: sdp, Type: webrtc.SDPTypeAnswer}) +func (peer *WebRTCPeerCtx) SetCandidate(candidate webrtc.ICECandidateInit) error { + peer.mu.Lock() + defer peer.mu.Unlock() + + return peer.connection.AddICECandidate(candidate) } -func (peer *Peer) SetCandidate(candidateString string) error { - var candidate webrtc.ICECandidateInit - err := json.Unmarshal([]byte(candidateString), &candidate) - if err != nil { - return err +// TODO: Add shutdown function? +func (peer *WebRTCPeerCtx) Destroy() { + peer.mu.Lock() + defer peer.mu.Unlock() + + var err error + + // if peer connection is not closed, close it + if peer.connection.ConnectionState() != webrtc.PeerConnectionStateClosed { + err = peer.connection.Close() } - return peer.connection.AddICECandidate(candidate) + peer.logger.Err(err).Msg("peer connection destroyed") } -func (peer *Peer) WriteData(v interface{}) error { +func (peer *WebRTCPeerCtx) estimatorReader() { + conf := peer.estimatorConfig + + // if estimator is not in debug mode, use a nop logger + var debugLogger zerolog.Logger + if conf.Debug { + debugLogger = peer.logger.With().Str("component", "estimator").Logger().Level(zerolog.DebugLevel) + } else { + debugLogger = zerolog.Nop() + } + + // if estimator is disabled, do nothing + if peer.estimator == nil { + return + } + + // use a ticker to get current client target bitrate + ticker := time.NewTicker(conf.ReadInterval) + defer ticker.Stop() + + // since when is the estimate stable/unstable + stableSince := time.Now() // we asume stable at start + unstableSince := time.Time{} + // since when are we neutral but cannot accomodate current bitrate + // we migt be stalled or estimator just reached zer (very bad connection) + stalledSince := time.Time{} + // when was the last upgrade/downgrade + lastUpgradeTime := time.Time{} + lastDowngradeTime := time.Time{} + + for range ticker.C { + targetBitrate := peer.estimator.GetTargetBitrate() + peer.metrics.SetReceiverEstimatedTargetBitrate(float64(targetBitrate)) + + // if peer connection is closed, stop reading + if peer.connection.ConnectionState() == webrtc.PeerConnectionStateClosed { + break + } + + // if estimation or video is disabled, do nothing + if !peer.videoAuto || peer.videoDisabled || peer.paused || conf.Passive { + continue + } + + // get trend direction to decide if we should upgrade or downgrade + peer.estimateTrend.AddValue(int64(targetBitrate)) + direction := peer.estimateTrend.GetDirection() + + // get current stream bitrate + stream, ok := peer.videoTrack.Stream() + if !ok { + debugLogger.Warn().Msg("looks like we don't have a stream yet, skipping bitrate estimation") + continue + } + + // if stream bitrate is 0, we need to wait for some time until we get a valid value + streamId, streamBitrate := stream.ID(), stream.Bitrate() + if streamBitrate == 0 { + debugLogger.Warn().Msg("looks like stream bitrate is 0, we need to wait for some time") + continue + } + + // check whats the difference between target and stream bitrate + diff := float64(targetBitrate) / float64(streamBitrate) + + debugLogger.Info(). + Float64("diff", diff). + Int("target_bitrate", targetBitrate). + Uint64("stream_bitrate", streamBitrate). + Str("direction", direction.String()). + Msg("got bitrate from estimator") + + // if we can accomodate current stream or we are not netural anymore, + // we are not stalled so we reset the stalled time + if direction != utils.TrendDirectionNeutral || diff > 1+conf.DiffThreshold { + stalledSince = time.Now() + } + + // if we are neutral and stalled for too long, we might be congesting + stalled := direction == utils.TrendDirectionNeutral && time.Since(stalledSince) > conf.StalledDuration + if stalled { + debugLogger.Warn(). + Time("stalled_since", stalledSince). + Msgf("it looks like we are stalled") + } + + // if we have an downward trend or are stalled, we might be congesting + if direction == utils.TrendDirectionDownward || stalled { + // we reset the stable time because we are congesting + stableSince = time.Now() + + // if we downgraded recently, we wait for some more time + if time.Since(lastDowngradeTime) < conf.DowngradeBackoff { + debugLogger.Debug(). + Time("last_downgrade", lastDowngradeTime). + Msgf("downgraded recently, waiting for at least %v", conf.DowngradeBackoff) + continue + } + + // if we are not unstable but we fluctuate we should wait for some more time + if time.Since(unstableSince) < conf.UnstableDuration { + debugLogger.Debug(). + Time("unstable_since", unstableSince). + Msgf("we are not unstable long enough, waiting for at least %v", conf.UnstableDuration) + continue + } + + // if we still have a big difference between target and stream bitrate, we wait for some more time + if conf.DiffThreshold >= 0 && diff > 1+conf.DiffThreshold { + debugLogger.Debug(). + Float64("diff", diff). + Float64("threshold", conf.DiffThreshold). + Msgf("we still have a big difference between target and stream bitrate, " + + "therefore we still should be able to accomodate current stream") + continue + } + + err := peer.SetVideo(types.PeerVideoRequest{ + Selector: &types.StreamSelector{ + ID: streamId, + Type: types.StreamSelectorTypeLower, + }, + }) + if err != nil && err != types.ErrWebRTCStreamNotFound { + peer.logger.Warn().Err(err).Msg("failed to downgrade video stream") + } + lastDowngradeTime = time.Now() + + if err == types.ErrWebRTCStreamNotFound { + debugLogger.Info().Msg("looks like we are already on the lowest stream") + } else { + debugLogger.Info().Msg("downgraded video stream") + } + continue + } + + // we reset the unstable time because we are not congesting + unstableSince = time.Now() + + // if we have a neutral or upward trend, that means our estimate is stable + // if we are on the highest stream, we don't need to do anything + // but if there is a higher stream, we should try to upgrade and see if it works + + // if we upgraded recently, we wait for some more time + if time.Since(lastUpgradeTime) < conf.UpgradeBackoff { + debugLogger.Debug(). + Time("last_upgrade", lastUpgradeTime). + Msgf("upgraded recently, waiting for at least %v", conf.UpgradeBackoff) + continue + } + + // if we are not stable for long enough, we wait for some more time + // because bandwidth estimation might fluctuate + if time.Since(stableSince) < conf.StableDuration { + debugLogger.Debug(). + Time("stable_since", stableSince). + Msgf("we are not stable long enough, waiting for at least %v", conf.StableDuration) + continue + } + + // upgrade only if estimated bitrate passed the threshold + if conf.DiffThreshold >= 0 && diff < 1+conf.DiffThreshold { + debugLogger.Debug(). + Float64("diff", diff). + Float64("threshold", conf.DiffThreshold). + Msgf("looks like we don't have enough bitrate to accomodate higher stream, " + + "therefore we should wait for some more time") + continue + } + + err := peer.SetVideo(types.PeerVideoRequest{ + Selector: &types.StreamSelector{ + ID: streamId, + Type: types.StreamSelectorTypeHigher, + }, + }) + if err != nil && err != types.ErrWebRTCStreamNotFound { + peer.logger.Warn().Err(err).Msg("failed to upgrade video stream") + } + lastUpgradeTime = time.Now() + + if err == types.ErrWebRTCStreamNotFound { + debugLogger.Info().Msg("looks like we are already on the highest stream") + } else { + debugLogger.Info().Msg("upgraded video stream") + } + } +} + +func (peer *WebRTCPeerCtx) SetPaused(isPaused bool) error { peer.mu.Lock() defer peer.mu.Unlock() + + peer.videoTrack.SetPaused(isPaused || peer.videoDisabled) + peer.audioTrack.SetPaused(isPaused || peer.audioDisabled) + + peer.logger.Info().Bool("is_paused", isPaused).Msg("set paused") + peer.paused = isPaused + return nil } -func (peer *Peer) Destroy() error { - if peer.connection != nil && peer.connection.ConnectionState() != webrtc.PeerConnectionStateClosed { - if err := peer.connection.Close(); err != nil { +func (peer *WebRTCPeerCtx) Paused() bool { + peer.mu.Lock() + defer peer.mu.Unlock() + + return peer.paused +} + +// +// video +// + +func (peer *WebRTCPeerCtx) SetVideo(r types.PeerVideoRequest) error { + peer.mu.Lock() + defer peer.mu.Unlock() + + modified := false + + // video disabled + if r.Disabled != nil { + disabled := *r.Disabled + + // update only if changed + if peer.videoDisabled != disabled { + peer.videoDisabled = disabled + peer.videoTrack.SetPaused(disabled || peer.paused) + + peer.logger.Info().Bool("disabled", disabled).Msg("set video disabled") + modified = true + } + } + + // video selector + if r.Selector != nil { + selector := *r.Selector + + // get requested video stream from selector + stream, ok := peer.video.GetStream(selector) + if !ok { + return types.ErrWebRTCStreamNotFound + } + + // set video stream to track + changed, err := peer.videoTrack.SetStream(stream) + if err != nil { return err } + + // update only if stream changed + if changed { + videoID := stream.ID() + peer.metrics.SetVideoID(videoID) + + peer.logger.Info().Str("video_id", videoID).Msg("set video") + modified = true + } + } + + // video auto + if r.Auto != nil { + videoAuto := *r.Auto + + if peer.estimator == nil || peer.estimatorConfig.Passive { + peer.logger.Warn().Msg("estimator is disabled or in passive mode, cannot change video auto") + videoAuto = false // ensure video auto is disabled + } + + // update only if video auto changed + if peer.videoAuto != videoAuto { + peer.videoAuto = videoAuto + + peer.logger.Info().Bool("video_auto", videoAuto).Msg("set video auto") + modified = true + } + } + + // send video signal if modified + if modified { + go func() { + // in goroutine because of mutex and we don't want to block + peer.session.Send(event.SIGNAL_VIDEO, peer.Video()) + }() + } + + return nil +} + +func (peer *WebRTCPeerCtx) Video() types.PeerVideo { + peer.mu.Lock() + defer peer.mu.Unlock() + + // get current video stream ID + ID := "" + stream, ok := peer.videoTrack.Stream() + if ok { + ID = stream.ID() + } + + return types.PeerVideo{ + Disabled: peer.videoDisabled, + ID: ID, + Video: ID, // TODO: Remove, used for backward compatibility + Auto: peer.videoAuto, + } +} + +// +// audio +// + +func (peer *WebRTCPeerCtx) SetAudio(r types.PeerAudioRequest) error { + peer.mu.Lock() + defer peer.mu.Unlock() + + modified := false + + // audio disabled + if r.Disabled != nil { + disabled := *r.Disabled + + // update only if changed + if peer.audioDisabled != disabled { + peer.audioDisabled = disabled + peer.audioTrack.SetPaused(disabled || peer.paused) + + peer.logger.Info().Bool("disabled", disabled).Msg("set audio disabled") + modified = true + } + } + + // send video signal if modified + if modified { + go func() { + // in goroutine because of mutex and we don't want to block + peer.session.Send(event.SIGNAL_AUDIO, peer.Audio()) + }() } return nil } + +func (peer *WebRTCPeerCtx) Audio() types.PeerAudio { + peer.mu.Lock() + defer peer.mu.Unlock() + + return types.PeerAudio{ + Disabled: peer.audioDisabled, + } +} + +// +// data channel +// + +func (peer *WebRTCPeerCtx) SendCursorPosition(x, y int) error { + peer.mu.Lock() + defer peer.mu.Unlock() + + // do not send cursor position to host + if peer.session.IsHost() { + return nil + } + + header := payload.Header{ + Event: payload.OP_CURSOR_POSITION, + Length: 7, + } + + data := payload.CursorPosition{ + X: uint16(x), + Y: uint16(y), + } + + buffer := &bytes.Buffer{} + + if err := binary.Write(buffer, binary.BigEndian, header); err != nil { + return err + } + + if err := binary.Write(buffer, binary.BigEndian, data); err != nil { + return err + } + + return peer.dataChannel.Send(buffer.Bytes()) +} + +func (peer *WebRTCPeerCtx) SendCursorImage(cur *types.CursorImage, img []byte) error { + peer.mu.Lock() + defer peer.mu.Unlock() + + header := payload.Header{ + Event: payload.OP_CURSOR_IMAGE, + Length: uint16(11 + len(img)), + } + + data := payload.CursorImage{ + Width: cur.Width, + Height: cur.Height, + Xhot: cur.Xhot, + Yhot: cur.Yhot, + } + + buffer := &bytes.Buffer{} + + if err := binary.Write(buffer, binary.BigEndian, header); err != nil { + return err + } + + if err := binary.Write(buffer, binary.BigEndian, data); err != nil { + return err + } + + if err := binary.Write(buffer, binary.BigEndian, img); err != nil { + return err + } + + return peer.dataChannel.Send(buffer.Bytes()) +} diff --git a/server/internal/webrtc/track.go b/server/internal/webrtc/track.go new file mode 100644 index 000000000..05e70ab09 --- /dev/null +++ b/server/internal/webrtc/track.go @@ -0,0 +1,203 @@ +package webrtc + +import ( + "errors" + "io" + "sync" + + "github.com/pion/rtcp" + "github.com/pion/webrtc/v3" + "github.com/pion/webrtc/v3/pkg/media" + "github.com/rs/zerolog" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/codec" +) + +type Track struct { + logger zerolog.Logger + track *webrtc.TrackLocalStaticSample + + rtcpCh chan []rtcp.Packet + sample chan types.Sample + + paused bool + stream types.StreamSinkManager + streamMu sync.Mutex +} + +type trackOption func(*Track) + +func WithRtcpChan(rtcp chan []rtcp.Packet) trackOption { + return func(t *Track) { + t.rtcpCh = rtcp + } +} + +func NewTrack(logger zerolog.Logger, codec codec.RTPCodec, connection *webrtc.PeerConnection, opts ...trackOption) (*Track, error) { + id := codec.Type.String() + track, err := webrtc.NewTrackLocalStaticSample(codec.Capability, id, "stream") + if err != nil { + return nil, err + } + + t := &Track{ + logger: logger.With().Str("id", id).Logger(), + track: track, + rtcpCh: nil, + sample: make(chan types.Sample), + } + + for _, opt := range opts { + opt(t) + } + + sender, err := connection.AddTrack(t.track) + if err != nil { + return nil, err + } + + go t.rtcpReader(sender) + go t.sampleReader() + + return t, nil +} + +func (t *Track) Shutdown() { + t.RemoveStream() + close(t.sample) +} + +func (t *Track) rtcpReader(sender *webrtc.RTPSender) { + for { + packets, _, err := sender.ReadRTCP() + if err != nil { + if errors.Is(err, io.EOF) || errors.Is(err, io.ErrClosedPipe) { + t.logger.Debug().Msg("track rtcp reader closed") + return + } + + t.logger.Warn().Err(err).Msg("failed to read track rtcp") + continue + } + + if t.rtcpCh != nil { + t.rtcpCh <- packets + } + } +} + +// --- sample --- + +func (t *Track) sampleReader() { + for { + sample, ok := <-t.sample + if !ok { + t.logger.Debug().Msg("track sample reader closed") + return + } + + err := t.track.WriteSample(media.Sample{ + Data: sample.Data, + Duration: sample.Duration, + Timestamp: sample.Timestamp, + }) + + if err != nil && !errors.Is(err, io.ErrClosedPipe) { + t.logger.Warn().Err(err).Msg("failed to write sample to track") + } + } +} + +func (t *Track) WriteSample(sample types.Sample) { + t.sample <- sample +} + +// --- stream --- + +func (t *Track) SetStream(stream types.StreamSinkManager) (bool, error) { + t.streamMu.Lock() + defer t.streamMu.Unlock() + + // if we already listen to the stream, do nothing + if t.stream == stream { + return false, nil + } + + // if paused, we switch the stream but don't add the listener + if t.paused { + t.stream = stream + return true, nil + } + + var err error + if t.stream != nil { + err = t.stream.MoveListenerTo(t, stream) + } else { + err = stream.AddListener(t) + } + if err != nil { + return false, err + } + + t.stream = stream + return true, nil +} + +func (t *Track) RemoveStream() { + t.streamMu.Lock() + defer t.streamMu.Unlock() + + // if there is no stream, or paused we don't need to remove the listener + if t.stream == nil || t.paused { + t.stream = nil + return + } + + err := t.stream.RemoveListener(t) + if err != nil { + t.logger.Warn().Err(err).Msg("failed to remove listener from stream") + } + + t.stream = nil +} + +func (t *Track) Stream() (types.StreamSinkManager, bool) { + t.streamMu.Lock() + defer t.streamMu.Unlock() + + return t.stream, t.stream != nil +} + +// --- paused --- + +func (t *Track) SetPaused(paused bool) { + t.streamMu.Lock() + defer t.streamMu.Unlock() + + // if there is no state change or no stream, do nothing + if t.paused == paused || t.stream == nil { + t.paused = paused + return + } + + var err error + if paused { + err = t.stream.RemoveListener(t) + } else { + err = t.stream.AddListener(t) + } + if err != nil { + t.logger.Warn().Err(err).Msg("failed to change listener state") + return + } + + t.paused = paused +} + +func (t *Track) Paused() bool { + t.streamMu.Lock() + defer t.streamMu.Unlock() + + return t.paused +} diff --git a/server/internal/webrtc/webrtc.go b/server/internal/webrtc/webrtc.go deleted file mode 100644 index fe278caea..000000000 --- a/server/internal/webrtc/webrtc.go +++ /dev/null @@ -1,345 +0,0 @@ -package webrtc - -import ( - "encoding/json" - "errors" - "fmt" - "io" - "net" - "strings" - "time" - - "github.com/pion/ice/v2" - "github.com/pion/interceptor" - "github.com/pion/webrtc/v3" - "github.com/pion/webrtc/v3/pkg/media" - "github.com/rs/zerolog" - "github.com/rs/zerolog/log" - - "m1k1o/neko/internal/config" - "m1k1o/neko/internal/types" - "m1k1o/neko/internal/webrtc/pionlog" -) - -func New(sessions types.SessionManager, capture types.CaptureManager, desktop types.DesktopManager, config *config.WebRTC) *WebRTCManager { - return &WebRTCManager{ - logger: log.With().Str("module", "webrtc").Logger(), - capture: capture, - desktop: desktop, - sessions: sessions, - config: config, - } -} - -type WebRTCManager struct { - logger zerolog.Logger - videoTrack *webrtc.TrackLocalStaticSample - audioTrack *webrtc.TrackLocalStaticSample - sessions types.SessionManager - capture types.CaptureManager - desktop types.DesktopManager - config *config.WebRTC - api *webrtc.API -} - -func (manager *WebRTCManager) Start() { - var err error - - // - // audio - // - - audioCodec := manager.capture.Audio().Codec() - manager.audioTrack, err = webrtc.NewTrackLocalStaticSample(audioCodec.Capability, "audio", "stream") - if err != nil { - manager.logger.Panic().Err(err).Msg("unable to create audio track") - } - - go func() { - for { - sample, ok := <-manager.capture.Audio().GetSampleChannel() - if !ok { - manager.logger.Debug().Msg("audio capture channel is closed") - continue - } - - err := manager.audioTrack.WriteSample(media.Sample(sample)) - if err != nil && errors.Is(err, io.ErrClosedPipe) { - manager.logger.Warn().Err(err).Msg("audio pipeline failed to write") - } - } - }() - - // - // video - // - - videoCodec := manager.capture.Video().Codec() - manager.videoTrack, err = webrtc.NewTrackLocalStaticSample(videoCodec.Capability, "video", "stream") - if err != nil { - manager.logger.Panic().Err(err).Msg("unable to create video track") - } - - go func() { - for { - sample, ok := <-manager.capture.Video().GetSampleChannel() - if !ok { - manager.logger.Debug().Msg("video capture channel is closed") - continue - } - - err := manager.videoTrack.WriteSample(media.Sample(sample)) - if err != nil && errors.Is(err, io.ErrClosedPipe) { - manager.logger.Warn().Err(err).Msg("video pipeline failed to write") - } - } - }() - - // - // api - // - - if err := manager.initAPI(); err != nil { - manager.logger.Panic().Err(err).Msg("failed to initialize webrtc API") - } - - manager.logger.Info(). - Str("ice_lite", fmt.Sprintf("%t", manager.config.ICELite)). - Str("ice_servers", fmt.Sprintf("%+v", manager.config.ICEServers)). - Str("ephemeral_port_range", fmt.Sprintf("%d-%d", manager.config.EphemeralMin, manager.config.EphemeralMax)). - Str("nat_ips", strings.Join(manager.config.NAT1To1IPs, ",")). - Msgf("webrtc starting") -} - -func (manager *WebRTCManager) Shutdown() error { - manager.logger.Info().Msgf("webrtc shutting down") - return nil -} - -func (manager *WebRTCManager) initAPI() error { - logger := pionlog.New(manager.logger) - - settings := webrtc.SettingEngine{ - LoggerFactory: logger, - } - - settings.SetNAT1To1IPs(manager.config.NAT1To1IPs, webrtc.ICECandidateTypeHost) - settings.SetICETimeouts(6*time.Second, 6*time.Second, 3*time.Second) - settings.SetSRTPReplayProtectionWindow(512) - settings.SetLite(manager.config.ICELite) - - var networkType []webrtc.NetworkType - - // Add TCP Mux - if manager.config.TCPMUX > 0 { - tcpListener, err := net.ListenTCP("tcp", &net.TCPAddr{ - IP: net.IP{0, 0, 0, 0}, - Port: manager.config.TCPMUX, - }) - - if err != nil { - return err - } - - tcpMux := ice.NewTCPMuxDefault(ice.TCPMuxParams{ - Listener: tcpListener, - Logger: logger.NewLogger("ice-tcp"), - ReadBufferSize: 32, // receiving channel size - WriteBufferSize: 4 * 1024 * 1024, // write buffer size, 4MB - }) - settings.SetICETCPMux(tcpMux) - - networkType = append(networkType, webrtc.NetworkTypeTCP4) - manager.logger.Info().Str("listener", tcpListener.Addr().String()).Msg("using TCP MUX") - } - - // Add UDP Mux - if manager.config.UDPMUX > 0 { - udpMux, err := ice.NewMultiUDPMuxFromPort(manager.config.UDPMUX, - ice.UDPMuxFromPortWithLogger(logger.NewLogger("ice-udp")), - ) - - if err != nil { - return err - } - - settings.SetICEUDPMux(udpMux) - - networkType = append(networkType, webrtc.NetworkTypeUDP4) - manager.logger.Info().Int("port", manager.config.UDPMUX).Msg("using UDP MUX") - } else if manager.config.EphemeralMax != 0 { - _ = settings.SetEphemeralUDPPortRange(manager.config.EphemeralMin, manager.config.EphemeralMax) - networkType = append(networkType, - webrtc.NetworkTypeUDP4, - webrtc.NetworkTypeUDP6, - ) - } - - settings.SetNetworkTypes(networkType) - - // Create MediaEngine with selected codecs - engine := webrtc.MediaEngine{} - manager.capture.Audio().Codec().Register(&engine) - manager.capture.Video().Codec().Register(&engine) - - // Register Interceptors - i := &interceptor.Registry{} - if err := webrtc.RegisterDefaultInterceptors(&engine, i); err != nil { - return err - } - - // Create API with MediaEngine and SettingEngine - manager.api = webrtc.NewAPI( - webrtc.WithMediaEngine(&engine), - webrtc.WithSettingEngine(settings), - webrtc.WithInterceptorRegistry(i), - ) - - return nil -} - -func (manager *WebRTCManager) CreatePeer(id string, session types.Session) (types.Peer, error) { - configuration := webrtc.Configuration{ - SDPSemantics: webrtc.SDPSemanticsUnifiedPlanWithFallback, - } - - if !manager.config.ICELite { - configuration.ICEServers = manager.config.ICEServers - } - - // Create new peer connection - connection, err := manager.api.NewPeerConnection(configuration) - if err != nil { - return nil, err - } - - negotiated := true - _, err = connection.CreateDataChannel("data", &webrtc.DataChannelInit{ - Negotiated: &negotiated, - }) - if err != nil { - return nil, err - } - - connection.OnDataChannel(func(d *webrtc.DataChannel) { - d.OnMessage(func(msg webrtc.DataChannelMessage) { - if err = manager.handle(id, msg); err != nil { - manager.logger.Warn().Err(err).Msg("data handle failed") - } - }) - }) - - // Set the handler for ICE connection state - // This will notify you when the peer has connected/disconnected - connection.OnICEConnectionStateChange(func(connectionState webrtc.ICEConnectionState) { - manager.logger.Info(). - Str("connection_state", connectionState.String()). - Msg("connection state has changed") - }) - - rtpVideo, err := connection.AddTrack(manager.videoTrack) - if err != nil { - return nil, err - } - - rtpAudio, err := connection.AddTrack(manager.audioTrack) - if err != nil { - return nil, err - } - - connection.OnConnectionStateChange(func(state webrtc.PeerConnectionState) { - switch state { - case webrtc.PeerConnectionStateDisconnected: - manager.logger.Info().Str("id", id).Msg("peer disconnected") - manager.sessions.Destroy(id) - case webrtc.PeerConnectionStateFailed: - manager.logger.Warn().Str("id", id).Msg("peer failed") - manager.sessions.Destroy(id) - case webrtc.PeerConnectionStateClosed: - manager.logger.Info().Str("id", id).Msg("peer closed") - manager.sessions.Destroy(id) - case webrtc.PeerConnectionStateConnected: - manager.logger.Info().Str("id", id).Msg("peer connected") - if err = session.SetConnected(true); err != nil { - manager.logger.Warn().Err(err).Msg("unable to set connected on peer") - manager.sessions.Destroy(id) - } - } - }) - - peer := &Peer{ - id: id, - manager: manager, - connection: connection, - } - - connection.OnNegotiationNeeded(func() { - manager.logger.Warn().Msg("negotiation is needed") - - sdp, err := peer.CreateOffer() - if err != nil { - manager.logger.Err(err).Msg("creating offer failed") - return - } - - err = session.SignalLocalOffer(sdp) - if err != nil { - manager.logger.Warn().Err(err).Msg("sending SignalLocalOffer failed") - return - } - }) - - connection.OnICECandidate(func(i *webrtc.ICECandidate) { - if i == nil { - manager.logger.Info().Msg("sent all ICECandidates") - return - } - - candidateString, err := json.Marshal(i.ToJSON()) - if err != nil { - manager.logger.Warn().Err(err).Msg("converting ICECandidate to json failed") - return - } - - if err := session.SignalLocalCandidate(string(candidateString)); err != nil { - manager.logger.Warn().Err(err).Msg("sending SignalCandidate failed") - return - } - }) - - if err := session.SetPeer(peer); err != nil { - return nil, err - } - - go func() { - rtcpBuf := make([]byte, 1500) - for { - if _, _, rtcpErr := rtpVideo.Read(rtcpBuf); rtcpErr != nil { - return - } - } - }() - - go func() { - rtcpBuf := make([]byte, 1500) - for { - if _, _, rtcpErr := rtpAudio.Read(rtcpBuf); rtcpErr != nil { - return - } - } - }() - - return peer, nil -} - -func (manager *WebRTCManager) ICELite() bool { - return manager.config.ICELite -} - -func (manager *WebRTCManager) ICEServers() []webrtc.ICEServer { - return manager.config.ICEServers -} - -func (manager *WebRTCManager) ImplicitControl() bool { - return manager.config.ImplicitControl -} diff --git a/server/internal/websocket/filechooserdialog.go b/server/internal/websocket/filechooserdialog.go new file mode 100644 index 000000000..1e3bc0a34 --- /dev/null +++ b/server/internal/websocket/filechooserdialog.go @@ -0,0 +1,67 @@ +package websocket + +import ( + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" +) + +func (manager *WebSocketManagerCtx) fileChooserDialogEvents() { + var activeSession types.Session + + // when dialog opens, everyone should be notified. + manager.desktop.OnFileChooserDialogOpened(func() { + manager.logger.Info().Msg("file chooser dialog opened") + + host, hasHost := manager.sessions.GetHost() + if !hasHost { + manager.logger.Warn().Msg("no host for file chooser dialog found, closing") + go manager.desktop.CloseFileChooserDialog() + return + } + + activeSession = host + + go manager.sessions.Broadcast( + event.FILE_CHOOSER_DIALOG_OPENED, + message.SessionID{ + ID: host.ID(), + }) + }) + + // when dialog closes, everyone should be notified. + manager.desktop.OnFileChooserDialogClosed(func() { + manager.logger.Info().Msg("file chooser dialog closed") + + activeSession = nil + + go manager.sessions.Broadcast( + event.FILE_CHOOSER_DIALOG_CLOSED, + message.SessionID{}) + }) + + // when new user joins, and someone holds dialog, he shouldd be notified about it. + manager.sessions.OnConnected(func(session types.Session) { + if activeSession == nil { + return + } + + manager.logger.Debug().Str("session_id", session.ID()).Msg("sending file chooser dialog status to a new session") + + session.Send( + event.FILE_CHOOSER_DIALOG_OPENED, + message.SessionID{ + ID: activeSession.ID(), + }) + }) + + // when user, that holds dialog, disconnects, it should be closed. + manager.sessions.OnDisconnected(func(session types.Session) { + if activeSession == nil || activeSession != session { + return + } + + manager.logger.Info().Msg("file chooser dialog owner left, closing") + manager.desktop.CloseFileChooserDialog() + }) +} diff --git a/server/internal/websocket/handler/admin.go b/server/internal/websocket/handler/admin.go deleted file mode 100644 index 45c803ab1..000000000 --- a/server/internal/websocket/handler/admin.go +++ /dev/null @@ -1,325 +0,0 @@ -package handler - -import ( - "strings" - - "m1k1o/neko/internal/types" - "m1k1o/neko/internal/types/event" - "m1k1o/neko/internal/types/message" -) - -func (h *MessageHandler) adminLock(id string, session types.Session, payload *message.AdminLock) error { - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - if h.state.IsLocked(payload.Resource) { - h.logger.Debug().Str("resource", payload.Resource).Msg("resource already locked...") - return nil - } - - // allow only known resources - switch payload.Resource { - case "login": - case "control": - case "file_transfer": - default: - h.logger.Debug().Msg("unknown lock resource") - return nil - } - - // TODO: Handle locks in sessions as flags. - if payload.Resource == "control" { - h.sessions.SetControlLocked(true) - } - - h.state.Lock(payload.Resource, id) - - if err := h.sessions.Broadcast( - message.AdminLock{ - Event: event.ADMIN_LOCK, - ID: id, - Resource: payload.Resource, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_LOCK) - return err - } - - return nil -} - -func (h *MessageHandler) adminUnlock(id string, session types.Session, payload *message.AdminLock) error { - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - if !h.state.IsLocked(payload.Resource) { - h.logger.Debug().Str("resource", payload.Resource).Msg("resource not locked...") - return nil - } - - // TODO: Handle locks in sessions as flags. - if payload.Resource == "control" { - h.sessions.SetControlLocked(false) - } - - h.state.Unlock(payload.Resource) - - if err := h.sessions.Broadcast( - message.AdminLock{ - Event: event.ADMIN_UNLOCK, - ID: id, - Resource: payload.Resource, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_UNLOCK) - return err - } - - return nil -} - -func (h *MessageHandler) adminControl(id string, session types.Session) error { - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - host, ok := h.sessions.GetHost() - - err := h.sessions.SetHost(id) - if err != nil { - return err - } - - if ok { - if err := h.sessions.Broadcast( - message.AdminTarget{ - Event: event.ADMIN_CONTROL, - ID: id, - Target: host.ID(), - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_CONTROL) - return err - } - } else { - if err := h.sessions.Broadcast( - message.Admin{ - Event: event.ADMIN_CONTROL, - ID: id, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_CONTROL) - return err - } - } - - return nil -} - -func (h *MessageHandler) AdminRelease(id string, session types.Session) error { - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - host, ok := h.sessions.GetHost() - - h.sessions.ClearHost() - - if ok { - if err := h.sessions.Broadcast( - message.AdminTarget{ - Event: event.ADMIN_RELEASE, - ID: id, - Target: host.ID(), - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_RELEASE) - return err - } - } else { - if err := h.sessions.Broadcast( - message.Admin{ - Event: event.ADMIN_RELEASE, - ID: id, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_RELEASE) - return err - } - } - - return nil -} - -func (h *MessageHandler) adminGive(id string, session types.Session, payload *message.Admin) error { - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - if !h.sessions.Has(payload.ID) { - h.logger.Debug().Str("id", payload.ID).Msg("user does not exist") - return nil - } - - // set host - err := h.sessions.SetHost(payload.ID) - if err != nil { - return err - } - - // let everyone know - if err := h.sessions.Broadcast( - message.AdminTarget{ - Event: event.CONTROL_GIVE, - ID: id, - Target: payload.ID, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_GIVE) - return err - } - - return nil -} - -func (h *MessageHandler) adminMute(id string, session types.Session, payload *message.Admin) error { - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - target, ok := h.sessions.Get(payload.ID) - if !ok { - h.logger.Debug().Str("id", payload.ID).Msg("can't find session id") - return nil - } - - if target.Admin() { - h.logger.Debug().Msg("target is an admin, baling") - return nil - } - - target.SetMuted(true) - - if err := h.sessions.Broadcast( - message.AdminTarget{ - Event: event.ADMIN_MUTE, - Target: target.ID(), - ID: id, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_MUTE) - return err - } - - return nil -} - -func (h *MessageHandler) adminUnmute(id string, session types.Session, payload *message.Admin) error { - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - target, ok := h.sessions.Get(payload.ID) - if !ok { - h.logger.Debug().Str("id", payload.ID).Msg("can't find target session") - return nil - } - - target.SetMuted(false) - - if err := h.sessions.Broadcast( - message.AdminTarget{ - Event: event.ADMIN_UNMUTE, - Target: target.ID(), - ID: id, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_UNMUTE) - return err - } - - return nil -} - -func (h *MessageHandler) adminKick(id string, session types.Session, payload *message.Admin) error { - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - target, ok := h.sessions.Get(payload.ID) - if !ok { - h.logger.Debug().Str("id", payload.ID).Msg("can't find session id") - return nil - } - - if target.Admin() { - h.logger.Debug().Msg("target is an admin, baling") - return nil - } - - if err := target.Kick("kicked"); err != nil { - return err - } - - if err := h.sessions.Broadcast( - message.AdminTarget{ - Event: event.ADMIN_KICK, - Target: target.ID(), - ID: id, - }, []string{payload.ID}); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_KICK) - return err - } - - return nil -} - -func (h *MessageHandler) adminBan(id string, session types.Session, payload *message.Admin) error { - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - target, ok := h.sessions.Get(payload.ID) - if !ok { - h.logger.Debug().Str("id", payload.ID).Msg("can't find session id") - return nil - } - - if target.Admin() { - h.logger.Debug().Msg("target is an admin, baling") - return nil - } - - remote := target.Address() - if remote == "" { - h.logger.Debug().Msg("no remote address, baling") - return nil - } - - address := strings.SplitN(remote, ":", -1) - if len(address[0]) < 1 { - h.logger.Debug().Str("address", remote).Msg("no remote address, baling") - return nil - } - - h.logger.Debug().Str("address", remote).Msg("adding address to banned") - h.state.Ban(address[0], id) - - if err := target.Kick("banned"); err != nil { - return err - } - - if err := h.sessions.Broadcast( - message.AdminTarget{ - Event: event.ADMIN_BAN, - Target: target.ID(), - ID: id, - }, []string{payload.ID}); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_BAN) - return err - } - - return nil -} diff --git a/server/internal/websocket/handler/broadcast.go b/server/internal/websocket/handler/broadcast.go deleted file mode 100644 index 405bfdacc..000000000 --- a/server/internal/websocket/handler/broadcast.go +++ /dev/null @@ -1,110 +0,0 @@ -package handler - -import ( - "m1k1o/neko/internal/types" - "m1k1o/neko/internal/types/event" - "m1k1o/neko/internal/types/message" -) - -func (h *MessageHandler) broadcastCreate(session types.Session, payload *message.BroadcastCreate) error { - broadcast := h.capture.Broadcast() - - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - if payload.URL == "" { - return session.Send( - message.SystemMessage{ - Event: event.SYSTEM_ERROR, - Title: "Error while starting broadcast", - Message: "missing broadcast URL", - }) - } - - if broadcast.Started() { - return session.Send( - message.SystemMessage{ - Event: event.SYSTEM_ERROR, - Title: "Error while starting broadcast", - Message: "server is already broadcasting", - }) - } - - if err := broadcast.Start(payload.URL); err != nil { - if err := session.Send( - message.SystemMessage{ - Event: event.SYSTEM_ERROR, - Title: "Error while starting broadcast", - Message: err.Error(), - }); err != nil { - h.logger.Warn().Err(err).Msgf("sending event %s has failed", event.SYSTEM_ERROR) - return err - } - } - - if err := h.broadcastStatus(nil); err != nil { - return err - } - - return nil -} - -func (h *MessageHandler) broadcastDestroy(session types.Session) error { - broadcast := h.capture.Broadcast() - - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - if !broadcast.Started() { - return session.Send( - message.SystemMessage{ - Event: event.SYSTEM_ERROR, - Title: "Error while stopping broadcast", - Message: "server is not broadcasting", - }) - } - - broadcast.Stop() - - if err := h.broadcastStatus(nil); err != nil { - return err - } - - return nil -} - -func (h *MessageHandler) broadcastStatus(session types.Session) error { - broadcast := h.capture.Broadcast() - - msg := message.BroadcastStatus{ - Event: event.BROADCAST_STATUS, - IsActive: broadcast.Started(), - URL: broadcast.Url(), - } - - // if no session, broadcast change - if session == nil { - if err := h.sessions.AdminBroadcast(msg, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.BROADCAST_STATUS) - return err - } - - return nil - } - - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - if err := session.Send(msg); err != nil { - h.logger.Warn().Err(err).Msgf("sending event %s has failed", event.BROADCAST_STATUS) - return err - } - - return nil -} diff --git a/server/internal/websocket/handler/chat.go b/server/internal/websocket/handler/chat.go deleted file mode 100644 index 5a447b75c..000000000 --- a/server/internal/websocket/handler/chat.go +++ /dev/null @@ -1,41 +0,0 @@ -package handler - -import ( - "m1k1o/neko/internal/types" - "m1k1o/neko/internal/types/event" - "m1k1o/neko/internal/types/message" -) - -func (h *MessageHandler) chat(id string, session types.Session, payload *message.ChatReceive) error { - if session.Muted() { - return nil - } - - if err := h.sessions.Broadcast( - message.ChatSend{ - Event: event.CHAT_MESSAGE, - Content: payload.Content, - ID: id, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CHAT_MESSAGE) - return err - } - return nil -} - -func (h *MessageHandler) chatEmote(id string, session types.Session, payload *message.EmoteReceive) error { - if session.Muted() { - return nil - } - - if err := h.sessions.Broadcast( - message.EmoteSend{ - Event: event.CHAT_EMOTE, - Emote: payload.Emote, - ID: id, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CHAT_EMOTE) - return err - } - return nil -} diff --git a/server/internal/websocket/handler/clipboard.go b/server/internal/websocket/handler/clipboard.go new file mode 100644 index 000000000..546c1341e --- /dev/null +++ b/server/internal/websocket/handler/clipboard.go @@ -0,0 +1,23 @@ +package handler + +import ( + "errors" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/message" +) + +func (h *MessageHandlerCtx) clipboardSet(session types.Session, payload *message.ClipboardData) error { + if !session.Profile().CanAccessClipboard { + return errors.New("cannot access clipboard") + } + + if !session.IsHost() { + return errors.New("is not the host") + } + + return h.desktop.ClipboardSetText(types.ClipboardText{ + Text: payload.Text, + // TODO: Send HTML? + }) +} diff --git a/server/internal/websocket/handler/control.go b/server/internal/websocket/handler/control.go index 2a3f4ba64..05592c654 100644 --- a/server/internal/websocket/handler/control.go +++ b/server/internal/websocket/handler/control.go @@ -1,157 +1,228 @@ package handler import ( - "m1k1o/neko/internal/types" - "m1k1o/neko/internal/types/event" - "m1k1o/neko/internal/types/message" + "errors" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" + "m1k1o/neko/pkg/xorg" +) + +var ( + ErrIsNotAllowedToHost = errors.New("is not allowed to host") + ErrIsNotTheHost = errors.New("is not the host") + ErrIsAlreadyTheHost = errors.New("is already the host") + ErrIsAlreadyHosted = errors.New("is already hosted") ) -func (h *MessageHandler) controlRelease(id string, session types.Session) error { - // check if session is host - if !h.sessions.IsHost(id) { - h.logger.Debug().Str("id", id).Msg("is not the host") +func (h *MessageHandlerCtx) controlRelease(session types.Session) error { + if !session.Profile().CanHost || session.PrivateModeEnabled() { + return ErrIsNotAllowedToHost + } + + if !session.IsHost() { + return ErrIsNotTheHost + } + + h.desktop.ResetKeys() + session.ClearHost() + + return nil +} + +func (h *MessageHandlerCtx) controlRequest(session types.Session) error { + if !session.Profile().CanHost || session.PrivateModeEnabled() { + return ErrIsNotAllowedToHost + } + + if session.IsHost() { + return ErrIsAlreadyTheHost + } + + if h.sessions.Settings().LockedControls && !session.Profile().IsAdmin { + return ErrIsNotAllowedToHost + } + + // if implicit hosting is enabled, set session as host without asking + if h.sessions.Settings().ImplicitHosting { + session.SetAsHost() + return nil + } + + // if there is no host, set session as host + host, hasHost := h.sessions.GetHost() + if !hasHost { + session.SetAsHost() return nil } - // release host - h.logger.Debug().Str("id", id).Msgf("host called %s", event.CONTROL_RELEASE) - h.sessions.ClearHost() + // TODO: Some throttling mechanism to prevent spamming. - // tell everyone - if err := h.sessions.Broadcast( - message.Control{ - Event: event.CONTROL_RELEASE, - ID: id, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_RELEASE) + // let host know that someone wants to take control + host.Send( + event.CONTROL_REQUEST, + message.SessionID{ + ID: session.ID(), + }) + + return ErrIsAlreadyHosted +} + +func (h *MessageHandlerCtx) controlMove(session types.Session, payload *message.ControlPos) error { + if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { return err } + // handle active cursor movement + h.desktop.Move(payload.X, payload.Y) + h.webrtc.SetCursorPosition(payload.X, payload.Y) return nil } -func (h *MessageHandler) controlRequest(id string, session types.Session) error { - // check for host - if !h.sessions.HasHost() { - // check if control is locked or user is admin - if h.state.IsLocked("control") && !session.Admin() { - h.logger.Debug().Msg("control is locked") - return nil - } +func (h *MessageHandlerCtx) controlScroll(session types.Session, payload *message.ControlScroll) error { + if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { + return err + } - // set host - err := h.sessions.SetHost(id) - if err != nil { + // TOOD: remove this once the client is fixed + if payload.DeltaX == 0 && payload.DeltaY == 0 { + payload.DeltaX = payload.X + payload.DeltaY = payload.Y + } + + h.desktop.Scroll(payload.DeltaX, payload.DeltaY, payload.ControlKey) + return nil +} + +func (h *MessageHandlerCtx) controlButtonPress(session types.Session, payload *message.ControlButton) error { + if payload.ControlPos != nil { + if err := h.controlMove(session, payload.ControlPos); err != nil { return err } + } else if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { + return err + } - // let everyone know - if err := h.sessions.Broadcast( - message.Control{ - Event: event.CONTROL_LOCKED, - ID: id, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_LOCKED) + return h.desktop.ButtonPress(payload.Code) +} + +func (h *MessageHandlerCtx) controlButtonDown(session types.Session, payload *message.ControlButton) error { + if payload.ControlPos != nil { + if err := h.controlMove(session, payload.ControlPos); err != nil { return err } + } else if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { + return err + } - return nil + return h.desktop.ButtonDown(payload.Code) +} + +func (h *MessageHandlerCtx) controlButtonUp(session types.Session, payload *message.ControlButton) error { + if payload.ControlPos != nil { + if err := h.controlMove(session, payload.ControlPos); err != nil { + return err + } + } else if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { + return err } - // get host - host, ok := h.sessions.GetHost() - if ok { + return h.desktop.ButtonUp(payload.Code) +} - // tell session there is a host - if err := session.Send(message.Control{ - Event: event.CONTROL_REQUEST, - ID: host.ID(), - }); err != nil { - h.logger.Warn().Err(err).Str("id", id).Msgf("sending event %s has failed", event.CONTROL_REQUEST) +func (h *MessageHandlerCtx) controlKeyPress(session types.Session, payload *message.ControlKey) error { + if payload.ControlPos != nil { + if err := h.controlMove(session, payload.ControlPos); err != nil { return err } + } else if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { + return err + } + + return h.desktop.KeyPress(payload.Keysym) +} - // tell host session wants to be host - if err := host.Send(message.Control{ - Event: event.CONTROL_REQUESTING, - ID: id, - }); err != nil { - h.logger.Warn().Err(err).Str("id", host.ID()).Msgf("sending event %s has failed", event.CONTROL_REQUESTING) +func (h *MessageHandlerCtx) controlKeyDown(session types.Session, payload *message.ControlKey) error { + if payload.ControlPos != nil { + if err := h.controlMove(session, payload.ControlPos); err != nil { return err } + } else if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { + return err } - return nil + return h.desktop.KeyDown(payload.Keysym) } -func (h *MessageHandler) controlGive(id string, session types.Session, payload *message.Control) error { - // check if session is host - if !h.sessions.IsHost(id) { - h.logger.Debug().Str("id", id).Msg("is not the host") - return nil +func (h *MessageHandlerCtx) controlKeyUp(session types.Session, payload *message.ControlKey) error { + if payload.ControlPos != nil { + if err := h.controlMove(session, payload.ControlPos); err != nil { + return err + } + } else if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { + return err } - if !h.sessions.Has(payload.ID) { - h.logger.Debug().Str("id", payload.ID).Msg("user does not exist") - return nil + return h.desktop.KeyUp(payload.Keysym) +} + +func (h *MessageHandlerCtx) controlTouchBegin(session types.Session, payload *message.ControlTouch) error { + if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { + return err } + return h.desktop.TouchBegin(payload.TouchId, payload.X, payload.Y, payload.Pressure) +} - // check if control is locked or giver is admin - if h.state.IsLocked("control") && !session.Admin() { - h.logger.Debug().Msg("control is locked") - return nil +func (h *MessageHandlerCtx) controlTouchUpdate(session types.Session, payload *message.ControlTouch) error { + if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { + return err } + return h.desktop.TouchUpdate(payload.TouchId, payload.X, payload.Y, payload.Pressure) +} - // set host - err := h.sessions.SetHost(payload.ID) - if err != nil { +func (h *MessageHandlerCtx) controlTouchEnd(session types.Session, payload *message.ControlTouch) error { + if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { return err } + return h.desktop.TouchEnd(payload.TouchId, payload.X, payload.Y, payload.Pressure) +} - // let everyone know - if err := h.sessions.Broadcast( - message.ControlTarget{ - Event: event.CONTROL_GIVE, - ID: id, - Target: payload.ID, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_GIVE) +func (h *MessageHandlerCtx) controlCut(session types.Session) error { + if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { return err } - return nil + return h.desktop.KeyPress(xorg.XK_Control_L, xorg.XK_x) } -func (h *MessageHandler) controlClipboard(id string, session types.Session, payload *message.Clipboard) error { - // check if session can access clipboard - if (!h.webrtc.ImplicitControl() && !h.sessions.IsHost(id)) || (h.webrtc.ImplicitControl() && !h.sessions.CanControl(id)) { - h.logger.Debug().Str("id", id).Msg("cannot access clipboard") - return nil +func (h *MessageHandlerCtx) controlCopy(session types.Session) error { + if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { + return err } - h.desktop.WriteClipboard(payload.Text) - return nil + return h.desktop.KeyPress(xorg.XK_Control_L, xorg.XK_c) } -func (h *MessageHandler) controlKeyboard(id string, session types.Session, payload *message.Keyboard) error { - // check if session can control keyboard - if (!h.webrtc.ImplicitControl() && !h.sessions.IsHost(id)) || (h.webrtc.ImplicitControl() && !h.sessions.CanControl(id)) { - h.logger.Debug().Str("id", id).Msg("cannot control keyboard") - return nil +func (h *MessageHandlerCtx) controlPaste(session types.Session, payload *message.ClipboardData) error { + if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { + return err } - h.desktop.SetKeyboardModifiers(types.KeyboardModifiers{ - NumLock: payload.NumLock, - CapsLock: payload.CapsLock, - // TODO: ScrollLock is deprecated. - }) + // if there have been set clipboard data, set them first + if payload != nil && payload.Text != "" { + if err := h.clipboardSet(session, payload); err != nil { + return err + } + } - // change layout - if payload.Layout != nil { - return h.desktop.SetKeyboardMap(types.KeyboardMap{ - Layout: *payload.Layout, - }) + return h.desktop.KeyPress(xorg.XK_Control_L, xorg.XK_v) +} + +func (h *MessageHandlerCtx) controlSelectAll(session types.Session) error { + if err := h.controlRequest(session); err != nil && !errors.Is(err, ErrIsAlreadyTheHost) { + return err } - return nil + return h.desktop.KeyPress(xorg.XK_Control_L, xorg.XK_a) } diff --git a/server/internal/websocket/handler/filetransfer.go b/server/internal/websocket/handler/filetransfer.go deleted file mode 100644 index 8d6068059..000000000 --- a/server/internal/websocket/handler/filetransfer.go +++ /dev/null @@ -1,47 +0,0 @@ -package handler - -import ( - "m1k1o/neko/internal/types" - "m1k1o/neko/internal/types/event" - "m1k1o/neko/internal/types/message" - "m1k1o/neko/internal/utils" -) - -func (h *MessageHandler) FileTransferRefresh(session types.Session) error { - if !h.state.FileTransferEnabled() { - return nil - } - - fileTransferPath := h.state.FileTransferPath("") // root - - // allow users only if file transfer is not locked - if session != nil && !(session.Admin() || !h.state.IsLocked("file_transfer")) { - h.logger.Debug().Msg("file transfer is locked for users") - return nil - } - - // TODO: keep list of files in memory and update it on file changes - files, err := utils.ListFiles(fileTransferPath) - if err != nil { - return err - } - - message := message.FileTransferList{ - Event: event.FILETRANSFER_LIST, - Cwd: fileTransferPath, - Files: files, - } - - // send to just one user - if session != nil { - return session.Send(message) - } - - // broadcast to all admins - if h.state.IsLocked("file_transfer") { - return h.sessions.AdminBroadcast(message, nil) - } - - // broadcast to all users - return h.sessions.Broadcast(message, nil) -} diff --git a/server/internal/websocket/handler/handler.go b/server/internal/websocket/handler/handler.go index 628771ca3..576584a56 100644 --- a/server/internal/websocket/handler/handler.go +++ b/server/internal/websocket/handler/handler.go @@ -1,211 +1,203 @@ package handler import ( - "encoding/json" - - "github.com/pkg/errors" "github.com/rs/zerolog" "github.com/rs/zerolog/log" - "m1k1o/neko/internal/types" - "m1k1o/neko/internal/types/event" - "m1k1o/neko/internal/types/message" - "m1k1o/neko/internal/utils" - "m1k1o/neko/internal/websocket/state" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" + "m1k1o/neko/pkg/utils" ) -type MessageHandler struct { - logger zerolog.Logger - sessions types.SessionManager - desktop types.DesktopManager - capture types.CaptureManager - webrtc types.WebRTCManager - state *state.State -} - func New( sessions types.SessionManager, desktop types.DesktopManager, capture types.CaptureManager, webrtc types.WebRTCManager, - state *state.State, -) *MessageHandler { - return &MessageHandler{ +) *MessageHandlerCtx { + return &MessageHandlerCtx{ logger: log.With().Str("module", "websocket").Str("submodule", "handler").Logger(), sessions: sessions, desktop: desktop, capture: capture, webrtc: webrtc, - state: state, } } -func (h *MessageHandler) Connected(admin bool, address string) (bool, string) { - if address == "" { - h.logger.Debug().Msg("no remote address") - } else { - if h.state.IsBanned(address) { - h.logger.Debug().Str("address", address).Msg("banned") - return false, "banned" - } - } - - if h.state.IsLocked("login") && !admin { - h.logger.Debug().Msg("server locked") - return false, "locked" - } - - return true, "" -} - -func (h *MessageHandler) Disconnected(id string) { - h.sessions.Destroy(id) +type MessageHandlerCtx struct { + logger zerolog.Logger + sessions types.SessionManager + webrtc types.WebRTCManager + desktop types.DesktopManager + capture types.CaptureManager } -func (h *MessageHandler) Message(id string, raw []byte) error { - header := message.Message{} - if err := json.Unmarshal(raw, &header); err != nil { - return err - } - - session, ok := h.sessions.Get(id) - if !ok { - return errors.Errorf("unknown session id %s", id) - } +func (h *MessageHandlerCtx) Message(session types.Session, data types.WebSocketMessage) bool { + var err error + switch data.Event { + // System Events + case event.SYSTEM_LOGS: + payload := &message.SystemLogs{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.systemLogs(session, payload) + }) - switch header.Event { // Signal Events + case event.SIGNAL_REQUEST: + payload := &message.SignalRequest{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.signalRequest(session, payload) + }) + case event.SIGNAL_RESTART: + err = h.signalRestart(session) case event.SIGNAL_OFFER: - payload := &message.SignalOffer{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.signalRemoteOffer(id, session, payload) - }), "%s failed", header.Event) + payload := &message.SignalDescription{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.signalOffer(session, payload) + }) case event.SIGNAL_ANSWER: - payload := &message.SignalAnswer{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.signalRemoteAnswer(id, session, payload) - }), "%s failed", header.Event) + payload := &message.SignalDescription{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.signalAnswer(session, payload) + }) case event.SIGNAL_CANDIDATE: payload := &message.SignalCandidate{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.signalRemoteCandidate(id, session, payload) - }), "%s failed", header.Event) + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.signalCandidate(session, payload) + }) + case event.SIGNAL_VIDEO: + payload := &message.SignalVideo{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.signalVideo(session, payload) + }) + case event.SIGNAL_AUDIO: + payload := &message.SignalAudio{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.signalAudio(session, payload) + }) // Control Events case event.CONTROL_RELEASE: - return errors.Wrapf(h.controlRelease(id, session), "%s failed", header.Event) + err = h.controlRelease(session) case event.CONTROL_REQUEST: - return errors.Wrapf(h.controlRequest(id, session), "%s failed", header.Event) - case event.CONTROL_GIVE: - payload := &message.Control{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.controlGive(id, session, payload) - }), "%s failed", header.Event) - case event.CONTROL_CLIPBOARD: - payload := &message.Clipboard{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.controlClipboard(id, session, payload) - }), "%s failed", header.Event) - case event.CONTROL_KEYBOARD: - payload := &message.Keyboard{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.controlKeyboard(id, session, payload) - }), "%s failed", header.Event) - - // Chat Events - case event.CHAT_MESSAGE: - payload := &message.ChatReceive{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.chat(id, session, payload) - }), "%s failed", header.Event) - case event.CHAT_EMOTE: - payload := &message.EmoteReceive{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.chatEmote(id, session, payload) - }), "%s failed", header.Event) - - // File Transfer Events - case event.FILETRANSFER_REFRESH: - return errors.Wrapf(h.FileTransferRefresh(session), "%s failed", header.Event) + err = h.controlRequest(session) + case event.CONTROL_MOVE: + payload := &message.ControlPos{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.controlMove(session, payload) + }) + case event.CONTROL_SCROLL: + payload := &message.ControlScroll{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.controlScroll(session, payload) + }) + case event.CONTROL_BUTTONPRESS: + payload := &message.ControlButton{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.controlButtonPress(session, payload) + }) + case event.CONTROL_BUTTONDOWN: + payload := &message.ControlButton{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.controlButtonDown(session, payload) + }) + case event.CONTROL_BUTTONUP: + payload := &message.ControlButton{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.controlButtonUp(session, payload) + }) + case event.CONTROL_KEYPRESS: + payload := &message.ControlKey{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.controlKeyPress(session, payload) + }) + case event.CONTROL_KEYDOWN: + payload := &message.ControlKey{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.controlKeyDown(session, payload) + }) + case event.CONTROL_KEYUP: + payload := &message.ControlKey{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.controlKeyUp(session, payload) + }) + // touch + case event.CONTROL_TOUCHBEGIN: + payload := &message.ControlTouch{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.controlTouchBegin(session, payload) + }) + case event.CONTROL_TOUCHUPDATE: + payload := &message.ControlTouch{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.controlTouchUpdate(session, payload) + }) + case event.CONTROL_TOUCHEND: + payload := &message.ControlTouch{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.controlTouchEnd(session, payload) + }) + // actions + case event.CONTROL_CUT: + err = h.controlCut(session) + case event.CONTROL_COPY: + err = h.controlCopy(session) + case event.CONTROL_PASTE: + payload := &message.ClipboardData{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.controlPaste(session, payload) + }) + case event.CONTROL_SELECT_ALL: + err = h.controlSelectAll(session) // Screen Events - case event.SCREEN_RESOLUTION: - return errors.Wrapf(h.screenResolution(id, session), "%s failed", header.Event) - case event.SCREEN_CONFIGURATIONS: - return errors.Wrapf(h.screenConfigurations(id, session), "%s failed", header.Event) case event.SCREEN_SET: - payload := &message.ScreenResolution{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.screenSet(id, session, payload) - }), "%s failed", header.Event) - - // Broadcast Events - case event.BROADCAST_CREATE: - payload := &message.BroadcastCreate{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.broadcastCreate(session, payload) - }), "%s failed", header.Event) - case event.BROADCAST_DESTROY: - return errors.Wrapf(h.broadcastDestroy(session), "%s failed", header.Event) - - // Admin Events - case event.ADMIN_LOCK: - payload := &message.AdminLock{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.adminLock(id, session, payload) - }), "%s failed", header.Event) - case event.ADMIN_UNLOCK: - payload := &message.AdminLock{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.adminUnlock(id, session, payload) - }), "%s failed", header.Event) - case event.ADMIN_CONTROL: - return errors.Wrapf(h.adminControl(id, session), "%s failed", header.Event) - case event.ADMIN_RELEASE: - return errors.Wrapf(h.AdminRelease(id, session), "%s failed", header.Event) - case event.ADMIN_GIVE: - payload := &message.Admin{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.adminGive(id, session, payload) - }), "%s failed", header.Event) - case event.ADMIN_BAN: - payload := &message.Admin{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.adminBan(id, session, payload) - }), "%s failed", header.Event) - case event.ADMIN_KICK: - payload := &message.Admin{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.adminKick(id, session, payload) - }), "%s failed", header.Event) - case event.ADMIN_MUTE: - payload := &message.Admin{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.adminMute(id, session, payload) - }), "%s failed", header.Event) - case event.ADMIN_UNMUTE: - payload := &message.Admin{} - return errors.Wrapf( - utils.Unmarshal(payload, raw, func() error { - return h.adminUnmute(id, session, payload) - }), "%s failed", header.Event) + payload := &message.ScreenSize{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.screenSet(session, payload) + }) + + // Clipboard Events + case event.CLIPBOARD_SET: + payload := &message.ClipboardData{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.clipboardSet(session, payload) + }) + + // Keyboard Events + case event.KEYBOARD_MAP: + payload := &message.KeyboardMap{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.keyboardMap(session, payload) + }) + case event.KEYBOARD_MODIFIERS: + payload := &message.KeyboardModifiers{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.keyboardModifiers(session, payload) + }) + + // Send Events + case event.SEND_UNICAST: + payload := &message.SendUnicast{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.sendUnicast(session, payload) + }) + case event.SEND_BROADCAST: + payload := &message.SendBroadcast{} + err = utils.Unmarshal(payload, data.Payload, func() error { + return h.sendBroadcast(session, payload) + }) default: - return errors.Errorf("unknown message event %s", header.Event) + return false } + + if err != nil { + h.logger.Warn().Err(err). + Str("event", data.Event). + Str("session_id", session.ID()). + Msg("message handler has failed") + } + + return true } diff --git a/server/internal/websocket/handler/keyboard.go b/server/internal/websocket/handler/keyboard.go new file mode 100644 index 000000000..7468b959b --- /dev/null +++ b/server/internal/websocket/handler/keyboard.go @@ -0,0 +1,25 @@ +package handler + +import ( + "errors" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/message" +) + +func (h *MessageHandlerCtx) keyboardMap(session types.Session, payload *message.KeyboardMap) error { + if !session.IsHost() { + return errors.New("is not the host") + } + + return h.desktop.SetKeyboardMap(payload.KeyboardMap) +} + +func (h *MessageHandlerCtx) keyboardModifiers(session types.Session, payload *message.KeyboardModifiers) error { + if !session.IsHost() { + return errors.New("is not the host") + } + + h.desktop.SetKeyboardModifiers(payload.KeyboardModifiers) + return nil +} diff --git a/server/internal/websocket/handler/screen.go b/server/internal/websocket/handler/screen.go index c4cacc4c1..9eb03068d 100644 --- a/server/internal/websocket/handler/screen.go +++ b/server/internal/websocket/handler/screen.go @@ -1,70 +1,26 @@ package handler import ( - "m1k1o/neko/internal/types" - "m1k1o/neko/internal/types/event" - "m1k1o/neko/internal/types/message" -) - -func (h *MessageHandler) screenSet(id string, session types.Session, payload *message.ScreenResolution) error { - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil - } - - if err := h.desktop.SetScreenSize(types.ScreenSize{ - Width: payload.Width, - Height: payload.Height, - Rate: payload.Rate, - }); err != nil { - h.logger.Warn().Err(err).Msgf("unable to change screen size") - return err - } - - if err := h.sessions.Broadcast( - message.ScreenResolution{ - Event: event.SCREEN_RESOLUTION, - ID: id, - Width: payload.Width, - Height: payload.Height, - Rate: payload.Rate, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.SCREEN_RESOLUTION) - return err - } + "errors" - return nil -} - -func (h *MessageHandler) screenResolution(id string, session types.Session) error { - if size := h.desktop.GetScreenSize(); size != nil { - if err := session.Send(message.ScreenResolution{ - Event: event.SCREEN_RESOLUTION, - Width: size.Width, - Height: size.Height, - Rate: size.Rate, - }); err != nil { - h.logger.Warn().Err(err).Msgf("sending event %s has failed", event.SCREEN_RESOLUTION) - return err - } - } - - return nil -} + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" +) -func (h *MessageHandler) screenConfigurations(id string, session types.Session) error { - if !session.Admin() { - h.logger.Debug().Msg("user not admin") - return nil +func (h *MessageHandlerCtx) screenSet(session types.Session, payload *message.ScreenSize) error { + if !session.Profile().IsAdmin { + return errors.New("is not the admin") } - if err := session.Send(message.ScreenConfigurations{ - Event: event.SCREEN_CONFIGURATIONS, - Configurations: h.desktop.ScreenConfigurations(), - }); err != nil { - h.logger.Warn().Err(err).Msgf("sending event %s has failed", event.SCREEN_CONFIGURATIONS) + size, err := h.desktop.SetScreenSize(payload.ScreenSize) + if err != nil { return err } + h.sessions.Broadcast(event.SCREEN_UPDATED, message.ScreenSizeUpdate{ + ID: session.ID(), + ScreenSize: size, + }) return nil } diff --git a/server/internal/websocket/handler/send.go b/server/internal/websocket/handler/send.go new file mode 100644 index 000000000..19c3d51c4 --- /dev/null +++ b/server/internal/websocket/handler/send.go @@ -0,0 +1,39 @@ +package handler + +import ( + "errors" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" +) + +func (h *MessageHandlerCtx) sendUnicast(session types.Session, payload *message.SendUnicast) error { + receiver, ok := h.sessions.Get(payload.Receiver) + if !ok { + return errors.New("receiver session ID not found") + } + + receiver.Send( + event.SEND_UNICAST, + message.SendUnicast{ + Sender: session.ID(), + Receiver: receiver.ID(), + Subject: payload.Subject, + Body: payload.Body, + }) + + return nil +} + +func (h *MessageHandlerCtx) sendBroadcast(session types.Session, payload *message.SendBroadcast) error { + h.sessions.Broadcast( + event.SEND_BROADCAST, + message.SendBroadcast{ + Sender: session.ID(), + Subject: payload.Subject, + Body: payload.Body, + }, session.ID()) + + return nil +} diff --git a/server/internal/websocket/handler/session.go b/server/internal/websocket/handler/session.go index af53d2523..ae1c05687 100644 --- a/server/internal/websocket/handler/session.go +++ b/server/internal/websocket/handler/session.go @@ -1,111 +1,106 @@ package handler import ( - "m1k1o/neko/internal/types" - "m1k1o/neko/internal/types/event" - "m1k1o/neko/internal/types/message" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" ) -func (h *MessageHandler) SessionCreated(id string, session types.Session) error { - // send sdp and id over to client - if err := h.signalProvide(id, session); err != nil { - return err - } - - // send initialization information - if err := session.Send(message.SystemInit{ - Event: event.SYSTEM_INIT, - ImplicitHosting: h.webrtc.ImplicitControl(), - Locks: h.state.AllLocked(), - FileTransfer: h.state.FileTransferEnabled(), - }); err != nil { - h.logger.Warn().Str("id", id).Err(err).Msgf("sending event %s has failed", event.SYSTEM_INIT) - return err - } - - if session.Admin() { - // send screen configurations if admin - if err := h.screenConfigurations(id, session); err != nil { - return err - } +func (h *MessageHandlerCtx) SessionCreated(session types.Session) error { + h.sessions.Broadcast( + event.SESSION_CREATED, + message.SessionData{ + ID: session.ID(), + Profile: session.Profile(), + State: session.State(), + }) - // send broadcast status if admin - if err := h.broadcastStatus(session); err != nil { - return err - } - } + return nil +} - // send file list if file transfer is enabled - if h.state.FileTransferEnabled() && (session.Admin() || !h.state.IsLocked("file_transfer")) { - if err := h.FileTransferRefresh(session); err != nil { - return err - } - } +func (h *MessageHandlerCtx) SessionDeleted(session types.Session) error { + h.sessions.Broadcast( + event.SESSION_DELETED, + message.SessionID{ + ID: session.ID(), + }) return nil } -func (h *MessageHandler) SessionConnected(id string, session types.Session) error { - // send list of members to session - if err := session.Send(message.MembersList{ - Event: event.MEMBER_LIST, - Members: h.sessions.Members(), - }); err != nil { - h.logger.Warn().Str("id", id).Err(err).Msgf("sending event %s has failed", event.MEMBER_LIST) +func (h *MessageHandlerCtx) SessionConnected(session types.Session) error { + if err := h.systemInit(session); err != nil { return err } - // send screen current resolution - if err := h.screenResolution(id, session); err != nil { - return err - } - - // tell session there is a host - host, ok := h.sessions.GetHost() - if ok { - if err := session.Send(message.Control{ - Event: event.CONTROL_LOCKED, - ID: host.ID(), - }); err != nil { - h.logger.Warn().Str("id", id).Err(err).Msgf("sending event %s has failed", event.CONTROL_LOCKED) + if session.Profile().IsAdmin { + if err := h.systemAdmin(session); err != nil { return err } - } - // let everyone know there is a new session - if err := h.sessions.Broadcast( - message.Member{ - Event: event.MEMBER_CONNECTED, - Member: session.Member(), - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.MEMBER_CONNECTED) - return err + // update settings in atomic way + h.sessions.UpdateSettingsFunc(session, func(settings *types.Settings) bool { + // if control protection & locked controls: unlock controls + if settings.LockedControls && settings.ControlProtection { + settings.LockedControls = false + return true // update settings + } + return false // do not update settings + }) } - return nil + return h.SessionStateChanged(session) } -func (h *MessageHandler) SessionDestroyed(id string) error { +func (h *MessageHandlerCtx) SessionDisconnected(session types.Session) error { // clear host if exists - if h.sessions.IsHost(id) { - h.sessions.ClearHost() - if err := h.sessions.Broadcast(message.Control{ - Event: event.CONTROL_RELEASE, - ID: id, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.CONTROL_RELEASE) - } + if session.IsHost() { + h.desktop.ResetKeys() + session.ClearHost() } - // let everyone know session disconnected - if err := h.sessions.Broadcast( - message.MemberDisconnected{ - Event: event.MEMBER_DISCONNECTED, - ID: id, - }, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.MEMBER_DISCONNECTED) - return err + if session.Profile().IsAdmin { + hasAdmin := false + h.sessions.Range(func(s types.Session) bool { + if s.Profile().IsAdmin && s.ID() != session.ID() && s.State().IsConnected { + hasAdmin = true + return false + } + return true + }) + + // update settings in atomic way + h.sessions.UpdateSettingsFunc(session, func(settings *types.Settings) bool { + // if control protection & not locked controls & no admin: lock controls + if !settings.LockedControls && settings.ControlProtection && !hasAdmin { + settings.LockedControls = true + return true // update settings + } + return false // do not update settings + }) } + return h.SessionStateChanged(session) +} + +func (h *MessageHandlerCtx) SessionProfileChanged(session types.Session, new, old types.MemberProfile) error { + h.sessions.Broadcast( + event.SESSION_PROFILE, + message.MemberProfile{ + ID: session.ID(), + MemberProfile: new, + }) + + return nil +} + +func (h *MessageHandlerCtx) SessionStateChanged(session types.Session) error { + h.sessions.Broadcast( + event.SESSION_STATE, + message.SessionState{ + ID: session.ID(), + SessionState: session.State(), + }) + return nil } diff --git a/server/internal/websocket/handler/signal.go b/server/internal/websocket/handler/signal.go index da1f2e0bc..cb0ff4f1c 100644 --- a/server/internal/websocket/handler/signal.go +++ b/server/internal/websocket/handler/signal.go @@ -1,51 +1,163 @@ package handler import ( - "m1k1o/neko/internal/types" - "m1k1o/neko/internal/types/event" - "m1k1o/neko/internal/types/message" + "errors" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" + + "github.com/pion/webrtc/v3" ) -func (h *MessageHandler) signalProvide(id string, session types.Session) error { - peer, err := h.webrtc.CreatePeer(id, session) +func (h *MessageHandlerCtx) signalRequest(session types.Session, payload *message.SignalRequest) error { + if !session.Profile().CanWatch { + return errors.New("not allowed to watch") + } + + offer, peer, err := h.webrtc.CreatePeer(session) if err != nil { return err } - sdp, err := peer.CreateOffer() + // set webrtc as paused if session has private mode enabled + if session.PrivateModeEnabled() { + peer.SetPaused(true) + } + + video := payload.Video + + // use default first video, if not provided + if video.Selector == nil { + videos := h.capture.Video().IDs() + video.Selector = &types.StreamSelector{ + ID: videos[0], + Type: types.StreamSelectorTypeExact, + } + } + + // TODO: Remove, used for compatibility with old clients. + if video.Auto == nil { + video.Auto = &payload.Auto + } + + // set video stream + err = peer.SetVideo(video) if err != nil { return err } - if err := session.Send(message.SignalProvide{ - Event: event.SIGNAL_PROVIDE, - ID: id, - SDP: sdp, - Lite: h.webrtc.ICELite(), - ICE: h.webrtc.ICEServers(), - }); err != nil { + audio := payload.Audio + + // enable by default if not requested otherwise + if audio.Disabled == nil { + disabled := false + audio.Disabled = &disabled + } + + // set audio stream + err = peer.SetAudio(audio) + if err != nil { return err } + session.Send( + event.SIGNAL_PROVIDE, + message.SignalProvide{ + SDP: offer.SDP, + ICEServers: h.webrtc.ICEServers(), + + Video: peer.Video(), + Audio: peer.Audio(), + }) + return nil } -func (h *MessageHandler) signalRemoteOffer(id string, session types.Session, payload *message.SignalOffer) error { - return session.SignalRemoteOffer(payload.SDP) +func (h *MessageHandlerCtx) signalRestart(session types.Session) error { + peer := session.GetWebRTCPeer() + if peer == nil { + return errors.New("webRTC peer does not exist") + } + + offer, err := peer.CreateOffer(true) + if err != nil { + return err + } + + // TODO: Use offer event instead. + session.Send( + event.SIGNAL_RESTART, + message.SignalDescription{ + SDP: offer.SDP, + }) + + return nil } -func (h *MessageHandler) signalRemoteAnswer(id string, session types.Session, payload *message.SignalAnswer) error { - if err := session.SetName(payload.DisplayName); err != nil { +func (h *MessageHandlerCtx) signalOffer(session types.Session, payload *message.SignalDescription) error { + peer := session.GetWebRTCPeer() + if peer == nil { + return errors.New("webRTC peer does not exist") + } + + err := peer.SetRemoteDescription(webrtc.SessionDescription{ + SDP: payload.SDP, + Type: webrtc.SDPTypeOffer, + }) + if err != nil { return err } - if err := session.SignalRemoteAnswer(payload.SDP); err != nil { + answer, err := peer.CreateAnswer() + if err != nil { return err } + session.Send( + event.SIGNAL_ANSWER, + message.SignalDescription{ + SDP: answer.SDP, + }) + return nil } -func (h *MessageHandler) signalRemoteCandidate(id string, session types.Session, payload *message.SignalCandidate) error { - return session.SignalRemoteCandidate(payload.Data) +func (h *MessageHandlerCtx) signalAnswer(session types.Session, payload *message.SignalDescription) error { + peer := session.GetWebRTCPeer() + if peer == nil { + return errors.New("webRTC peer does not exist") + } + + return peer.SetRemoteDescription(webrtc.SessionDescription{ + SDP: payload.SDP, + Type: webrtc.SDPTypeAnswer, + }) +} + +func (h *MessageHandlerCtx) signalCandidate(session types.Session, payload *message.SignalCandidate) error { + peer := session.GetWebRTCPeer() + if peer == nil { + return errors.New("webRTC peer does not exist") + } + + return peer.SetCandidate(payload.ICECandidateInit) +} + +func (h *MessageHandlerCtx) signalVideo(session types.Session, payload *message.SignalVideo) error { + peer := session.GetWebRTCPeer() + if peer == nil { + return errors.New("webRTC peer does not exist") + } + + return peer.SetVideo(payload.PeerVideoRequest) +} + +func (h *MessageHandlerCtx) signalAudio(session types.Session, payload *message.SignalAudio) error { + peer := session.GetWebRTCPeer() + if peer == nil { + return errors.New("webRTC peer does not exist") + } + + return peer.SetAudio(payload.PeerAudioRequest) } diff --git a/server/internal/websocket/handler/system.go b/server/internal/websocket/handler/system.go new file mode 100644 index 000000000..9b56beabc --- /dev/null +++ b/server/internal/websocket/handler/system.go @@ -0,0 +1,96 @@ +package handler + +import ( + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" +) + +func (h *MessageHandlerCtx) systemInit(session types.Session) error { + host, hasHost := h.sessions.GetHost() + + var hostID string + if hasHost { + hostID = host.ID() + } + + controlHost := message.ControlHost{ + HasHost: hasHost, + HostID: hostID, + } + + sessions := map[string]message.SessionData{} + for _, session := range h.sessions.List() { + sessionId := session.ID() + sessions[sessionId] = message.SessionData{ + ID: sessionId, + Profile: session.Profile(), + State: session.State(), + } + } + + session.Send( + event.SYSTEM_INIT, + message.SystemInit{ + SessionId: session.ID(), + ControlHost: controlHost, + ScreenSize: h.desktop.GetScreenSize(), + Sessions: sessions, + Settings: h.sessions.Settings(), + TouchEvents: h.desktop.HasTouchSupport(), + ScreencastEnabled: h.capture.Screencast().Enabled(), + WebRTC: message.SystemWebRTC{ + Videos: h.capture.Video().IDs(), + }, + }) + + return nil +} + +func (h *MessageHandlerCtx) systemAdmin(session types.Session) error { + configurations := h.desktop.ScreenConfigurations() + + list := make([]types.ScreenSize, 0, len(configurations)) + for _, conf := range configurations { + list = append(list, types.ScreenSize{ + Width: conf.Width, + Height: conf.Height, + Rate: conf.Rate, + }) + } + + broadcast := h.capture.Broadcast() + session.Send( + event.SYSTEM_ADMIN, + message.SystemAdmin{ + ScreenSizesList: list, // TODO: remove + BroadcastStatus: message.BroadcastStatus{ + IsActive: broadcast.Started(), + URL: broadcast.Url(), + }, + }) + + return nil +} + +func (h *MessageHandlerCtx) systemLogs(session types.Session, payload *message.SystemLogs) error { + for _, msg := range *payload { + level, _ := zerolog.ParseLevel(msg.Level) + + if level < zerolog.DebugLevel || level > zerolog.ErrorLevel { + level = zerolog.NoLevel + } + + // do not use handler logger context + log.WithLevel(level). + Fields(msg.Fields). + Str("module", "client"). + Str("session_id", session.ID()). + Msg(msg.Message) + } + + return nil +} diff --git a/server/internal/websocket/manager.go b/server/internal/websocket/manager.go new file mode 100644 index 000000000..1d09fad45 --- /dev/null +++ b/server/internal/websocket/manager.go @@ -0,0 +1,431 @@ +package websocket + +import ( + "encoding/json" + "errors" + "net/http" + "sync" + "time" + + "github.com/gorilla/websocket" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + + "m1k1o/neko/internal/websocket/handler" + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" + "m1k1o/neko/pkg/utils" +) + +// send pings to peer with this period - must be less than pongWait +const pingPeriod = 10 * time.Second + +// period for sending inactive cursor messages +const inactiveCursorsPeriod = 750 * time.Millisecond + +// maximum payload length for logging +const maxPayloadLogLength = 10_000 + +// events that are not logged in debug mode +var nologEvents = []string{ + // don't log twice + event.SYSTEM_LOGS, + // don't log heartbeat + event.SYSTEM_HEARTBEAT, + // don't log every cursor update + event.SESSION_CURSORS, +} + +func New( + sessions types.SessionManager, + desktop types.DesktopManager, + capture types.CaptureManager, + webrtc types.WebRTCManager, +) *WebSocketManagerCtx { + logger := log.With().Str("module", "websocket").Logger() + + return &WebSocketManagerCtx{ + logger: logger, + shutdown: make(chan struct{}), + sessions: sessions, + desktop: desktop, + handler: handler.New(sessions, desktop, capture, webrtc), + handlers: []types.WebSocketHandler{}, + } +} + +type WebSocketManagerCtx struct { + logger zerolog.Logger + wg sync.WaitGroup + shutdown chan struct{} + sessions types.SessionManager + desktop types.DesktopManager + handler *handler.MessageHandlerCtx + handlers []types.WebSocketHandler + + shutdownInactiveCursors chan struct{} +} + +func (manager *WebSocketManagerCtx) Start() { + manager.sessions.OnCreated(func(session types.Session) { + err := manager.handler.SessionCreated(session) + manager.logger.Err(err). + Str("session_id", session.ID()). + Msg("session created") + }) + + manager.sessions.OnDeleted(func(session types.Session) { + err := manager.handler.SessionDeleted(session) + manager.logger.Err(err). + Str("session_id", session.ID()). + Msg("session deleted") + }) + + manager.sessions.OnConnected(func(session types.Session) { + err := manager.handler.SessionConnected(session) + manager.logger.Err(err). + Str("session_id", session.ID()). + Msg("session connected") + }) + + manager.sessions.OnDisconnected(func(session types.Session) { + err := manager.handler.SessionDisconnected(session) + manager.logger.Err(err). + Str("session_id", session.ID()). + Msg("session disconnected") + }) + + manager.sessions.OnProfileChanged(func(session types.Session, new, old types.MemberProfile) { + err := manager.handler.SessionProfileChanged(session, new, old) + manager.logger.Err(err). + Str("session_id", session.ID()). + Interface("new", new). + Interface("old", old). + Msg("session profile changed") + }) + + manager.sessions.OnStateChanged(func(session types.Session) { + err := manager.handler.SessionStateChanged(session) + manager.logger.Err(err). + Str("session_id", session.ID()). + Msg("session state changed") + }) + + manager.sessions.OnHostChanged(func(session, host types.Session) { + payload := message.ControlHost{ + ID: session.ID(), + HasHost: host != nil, + } + + if payload.HasHost { + payload.HostID = host.ID() + } + + manager.sessions.Broadcast(event.CONTROL_HOST, payload) + + manager.logger.Info(). + Str("session_id", session.ID()). + Bool("has_host", payload.HasHost). + Str("host_id", payload.HostID). + Msg("session host changed") + }) + + manager.sessions.OnSettingsChanged(func(session types.Session, new, old types.Settings) { + // start inactive cursors + if new.InactiveCursors && !old.InactiveCursors { + manager.startInactiveCursors() + } + + // stop inactive cursors + if !new.InactiveCursors && old.InactiveCursors { + manager.stopInactiveCursors() + } + + manager.sessions.Broadcast(event.SYSTEM_SETTINGS, message.SystemSettingsUpdate{ + ID: session.ID(), + Settings: new, + }) + + manager.logger.Info(). + Str("session_id", session.ID()). + Interface("new", new). + Interface("old", old). + Msg("settings changed") + }) + + manager.desktop.OnClipboardUpdated(func() { + host, hasHost := manager.sessions.GetHost() + if !hasHost || !host.Profile().CanAccessClipboard { + return + } + + manager.logger.Info().Msg("sync clipboard") + + data, err := manager.desktop.ClipboardGetText() + if err != nil { + manager.logger.Err(err).Msg("could not get clipboard content") + return + } + + host.Send( + event.CLIPBOARD_UPDATED, + message.ClipboardData{ + Text: data.Text, + // TODO: Send HTML? + }) + }) + + if manager.desktop.IsFileChooserDialogEnabled() { + manager.fileChooserDialogEvents() + } + + if manager.sessions.Settings().InactiveCursors { + manager.startInactiveCursors() + } + + manager.logger.Info().Msg("websocket starting") +} + +func (manager *WebSocketManagerCtx) Shutdown() error { + manager.logger.Info().Msg("shutdown") + close(manager.shutdown) + manager.stopInactiveCursors() + manager.wg.Wait() + return nil +} + +func (manager *WebSocketManagerCtx) AddHandler(handler types.WebSocketHandler) { + manager.handlers = append(manager.handlers, handler) +} + +func (manager *WebSocketManagerCtx) Upgrade(checkOrigin types.CheckOrigin) types.RouterHandler { + return func(w http.ResponseWriter, r *http.Request) error { + upgrader := websocket.Upgrader{ + CheckOrigin: checkOrigin, + // Do not return any error while handshake + Error: func(w http.ResponseWriter, r *http.Request, status int, reason error) {}, + } + + connection, err := upgrader.Upgrade(w, r, nil) + if err != nil { + return utils.HttpBadRequest().WithInternalErr(err) + } + + // Cannot write HTTP response after connection upgrade + manager.connect(connection, r) + return nil + } +} + +func (manager *WebSocketManagerCtx) connect(connection *websocket.Conn, r *http.Request) { + session, err := manager.sessions.Authenticate(r) + if err != nil { + manager.logger.Warn().Err(err).Msg("authentication failed") + newPeer(manager.logger, connection).Destroy(err.Error()) + return + } + + // add session id to all log messages + logger := manager.logger.With().Str("session_id", session.ID()).Logger() + + // create new peer + peer := newPeer(logger, connection) + + if !session.Profile().CanConnect { + logger.Warn().Msg("connection disabled") + peer.Destroy("connection disabled") + return + } + + if session.State().IsConnected { + logger.Warn().Msg("already connected") + + if !manager.sessions.Settings().MercifulReconnect { + peer.Destroy("already connected") + return + } + + logger.Info().Msg("replacing peer connection") + } + + logger.Info(). + Str("address", connection.RemoteAddr().String()). + Str("agent", r.UserAgent()). + Msg("connection started") + + session.ConnectWebSocketPeer(peer) + + // this is a blocking function that lives + // throughout whole websocket connection + err = manager.handle(connection, peer, session) + + logger.Info(). + Str("address", connection.RemoteAddr().String()). + Str("agent", r.UserAgent()). + Msg("connection ended") + + if err == nil { + logger.Debug().Msg("websocket close") + session.DisconnectWebSocketPeer(peer, false) + return + } + + delayedDisconnect := false + + e, ok := err.(*websocket.CloseError) + if !ok { + err = errors.Unwrap(err) // unwrap if possible + logger.Warn().Err(err).Msg("read message error") + // client is expected to reconnect soon + delayedDisconnect = true + } else { + switch e.Code { + case websocket.CloseNormalClosure: + logger.Debug().Str("reason", e.Text).Msg("websocket close") + case websocket.CloseGoingAway: + logger.Debug().Str("reason", "going away").Msg("websocket close") + default: + logger.Warn().Err(err).Msg("websocket close") + // abnormal websocket closure: + // client is expected to reconnect soon + delayedDisconnect = true + } + } + + session.DisconnectWebSocketPeer(peer, delayedDisconnect) +} + +func (manager *WebSocketManagerCtx) handle(connection *websocket.Conn, peer types.WebSocketPeer, session types.Session) error { + // add session id to logger context + logger := manager.logger.With().Str("session_id", session.ID()).Logger() + + bytes := make(chan []byte) + cancel := make(chan error) + + ticker := time.NewTicker(pingPeriod) + defer ticker.Stop() + + manager.wg.Add(1) + go func() { + defer manager.wg.Done() + + for { + _, raw, err := connection.ReadMessage() + if err != nil { + cancel <- err + break + } + + bytes <- raw + } + }() + + for { + select { + case raw := <-bytes: + data := types.WebSocketMessage{} + if err := json.Unmarshal(raw, &data); err != nil { + logger.Err(err).Msg("message unmarshalling has failed") + break + } + + // log events if not ignored + if ok, _ := utils.ArrayIn(data.Event, nologEvents); !ok { + payload := data.Payload + if len(payload) > maxPayloadLogLength { + payload = []byte("") + } + + logger.Debug(). + Str("address", connection.RemoteAddr().String()). + Str("event", data.Event). + Str("payload", string(payload)). + Msg("received message from client") + } + + handled := manager.handler.Message(session, data) + for _, handler := range manager.handlers { + if handled { + break + } + + handled = handler(session, data) + } + + if !handled { + logger.Warn().Str("event", data.Event).Msg("unhandled message") + } + case err := <-cancel: + return err + case <-manager.shutdown: + peer.Destroy("connection shutdown") + return nil + case <-ticker.C: + if err := peer.Ping(); err != nil { + return err + } + } + } +} + +func (manager *WebSocketManagerCtx) startInactiveCursors() { + if manager.shutdownInactiveCursors != nil { + manager.logger.Warn().Msg("inactive cursors handler already running") + return + } + + manager.logger.Info().Msg("starting inactive cursors handler") + manager.shutdownInactiveCursors = make(chan struct{}) + + manager.wg.Add(1) + go func() { + defer manager.wg.Done() + + ticker := time.NewTicker(inactiveCursorsPeriod) + defer ticker.Stop() + + var currentEmpty bool + var lastEmpty = false + + for { + select { + case <-manager.shutdownInactiveCursors: + manager.logger.Info().Msg("stopping inactive cursors handler") + manager.shutdownInactiveCursors = nil + + // remove last cursor entries and send empty message + _ = manager.sessions.PopCursors() + manager.sessions.InactiveCursorsBroadcast(event.SESSION_CURSORS, []message.SessionCursors{}) + return + case <-ticker.C: + cursorsMap := manager.sessions.PopCursors() + + currentEmpty = len(cursorsMap) == 0 + if currentEmpty && lastEmpty { + continue + } + lastEmpty = currentEmpty + + sessionCursors := []message.SessionCursors{} + for session, cursors := range cursorsMap { + sessionCursors = append( + sessionCursors, + message.SessionCursors{ + ID: session.ID(), + Cursors: cursors, + }, + ) + } + + manager.sessions.InactiveCursorsBroadcast(event.SESSION_CURSORS, sessionCursors) + } + } + }() +} + +func (manager *WebSocketManagerCtx) stopInactiveCursors() { + if manager.shutdownInactiveCursors != nil { + close(manager.shutdownInactiveCursors) + } +} diff --git a/server/internal/websocket/peer.go b/server/internal/websocket/peer.go new file mode 100644 index 000000000..7f40c963b --- /dev/null +++ b/server/internal/websocket/peer.go @@ -0,0 +1,91 @@ +package websocket + +import ( + "encoding/json" + "errors" + "sync" + + "github.com/gorilla/websocket" + "github.com/rs/zerolog" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/types/event" + "m1k1o/neko/pkg/types/message" + "m1k1o/neko/pkg/utils" +) + +type WebSocketPeerCtx struct { + mu sync.Mutex + logger zerolog.Logger + connection *websocket.Conn +} + +func newPeer(logger zerolog.Logger, connection *websocket.Conn) *WebSocketPeerCtx { + return &WebSocketPeerCtx{ + logger: logger.With().Str("submodule", "peer").Logger(), + connection: connection, + } +} + +func (peer *WebSocketPeerCtx) Send(event string, payload any) { + peer.mu.Lock() + defer peer.mu.Unlock() + + raw, err := json.Marshal(payload) + if err != nil { + peer.logger.Err(err).Str("event", event).Msg("message marshalling has failed") + return + } + + err = peer.connection.WriteJSON(types.WebSocketMessage{ + Event: event, + Payload: raw, + }) + + if err != nil { + err = errors.Unwrap(err) // unwrap if possible + peer.logger.Warn().Err(err).Str("event", event).Msg("send message error") + return + } + + // log events if not ignored + if ok, _ := utils.ArrayIn(event, nologEvents); !ok { + if len(raw) > maxPayloadLogLength { + raw = []byte("") + } + + peer.logger.Debug(). + Str("address", peer.connection.RemoteAddr().String()). + Str("event", event). + Str("payload", string(raw)). + Msg("sending message to client") + } +} + +func (peer *WebSocketPeerCtx) Ping() error { + peer.mu.Lock() + defer peer.mu.Unlock() + + // application level heartbeat + if err := peer.connection.WriteJSON(types.WebSocketMessage{ + Event: event.SYSTEM_HEARTBEAT, + }); err != nil { + return err + } + + return peer.connection.WriteMessage(websocket.PingMessage, nil) +} + +func (peer *WebSocketPeerCtx) Destroy(reason string) { + peer.Send( + event.SYSTEM_DISCONNECT, + message.SystemDisconnect{ + Message: reason, + }) + + peer.mu.Lock() + defer peer.mu.Unlock() + + err := peer.connection.Close() + peer.logger.Err(err).Msg("peer connection destroyed") +} diff --git a/server/internal/websocket/socket.go b/server/internal/websocket/socket.go deleted file mode 100644 index c9875bfd0..000000000 --- a/server/internal/websocket/socket.go +++ /dev/null @@ -1,55 +0,0 @@ -package websocket - -import ( - "encoding/json" - "strings" - "sync" - - "github.com/gorilla/websocket" -) - -type WebSocket struct { - id string - address string - ws *WebSocketHandler - connection *websocket.Conn - mu sync.Mutex -} - -func (socket *WebSocket) Address() string { - //remote := socket.connection.RemoteAddr() - address := strings.SplitN(socket.address, ":", -1) - if len(address[0]) < 1 { - return socket.address - } - return address[0] -} - -func (socket *WebSocket) Send(v interface{}) error { - socket.mu.Lock() - defer socket.mu.Unlock() - if socket.connection == nil { - return nil - } - - raw, err := json.Marshal(v) - if err != nil { - return err - } - - socket.ws.logger.Debug(). - Str("session", socket.id). - Str("address", socket.connection.RemoteAddr().String()). - Str("raw", string(raw)). - Msg("sending message to client") - - return socket.connection.WriteMessage(websocket.TextMessage, raw) -} - -func (socket *WebSocket) Destroy() error { - if socket.connection == nil { - return nil - } - - return socket.connection.Close() -} diff --git a/server/internal/websocket/state/state.go b/server/internal/websocket/state/state.go deleted file mode 100644 index a348c19cf..000000000 --- a/server/internal/websocket/state/state.go +++ /dev/null @@ -1,84 +0,0 @@ -package state - -import "path/filepath" - -type State struct { - banned map[string]string // IP -> session ID (that banned it) - locked map[string]string // resource name -> session ID (that locked it) - - fileTransferEnabled bool - fileTransferPath string // path where files are located -} - -func New(fileTransferEnabled bool, fileTransferPath string) *State { - return &State{ - banned: make(map[string]string), - locked: make(map[string]string), - - fileTransferEnabled: fileTransferEnabled, - fileTransferPath: fileTransferPath, - } -} - -// Ban - -func (s *State) Ban(ip, id string) { - s.banned[ip] = id -} - -func (s *State) Unban(ip string) { - delete(s.banned, ip) -} - -func (s *State) IsBanned(ip string) bool { - _, ok := s.banned[ip] - return ok -} - -func (s *State) GetBanned(ip string) (string, bool) { - id, ok := s.banned[ip] - return id, ok -} - -func (s *State) AllBanned() map[string]string { - return s.banned -} - -// Lock - -func (s *State) Lock(resource, id string) { - s.locked[resource] = id -} - -func (s *State) Unlock(resource string) { - delete(s.locked, resource) -} - -func (s *State) IsLocked(resource string) bool { - _, ok := s.locked[resource] - return ok -} - -func (s *State) GetLocked(resource string) (string, bool) { - id, ok := s.locked[resource] - return id, ok -} - -func (s *State) AllLocked() map[string]string { - return s.locked -} - -// File transfer - -func (s *State) FileTransferPath(filename string) string { - if filename == "" { - return s.fileTransferPath - } - - cleanPath := filepath.Clean(filename) - return filepath.Join(s.fileTransferPath, cleanPath) -} - -func (s *State) FileTransferEnabled() bool { - return s.fileTransferEnabled -} diff --git a/server/internal/websocket/websocket.go b/server/internal/websocket/websocket.go deleted file mode 100644 index e22ab0de3..000000000 --- a/server/internal/websocket/websocket.go +++ /dev/null @@ -1,471 +0,0 @@ -package websocket - -import ( - "fmt" - "net/http" - "os" - "sync" - "sync/atomic" - "time" - - "github.com/fsnotify/fsnotify" - "github.com/gorilla/websocket" - "github.com/rs/zerolog" - "github.com/rs/zerolog/log" - - "m1k1o/neko/internal/config" - "m1k1o/neko/internal/types" - "m1k1o/neko/internal/types/event" - "m1k1o/neko/internal/types/message" - "m1k1o/neko/internal/utils" - "m1k1o/neko/internal/websocket/handler" - "m1k1o/neko/internal/websocket/state" -) - -const CONTROL_PROTECTION_SESSION = "by_control_protection" - -func New(sessions types.SessionManager, desktop types.DesktopManager, capture types.CaptureManager, webrtc types.WebRTCManager, conf *config.WebSocket) *WebSocketHandler { - logger := log.With().Str("module", "websocket").Logger() - - state := state.New(conf.FileTransferEnabled, conf.FileTransferPath) - - // if control protection is enabled - if conf.ControlProtection { - state.Lock("control", CONTROL_PROTECTION_SESSION) - logger.Info().Msgf("control locked on behalf of control protection") - } - - // create file transfer directory if not exists - if conf.FileTransferEnabled { - if _, err := os.Stat(conf.FileTransferPath); os.IsNotExist(err) { - err = os.Mkdir(conf.FileTransferPath, os.ModePerm) - logger.Err(err).Msg("creating file transfer directory") - } - } - - // apply default locks - for _, lock := range conf.Locks { - state.Lock(lock, "") // empty session ID - } - - if len(conf.Locks) > 0 { - logger.Info().Msgf("locked resources: %+v", conf.Locks) - } - - handler := handler.New( - sessions, - desktop, - capture, - webrtc, - state, - ) - - return &WebSocketHandler{ - logger: logger, - shutdown: make(chan interface{}), - conf: conf, - sessions: sessions, - desktop: desktop, - webrtc: webrtc, - state: state, - upgrader: websocket.Upgrader{ - CheckOrigin: func(r *http.Request) bool { - return true - }, - }, - handler: handler, - serverStartedAt: time.Now(), - } -} - -// Send pings to peer with this period. Must be less than pongWait. -const pingPeriod = 60 * time.Second - -type WebSocketHandler struct { - logger zerolog.Logger - wg sync.WaitGroup - shutdown chan interface{} - upgrader websocket.Upgrader - sessions types.SessionManager - desktop types.DesktopManager - webrtc types.WebRTCManager - state *state.State - conf *config.WebSocket - handler *handler.MessageHandler - - // stats - conns uint32 - serverStartedAt time.Time - lastAdminLeftAt *time.Time - lastUserLeftAt *time.Time -} - -func (ws *WebSocketHandler) Start() { - go func() { - for { - e, ok := <-ws.sessions.GetEventsChannel() - if !ok { - ws.logger.Info().Msg("session channel was closed") - return - } - - switch e.Type { - case types.SESSION_CREATED: - if err := ws.handler.SessionCreated(e.Id, e.Session); err != nil { - ws.logger.Warn().Str("id", e.Id).Err(err).Msg("session created with and error") - } else { - ws.logger.Debug().Str("id", e.Id).Msg("session created") - } - case types.SESSION_CONNECTED: - if err := ws.handler.SessionConnected(e.Id, e.Session); err != nil { - ws.logger.Warn().Str("id", e.Id).Err(err).Msg("session connected with and error") - } else { - ws.logger.Debug().Str("id", e.Id).Msg("session connected") - } - - // if control protection is enabled and at least one admin - // and if room was locked on behalf control protection, unlock - sess, ok := ws.state.GetLocked("control") - if ok && ws.conf.ControlProtection && sess == CONTROL_PROTECTION_SESSION && len(ws.sessions.Admins()) > 0 { - ws.state.Unlock("control") - ws.sessions.SetControlLocked(false) // TODO: Handle locks in sessions as flags. - ws.logger.Info().Msgf("control unlocked on behalf of control protection") - - if err := ws.sessions.Broadcast( - message.AdminLock{ - Event: event.ADMIN_UNLOCK, - ID: e.Id, - Resource: "control", - }, nil); err != nil { - ws.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_UNLOCK) - } - } - - // remove outdated stats - if e.Session.Admin() { - ws.lastAdminLeftAt = nil - } else { - ws.lastUserLeftAt = nil - } - case types.SESSION_DESTROYED: - if err := ws.handler.SessionDestroyed(e.Id); err != nil { - ws.logger.Warn().Str("id", e.Id).Err(err).Msg("session destroyed with and error") - } else { - ws.logger.Debug().Str("id", e.Id).Msg("session destroyed") - } - - membersCount := len(ws.sessions.Members()) - adminCount := len(ws.sessions.Admins()) - - // if control protection is enabled and no admin - // and room is not locked, lock - ok := ws.state.IsLocked("control") - if !ok && ws.conf.ControlProtection && adminCount == 0 { - ws.state.Lock("control", CONTROL_PROTECTION_SESSION) - ws.sessions.SetControlLocked(true) // TODO: Handle locks in sessions as flags. - ws.logger.Info().Msgf("control locked and released on behalf of control protection") - ws.handler.AdminRelease(e.Id, e.Session) - - if err := ws.sessions.Broadcast( - message.AdminLock{ - Event: event.ADMIN_LOCK, - ID: e.Id, - Resource: "control", - }, nil); err != nil { - ws.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.ADMIN_LOCK) - } - } - - // if this was the last admin - if e.Session.Admin() && adminCount == 0 { - now := time.Now() - ws.lastAdminLeftAt = &now - } - - // if this was the last user - if !e.Session.Admin() && membersCount-adminCount == 0 { - now := time.Now() - ws.lastUserLeftAt = &now - } - case types.SESSION_HOST_SET: - // TODO: Unused. - case types.SESSION_HOST_CLEARED: - // TODO: Unused. - } - } - }() - - go func() { - for { - _, ok := <-ws.desktop.GetClipboardUpdatedChannel() - if !ok { - ws.logger.Info().Msg("clipboard update channel closed") - return - } - - session, ok := ws.sessions.GetHost() - if !ok { - return - } - - err := session.Send(message.Clipboard{ - Event: event.CONTROL_CLIPBOARD, - Text: ws.desktop.ReadClipboard(), - }) - - ws.logger.Err(err).Msg("sync clipboard") - } - }() - - // watch for file changes and send file list if file transfer is enabled - if ws.conf.FileTransferEnabled { - watcher, err := fsnotify.NewWatcher() - if err != nil { - ws.logger.Err(err).Msg("unable to start file transfer dir watcher") - return - } - - go func() { - for { - select { - case e, ok := <-watcher.Events: - if !ok { - ws.logger.Info().Msg("file transfer dir watcher closed") - return - } - if e.Has(fsnotify.Create) || e.Has(fsnotify.Remove) || e.Has(fsnotify.Rename) { - ws.logger.Debug().Str("event", e.String()).Msg("file transfer dir watcher event") - ws.handler.FileTransferRefresh(nil) - } - case err := <-watcher.Errors: - ws.logger.Err(err).Msg("error in file transfer dir watcher") - } - } - }() - - if err := watcher.Add(ws.conf.FileTransferPath); err != nil { - ws.logger.Err(err).Msg("unable to add file transfer path to watcher") - } - } -} - -func (ws *WebSocketHandler) Shutdown() error { - close(ws.shutdown) - ws.wg.Wait() - return nil -} - -func (ws *WebSocketHandler) Upgrade(w http.ResponseWriter, r *http.Request) error { - ws.logger.Debug().Msg("attempting to upgrade connection") - - id, err := utils.NewUID(32) - if err != nil { - ws.logger.Error().Err(err).Msg("failed to generate user id") - return err - } - - connection, err := ws.upgrader.Upgrade(w, r, nil) - if err != nil { - ws.logger.Error().Err(err).Msg("failed to upgrade connection") - return err - } - - admin, err := ws.authenticate(r) - if err != nil { - ws.logger.Warn().Err(err).Msg("authentication failed") - - if err = connection.WriteJSON(message.SystemMessage{ - Event: event.SYSTEM_DISCONNECT, - Message: "invalid_password", - }); err != nil { - ws.logger.Error().Err(err).Msg("failed to send disconnect") - } - - if err = connection.Close(); err != nil { - return err - } - return nil - } - - socket := &WebSocket{ - id: id, - ws: ws, - address: r.RemoteAddr, - connection: connection, - } - - ok, reason := ws.handler.Connected(admin, socket.Address()) - if !ok { - if err = connection.WriteJSON(message.SystemMessage{ - Event: event.SYSTEM_DISCONNECT, - Message: reason, - }); err != nil { - ws.logger.Error().Err(err).Msg("failed to send disconnect") - } - - if err = connection.Close(); err != nil { - return err - } - - return nil - } - - ws.sessions.New(id, admin, socket) - - ws.logger. - Debug(). - Str("session", id). - Str("address", connection.RemoteAddr().String()). - Msg("new connection created") - - atomic.AddUint32(&ws.conns, uint32(1)) - - defer func() { - ws.logger. - Debug(). - Str("session", id). - Str("address", connection.RemoteAddr().String()). - Msg("session ended") - - atomic.AddUint32(&ws.conns, ^uint32(0)) - }() - - ws.handle(connection, id) - return nil -} - -func (ws *WebSocketHandler) Stats() types.Stats { - host := "" - session, ok := ws.sessions.GetHost() - if ok { - host = session.ID() - } - - return types.Stats{ - Connections: atomic.LoadUint32(&ws.conns), - Host: host, - Members: ws.sessions.Members(), - - Banned: ws.state.AllBanned(), - Locked: ws.state.AllLocked(), - - ServerStartedAt: ws.serverStartedAt, - LastAdminLeftAt: ws.lastAdminLeftAt, - LastUserLeftAt: ws.lastUserLeftAt, - - ControlProtection: ws.conf.ControlProtection, - ImplicitControl: ws.webrtc.ImplicitControl(), - } -} - -func (ws *WebSocketHandler) IsLocked(resource string) bool { - return ws.state.IsLocked(resource) -} - -func (ws *WebSocketHandler) IsAdmin(password string) (bool, error) { - if password == ws.conf.AdminPassword { - return true, nil - } - - if password == ws.conf.Password { - return false, nil - } - - return false, fmt.Errorf("invalid password") -} - -func (ws *WebSocketHandler) authenticate(r *http.Request) (bool, error) { - passwords, ok := r.URL.Query()["password"] - if !ok || len(passwords[0]) < 1 { - return false, fmt.Errorf("no password provided") - } - - return ws.IsAdmin(passwords[0]) -} - -func (ws *WebSocketHandler) handle(connection *websocket.Conn, id string) { - bytes := make(chan []byte) - cancel := make(chan struct{}) - ticker := time.NewTicker(pingPeriod) - - ws.wg.Add(1) - go func() { - defer func() { - ticker.Stop() - ws.logger.Debug().Str("address", connection.RemoteAddr().String()).Msg("handle socket ending") - ws.handler.Disconnected(id) - ws.wg.Done() - }() - - for { - _, raw, err := connection.ReadMessage() - if err != nil { - if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) { - ws.logger.Warn().Err(err).Msg("read message error") - } else { - ws.logger.Debug().Err(err).Msg("read message error") - } - close(cancel) - break - } - bytes <- raw - } - }() - - for { - select { - case raw := <-bytes: - ws.logger.Debug(). - Str("session", id). - Str("address", connection.RemoteAddr().String()). - Str("raw", string(raw)). - Msg("received message from client") - if err := ws.handler.Message(id, raw); err != nil { - ws.logger.Error().Err(err).Msg("message handler has failed") - } - case <-ws.shutdown: - if err := connection.WriteJSON(message.SystemMessage{ - Event: event.SYSTEM_DISCONNECT, - Message: "server_shutdown", - }); err != nil { - ws.logger.Err(err).Msg("failed to send disconnect") - } - - if err := connection.Close(); err != nil { - ws.logger.Err(err).Msg("connection closed with an error") - } - return - case <-cancel: - return - case <-ticker.C: - if err := connection.WriteMessage(websocket.PingMessage, nil); err != nil { - return - } - } - } -} - -// -// File transfer -// - -func (ws *WebSocketHandler) CanTransferFiles(password string) (bool, error) { - if !ws.conf.FileTransferEnabled { - return false, nil - } - - isAdmin, err := ws.IsAdmin(password) - if err != nil { - return false, err - } - - return isAdmin || !ws.state.IsLocked("file_transfer"), nil -} - -func (ws *WebSocketHandler) FileTransferPath(filename string) string { - return ws.state.FileTransferPath(filename) -} - -func (ws *WebSocketHandler) FileTransferEnabled() bool { - return ws.conf.FileTransferEnabled -} diff --git a/server/neko.go b/server/neko.go index ab6189a95..d25ee6a7e 100644 --- a/server/neko.go +++ b/server/neko.go @@ -2,25 +2,11 @@ package neko import ( "fmt" - "os" - "os/signal" "runtime" "strings" - - "m1k1o/neko/internal/capture" - "m1k1o/neko/internal/config" - "m1k1o/neko/internal/desktop" - "m1k1o/neko/internal/http" - "m1k1o/neko/internal/session" - "m1k1o/neko/internal/webrtc" - "m1k1o/neko/internal/websocket" - - "github.com/rs/zerolog" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" ) -const Header = `&34 +const Header = `&34 _ __ __ / | / /__ / /______ \ /\ / |/ / _ \/ //_/ __ \ ) ( ') @@ -40,29 +26,17 @@ var ( gitTag = "dev" ) -var Service *Neko - -func init() { - Service = &Neko{ - Version: &Version{ - GitCommit: gitCommit, - GitBranch: gitBranch, - GitTag: gitTag, - BuildDate: buildDate, - GoVersion: runtime.Version(), - Compiler: runtime.Compiler, - Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), - }, - Root: &config.Root{}, - Server: &config.Server{}, - Capture: &config.Capture{}, - Desktop: &config.Desktop{}, - WebRTC: &config.WebRTC{}, - WebSocket: &config.WebSocket{}, - } +var Version = &version{ + GitCommit: gitCommit, + GitBranch: gitBranch, + GitTag: gitTag, + BuildDate: buildDate, + GoVersion: runtime.Version(), + Compiler: runtime.Compiler, + Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH), } -type Version struct { +type version struct { GitCommit string GitBranch string GitTag string @@ -72,7 +46,7 @@ type Version struct { Platform string } -func (i *Version) String() string { +func (i *version) String() string { version := i.GitTag if version == "" || version == "dev" { version = i.GitBranch @@ -81,7 +55,7 @@ func (i *Version) String() string { return fmt.Sprintf("%s@%s", version, i.GitCommit) } -func (i *Version) Details() string { +func (i *version) Details() string { return "\n" + strings.Join([]string{ fmt.Sprintf("Version %s", i.String()), fmt.Sprintf("GitCommit %s", i.GitCommit), @@ -93,84 +67,3 @@ func (i *Version) Details() string { fmt.Sprintf("Platform %s", i.Platform), }, "\n") + "\n" } - -type Neko struct { - Version *Version - Root *config.Root - Capture *config.Capture - Desktop *config.Desktop - Server *config.Server - WebRTC *config.WebRTC - WebSocket *config.WebSocket - - logger zerolog.Logger - server *http.Server - sessionManager *session.SessionManager - captureManager *capture.CaptureManagerCtx - desktopManager *desktop.DesktopManagerCtx - webRTCManager *webrtc.WebRTCManager - webSocketHandler *websocket.WebSocketHandler -} - -func (neko *Neko) Preflight() { - neko.logger = log.With().Str("service", "neko").Logger() -} - -func (neko *Neko) Start() { - desktopManager := desktop.New(neko.Desktop) - desktopManager.Start() - - captureManager := capture.New(desktopManager, neko.Capture) - captureManager.Start() - - sessionManager := session.New(captureManager) - - webRTCManager := webrtc.New(sessionManager, captureManager, desktopManager, neko.WebRTC) - webRTCManager.Start() - - webSocketHandler := websocket.New(sessionManager, desktopManager, captureManager, webRTCManager, neko.WebSocket) - webSocketHandler.Start() - - server := http.New(neko.Server, webSocketHandler, desktopManager) - server.Start() - - neko.sessionManager = sessionManager - neko.captureManager = captureManager - neko.desktopManager = desktopManager - neko.webRTCManager = webRTCManager - neko.webSocketHandler = webSocketHandler - neko.server = server -} - -func (neko *Neko) Shutdown() { - var err error - - err = neko.server.Shutdown() - neko.logger.Err(err).Msg("server shutdown") - - err = neko.webSocketHandler.Shutdown() - neko.logger.Err(err).Msg("websocket handler shutdown") - - err = neko.webRTCManager.Shutdown() - neko.logger.Err(err).Msg("webrtc manager shutdown") - - err = neko.captureManager.Shutdown() - neko.logger.Err(err).Msg("capture manager shutdown") - - err = neko.desktopManager.Shutdown() - neko.logger.Err(err).Msg("desktop manager shutdown") -} - -func (neko *Neko) ServeCommand(cmd *cobra.Command, args []string) { - neko.logger.Info().Msg("starting neko server") - neko.Start() - neko.logger.Info().Msg("neko ready") - - quit := make(chan os.Signal, 1) - signal.Notify(quit, os.Interrupt) - sig := <-quit - - neko.logger.Warn().Msgf("received %s, attempting graceful shutdown", sig) - neko.Shutdown() - neko.logger.Info().Msg("shutdown complete") -} diff --git a/server/openapi.yaml b/server/openapi.yaml new file mode 100644 index 000000000..bf5e18c8f --- /dev/null +++ b/server/openapi.yaml @@ -0,0 +1,1310 @@ +openapi: 3.0.0 + +info: + title: n.eko REST API + description: Next Gen Renderer. + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' + version: "1.0.0" + +servers: + - description: Local server + url: http://localhost:3000 + +tags: + - name: sessions + description: Sessions management. + - name: room + description: Room releated operations. + - name: members + description: Members management. + +paths: + /health: + get: + summary: healthcheck + operationId: healthcheck + security: [] + responses: + '200': + description: OK + /metrics: + get: + summary: metrics + operationId: metrics + security: [] + responses: + '200': + description: OK + + /api/batch: + post: + summary: batch + operationId: batch + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/BatchResponse' + requestBody: + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/BatchRequest' + required: true + + # + # current session + # + + /api/login: + post: + summary: login + operationId: login + security: [] + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SessionData' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SessionLogin' + required: true + /api/logout: + post: + summary: logout + operationId: logout + responses: + '200': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + /api/whoami: + get: + summary: whoami + operationId: whoami + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SessionData' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + /api/profile: + post: + summary: update current profile without syncing it with member profile (experimental) + operationId: profile + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MemberProfile' + required: true + + # + # sessions + # + + /api/sessions: + get: + tags: + - sessions + summary: get sessions + operationId: sessionsGet + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/SessionData' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + /api/sessions/{sessionId}: + get: + tags: + - sessions + summary: get session + operationId: sessionGet + parameters: + - in: path + name: sessionId + description: session identifier + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/SessionData' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + delete: + tags: + - sessions + summary: remove session + operationId: sessionRemove + parameters: + - in: path + name: sessionId + description: session identifier + required: true + schema: + type: string + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + /api/sessions/{sessionId}/disconnect: + post: + tags: + - sessions + summary: disconnect session + operationId: sessionDisconnect + parameters: + - in: path + name: sessionId + description: session identifier + required: true + schema: + type: string + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + + # + # room + # + + /api/room/settings: + get: + tags: + - room + summary: get settings + operationId: settingsGet + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/Settings' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + post: + tags: + - room + summary: set settings + operationId: settingsSet + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Settings' + required: true + /api/room/broadcast: + get: + tags: + - room + summary: get broadcast status + operationId: broadcastStatus + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/BroadcastStatus' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + /api/room/broadcast/start: + post: + tags: + - room + summary: start broadcast + operationId: broadcastStart + responses: + '204': + description: OK + '400': + description: Missing broadcast URL + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '422': + description: Server is already broadcasting + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + '500': + description: Unable to start broadcast + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BroadcastStatus' + required: true + /api/room/broadcast/stop: + post: + tags: + - room + summary: stop broadcast + operationId: broadcastStop + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '422': + description: Server is not broadcasting + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + + /api/room/clipboard: + get: + tags: + - room + summary: get clipboard rich-text or plain-text content + operationId: clipboardGetText + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ClipboardText' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '500': + description: Unable to get clipboard content + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + post: + tags: + - room + summary: set clipboard rich-text or plain-text content + operationId: clipboardSetText + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '500': + description: Unable to set clipboard content + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ClipboardText' + required: true + /api/room/clipboard/image.png: + get: + tags: + - room + summary: get clipboard image content + operationId: clipboardGetImage + responses: + '200': + description: OK + content: + image/png: + schema: + type: string + format: binary + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '500': + description: Unable to get clipboard content + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + + /api/room/keyboard/map: + get: + tags: + - room + summary: get keyboard map + operationId: keyboardMapGet + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/KeyboardMap' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '500': + description: Unable to get keyboard map + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + post: + tags: + - room + summary: set keyboard map + operationId: keyboardMapSet + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '500': + description: Unable to change keyboard map + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/KeyboardMap' + required: true + /api/room/keyboard/modifiers: + get: + tags: + - room + summary: get keyboard modifiers + operationId: keyboardModifiersGet + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/KeyboardModifiers' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + post: + tags: + - room + summary: set keyboard modifiers + operationId: keyboardModifiersSet + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/KeyboardModifiers' + required: true + + /api/room/control: + get: + tags: + - room + summary: get control status + operationId: controlStatus + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ControlStatus' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + /api/room/control/request: + post: + tags: + - room + summary: request control + operationId: controlRequest + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '422': + description: There is already a host + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + /api/room/control/release: + post: + tags: + - room + summary: release control + operationId: controlRelease + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '422': + description: There is already a host + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + /api/room/control/take: + post: + tags: + - room + summary: take control + operationId: controlTake + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + /api/room/control/give/{sessionId}: + post: + tags: + - room + summary: give control + operationId: controlGive + parameters: + - in: path + name: sessionId + description: session ID + required: true + schema: + type: string + responses: + '204': + description: OK + '400': + description: Target session is not allowed to host + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + /api/room/control/reset: + post: + tags: + - room + summary: reset control + operationId: controlReset + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + + /api/room/screen: + get: + tags: + - room + summary: get current screen configuration + operationId: screenConfiguration + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ScreenConfiguration' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '500': + description: Unable to get screen configuration + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + post: + tags: + - room + summary: change screen configuration + operationId: screenConfigurationChange + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ScreenConfiguration' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '422': + description: Invalid screen configuration + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ScreenConfiguration' + required: true + /api/room/screen/configurations: + get: + tags: + - room + summary: get list of all available screen configurations + operationId: screenConfigurationsList + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/ScreenConfiguration' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + /api/room/screen/cast.jpg: + get: + tags: + - room + summary: get screencast image + operationId: screenCastImage + responses: + '200': + description: OK + content: + image/jpeg: + schema: + type: string + format: binary + '400': + description: Screencast is not enabled + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '500': + description: Unable to fetch image + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + /api/room/screen/shot.jpg: + get: + tags: + - room + summary: get screenshot image + operationId: screenShotImage + parameters: + - in: query + name: quality + description: image quality (0-100) + required: false + schema: + type: integer + responses: + '200': + description: OK + content: + image/jpeg: + schema: + type: string + format: binary + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '500': + description: Unable to create image + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + + /api/room/upload/drop: + post: + tags: + - room + summary: upload and drop file + operationId: uploadDrop + responses: + '204': + description: OK + '400': + description: Unable to upload file + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '500': + description: Unable to process uploaded file + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + x: + type: number + description: X coordinate of drop + y: + type: number + description: Y coordinate of drop + files: + type: array + description: files to be uploaded + items: + type: string + format: binary + required: true + /api/room/upload/dialog: + post: + tags: + - room + summary: upload file to a dialog + operationId: uploadDialog + responses: + '204': + description: OK + '400': + description: Unable to upload file + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '422': + description: No upload dialog prompt active + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + '500': + description: Unable to process uploaded file + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + files: + type: array + description: files to be uploaded + items: + type: string + format: binary + required: true + delete: + tags: + - room + summary: close file chooser dialog + operationId: uploadDialogClose + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '422': + description: No upload dialog prompt active + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + + # + # members + # + + /api/members: + get: + tags: + - members + summary: list of members + operationId: membersList + parameters: + - in: query + name: limit + schema: + type: number + - in: query + name: offset + schema: + type: number + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/MemberData' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + post: + tags: + - members + summary: create new member + operationId: membersCreate + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MemberData' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '422': + description: Member with chosen ID already exists + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MemberCreate' + required: true + /api/members/{memberId}: + get: + tags: + - members + summary: get member's profile + operationId: membersGetProfile + parameters: + - in: path + name: memberId + description: member identifier + required: true + schema: + type: string + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/MemberProfile' + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + post: + tags: + - members + summary: update member's profile + operationId: membersUpdateProfile + parameters: + - in: path + name: memberId + description: member identifier + required: true + schema: + type: string + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MemberProfile' + required: true + delete: + tags: + - members + summary: remove member + operationId: membersRemove + parameters: + - in: path + name: memberId + description: member identifier + required: true + schema: + type: string + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + /api/members/{memberId}/password: + post: + tags: + - members + summary: update member's password + operationId: membersUpdatePassword + parameters: + - in: path + name: memberId + description: member identifier + required: true + schema: + type: string + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MemberPassword' + required: true + /api/members_bulk/update: + post: + tags: + - members + summary: bulk update members + operationId: membersBulkUpdate + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MemberBulkUpdate' + required: true + /api/members_bulk/delete: + post: + tags: + - members + summary: bulk delete members + operationId: membersBulkDelete + responses: + '204': + description: OK + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + '404': + $ref: '#/components/responses/NotFound' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MemberBulkDelete' + required: true + +components: + securitySchemes: + CookieAuth: + type: apiKey + in: cookie + name: NEKO_SESSION + BearerAuth: + type: http + scheme: bearer + TokenAuth: + type: apiKey + in: query + name: token + + responses: + NotFound: + description: The specified resource was not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + Unauthorized: + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + Forbidden: + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorMessage' + + schemas: + ErrorMessage: + type: object + properties: + message: + type: string + + BatchRequest: + type: object + properties: + path: + type: string + method: + type: string + enum: + - GET + - POST + - DELETE + body: + description: Request body + + BatchResponse: + type: object + properties: + path: + type: string + method: + type: string + enum: + - GET + - POST + - DELETE + body: + description: Response body + status: + type: integer + + # + # sessions + # + + SessionLogin: + type: object + properties: + username: + type: string + password: + type: string + + SessionData: + type: object + properties: + id: + type: string + token: + type: string + description: Only if cookie authentication is disabled. + profile: + $ref: '#/components/schemas/MemberProfile' + state: + $ref: '#/components/schemas/SessionState' + + SessionState: + type: object + properties: + is_connected: + type: boolean + is_watching: + type: boolean + + # + # room + # + + Settings: + type: object + properties: + private_mode: + type: boolean + locked_controls: + type: boolean + implicit_hosting: + type: boolean + inactive_cursors: + type: boolean + merciful_reconnect: + type: boolean + plugins: + type: object + additionalProperties: true + + BroadcastStatus: + type: object + properties: + url: + type: string + example: rtmp://localhost/live + is_active: + type: boolean + + ClipboardText: + type: object + properties: + text: + type: string + example: Copied Content 123 + html: + type: string + example: Copied Content 123 + + KeyboardMap: + type: object + properties: + layout: + type: string + example: sk + variant: + type: string + example: qwerty + + KeyboardModifiers: + type: object + properties: + shift: + type: boolean + capslock: + type: boolean + control: + type: boolean + alt: + type: boolean + numlock: + type: boolean + meta: + type: boolean + super: + type: boolean + altgr: + type: boolean + + ControlStatus: + type: object + properties: + has_host: + type: boolean + host_id: + type: string + + ScreenConfiguration: + type: object + properties: + width: + type: integer + example: 1280 + height: + type: integer + example: 720 + rate: + type: integer + example: 30 + + # + # members + # + + MemberProfile: + type: object + properties: + name: + type: string + is_admin: + type: boolean + can_login: + type: boolean + can_connect: + type: boolean + can_watch: + type: boolean + can_host: + type: boolean + can_share_media: + type: boolean + can_access_clipboard: + type: boolean + sends_inactive_cursor: + type: boolean + can_see_inactive_cursors: + type: boolean + plugins: + type: object + additionalProperties: true + + MemberData: + properties: + id: + type: string + profile: + $ref: '#/components/schemas/MemberProfile' + + MemberCreate: + properties: + username: + type: string + password: + type: string + profile: + $ref: '#/components/schemas/MemberProfile' + + MemberPassword: + properties: + password: + type: string + + MemberBulkUpdate: + properties: + ids: + type: array + items: + type: string + profile: + $ref: '#/components/schemas/MemberProfile' + + MemberBulkDelete: + properties: + ids: + type: array + items: + type: string + +security: + - BearerAuth: [] + - CookieAuth: [] + - TokenAuth: [] diff --git a/server/pkg/auth/auth.go b/server/pkg/auth/auth.go new file mode 100644 index 000000000..834b344ea --- /dev/null +++ b/server/pkg/auth/auth.go @@ -0,0 +1,107 @@ +package auth + +import ( + "context" + "fmt" + "net/http" + + "m1k1o/neko/pkg/types" + "m1k1o/neko/pkg/utils" +) + +type key int + +const keySessionCtx key = iota + +func SetSession(r *http.Request, session types.Session) context.Context { + return context.WithValue(r.Context(), keySessionCtx, session) +} + +func GetSession(r *http.Request) (types.Session, bool) { + session, ok := r.Context().Value(keySessionCtx).(types.Session) + return session, ok +} + +func AdminsOnly(w http.ResponseWriter, r *http.Request) (context.Context, error) { + session, ok := GetSession(r) + if !ok || !session.Profile().IsAdmin { + return nil, utils.HttpForbidden("session is not admin") + } + + return nil, nil +} + +func HostsOnly(w http.ResponseWriter, r *http.Request) (context.Context, error) { + session, ok := GetSession(r) + if !ok || !session.IsHost() { + return nil, utils.HttpForbidden("session is not host") + } + + return nil, nil +} + +func HostsOrAdminsOnly(w http.ResponseWriter, r *http.Request) (context.Context, error) { + session, ok := GetSession(r) + if !ok || (!session.IsHost() && !session.Profile().IsAdmin) { + return nil, utils.HttpForbidden("session is not host or admin") + } + + return nil, nil +} + +func CanWatchOnly(w http.ResponseWriter, r *http.Request) (context.Context, error) { + session, ok := GetSession(r) + if !ok || !session.Profile().CanWatch { + return nil, utils.HttpForbidden("session cannot watch") + } + + return nil, nil +} + +func CanHostOnly(w http.ResponseWriter, r *http.Request) (context.Context, error) { + session, ok := GetSession(r) + if !ok || !session.Profile().CanHost { + return nil, utils.HttpForbidden("session cannot host") + } + + if session.PrivateModeEnabled() { + return nil, utils.HttpUnprocessableEntity("private mode is enabled") + } + + return nil, nil +} + +func CanAccessClipboardOnly(w http.ResponseWriter, r *http.Request) (context.Context, error) { + session, ok := GetSession(r) + if !ok || !session.Profile().CanAccessClipboard { + return nil, utils.HttpForbidden("session cannot access clipboard") + } + + return nil, nil +} + +func PluginsGenericOnly[V comparable](key string, exp V) func(w http.ResponseWriter, r *http.Request) (context.Context, error) { + return func(w http.ResponseWriter, r *http.Request) (context.Context, error) { + session, ok := GetSession(r) + if !ok { + return nil, utils.HttpForbidden("session not found") + } + + plugins := session.Profile().Plugins + + if plugins[key] == nil { + return nil, utils.HttpForbidden(fmt.Sprintf("missing plugin permission: %s=%T", key, exp)) + } + + val, ok := plugins[key].(V) + if !ok { + return nil, utils.HttpForbidden(fmt.Sprintf("invalid plugin permission type: %s=%T expected %T", key, plugins[key], exp)) + } + + if val != exp { + return nil, utils.HttpForbidden(fmt.Sprintf("wrong plugin permission value for %s=%T", key, exp)) + } + + return nil, nil + } +} diff --git a/server/pkg/auth/auth_test.go b/server/pkg/auth/auth_test.go new file mode 100644 index 000000000..7218c728c --- /dev/null +++ b/server/pkg/auth/auth_test.go @@ -0,0 +1,358 @@ +package auth + +import ( + "fmt" + "net/http" + "reflect" + "testing" + + "m1k1o/neko/internal/config" + "m1k1o/neko/internal/session" + "m1k1o/neko/pkg/types" +) + +var i = 0 +var sessionManager = session.New(&config.Session{}) + +func rWithSession(profile types.MemberProfile) (*http.Request, types.Session, error) { + i++ + r := &http.Request{} + session, _, err := sessionManager.Create(fmt.Sprintf("id-%d", i), profile) + ctx := SetSession(r, session) + r = r.WithContext(ctx) + return r, session, err +} + +func TestSessionCtx(t *testing.T) { + r, session, err := rWithSession(types.MemberProfile{}) + if err != nil { + t.Errorf("could not create session %s", err.Error()) + return + } + + sess, ok := GetSession(r) + if !ok { + t.Errorf("session not found") + return + } + + if !reflect.DeepEqual(sess, session) { + t.Errorf("sessions not equal") + return + } +} + +func TestAdminsOnly(t *testing.T) { + r1, _, err := rWithSession(types.MemberProfile{IsAdmin: false}) + if err != nil { + t.Errorf("could not create session %s", err.Error()) + return + } + + r2, _, err := rWithSession(types.MemberProfile{IsAdmin: true}) + if err != nil { + t.Errorf("could not create session %s", err.Error()) + return + } + + tests := []struct { + name string + r *http.Request + wantErr bool + }{ + { + name: "is not admin", + r: r1, + wantErr: true, + }, + { + name: "is admin", + r: r2, + wantErr: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + _, err := AdminsOnly(nil, tt.r) + if (err != nil) != tt.wantErr { + t.Errorf("AdminsOnly() error = %v, wantErr %v", err, tt.wantErr) + return + } + }) + } +} + +func TestHostsOnly(t *testing.T) { + r1, _, err := rWithSession(types.MemberProfile{CanHost: true}) + if err != nil { + t.Errorf("could not create session %s", err.Error()) + return + } + + r2, session, err := rWithSession(types.MemberProfile{CanHost: true}) + if err != nil { + t.Errorf("could not create session %s", err.Error()) + return + } + + // r2 is host + session.SetAsHost() + + r3, _, err := rWithSession(types.MemberProfile{CanHost: false}) + if err != nil { + t.Errorf("could not create session %s", err.Error()) + return + } + + tests := []struct { + name string + r *http.Request + wantErr bool + }{ + { + name: "is not hosting", + r: r1, + wantErr: true, + }, + { + name: "is hosting", + r: r2, + wantErr: false, + }, + { + name: "cannot host", + r: r3, + wantErr: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + _, err := HostsOnly(nil, tt.r) + if (err != nil) != tt.wantErr { + t.Errorf("HostsOnly() error = %v, wantErr %v", err, tt.wantErr) + return + } + }) + } +} + +func TestCanWatchOnly(t *testing.T) { + r1, _, err := rWithSession(types.MemberProfile{CanWatch: false}) + if err != nil { + t.Errorf("could not create session %s", err.Error()) + return + } + + r2, _, err := rWithSession(types.MemberProfile{CanWatch: true}) + if err != nil { + t.Errorf("could not create session %s", err.Error()) + return + } + + tests := []struct { + name string + r *http.Request + wantErr bool + }{ + { + name: "can not watch", + r: r1, + wantErr: true, + }, + { + name: "can watch", + r: r2, + wantErr: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + _, err := CanWatchOnly(nil, tt.r) + if (err != nil) != tt.wantErr { + t.Errorf("CanWatchOnly() error = %v, wantErr %v", err, tt.wantErr) + return + } + }) + } +} + +func TestCanHostOnly(t *testing.T) { + r1, _, err := rWithSession(types.MemberProfile{CanHost: false}) + if err != nil { + t.Errorf("could not create session %s", err.Error()) + return + } + + r2, _, err := rWithSession(types.MemberProfile{CanHost: true}) + if err != nil { + t.Errorf("could not create session %s", err.Error()) + return + } + + tests := []struct { + name string + r *http.Request + wantErr bool + privateMode bool + }{ + { + name: "can not host", + r: r1, + wantErr: true, + }, + { + name: "can host", + r: r2, + wantErr: false, + }, + { + name: "private mode enabled: can not host", + r: r1, + wantErr: true, + privateMode: true, + }, + { + name: "private mode enabled: can host", + r: r2, + wantErr: true, + privateMode: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + session, _ := GetSession(tt.r) + sessionManager.UpdateSettingsFunc(session, func(s *types.Settings) bool { + s.PrivateMode = tt.privateMode + return true + }) + + _, err := CanHostOnly(nil, tt.r) + if (err != nil) != tt.wantErr { + t.Errorf("CanHostOnly() error = %v, wantErr %v", err, tt.wantErr) + return + } + }) + } +} + +func TestCanAccessClipboardOnly(t *testing.T) { + r1, _, err := rWithSession(types.MemberProfile{CanAccessClipboard: false}) + if err != nil { + t.Errorf("could not create session %s", err.Error()) + return + } + + r2, _, err := rWithSession(types.MemberProfile{CanAccessClipboard: true}) + if err != nil { + t.Errorf("could not create session %s", err.Error()) + return + } + + tests := []struct { + name string + r *http.Request + wantErr bool + }{ + { + name: "can not access clipboard", + r: r1, + wantErr: true, + }, + { + name: "can access clipboard", + r: r2, + wantErr: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + _, err := CanAccessClipboardOnly(nil, tt.r) + if (err != nil) != tt.wantErr { + t.Errorf("CanAccessClipboardOnly() error = %v, wantErr %v", err, tt.wantErr) + return + } + }) + } +} + +func TestPluginsGenericOnly(t *testing.T) { + r1, _, err := rWithSession(types.MemberProfile{ + Plugins: map[string]any{ + "foo.bar": 1, + }, + }) + if err != nil { + t.Errorf("could not create session %s", err.Error()) + return + } + + t.Run("test if exists", func(t *testing.T) { + key := "foo.bar" + val := 1 + wantErr := false + + handler := PluginsGenericOnly(key, val) + _, err := handler(nil, r1) + if (err != nil) != wantErr { + t.Errorf("PluginsGenericOnly(%q, %v) error = %v, wantErr %v", key, val, err, wantErr) + return + } + }) + + t.Run("test when gets different value", func(t *testing.T) { + key := "foo.bar" + val := 2 + wantErr := true + + handler := PluginsGenericOnly(key, val) + _, err := handler(nil, r1) + if (err != nil) != wantErr { + t.Errorf("PluginsGenericOnly(%q, %v) error = %v, wantErr %v", key, val, err, wantErr) + return + } + }) + + t.Run("test when gets different type", func(t *testing.T) { + key := "foo.bar" + val := "1" + wantErr := true + + handler := PluginsGenericOnly(key, val) + _, err := handler(nil, r1) + if (err != nil) != wantErr { + t.Errorf("PluginsGenericOnly(%q, %v) error = %v, wantErr %v", key, val, err, wantErr) + return + } + }) + + t.Run("test if does not exists", func(t *testing.T) { + key := "foo.bar_not_extist" + val := 1 + wantErr := true + + handler := PluginsGenericOnly(key, val) + _, err := handler(nil, r1) + if (err != nil) != wantErr { + t.Errorf("PluginsGenericOnly(%q, %v) error = %v, wantErr %v", key, val, err, wantErr) + return + } + }) + + t.Run("test if session does not exists", func(t *testing.T) { + key := "foo.bar_not_extist" + val := 1 + wantErr := true + + handler := PluginsGenericOnly(key, val) + _, err := handler(nil, &http.Request{}) + if (err != nil) != wantErr { + t.Errorf("PluginsGenericOnly(%q, %v) error = %v, wantErr %v", key, val, err, wantErr) + return + } + }) +} diff --git a/server/pkg/drop/drop.c b/server/pkg/drop/drop.c new file mode 100644 index 000000000..daae0d165 --- /dev/null +++ b/server/pkg/drop/drop.c @@ -0,0 +1,93 @@ +#include "drop.h" + +GtkWidget *drag_widget = NULL; + +static void dragDataGet( + GtkWidget *widget, + GdkDragContext *context, + GtkSelectionData *data, + guint target_type, + guint time, + gpointer user_data +) { + gchar **uris = (gchar **) user_data; + + if (target_type == DRAG_TARGET_TYPE_URI) { + gtk_selection_data_set_uris(data, uris); + return; + } + + if (target_type == DRAG_TARGET_TYPE_TEXT) { + gtk_selection_data_set_text(data, uris[0], -1); + return; + } +} + +static void dragEnd( + GtkWidget *widget, + GdkDragContext *context, + gpointer user_data +) { + gboolean succeeded = gdk_drag_drop_succeeded(context); + gtk_widget_destroy(widget); + goDragFinish(succeeded); + drag_widget = NULL; +} + +void dragWindowOpen(char **uris) { + if (drag_widget != NULL) dragWindowClose(); + + gtk_init(NULL, NULL); + + GtkWidget *widget = gtk_window_new(GTK_WINDOW_POPUP); + GtkWindow *window = GTK_WINDOW(widget); + + gtk_window_move(window, 0, 0); + gtk_window_set_title(window, "Neko Drag & Drop Window"); + gtk_window_set_decorated(window, FALSE); + gtk_window_set_keep_above(window, TRUE); + gtk_window_set_default_size(window, 100, 100); + + GtkTargetList* target_list = gtk_target_list_new(NULL, 0); + gtk_target_list_add_uri_targets(target_list, DRAG_TARGET_TYPE_URI); + gtk_target_list_add_text_targets(target_list, DRAG_TARGET_TYPE_TEXT); + + gtk_drag_source_set(widget, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_ASK); + gtk_drag_source_set_target_list(widget, target_list); + + g_signal_connect(widget, "map-event", G_CALLBACK(goDragCreate), NULL); + g_signal_connect(widget, "enter-notify-event", G_CALLBACK(goDragCursorEnter), NULL); + g_signal_connect(widget, "button-press-event", G_CALLBACK(goDragButtonPress), NULL); + g_signal_connect(widget, "drag-begin", G_CALLBACK(goDragBegin), NULL); + + g_signal_connect(widget, "drag-data-get", G_CALLBACK(dragDataGet), uris); + g_signal_connect(widget, "drag-end", G_CALLBACK(dragEnd), NULL); + g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); + + gtk_widget_show_all(widget); + drag_widget = widget; + + gtk_main(); +} + +void dragWindowClose() { + gtk_widget_destroy(drag_widget); + drag_widget = NULL; +} + +char **dragUrisMake(int size) { + return calloc(size + 1, sizeof(char *)); +} + +void dragUrisSetFile(char **uris, char *file, int n) { + GFile *gfile = g_file_new_for_path(file); + uris[n] = g_file_get_uri(gfile); +} + +void dragUrisFree(char **uris, int size) { + for (int i = 0; i < size; i++) { + free(uris[i]); + } + + free(uris); +} diff --git a/server/pkg/drop/drop.go b/server/pkg/drop/drop.go new file mode 100644 index 000000000..15ecbeb7c --- /dev/null +++ b/server/pkg/drop/drop.go @@ -0,0 +1,65 @@ +package drop + +/* +#cgo pkg-config: gtk+-3.0 + +#include "drop.h" +*/ +import "C" + +import ( + "sync" + + "github.com/kataras/go-events" +) + +var Emmiter events.EventEmmiter +var mu = sync.Mutex{} + +func init() { + Emmiter = events.New() +} + +func OpenWindow(files []string) { + mu.Lock() + defer mu.Unlock() + + size := C.int(len(files)) + urisUnsafe := C.dragUrisMake(size) + defer C.dragUrisFree(urisUnsafe, size) + + for i, file := range files { + C.dragUrisSetFile(urisUnsafe, C.CString(file), C.int(i)) + } + + C.dragWindowOpen(urisUnsafe) +} + +func CloseWindow() { + C.dragWindowClose() +} + +//export goDragCreate +func goDragCreate(widget *C.GtkWidget, event *C.GdkEvent, user_data C.gpointer) { + go Emmiter.Emit("create") +} + +//export goDragCursorEnter +func goDragCursorEnter(widget *C.GtkWidget, event *C.GdkEvent, user_data C.gpointer) { + go Emmiter.Emit("cursor-enter") +} + +//export goDragButtonPress +func goDragButtonPress(widget *C.GtkWidget, event *C.GdkEvent, user_data C.gpointer) { + go Emmiter.Emit("button-press") +} + +//export goDragBegin +func goDragBegin(widget *C.GtkWidget, context *C.GdkDragContext, user_data C.gpointer) { + go Emmiter.Emit("begin") +} + +//export goDragFinish +func goDragFinish(succeeded C.gboolean) { + go Emmiter.Emit("finish", bool(succeeded == C.int(1))) +} diff --git a/server/pkg/drop/drop.h b/server/pkg/drop/drop.h new file mode 100644 index 000000000..e18c99a2d --- /dev/null +++ b/server/pkg/drop/drop.h @@ -0,0 +1,36 @@ +#pragma once + +#include + +enum { + DRAG_TARGET_TYPE_TEXT, + DRAG_TARGET_TYPE_URI +}; + +extern void goDragCreate(GtkWidget *widget, GdkEvent *event, gpointer user_data); +extern void goDragCursorEnter(GtkWidget *widget, GdkEvent *event, gpointer user_data); +extern void goDragButtonPress(GtkWidget *widget, GdkEvent *event, gpointer user_data); +extern void goDragBegin(GtkWidget *widget, GdkDragContext *context, gpointer user_data); +extern void goDragFinish(gboolean succeeded); + +static void dragDataGet( + GtkWidget *widget, + GdkDragContext *context, + GtkSelectionData *data, + guint target_type, + guint time, + gpointer user_data +); + +static void dragEnd( + GtkWidget *widget, + GdkDragContext *context, + gpointer user_data +); + +void dragWindowOpen(char **uris); +void dragWindowClose(); + +char **dragUrisMake(int size); +void dragUrisSetFile(char **uris, char *file, int n); +void dragUrisFree(char **uris, int size); diff --git a/server/internal/capture/gst/gst.c b/server/pkg/gst/gst.c similarity index 87% rename from server/internal/capture/gst/gst.c rename to server/pkg/gst/gst.c index 6f903234b..f1258a8bd 100644 --- a/server/internal/capture/gst/gst.c +++ b/server/pkg/gst/gst.c @@ -3,10 +3,10 @@ static void gstreamer_pipeline_log(GstPipelineCtx *ctx, char* level, const char* format, ...) { va_list argptr; va_start(argptr, format); - char buffer[4096]; - vsnprintf(buffer, sizeof(buffer), format, argptr); + char buffer[100]; + vsprintf(buffer, format, argptr); va_end(argptr); - goPipelineLog(level, buffer, ctx->pipelineId); + goPipelineLog(ctx->pipelineId, level, buffer); } static gboolean gstreamer_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) { @@ -95,7 +95,10 @@ static GstFlowReturn gstreamer_send_new_sample_handler(GstElement *object, gpoin buffer = gst_sample_get_buffer(sample); if (buffer) { gst_buffer_extract_dup(buffer, 0, gst_buffer_get_size(buffer), ©, ©_size); - goHandlePipelineBuffer(copy, copy_size, GST_BUFFER_DURATION(buffer), ctx->pipelineId); + goHandlePipelineBuffer(ctx->pipelineId, copy, copy_size, + GST_BUFFER_DURATION(buffer), + GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT) + ); } gst_sample_unref(sample); } @@ -148,7 +151,7 @@ void gstreamer_pipeline_destory(GstPipelineCtx *ctx) { void gstreamer_pipeline_push(GstPipelineCtx *ctx, void *buffer, int bufferLen) { if (ctx->appsrc != NULL) { - gpointer p = g_memdup(buffer, bufferLen); + gpointer p = g_memdup2(buffer, bufferLen); GstBuffer *buffer = gst_buffer_new_wrapped(p, bufferLen); gst_app_src_push_buffer(GST_APP_SRC(ctx->appsrc), buffer); } @@ -200,3 +203,15 @@ gboolean gstreamer_pipeline_set_caps_resolution(GstPipelineCtx *ctx, const gchar gst_object_unref(el); return TRUE; } + +gboolean gstreamer_pipeline_emit_video_keyframe(GstPipelineCtx *ctx) { + GstClock *clock = gst_pipeline_get_clock(GST_PIPELINE(ctx->pipeline)); + gst_object_ref(clock); + + GstClockTime time = gst_clock_get_time(clock); + GstClockTime now = time - gst_element_get_base_time(ctx->pipeline); + gst_object_unref(clock); + + GstEvent *keyFrameEvent = gst_video_event_new_downstream_force_key_unit(now, time, now, TRUE, 0); + return gst_element_send_event(GST_ELEMENT(ctx->pipeline), keyFrameEvent); +} diff --git a/server/internal/capture/gst/gst.go b/server/pkg/gst/gst.go similarity index 55% rename from server/internal/capture/gst/gst.go rename to server/pkg/gst/gst.go index 7731d2e7e..29028860e 100644 --- a/server/internal/capture/gst/gst.go +++ b/server/pkg/gst/gst.go @@ -1,7 +1,7 @@ package gst /* -#cgo pkg-config: gstreamer-1.0 gstreamer-app-1.0 +#cgo pkg-config: gstreamer-1.0 gstreamer-app-1.0 gstreamer-video-1.0 #include "gst.h" */ @@ -16,45 +16,49 @@ import ( "github.com/rs/zerolog" "github.com/rs/zerolog/log" - "m1k1o/neko/internal/types" + "m1k1o/neko/pkg/types" ) -type Pipeline struct { - id int - logger zerolog.Logger - Src string - Ctx *C.GstPipelineCtx - Sample chan types.Sample -} - -var pSerial int32 -var pipelines = make(map[int]*Pipeline) -var pipelinesLock sync.Mutex -var registry *C.GstRegistry -var gMainLoop *C.GMainLoop +var ( + pSerial int32 + pipelines = make(map[int]*pipeline) + pipelinesLock sync.Mutex + registry *C.GstRegistry +) func init() { C.gst_init(nil, nil) registry = C.gst_registry_get() } -func RunMainLoop() { - if gMainLoop != nil { - return - } - gMainLoop = C.g_main_loop_new(nil, C.int(0)) - C.g_main_loop_run(gMainLoop) -} - -func QuitMainLoop() { - if gMainLoop == nil { - return - } - C.g_main_loop_quit(gMainLoop) - gMainLoop = nil +type Pipeline interface { + Src() string + Sample() chan types.Sample + // attach sink or src to pipeline + AttachAppsink(sinkName string) + AttachAppsrc(srcName string) + // control pipeline lifecycle + Play() + Pause() + Destroy() + Push(buffer []byte) + // modify the property of a bin + SetPropInt(binName string, prop string, value int) bool + SetCapsFramerate(binName string, numerator, denominator int) bool + SetCapsResolution(binName string, width, height int) bool + // emit video keyframe + EmitVideoKeyframe() bool +} + +type pipeline struct { + id int + logger zerolog.Logger + src string + ctx *C.GstPipelineCtx + sample chan types.Sample } -func CreatePipeline(pipelineStr string) (*Pipeline, error) { +func CreatePipeline(pipelineStr string) (Pipeline, error) { id := atomic.AddInt32(&pSerial, 1) pipelineStrUnsafe := C.CString(pipelineStr) @@ -68,67 +72,73 @@ func CreatePipeline(pipelineStr string) (*Pipeline, error) { if gstError != nil { defer C.g_error_free(gstError) - fmt.Printf("(pipeline error) %s", C.GoString(gstError.message)) return nil, fmt.Errorf("(pipeline error) %s", C.GoString(gstError.message)) } - p := &Pipeline{ + p := &pipeline{ id: int(id), logger: log.With(). Str("module", "capture"). Str("submodule", "gstreamer"). Int("pipeline_id", int(id)).Logger(), - Src: pipelineStr, - Ctx: ctx, + src: pipelineStr, + ctx: ctx, + sample: make(chan types.Sample), } pipelines[p.id] = p return p, nil } -func (p *Pipeline) AttachAppsink(sinkName string, sampleChannel chan types.Sample) { +func (p *pipeline) Src() string { + return p.src +} + +func (p *pipeline) Sample() chan types.Sample { + return p.sample +} + +func (p *pipeline) AttachAppsink(sinkName string) { sinkNameUnsafe := C.CString(sinkName) defer C.free(unsafe.Pointer(sinkNameUnsafe)) - p.Sample = sampleChannel - - C.gstreamer_pipeline_attach_appsink(p.Ctx, sinkNameUnsafe) + C.gstreamer_pipeline_attach_appsink(p.ctx, sinkNameUnsafe) } -func (p *Pipeline) AttachAppsrc(srcName string) { +func (p *pipeline) AttachAppsrc(srcName string) { srcNameUnsafe := C.CString(srcName) defer C.free(unsafe.Pointer(srcNameUnsafe)) - C.gstreamer_pipeline_attach_appsrc(p.Ctx, srcNameUnsafe) + C.gstreamer_pipeline_attach_appsrc(p.ctx, srcNameUnsafe) } -func (p *Pipeline) Play() { - C.gstreamer_pipeline_play(p.Ctx) +func (p *pipeline) Play() { + C.gstreamer_pipeline_play(p.ctx) } -func (p *Pipeline) Pause() { - C.gstreamer_pipeline_pause(p.Ctx) +func (p *pipeline) Pause() { + C.gstreamer_pipeline_pause(p.ctx) } -func (p *Pipeline) Destroy() { - C.gstreamer_pipeline_destory(p.Ctx) +func (p *pipeline) Destroy() { + C.gstreamer_pipeline_destory(p.ctx) pipelinesLock.Lock() delete(pipelines, p.id) pipelinesLock.Unlock() - C.free(unsafe.Pointer(p.Ctx)) - p = nil + close(p.sample) + C.free(unsafe.Pointer(p.ctx)) } -func (p *Pipeline) Push(buffer []byte) { +func (p *pipeline) Push(buffer []byte) { bytes := C.CBytes(buffer) defer C.free(bytes) - C.gstreamer_pipeline_push(p.Ctx, bytes, C.int(len(buffer))) + C.gstreamer_pipeline_push(p.ctx, bytes, C.int(len(buffer))) } -func (p *Pipeline) SetPropInt(binName string, prop string, value int) bool { +func (p *pipeline) SetPropInt(binName string, prop string, value int) bool { cBinName := C.CString(binName) defer C.free(unsafe.Pointer(cBinName)) @@ -139,11 +149,11 @@ func (p *Pipeline) SetPropInt(binName string, prop string, value int) bool { p.logger.Debug().Msgf("setting prop %s of %s to %d", prop, binName, value) - ok := C.gstreamer_pipeline_set_prop_int(p.Ctx, cBinName, cProp, cValue) + ok := C.gstreamer_pipeline_set_prop_int(p.ctx, cBinName, cProp, cValue) return ok == C.TRUE } -func (p *Pipeline) SetCapsFramerate(binName string, numerator, denominator int) bool { +func (p *pipeline) SetCapsFramerate(binName string, numerator, denominator int) bool { cBinName := C.CString(binName) cNumerator := C.int(numerator) cDenominator := C.int(denominator) @@ -152,11 +162,11 @@ func (p *Pipeline) SetCapsFramerate(binName string, numerator, denominator int) p.logger.Debug().Msgf("setting caps framerate of %s to %d/%d", binName, numerator, denominator) - ok := C.gstreamer_pipeline_set_caps_framerate(p.Ctx, cBinName, cNumerator, cDenominator) + ok := C.gstreamer_pipeline_set_caps_framerate(p.ctx, cBinName, cNumerator, cDenominator) return ok == C.TRUE } -func (p *Pipeline) SetCapsResolution(binName string, width, height int) bool { +func (p *pipeline) SetCapsResolution(binName string, width, height int) bool { cBinName := C.CString(binName) cWidth := C.int(width) cHeight := C.int(height) @@ -165,7 +175,12 @@ func (p *Pipeline) SetCapsResolution(binName string, width, height int) bool { p.logger.Debug().Msgf("setting caps resolution of %s to %dx%d", binName, width, height) - ok := C.gstreamer_pipeline_set_caps_resolution(p.Ctx, cBinName, cWidth, cHeight) + ok := C.gstreamer_pipeline_set_caps_resolution(p.ctx, cBinName, cWidth, cHeight) + return ok == C.TRUE +} + +func (p *pipeline) EmitVideoKeyframe() bool { + ok := C.gstreamer_pipeline_emit_video_keyframe(p.ctx) return ok == C.TRUE } @@ -185,18 +200,20 @@ func CheckPlugins(plugins []string) error { } //export goHandlePipelineBuffer -func goHandlePipelineBuffer(buffer unsafe.Pointer, bufferLen C.int, duration C.int, pipelineID C.int) { - defer C.free(buffer) +func goHandlePipelineBuffer(pipelineID C.int, buf C.gpointer, bufLen C.int, duration C.guint64, deltaUnit C.gboolean) { + defer C.g_free(buf) pipelinesLock.Lock() pipeline, ok := pipelines[int(pipelineID)] pipelinesLock.Unlock() if ok { - pipeline.Sample <- types.Sample{ - Data: C.GoBytes(buffer, bufferLen), + pipeline.sample <- types.Sample{ + Data: C.GoBytes(unsafe.Pointer(buf), bufLen), + Length: int(bufLen), Timestamp: time.Now(), Duration: time.Duration(duration), + DeltaUnit: deltaUnit == C.TRUE, } } else { log.Warn(). @@ -208,7 +225,7 @@ func goHandlePipelineBuffer(buffer unsafe.Pointer, bufferLen C.int, duration C.i } //export goPipelineLog -func goPipelineLog(levelUnsafe *C.char, msgUnsafe *C.char, pipelineID C.int) { +func goPipelineLog(pipelineID C.int, levelUnsafe *C.char, msgUnsafe *C.char) { levelStr := C.GoString(levelUnsafe) msg := C.GoString(msgUnsafe) diff --git a/server/internal/capture/gst/gst.h b/server/pkg/gst/gst.h similarity index 59% rename from server/internal/capture/gst/gst.h rename to server/pkg/gst/gst.h index a562ec348..bdbd03472 100644 --- a/server/internal/capture/gst/gst.h +++ b/server/pkg/gst/gst.h @@ -3,6 +3,18 @@ #include #include #include +#include + +#define GLIB_CHECK_VERSION(major,minor,micro) \ + (GLIB_MAJOR_VERSION > (major) || \ + (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION > (minor)) || \ + (GLIB_MAJOR_VERSION == (major) && GLIB_MINOR_VERSION == (minor) && \ + GLIB_MICRO_VERSION >= (micro))) + +// g_memdup2 was added in glib 2.67.4, maintain compatibility with older versions +#if !GLIB_CHECK_VERSION(2, 67, 4) +#define g_memdup2 g_memdup +#endif typedef struct GstPipelineCtx { int pipelineId; @@ -11,8 +23,8 @@ typedef struct GstPipelineCtx { GstElement *appsrc; } GstPipelineCtx; -extern void goHandlePipelineBuffer(void *buffer, int bufferLen, int samples, int pipelineId); -extern void goPipelineLog(char *level, char *msg, int pipelineId); +extern void goHandlePipelineBuffer(int pipelineId, void *buffer, int bufferLen, guint64 duration, gboolean deltaUnit); +extern void goPipelineLog(int pipelineId, char *level, char *msg); GstPipelineCtx *gstreamer_pipeline_create(char *pipelineStr, int pipelineId, GError **error); void gstreamer_pipeline_attach_appsink(GstPipelineCtx *ctx, char *sinkName); @@ -25,3 +37,4 @@ void gstreamer_pipeline_push(GstPipelineCtx *ctx, void *buffer, int bufferLen); gboolean gstreamer_pipeline_set_prop_int(GstPipelineCtx *ctx, char *binName, char *prop, gint value); gboolean gstreamer_pipeline_set_caps_framerate(GstPipelineCtx *ctx, const gchar* binName, gint numerator, gint denominator); gboolean gstreamer_pipeline_set_caps_resolution(GstPipelineCtx *ctx, const gchar* binName, gint width, gint height); +gboolean gstreamer_pipeline_emit_video_keyframe(GstPipelineCtx *ctx); diff --git a/server/pkg/types/api.go b/server/pkg/types/api.go new file mode 100644 index 000000000..d9625bb31 --- /dev/null +++ b/server/pkg/types/api.go @@ -0,0 +1,6 @@ +package types + +type ApiManager interface { + Route(r Router) + AddRouter(path string, router func(Router)) +} diff --git a/server/pkg/types/capture.go b/server/pkg/types/capture.go new file mode 100644 index 000000000..c2f210709 --- /dev/null +++ b/server/pkg/types/capture.go @@ -0,0 +1,246 @@ +package types + +import ( + "context" + "errors" + "fmt" + "math" + "strings" + "time" + + "m1k1o/neko/pkg/types/codec" + + "github.com/PaesslerAG/gval" +) + +var ( + ErrCapturePipelineAlreadyExists = errors.New("capture pipeline already exists") +) + +type Sample struct { + // buffer with encoded media + Data []byte + Length int + // timing information + Timestamp time.Time + Duration time.Duration + // metadata + DeltaUnit bool // this unit cannot be decoded independently. +} + +type SampleListener interface { + WriteSample(Sample) +} + +type BroadcastManager interface { + Start(url string) error + Stop() + Started() bool + Url() string +} + +type ScreencastManager interface { + Enabled() bool + Started() bool + Image() ([]byte, error) +} + +type StreamSelectorType int + +const ( + // select exact stream + StreamSelectorTypeExact StreamSelectorType = iota + // select nearest stream (in either direction) if exact stream is not available + StreamSelectorTypeNearest + // if exact stream is found select the next lower stream, otherwise select the nearest lower stream + StreamSelectorTypeLower + // if exact stream is found select the next higher stream, otherwise select the nearest higher stream + StreamSelectorTypeHigher +) + +func (s StreamSelectorType) String() string { + switch s { + case StreamSelectorTypeExact: + return "exact" + case StreamSelectorTypeNearest: + return "nearest" + case StreamSelectorTypeLower: + return "lower" + case StreamSelectorTypeHigher: + return "higher" + default: + return fmt.Sprintf("%d", int(s)) + } +} + +func (s *StreamSelectorType) UnmarshalText(text []byte) error { + switch strings.ToLower(string(text)) { + case "exact", "": + *s = StreamSelectorTypeExact + case "nearest": + *s = StreamSelectorTypeNearest + case "lower": + *s = StreamSelectorTypeLower + case "higher": + *s = StreamSelectorTypeHigher + default: + return fmt.Errorf("invalid stream selector type: %s", string(text)) + } + return nil +} + +func (s StreamSelectorType) MarshalText() ([]byte, error) { + return []byte(s.String()), nil +} + +type StreamSelector struct { + // type of stream selector + Type StreamSelectorType `json:"type"` + // select stream by its ID + ID string `json:"id"` + // select stream by its bitrate + Bitrate uint64 `json:"bitrate"` +} + +type StreamSelectorManager interface { + IDs() []string + Codec() codec.RTPCodec + + GetStream(selector StreamSelector) (StreamSinkManager, bool) +} + +type StreamSinkManager interface { + ID() string + Codec() codec.RTPCodec + Bitrate() uint64 + + AddListener(listener SampleListener) error + RemoveListener(listener SampleListener) error + MoveListenerTo(listener SampleListener, targetStream StreamSinkManager) error + + ListenersCount() int + Started() bool + + CreatePipeline() error + DestroyPipeline() +} + +type StreamSrcManager interface { + Codec() codec.RTPCodec + + Start(codec codec.RTPCodec) error + Stop() + Push(bytes []byte) + + Started() bool +} + +type CaptureManager interface { + Start() + Shutdown() error + + Broadcast() BroadcastManager + Screencast() ScreencastManager + Audio() StreamSinkManager + Video() StreamSelectorManager + + Webcam() StreamSrcManager + Microphone() StreamSrcManager +} + +type VideoConfig struct { + Width string `mapstructure:"width"` // expression + Height string `mapstructure:"height"` // expression + Fps string `mapstructure:"fps"` // expression + Bitrate int `mapstructure:"bitrate"` // pipeline bitrate + GstPrefix string `mapstructure:"gst_prefix"` // pipeline prefix, starts with ! + GstEncoder string `mapstructure:"gst_encoder"` // gst encoder name + GstParams map[string]string `mapstructure:"gst_params"` // map of expressions + GstSuffix string `mapstructure:"gst_suffix"` // pipeline suffix, starts with ! + GstPipeline string `mapstructure:"gst_pipeline"` // whole pipeline as a string +} + +func (config *VideoConfig) GetPipeline(screen ScreenSize) (string, error) { + values := map[string]any{ + "width": screen.Width, + "height": screen.Height, + "fps": screen.Rate, + } + + language := []gval.Language{ + gval.Function("round", func(args ...any) (any, error) { + return (int)(math.Round(args[0].(float64))), nil + }), + } + + // get fps pipeline + fpsPipeline := "! video/x-raw ! videoconvert ! queue" + if config.Fps != "" { + eval, err := gval.Full(language...).NewEvaluable(config.Fps) + if err != nil { + return "", err + } + + val, err := eval.EvalFloat64(context.Background(), values) + if err != nil { + return "", err + } + + fpsPipeline = fmt.Sprintf("! capsfilter caps=video/x-raw,framerate=%d/100 name=framerate ! videoconvert ! queue", int(val*100)) + } + + // get scale pipeline + scalePipeline := "" + if config.Width != "" && config.Height != "" { + eval, err := gval.Full(language...).NewEvaluable(config.Width) + if err != nil { + return "", err + } + + w, err := eval.EvalInt(context.Background(), values) + if err != nil { + return "", err + } + + eval, err = gval.Full(language...).NewEvaluable(config.Height) + if err != nil { + return "", err + } + + h, err := eval.EvalInt(context.Background(), values) + if err != nil { + return "", err + } + + // element videoscale parameter method to 0 meaning nearest neighbor + scalePipeline = fmt.Sprintf("! videoscale method=0 ! capsfilter caps=video/x-raw,width=%d,height=%d name=resolution ! queue", w, h) + } + + // get encoder pipeline + encPipeline := fmt.Sprintf("! %s name=encoder", config.GstEncoder) + for key, expr := range config.GstParams { + if expr == "" { + continue + } + + val, err := gval.Evaluate(expr, values, language...) + if err != nil { + return "", err + } + + if val != nil { + encPipeline += fmt.Sprintf(" %s=%v", key, val) + } else { + encPipeline += fmt.Sprintf(" %s=%s", key, expr) + } + } + + // join strings with space + return strings.Join([]string{ + fpsPipeline, + scalePipeline, + config.GstPrefix, + encPipeline, + config.GstSuffix, + }[:], " "), nil +} diff --git a/server/internal/types/codec/codecs.go b/server/pkg/types/codec/codecs.go similarity index 66% rename from server/internal/types/codec/codecs.go rename to server/pkg/types/codec/codecs.go index 4c5b8435c..372975a23 100644 --- a/server/internal/types/codec/codecs.go +++ b/server/pkg/types/codec/codecs.go @@ -8,7 +8,7 @@ import ( var RTCPFeedback = []webrtc.RTCPFeedback{ {Type: webrtc.TypeRTCPFBTransportCC, Parameter: ""}, - {Type: webrtc.TypeRTCPFBGoogREMB, Parameter: ""}, + {Type: webrtc.TypeRTCPFBGoogREMB, Parameter: ""}, // TODO: Deprecated. // https://www.iana.org/assignments/sdp-parameters/sdp-parameters.xhtml#sdp-parameters-19 {Type: webrtc.TypeRTCPFBCCM, Parameter: "fir"}, @@ -55,23 +55,28 @@ type RTPCodec struct { PayloadType webrtc.PayloadType Type webrtc.RTPCodecType Capability webrtc.RTPCodecCapability + Pipeline string } -func (codec RTPCodec) Register(engine *webrtc.MediaEngine) error { +func (codec *RTPCodec) Register(engine *webrtc.MediaEngine) error { return engine.RegisterCodec(webrtc.RTPCodecParameters{ RTPCodecCapability: codec.Capability, PayloadType: codec.PayloadType, }, codec.Type) } -func (codec RTPCodec) IsVideo() bool { +func (codec *RTPCodec) IsVideo() bool { return codec.Type == webrtc.RTPCodecTypeVideo } -func (codec RTPCodec) IsAudio() bool { +func (codec *RTPCodec) IsAudio() bool { return codec.Type == webrtc.RTPCodecTypeAudio } +func (codec *RTPCodec) String() string { + return codec.Type.String() + "/" + codec.Name +} + func VP8() RTPCodec { return RTPCodec{ Name: "vp8", @@ -84,6 +89,9 @@ func VP8() RTPCodec { SDPFmtpLine: "", RTCPFeedback: RTCPFeedback, }, + // https://gstreamer.freedesktop.org/documentation/vpx/vp8enc.html + // gstreamer1.0-plugins-good + Pipeline: "vp8enc cpu-used=16 threads=4 deadline=1 error-resilient=partitions keyframe-max-dist=15 static-threshold=20", } } @@ -100,6 +108,9 @@ func VP9() RTPCodec { SDPFmtpLine: "profile-id=0", RTCPFeedback: RTCPFeedback, }, + // https://gstreamer.freedesktop.org/documentation/vpx/vp9enc.html + // gstreamer1.0-plugins-good + Pipeline: "vp9enc cpu-used=16 threads=4 deadline=1 keyframe-max-dist=15 static-threshold=20", } } @@ -116,6 +127,12 @@ func H264() RTPCodec { SDPFmtpLine: "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f", RTCPFeedback: RTCPFeedback, }, + // https://gstreamer.freedesktop.org/documentation/x264/index.html + // gstreamer1.0-plugins-ugly + Pipeline: "video/x-raw,format=I420 ! x264enc threads=4 bitrate=4096 key-int-max=15 byte-stream=true tune=zerolatency speed-preset=veryfast ! video/x-h264,stream-format=byte-stream", + // https://gstreamer.freedesktop.org/documentation/openh264/openh264enc.html + // gstreamer1.0-plugins-bad + //Pipeline: "openh264enc multi-thread=4 complexity=high bitrate=3072000 max-bitrate=4096000 ! video/x-h264,stream-format=byte-stream", } } @@ -132,6 +149,9 @@ func AV1() RTPCodec { SDPFmtpLine: "", RTCPFeedback: RTCPFeedback, }, + // https://gstreamer.freedesktop.org/documentation/av1/av1enc.html + // gstreamer1.0-plugins-bad + Pipeline: "av1enc target-bitrate=4096 cpu-used=4 end-usage=cbr undershoot=95 keyframe-max-dist=15 min-quantizer=4 max-quantizer=20", } } @@ -147,6 +167,9 @@ func Opus() RTPCodec { SDPFmtpLine: "useinbandfec=1;stereo=1", RTCPFeedback: []webrtc.RTCPFeedback{}, }, + // https://gstreamer.freedesktop.org/documentation/opus/opusenc.html + // gstreamer1.0-plugins-base + Pipeline: "opusenc inband-fec=true bitrate=128000", } } @@ -162,6 +185,9 @@ func G722() RTPCodec { SDPFmtpLine: "", RTCPFeedback: []webrtc.RTCPFeedback{}, }, + // https://gstreamer.freedesktop.org/documentation/libav/avenc_g722.html + // gstreamer1.0-libav + Pipeline: "avenc_g722", } } @@ -177,6 +203,9 @@ func PCMU() RTPCodec { SDPFmtpLine: "", RTCPFeedback: []webrtc.RTCPFeedback{}, }, + // https://gstreamer.freedesktop.org/documentation/mulaw/mulawenc.html + // gstreamer1.0-plugins-good + Pipeline: "audio/x-raw, rate=8000 ! mulawenc", } } @@ -192,5 +221,8 @@ func PCMA() RTPCodec { SDPFmtpLine: "", RTCPFeedback: []webrtc.RTCPFeedback{}, }, + // https://gstreamer.freedesktop.org/documentation/alaw/alawenc.html + // gstreamer1.0-plugins-good + Pipeline: "audio/x-raw, rate=8000 ! alawenc", } } diff --git a/server/pkg/types/desktop.go b/server/pkg/types/desktop.go new file mode 100644 index 000000000..0cc4cae96 --- /dev/null +++ b/server/pkg/types/desktop.go @@ -0,0 +1,104 @@ +package types + +import ( + "fmt" + "image" +) + +type CursorImage struct { + Width uint16 + Height uint16 + Xhot uint16 + Yhot uint16 + Serial uint64 + Image *image.RGBA +} + +type ScreenSize struct { + Width int `json:"width"` + Height int `json:"height"` + Rate int16 `json:"rate"` +} + +func (s ScreenSize) String() string { + return fmt.Sprintf("%dx%d@%d", s.Width, s.Height, s.Rate) +} + +type KeyboardModifiers struct { + Shift *bool `json:"shift"` + CapsLock *bool `json:"capslock"` + Control *bool `json:"control"` + Alt *bool `json:"alt"` + NumLock *bool `json:"numlock"` + Meta *bool `json:"meta"` + Super *bool `json:"super"` + AltGr *bool `json:"altgr"` +} + +type KeyboardMap struct { + Layout string `json:"layout"` + Variant string `json:"variant"` +} + +type ClipboardText struct { + Text string + HTML string +} + +type DesktopManager interface { + Start() + Shutdown() error + OnBeforeScreenSizeChange(listener func()) + OnAfterScreenSizeChange(listener func()) + + // xorg + Move(x, y int) + GetCursorPosition() (int, int) + Scroll(deltaX, deltaY int, controlKey bool) + ButtonDown(code uint32) error + KeyDown(code uint32) error + ButtonUp(code uint32) error + KeyUp(code uint32) error + ButtonPress(code uint32) error + KeyPress(codes ...uint32) error + ResetKeys() + ScreenConfigurations() []ScreenSize + SetScreenSize(ScreenSize) (ScreenSize, error) + GetScreenSize() ScreenSize + SetKeyboardMap(KeyboardMap) error + GetKeyboardMap() (*KeyboardMap, error) + SetKeyboardModifiers(mod KeyboardModifiers) + GetKeyboardModifiers() KeyboardModifiers + GetCursorImage() *CursorImage + GetScreenshotImage() *image.RGBA + + // xevent + OnCursorChanged(listener func(serial uint64)) + OnClipboardUpdated(listener func()) + OnFileChooserDialogOpened(listener func()) + OnFileChooserDialogClosed(listener func()) + OnEventError(listener func(error_code uint8, message string, request_code uint8, minor_code uint8)) + + // input driver + HasTouchSupport() bool + TouchBegin(touchId uint32, x, y int, pressure uint8) error + TouchUpdate(touchId uint32, x, y int, pressure uint8) error + TouchEnd(touchId uint32, x, y int, pressure uint8) error + + // clipboard + ClipboardGetText() (*ClipboardText, error) + ClipboardSetText(data ClipboardText) error + ClipboardGetBinary(mime string) ([]byte, error) + ClipboardSetBinary(mime string, data []byte) error + ClipboardGetTargets() ([]string, error) + + // drop + DropFiles(x int, y int, files []string) bool + IsUploadDropEnabled() bool + + // filechooser + HandleFileChooserDialog(uri string) error + CloseFileChooserDialog() + IsFileChooserDialogEnabled() bool + IsFileChooserDialogOpened() bool +} diff --git a/server/pkg/types/event/events.go b/server/pkg/types/event/events.go new file mode 100644 index 000000000..0259d4d79 --- /dev/null +++ b/server/pkg/types/event/events.go @@ -0,0 +1,84 @@ +package event + +const ( + SYSTEM_INIT = "system/init" + SYSTEM_ADMIN = "system/admin" + SYSTEM_SETTINGS = "system/settings" + SYSTEM_LOGS = "system/logs" + SYSTEM_DISCONNECT = "system/disconnect" + SYSTEM_HEARTBEAT = "system/heartbeat" +) + +const ( + SIGNAL_REQUEST = "signal/request" + SIGNAL_RESTART = "signal/restart" + SIGNAL_OFFER = "signal/offer" + SIGNAL_ANSWER = "signal/answer" + SIGNAL_PROVIDE = "signal/provide" + SIGNAL_CANDIDATE = "signal/candidate" + SIGNAL_VIDEO = "signal/video" + SIGNAL_AUDIO = "signal/audio" + SIGNAL_CLOSE = "signal/close" +) + +const ( + SESSION_CREATED = "session/created" + SESSION_DELETED = "session/deleted" + SESSION_PROFILE = "session/profile" + SESSION_STATE = "session/state" + SESSION_CURSORS = "session/cursors" +) + +const ( + CONTROL_HOST = "control/host" + CONTROL_RELEASE = "control/release" + CONTROL_REQUEST = "control/request" + // mouse + CONTROL_MOVE = "control/move" + CONTROL_SCROLL = "control/scroll" + CONTROL_BUTTONPRESS = "control/buttonpress" + CONTROL_BUTTONDOWN = "control/buttondown" + CONTROL_BUTTONUP = "control/buttonup" + // keyboard + CONTROL_KEYPRESS = "control/keypress" + CONTROL_KEYDOWN = "control/keydown" + CONTROL_KEYUP = "control/keyup" + // touch + CONTROL_TOUCHBEGIN = "control/touchbegin" + CONTROL_TOUCHUPDATE = "control/touchupdate" + CONTROL_TOUCHEND = "control/touchend" + // actions + CONTROL_CUT = "control/cut" + CONTROL_COPY = "control/copy" + CONTROL_PASTE = "control/paste" + CONTROL_SELECT_ALL = "control/select_all" +) + +const ( + SCREEN_UPDATED = "screen/updated" + SCREEN_SET = "screen/set" +) + +const ( + CLIPBOARD_UPDATED = "clipboard/updated" + CLIPBOARD_SET = "clipboard/set" +) + +const ( + KEYBOARD_MODIFIERS = "keyboard/modifiers" + KEYBOARD_MAP = "keyboard/map" +) + +const ( + BROADCAST_STATUS = "broadcast/status" +) + +const ( + SEND_UNICAST = "send/unicast" + SEND_BROADCAST = "send/broadcast" +) + +const ( + FILE_CHOOSER_DIALOG_OPENED = "file_chooser_dialog/opened" + FILE_CHOOSER_DIALOG_CLOSED = "file_chooser_dialog/closed" +) diff --git a/server/pkg/types/http.go b/server/pkg/types/http.go new file mode 100644 index 000000000..0eced4581 --- /dev/null +++ b/server/pkg/types/http.go @@ -0,0 +1,27 @@ +package types + +import ( + "context" + "net/http" +) + +type RouterHandler func(w http.ResponseWriter, r *http.Request) error +type MiddlewareHandler func(w http.ResponseWriter, r *http.Request) (context.Context, error) + +type Router interface { + Group(fn func(Router)) + Route(pattern string, fn func(Router)) + Get(pattern string, fn RouterHandler) + Post(pattern string, fn RouterHandler) + Put(pattern string, fn RouterHandler) + Patch(pattern string, fn RouterHandler) + Delete(pattern string, fn RouterHandler) + With(fn MiddlewareHandler) Router + Use(fn MiddlewareHandler) + ServeHTTP(w http.ResponseWriter, req *http.Request) +} + +type HttpManager interface { + Start() + Shutdown() error +} diff --git a/server/pkg/types/member.go b/server/pkg/types/member.go new file mode 100644 index 000000000..e3558060d --- /dev/null +++ b/server/pkg/types/member.go @@ -0,0 +1,48 @@ +package types + +import "errors" + +var ( + ErrMemberAlreadyExists = errors.New("member already exists") + ErrMemberDoesNotExist = errors.New("member does not exist") + ErrMemberInvalidPassword = errors.New("invalid password") +) + +type MemberProfile struct { + Name string `json:"name"` + + // permissions + IsAdmin bool `json:"is_admin" mapstructure:"is_admin"` + CanLogin bool `json:"can_login" mapstructure:"can_login"` + CanConnect bool `json:"can_connect" mapstructure:"can_connect"` + CanWatch bool `json:"can_watch" mapstructure:"can_watch"` + CanHost bool `json:"can_host" mapstructure:"can_host"` + CanShareMedia bool `json:"can_share_media" mapstructure:"can_share_media"` + CanAccessClipboard bool `json:"can_access_clipboard" mapstructure:"can_access_clipboard"` + SendsInactiveCursor bool `json:"sends_inactive_cursor" mapstructure:"sends_inactive_cursor"` + CanSeeInactiveCursors bool `json:"can_see_inactive_cursors" mapstructure:"can_see_inactive_cursors"` + + // plugin scope + Plugins PluginSettings `json:"plugins"` +} + +type MemberProvider interface { + Connect() error + Disconnect() error + + Authenticate(username string, password string) (id string, profile MemberProfile, err error) + + Insert(username string, password string, profile MemberProfile) (id string, err error) + Select(id string) (profile MemberProfile, err error) + SelectAll(limit int, offset int) (profiles map[string]MemberProfile, err error) + UpdateProfile(id string, profile MemberProfile) error + UpdatePassword(id string, password string) error + Delete(id string) error +} + +type MemberManager interface { + MemberProvider + + Login(username string, password string) (Session, string, error) + Logout(id string) error +} diff --git a/server/pkg/types/message/messages.go b/server/pkg/types/message/messages.go new file mode 100644 index 000000000..af08e072a --- /dev/null +++ b/server/pkg/types/message/messages.go @@ -0,0 +1,212 @@ +package message + +import ( + "github.com/pion/webrtc/v3" + + "m1k1o/neko/pkg/types" +) + +///////////////////////////// +// System +///////////////////////////// + +type SystemWebRTC struct { + Videos []string `json:"videos"` +} + +type SystemInit struct { + SessionId string `json:"session_id"` + ControlHost ControlHost `json:"control_host"` + ScreenSize types.ScreenSize `json:"screen_size"` + Sessions map[string]SessionData `json:"sessions"` + Settings types.Settings `json:"settings"` + TouchEvents bool `json:"touch_events"` + ScreencastEnabled bool `json:"screencast_enabled"` + WebRTC SystemWebRTC `json:"webrtc"` +} + +type SystemAdmin struct { + ScreenSizesList []types.ScreenSize `json:"screen_sizes_list"` + BroadcastStatus BroadcastStatus `json:"broadcast_status"` +} + +type SystemLogs = []SystemLog + +type SystemLog struct { + Level string `json:"level"` + Fields map[string]any `json:"fields"` + Message string `json:"message"` +} + +type SystemDisconnect struct { + Message string `json:"message"` +} + +type SystemSettingsUpdate struct { + ID string `json:"id"` + types.Settings +} + +///////////////////////////// +// Signal +///////////////////////////// + +type SignalRequest struct { + Video types.PeerVideoRequest `json:"video"` + Audio types.PeerAudioRequest `json:"audio"` + + Auto bool `json:"auto"` // TODO: Remove this +} + +type SignalProvide struct { + SDP string `json:"sdp"` + ICEServers []types.ICEServer `json:"iceservers"` + + Video types.PeerVideo `json:"video"` + Audio types.PeerAudio `json:"audio"` +} + +type SignalCandidate struct { + webrtc.ICECandidateInit +} + +type SignalDescription struct { + SDP string `json:"sdp"` +} + +type SignalVideo struct { + types.PeerVideoRequest +} + +type SignalAudio struct { + types.PeerAudioRequest +} + +///////////////////////////// +// Session +///////////////////////////// + +type SessionID struct { + ID string `json:"id"` +} + +type MemberProfile struct { + ID string `json:"id"` + types.MemberProfile +} + +type SessionState struct { + ID string `json:"id"` + types.SessionState +} + +type SessionData struct { + ID string `json:"id"` + Profile types.MemberProfile `json:"profile"` + State types.SessionState `json:"state"` +} + +type SessionCursors struct { + ID string `json:"id"` + Cursors []types.Cursor `json:"cursors"` +} + +///////////////////////////// +// Control +///////////////////////////// + +type ControlHost struct { + ID string `json:"id"` + HasHost bool `json:"has_host"` + HostID string `json:"host_id,omitempty"` +} + +type ControlScroll struct { + // TOOD: remove this once the client is fixed + X int `json:"x"` + Y int `json:"y"` + + DeltaX int `json:"delta_x"` + DeltaY int `json:"delta_y"` + ControlKey bool `json:"control_key"` +} + +type ControlPos struct { + X int `json:"x"` + Y int `json:"y"` +} + +type ControlButton struct { + *ControlPos + Code uint32 `json:"code"` +} + +type ControlKey struct { + *ControlPos + Keysym uint32 `json:"keysym"` +} + +type ControlTouch struct { + TouchId uint32 `json:"touch_id"` + *ControlPos + Pressure uint8 `json:"pressure"` +} + +///////////////////////////// +// Screen +///////////////////////////// + +type ScreenSize struct { + types.ScreenSize +} + +type ScreenSizeUpdate struct { + ID string `json:"id"` + types.ScreenSize +} + +///////////////////////////// +// Clipboard +///////////////////////////// + +type ClipboardData struct { + Text string `json:"text"` +} + +///////////////////////////// +// Keyboard +///////////////////////////// + +type KeyboardMap struct { + types.KeyboardMap +} + +type KeyboardModifiers struct { + types.KeyboardModifiers +} + +///////////////////////////// +// Broadcast +///////////////////////////// + +type BroadcastStatus struct { + IsActive bool `json:"is_active"` + URL string `json:"url,omitempty"` +} + +///////////////////////////// +// Send (opaque comunication channel) +///////////////////////////// + +type SendUnicast struct { + Sender string `json:"sender"` + Receiver string `json:"receiver"` + Subject string `json:"subject"` + Body any `json:"body"` +} + +type SendBroadcast struct { + Sender string `json:"sender"` + Subject string `json:"subject"` + Body any `json:"body"` +} diff --git a/server/pkg/types/plugins.go b/server/pkg/types/plugins.go new file mode 100644 index 000000000..a5833045b --- /dev/null +++ b/server/pkg/types/plugins.go @@ -0,0 +1,94 @@ +package types + +import ( + "errors" + "fmt" + "strings" + + "m1k1o/neko/pkg/utils" + + "github.com/spf13/cobra" +) + +var ( + ErrPluginSettingsNotFound = errors.New("plugin settings not found") +) + +type Plugin interface { + Name() string + Config() PluginConfig + Start(PluginManagers) error + Shutdown() error +} + +type DependablePlugin interface { + Plugin + DependsOn() []string +} + +type ExposablePlugin interface { + Plugin + ExposeService() any +} + +type PluginConfig interface { + Init(cmd *cobra.Command) error + Set() +} + +type PluginMetadata struct { + Name string + IsDependable bool + IsExposable bool + DependsOn []string `json:",omitempty"` +} + +type PluginManagers struct { + SessionManager SessionManager + WebSocketManager WebSocketManager + ApiManager ApiManager + LoadServiceFromPlugin func(string) (any, error) +} + +func (p *PluginManagers) Validate() error { + if p.SessionManager == nil { + return errors.New("SessionManager is nil") + } + + if p.WebSocketManager == nil { + return errors.New("WebSocketManager is nil") + } + + if p.ApiManager == nil { + return errors.New("ApiManager is nil") + } + + if p.LoadServiceFromPlugin == nil { + return errors.New("LoadServiceFromPlugin is nil") + } + + return nil +} + +type PluginSettings map[string]any + +func (p PluginSettings) Unmarshal(name string, def any) error { + if p == nil { + return fmt.Errorf("%w: %s", ErrPluginSettingsNotFound, name) + } + + // loop through the plugin settings and take only the one that starts with the name + // because the settings are stored in a map["plugin_name.setting_name"] = value + newMap := make(map[string]any) + for k, v := range p { + if strings.HasPrefix(k, name+".") { + newMap[strings.TrimPrefix(k, name+".")] = v + } + } + + if len(newMap) == 0 { + return fmt.Errorf("%w: %s", ErrPluginSettingsNotFound, name) + } + + return utils.Decode(newMap, def) +} diff --git a/server/pkg/types/session.go b/server/pkg/types/session.go new file mode 100644 index 000000000..e03ef2358 --- /dev/null +++ b/server/pkg/types/session.go @@ -0,0 +1,116 @@ +package types + +import ( + "errors" + "net/http" + "time" +) + +var ( + ErrSessionNotFound = errors.New("session not found") + ErrSessionAlreadyExists = errors.New("session already exists") + ErrSessionAlreadyConnected = errors.New("session is already connected") + ErrSessionLoginDisabled = errors.New("session login disabled") + ErrSessionLoginsLocked = errors.New("session logins locked") +) + +type Cursor struct { + X int `json:"x"` + Y int `json:"y"` +} + +type SessionProfile struct { + Id string + Token string + Profile MemberProfile +} + +type SessionState struct { + IsConnected bool `json:"is_connected"` + // when the session was last connected + ConnectedSince *time.Time `json:"connected_since,omitempty"` + // when the session was last not connected + NotConnectedSince *time.Time `json:"not_connected_since,omitempty"` + + IsWatching bool `json:"is_watching"` + // when the session was last watching + WatchingSince *time.Time `json:"watching_since,omitempty"` + // when the session was last not watching + NotWatchingSince *time.Time `json:"not_watching_since,omitempty"` +} + +type Settings struct { + PrivateMode bool `json:"private_mode"` + LockedLogins bool `json:"locked_logins"` + LockedControls bool `json:"locked_controls"` + ControlProtection bool `json:"control_protection"` + ImplicitHosting bool `json:"implicit_hosting"` + InactiveCursors bool `json:"inactive_cursors"` + MercifulReconnect bool `json:"merciful_reconnect"` + + // plugin scope + Plugins PluginSettings `json:"plugins"` +} + +type Session interface { + ID() string + Profile() MemberProfile + State() SessionState + IsHost() bool + LegacyIsHost() bool + SetAsHost() + SetAsHostBy(session Session) + ClearHost() + PrivateModeEnabled() bool + + // cursor + SetCursor(cursor Cursor) + + // websocket + ConnectWebSocketPeer(websocketPeer WebSocketPeer) + DisconnectWebSocketPeer(websocketPeer WebSocketPeer, delayed bool) + DestroyWebSocketPeer(reason string) + Send(event string, payload any) + + // webrtc + SetWebRTCPeer(webrtcPeer WebRTCPeer) + SetWebRTCConnected(webrtcPeer WebRTCPeer, connected bool) + GetWebRTCPeer() WebRTCPeer +} + +type SessionManager interface { + Create(id string, profile MemberProfile) (Session, string, error) + Update(id string, profile MemberProfile) error + Delete(id string) error + Disconnect(id string) error + Get(id string) (Session, bool) + GetByToken(token string) (Session, bool) + List() []Session + Range(func(Session) bool) + + GetHost() (Session, bool) + + SetCursor(cursor Cursor, session Session) + PopCursors() map[Session][]Cursor + + Broadcast(event string, payload any, exclude ...string) + AdminBroadcast(event string, payload any, exclude ...string) + InactiveCursorsBroadcast(event string, payload any, exclude ...string) + + OnCreated(listener func(session Session)) + OnDeleted(listener func(session Session)) + OnConnected(listener func(session Session)) + OnDisconnected(listener func(session Session)) + OnProfileChanged(listener func(session Session, new, old MemberProfile)) + OnStateChanged(listener func(session Session)) + OnHostChanged(listener func(session, host Session)) + OnSettingsChanged(listener func(session Session, new, old Settings)) + + UpdateSettingsFunc(session Session, f func(settings *Settings) bool) + Settings() Settings + CookieEnabled() bool + + CookieSetToken(w http.ResponseWriter, token string) + CookieClearToken(w http.ResponseWriter, r *http.Request) + Authenticate(r *http.Request) (Session, error) +} diff --git a/server/pkg/types/webrtc.go b/server/pkg/types/webrtc.go new file mode 100644 index 000000000..5469a3b13 --- /dev/null +++ b/server/pkg/types/webrtc.go @@ -0,0 +1,70 @@ +package types + +import ( + "errors" + + "github.com/pion/webrtc/v3" +) + +var ( + ErrWebRTCDataChannelNotFound = errors.New("webrtc data channel not found") + ErrWebRTCConnectionNotFound = errors.New("webrtc connection not found") + ErrWebRTCStreamNotFound = errors.New("webrtc stream not found") +) + +type ICEServer struct { + URLs []string `mapstructure:"urls" json:"urls"` + Username string `mapstructure:"username" json:"username,omitempty"` + Credential string `mapstructure:"credential" json:"credential,omitempty"` +} + +type PeerVideo struct { + Disabled bool `json:"disabled"` + ID string `json:"id"` + Video string `json:"video"` // TODO: Remove this, used for compatibility with old clients. + Auto bool `json:"auto"` +} + +type PeerVideoRequest struct { + Disabled *bool `json:"disabled,omitempty"` + Selector *StreamSelector `json:"selector,omitempty"` + Auto *bool `json:"auto,omitempty"` +} + +type PeerAudio struct { + Disabled bool `json:"disabled"` +} + +type PeerAudioRequest struct { + Disabled *bool `json:"disabled,omitempty"` +} + +type WebRTCPeer interface { + CreateOffer(ICERestart bool) (*webrtc.SessionDescription, error) + CreateAnswer() (*webrtc.SessionDescription, error) + SetRemoteDescription(webrtc.SessionDescription) error + SetCandidate(webrtc.ICECandidateInit) error + + SetPaused(isPaused bool) error + Paused() bool + + SetVideo(PeerVideoRequest) error + Video() PeerVideo + SetAudio(PeerAudioRequest) error + Audio() PeerAudio + + SendCursorPosition(x, y int) error + SendCursorImage(cur *CursorImage, img []byte) error + + Destroy() +} + +type WebRTCManager interface { + Start() + Shutdown() error + + ICEServers() []ICEServer + + CreatePeer(session Session) (*webrtc.SessionDescription, WebRTCPeer, error) + SetCursorPosition(x, y int) +} diff --git a/server/pkg/types/websocket.go b/server/pkg/types/websocket.go new file mode 100644 index 000000000..a99dc3446 --- /dev/null +++ b/server/pkg/types/websocket.go @@ -0,0 +1,28 @@ +package types + +import ( + "encoding/json" + "net/http" +) + +type WebSocketMessage struct { + Event string `json:"event"` + Payload json.RawMessage `json:"payload,omitempty"` +} + +type WebSocketHandler func(Session, WebSocketMessage) bool + +type CheckOrigin func(r *http.Request) bool + +type WebSocketPeer interface { + Send(event string, payload any) + Ping() error + Destroy(reason string) +} + +type WebSocketManager interface { + Start() + Shutdown() error + AddHandler(handler WebSocketHandler) + Upgrade(checkOrigin CheckOrigin) RouterHandler +} diff --git a/server/internal/utils/array.go b/server/pkg/utils/array.go similarity index 54% rename from server/internal/utils/array.go rename to server/pkg/utils/array.go index 3f6901c7a..a84853bef 100644 --- a/server/internal/utils/array.go +++ b/server/pkg/utils/array.go @@ -1,12 +1,11 @@ package utils func ArrayIn[T comparable](val T, array []T) (exists bool, index int) { - index = -1 + exists, index = false, -1 - for i, v := range array { - if v == val { - index = i - exists = true + for i, a := range array { + if a == val { + exists, index = true, i return } } diff --git a/server/internal/utils/color.go b/server/pkg/utils/color.go similarity index 92% rename from server/internal/utils/color.go rename to server/pkg/utils/color.go index 919887c28..09f0981d1 100644 --- a/server/internal/utils/color.go +++ b/server/pkg/utils/color.go @@ -29,6 +29,6 @@ func Color(str string) string { return result + str[lastIndex:] } -func Colorf(format string, a ...interface{}) string { +func Colorf(format string, a ...any) string { return fmt.Sprintf(Color(format), a...) } diff --git a/server/pkg/utils/deocde.go b/server/pkg/utils/deocde.go new file mode 100644 index 000000000..12aeaec7f --- /dev/null +++ b/server/pkg/utils/deocde.go @@ -0,0 +1,35 @@ +package utils + +import ( + "encoding/json" + "reflect" + + "github.com/mitchellh/mapstructure" +) + +func Decode(input interface{}, output interface{}) error { + return mapstructure.Decode(input, output) +} + +func Unmarshal(in any, raw []byte, callback func() error) error { + if err := json.Unmarshal(raw, &in); err != nil { + return err + } + return callback() +} + +func JsonStringAutoDecode(m any) func(rf reflect.Kind, rt reflect.Kind, data any) (any, error) { + return func(rf reflect.Kind, rt reflect.Kind, data any) (any, error) { + if rf != reflect.String || rt == reflect.String { + return data, nil + } + + raw := data.(string) + if raw != "" && (raw[0:1] == "{" || raw[0:1] == "[") { + err := json.Unmarshal([]byte(raw), &m) + return m, err + } + + return data, nil + } +} diff --git a/server/pkg/utils/http.go b/server/pkg/utils/http.go new file mode 100644 index 000000000..e95cf6b4f --- /dev/null +++ b/server/pkg/utils/http.go @@ -0,0 +1,133 @@ +package utils + +import ( + "encoding/json" + "fmt" + "io" + "net/http" + + "github.com/rs/zerolog/log" +) + +func HttpJsonRequest(w http.ResponseWriter, r *http.Request, res any) error { + err := json.NewDecoder(r.Body).Decode(res) + + if err == nil { + return nil + } + + if err == io.EOF { + return HttpBadRequest("no data provided").WithInternalErr(err) + } + + return HttpBadRequest("unable to parse provided data").WithInternalErr(err) +} + +func HttpJsonResponse(w http.ResponseWriter, code int, res any) { + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(code) + + if err := json.NewEncoder(w).Encode(res); err != nil { + log.Err(err).Str("module", "http").Msg("sending http json response failed") + } +} + +func HttpSuccess(w http.ResponseWriter, res ...any) error { + if len(res) == 0 { + w.WriteHeader(http.StatusNoContent) + } else { + HttpJsonResponse(w, http.StatusOK, res[0]) + } + + return nil +} + +// HTTPError is an error with a message and an HTTP status code. +type HTTPError struct { + Code int `json:"code"` + Message string `json:"message"` + + InternalErr error `json:"-"` + InternalMsg string `json:"-"` +} + +func (e *HTTPError) Error() string { + if e.InternalMsg != "" { + return e.InternalMsg + } + return fmt.Sprintf("%d: %s", e.Code, e.Message) +} + +func (e *HTTPError) Cause() error { + if e.InternalErr != nil { + return e.InternalErr + } + return e +} + +// WithInternalErr adds internal error information to the error +func (e *HTTPError) WithInternalErr(err error) *HTTPError { + e.InternalErr = err + return e +} + +// WithInternalMsg adds internal message information to the error +func (e *HTTPError) WithInternalMsg(msg string) *HTTPError { + e.InternalMsg = msg + return e +} + +// WithInternalMsg adds internal formated message information to the error +func (e *HTTPError) WithInternalMsgf(fmtStr string, args ...any) *HTTPError { + e.InternalMsg = fmt.Sprintf(fmtStr, args...) + return e +} + +// Sends error with custom formated message +func (e *HTTPError) Msgf(fmtSt string, args ...any) *HTTPError { + e.Message = fmt.Sprintf(fmtSt, args...) + return e +} + +// Sends error with custom message +func (e *HTTPError) Msg(str string) *HTTPError { + e.Message = str + return e +} + +func HttpError(code int, res ...string) *HTTPError { + err := &HTTPError{ + Code: code, + Message: http.StatusText(code), + } + + if len(res) == 1 { + err.Message = res[0] + } + + return err +} + +func HttpBadRequest(res ...string) *HTTPError { + return HttpError(http.StatusBadRequest, res...) +} + +func HttpUnauthorized(res ...string) *HTTPError { + return HttpError(http.StatusUnauthorized, res...) +} + +func HttpForbidden(res ...string) *HTTPError { + return HttpError(http.StatusForbidden, res...) +} + +func HttpNotFound(res ...string) *HTTPError { + return HttpError(http.StatusNotFound, res...) +} + +func HttpUnprocessableEntity(res ...string) *HTTPError { + return HttpError(http.StatusUnprocessableEntity, res...) +} + +func HttpInternalServerError(res ...string) *HTTPError { + return HttpError(http.StatusInternalServerError, res...) +} diff --git a/server/pkg/utils/image.go b/server/pkg/utils/image.go new file mode 100644 index 000000000..b621fb4ba --- /dev/null +++ b/server/pkg/utils/image.go @@ -0,0 +1,39 @@ +package utils + +import ( + "bytes" + "encoding/base64" + "image" + "image/jpeg" + "image/png" +) + +func CreatePNGImage(img *image.RGBA) ([]byte, error) { + out := new(bytes.Buffer) + err := png.Encode(out, img) + if err != nil { + return nil, err + } + + return out.Bytes(), nil +} + +func CreateJPGImage(img *image.RGBA, quality int) ([]byte, error) { + out := new(bytes.Buffer) + err := jpeg.Encode(out, img, &jpeg.Options{Quality: quality}) + if err != nil { + return nil, err + } + + return out.Bytes(), nil +} + +func CreatePNGImageURI(img *image.RGBA) (string, error) { + data, err := CreatePNGImage(img) + if err != nil { + return "", err + } + + uri := "data:image/png;base64," + base64.StdEncoding.EncodeToString(data) + return uri, nil +} diff --git a/server/pkg/utils/request.go b/server/pkg/utils/request.go new file mode 100644 index 000000000..7f860452e --- /dev/null +++ b/server/pkg/utils/request.go @@ -0,0 +1,22 @@ +package utils + +import ( + "bytes" + "io" + "net/http" +) + +func HttpRequestGET(url string) (string, error) { + rsp, err := http.Get(url) + if err != nil { + return "", err + } + defer rsp.Body.Close() + + buf, err := io.ReadAll(rsp.Body) + if err != nil { + return "", err + } + + return string(bytes.TrimSpace(buf)), nil +} diff --git a/server/pkg/utils/trenddetector.go b/server/pkg/utils/trenddetector.go new file mode 100644 index 000000000..a07f68be6 --- /dev/null +++ b/server/pkg/utils/trenddetector.go @@ -0,0 +1,153 @@ +// From https://github.com/livekit/livekit/blob/master/pkg/sfu/streamallocator/trenddetector.go +package utils + +import ( + "fmt" + "time" +) + +// ------------------------------------------------ + +type TrendDirection int + +const ( + TrendDirectionNeutral TrendDirection = iota + TrendDirectionUpward + TrendDirectionDownward +) + +func (t TrendDirection) String() string { + switch t { + case TrendDirectionNeutral: + return "NEUTRAL" + case TrendDirectionUpward: + return "UPWARD" + case TrendDirectionDownward: + return "DOWNWARD" + default: + return fmt.Sprintf("%d", int(t)) + } +} + +// ------------------------------------------------ + +type TrendDetectorParams struct { + RequiredSamples int + DownwardTrendThreshold float64 + CollapseValues bool +} + +type TrendDetector struct { + params TrendDetectorParams + + startTime time.Time + numSamples int + values []int64 + lowestValue int64 + highestValue int64 + + direction TrendDirection +} + +func NewTrendDetector(params TrendDetectorParams) *TrendDetector { + return &TrendDetector{ + params: params, + startTime: time.Now(), + direction: TrendDirectionNeutral, + } +} + +func (t *TrendDetector) Seed(value int64) { + if len(t.values) != 0 { + return + } + + t.values = append(t.values, value) +} + +func (t *TrendDetector) AddValue(value int64) { + t.numSamples++ + if t.lowestValue == 0 || value < t.lowestValue { + t.lowestValue = value + } + if value > t.highestValue { + t.highestValue = value + } + + // ignore duplicate values + if t.params.CollapseValues && len(t.values) != 0 && t.values[len(t.values)-1] == value { + return + } + + if len(t.values) == t.params.RequiredSamples { + t.values = t.values[1:] + } + t.values = append(t.values, value) + + t.updateDirection() +} + +func (t *TrendDetector) GetLowest() int64 { + return t.lowestValue +} + +func (t *TrendDetector) GetHighest() int64 { + return t.highestValue +} + +func (t *TrendDetector) GetValues() []int64 { + return t.values +} + +func (t *TrendDetector) GetDirection() TrendDirection { + return t.direction +} + +func (t *TrendDetector) ToString() string { + now := time.Now() + elapsed := now.Sub(t.startTime).Seconds() + str := fmt.Sprintf("t: %+v|%+v|%.2fs", t.startTime.Format(time.UnixDate), now.Format(time.UnixDate), elapsed) + str += fmt.Sprintf(", v: %d|%d|%d|%+v|%.2f", t.numSamples, t.lowestValue, t.highestValue, t.values, kendallsTau(t.values)) + return str +} + +func (t *TrendDetector) updateDirection() { + if len(t.values) < t.params.RequiredSamples { + t.direction = TrendDirectionNeutral + return + } + + // using Kendall's Tau to find trend + kt := kendallsTau(t.values) + + t.direction = TrendDirectionNeutral + switch { + case kt > 0: + t.direction = TrendDirectionUpward + case kt < t.params.DownwardTrendThreshold: + t.direction = TrendDirectionDownward + } +} + +// ------------------------------------------------ + +func kendallsTau(values []int64) float64 { + concordantPairs := 0 + discordantPairs := 0 + + for i := 0; i < len(values)-1; i++ { + for j := i + 1; j < len(values); j++ { + if values[i] < values[j] { + concordantPairs++ + } else if values[i] > values[j] { + discordantPairs++ + } + } + } + + if (concordantPairs + discordantPairs) == 0 { + return 0.0 + } + + return (float64(concordantPairs) - float64(discordantPairs)) / (float64(concordantPairs) + float64(discordantPairs)) +} diff --git a/server/internal/utils/uid.go b/server/pkg/utils/uid.go similarity index 100% rename from server/internal/utils/uid.go rename to server/pkg/utils/uid.go diff --git a/server/pkg/utils/zip.go b/server/pkg/utils/zip.go new file mode 100644 index 000000000..0818398f8 --- /dev/null +++ b/server/pkg/utils/zip.go @@ -0,0 +1,114 @@ +package utils + +import ( + "archive/zip" + "io" + "os" + "path/filepath" + "strings" +) + +func Zip(source, zipPath string) error { + archiveFile, err := os.Create(zipPath) + if err != nil { + return err + } + defer archiveFile.Close() + + archive := zip.NewWriter(archiveFile) + defer archive.Close() + + return filepath.Walk(source, func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + if !info.IsDir() && !info.Mode().IsRegular() { + return nil + } + + header, err := zip.FileInfoHeader(info) + if err != nil { + return err + } + + header.Name = strings.TrimPrefix(path, source) + + if info.IsDir() { + header.Name += "/" + } else { + header.Method = zip.Deflate + } + + writer, err := archive.CreateHeader(header) + if err != nil { + return err + } + + if info.IsDir() { + return nil + } + + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + _, err = io.Copy(writer, file) + return err + }) +} + +func Unzip(zipPath, target string) error { + reader, err := zip.OpenReader(zipPath) + if err != nil { + return err + } + + if err := os.MkdirAll(target, 0755); err != nil { + return err + } + + for _, file := range reader.File { + path := filepath.Join(target, file.Name) + if file.FileInfo().IsDir() { + if err := os.MkdirAll(path, file.Mode()); err != nil { + return err + } + continue + } + + fileReader, err := file.Open() + if err != nil { + if fileReader != nil { + fileReader.Close() + } + + return err + } + + targetFile, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, file.Mode()) + if err != nil { + fileReader.Close() + + if targetFile != nil { + targetFile.Close() + } + + return err + } + + if _, err := io.Copy(targetFile, fileReader); err != nil { + fileReader.Close() + targetFile.Close() + + return err + } + + fileReader.Close() + targetFile.Close() + } + + return nil +} diff --git a/server/pkg/xevent/xevent.c b/server/pkg/xevent/xevent.c new file mode 100644 index 000000000..1d75422ce --- /dev/null +++ b/server/pkg/xevent/xevent.c @@ -0,0 +1,192 @@ +#include "xevent.h" + +static int XEventError(Display *display, XErrorEvent *event) { + char message[100]; + + int error; + error = XGetErrorText(display, event->error_code, message, sizeof(message)); + if (error) { + goXEventError(event, "Could not get error message."); + } else { + goXEventError(event, message); + } + + return 1; +} + +void XSetupErrorHandler() { + XSetErrorHandler(XEventError); +} + +void XEventLoop(char *name) { + Display *display = XOpenDisplay(name); + Window root = DefaultRootWindow(display); + + int xfixes_event_base, xfixes_error_base; + if (!XFixesQueryExtension(display, &xfixes_event_base, &xfixes_error_base)) { + return; + } + + // save last size id for fullscreen bug fix + SizeID last_size_id; + + Atom WM_WINDOW_ROLE = XInternAtom(display, "WM_WINDOW_ROLE", 1); + Atom XA_CLIPBOARD = XInternAtom(display, "CLIPBOARD", 0); + XFixesSelectSelectionInput(display, root, XA_CLIPBOARD, XFixesSetSelectionOwnerNotifyMask); + XFixesSelectCursorInput(display, root, XFixesDisplayCursorNotifyMask); + XSelectInput(display, root, SubstructureNotifyMask); + + XSync(display, 0); + + while (goXEventActive()) { + XEvent event; + XNextEvent(display, &event); + + // XFixesDisplayCursorNotify + if (event.type == xfixes_event_base + 1) { + XFixesCursorNotifyEvent notifyEvent = *((XFixesCursorNotifyEvent *) &event); + if (notifyEvent.subtype == XFixesDisplayCursorNotify) { + goXEventCursorChanged(notifyEvent); + continue; + } + } + + // XFixesSelectionNotifyEvent + if (event.type == xfixes_event_base + XFixesSelectionNotify) { + XFixesSelectionNotifyEvent notifyEvent = *((XFixesSelectionNotifyEvent *) &event); + if (notifyEvent.subtype == XFixesSetSelectionOwnerNotify && notifyEvent.selection == XA_CLIPBOARD) { + goXEventClipboardUpdated(); + continue; + } + } + + // ConfigureNotify + if (event.type == ConfigureNotify) { + Window window = event.xconfigure.window; + + char *name; + XFetchName(display, window, &name); + + XTextProperty role; + XGetTextProperty(display, window, &role, WM_WINDOW_ROLE); + + goXEventConfigureNotify(display, window, name, role.value); + XFree(name); + continue; + } + + // UnmapNotify + if (event.type == UnmapNotify) { + Window window = event.xunmap.window; + goXEventUnmapNotify(window); + continue; + } + + // ClientMessage + if (event.type == ClientMessage) { + Window window = event.xclient.window; + + // check for net window manager state (fullscreen, maximized, etc) + if (event.xclient.message_type == XInternAtom(display, "_NET_WM_STATE", 0)) { + // see documentation in XWindowManagerStateEvent + Atom action = event.xclient.data.l[0]; + Atom first = event.xclient.data.l[1]; + Atom second = event.xclient.data.l[2]; + + // check if user is entering or exiting fullscreen + if (first == XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", 0)) { + // get current size id + Rotation current_rotation; + XRRScreenConfiguration *conf = XRRGetScreenInfo(display, root); + SizeID current_size_id = XRRConfigCurrentConfiguration(conf, ¤t_rotation); + + // window just went fullscreen + if (action == 1) { + // save current size id + last_size_id = current_size_id; + continue; + } + + // window just exited fullscreen + if (action == 0) { + // if size id changed, that means user changed resolution while in fullscreen + // there is a bug in some window managers that causes the window to not resize + // if it was previously maximized, so we need to unmaximize it and maximize it again + if (current_size_id != last_size_id) { + // toggle maximized state twice + XWindowManagerStateEvent(display, window, 2, + XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_VERT", 0), + XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_HORZ", 0)); + XWindowManagerStateEvent(display, window, 2, + XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_VERT", 0), + XInternAtom(display, "_NET_WM_STATE_MAXIMIZED_HORZ", 0)); + } + } + } + } + + // check for window manager change state (minimize, maximize, etc) + if (event.xclient.message_type == XInternAtom(display, "WM_CHANGE_STATE", 0)) { + int window_state = event.xclient.data.l[0]; + // NormalState - The client's top-level window is viewable. + // IconicState - The client's top-level window is iconic (whatever that means for this window manager). + // WithdrawnState - Neither the client's top-level window nor its icon is visible. + goXEventWMChangeState(display, window, window_state); + } + + continue; + } + + } + + XCloseDisplay(display); +} + +static void XWindowManagerStateEvent(Display *display, Window window, ulong action, ulong first, ulong second) { + Window root = DefaultRootWindow(display); + + XClientMessageEvent clientMessageEvent; + memset(&clientMessageEvent, 0, sizeof(clientMessageEvent)); + + // window = the respective client window + // message_type = _NET_WM_STATE + // format = 32 + // data.l[0] = the action, as listed below + // _NET_WM_STATE_REMOVE 0 // remove/unset property + // _NET_WM_STATE_ADD 1 // add/set property + // _NET_WM_STATE_TOGGLE 2 // toggle property + // data.l[1] = first property to alter + // data.l[2] = second property to alter + // data.l[3] = source indication + // other data.l[] elements = 0 + + clientMessageEvent.type = ClientMessage; + clientMessageEvent.window = window; + clientMessageEvent.message_type = XInternAtom(display, "_NET_WM_STATE", 0); + clientMessageEvent.format = 32; + clientMessageEvent.data.l[0] = action; + clientMessageEvent.data.l[1] = first; + clientMessageEvent.data.l[2] = second; + clientMessageEvent.data.l[3] = 1; + + XSendEvent(display, root, 0, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&clientMessageEvent); + XFlush(display); +} + +void XFileChooserHide(Display *display, Window window) { + // The WM_TRANSIENT_FOR property is defined by the [ICCCM] for managed windows. + // This specification extends the use of the property to override-redirect windows. + // If an override-redirect is a pop-up on behalf of another window, then the Client + // SHOULD set WM_TRANSIENT_FOR on the override-redirect to this other window. + // + // As an example, a Client should set WM_TRANSIENT_FOR on dropdown menus to the + // toplevel application window that contains the menubar. + + // Remove WM_TRANSIENT_FOR + Atom WM_TRANSIENT_FOR = XInternAtom(display, "WM_TRANSIENT_FOR", 0); + XDeleteProperty(display, window, WM_TRANSIENT_FOR); + + // Add _NET_WM_STATE_BELOW + XWindowManagerStateEvent(display, window, 1, // set property + XInternAtom(display, "_NET_WM_STATE_BELOW", 0), 0); +} diff --git a/server/pkg/xevent/xevent.go b/server/pkg/xevent/xevent.go new file mode 100644 index 000000000..b2fd9d4f1 --- /dev/null +++ b/server/pkg/xevent/xevent.go @@ -0,0 +1,96 @@ +package xevent + +/* +#cgo LDFLAGS: -lX11 -lXfixes + +#include "xevent.h" +*/ +import "C" + +import ( + "strings" + "unsafe" + + "github.com/kataras/go-events" +) + +var Emmiter events.EventEmmiter +var Unminimize bool = false +var FileChooserDialog bool = false +var fileChooserDialogWindow uint32 = 0 + +func init() { + Emmiter = events.New() +} + +func SetupErrorHandler() { + C.XSetupErrorHandler() +} + +func EventLoop(display string) { + displayUnsafe := C.CString(display) + defer C.free(unsafe.Pointer(displayUnsafe)) + + C.XEventLoop(displayUnsafe) +} + +//export goXEventCursorChanged +func goXEventCursorChanged(event C.XFixesCursorNotifyEvent) { + Emmiter.Emit("cursor-changed", uint64(event.cursor_serial)) +} + +//export goXEventClipboardUpdated +func goXEventClipboardUpdated() { + Emmiter.Emit("clipboard-updated") +} + +//export goXEventConfigureNotify +func goXEventConfigureNotify(display *C.Display, window C.Window, name *C.char, role *C.char) { + if C.GoString(role) != "GtkFileChooserDialog" || !FileChooserDialog { + return + } + + // TODO: Refactor. Right now processing of this dialog relies on identifying + // via its name. When that changes to role, this condition should be removed. + if !strings.HasPrefix(C.GoString(name), "Open File") { + return + } + + C.XFileChooserHide(display, window) + + if fileChooserDialogWindow == 0 { + fileChooserDialogWindow = uint32(window) + Emmiter.Emit("file-chooser-dialog-opened") + } +} + +//export goXEventUnmapNotify +func goXEventUnmapNotify(window C.Window) { + if uint32(window) != fileChooserDialogWindow || !FileChooserDialog { + return + } + + fileChooserDialogWindow = 0 + Emmiter.Emit("file-chooser-dialog-closed") +} + +//export goXEventWMChangeState +func goXEventWMChangeState(display *C.Display, window C.Window, window_state C.ulong) { + // if we just realized that window is minimized and we want it to be unminimized + if window_state != C.NormalState && Unminimize { + // we want to unmap and map the window to force it to redraw + C.XUnmapWindow(display, window) + C.XMapWindow(display, window) + C.XFlush(display) + } +} + +//export goXEventError +func goXEventError(event *C.XErrorEvent, message *C.char) { + Emmiter.Emit("event-error", uint8(event.error_code), C.GoString(message), uint8(event.request_code), uint8(event.minor_code)) +} + +//export goXEventActive +func goXEventActive() C.int { + return C.int(1) +} diff --git a/server/internal/desktop/xevent/xevent.h b/server/pkg/xevent/xevent.h similarity index 71% rename from server/internal/desktop/xevent/xevent.h rename to server/pkg/xevent/xevent.h index 3dfdfc0b1..c3924daee 100644 --- a/server/internal/desktop/xevent/xevent.h +++ b/server/pkg/xevent/xevent.h @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -11,10 +12,13 @@ extern void goXEventCursorChanged(XFixesCursorNotifyEvent event); extern void goXEventClipboardUpdated(); extern void goXEventConfigureNotify(Display *display, Window window, char *name, char *role); extern void goXEventUnmapNotify(Window window); +extern void goXEventWMChangeState(Display *display, Window window, ulong state); extern void goXEventError(XErrorEvent *event, char *message); extern int goXEventActive(); static int XEventError(Display *display, XErrorEvent *event); +void XSetupErrorHandler(); void XEventLoop(char *display); +static void XWindowManagerStateEvent(Display *display, Window window, ulong action, ulong first, ulong second); void XFileChooserHide(Display *display, Window window); diff --git a/server/pkg/xinput/dummy.go b/server/pkg/xinput/dummy.go new file mode 100644 index 000000000..a2d5c3449 --- /dev/null +++ b/server/pkg/xinput/dummy.go @@ -0,0 +1,31 @@ +package xinput + +import "time" + +type dummy struct{} + +func NewDummy() Driver { + return &dummy{} +} + +func (d *dummy) Connect() error { + return nil +} + +func (d *dummy) Close() error { + return nil +} + +func (d *dummy) Debounce(duration time.Duration) {} + +func (d *dummy) TouchBegin(touchId uint32, x, y int, pressure uint8) error { + return nil +} + +func (d *dummy) TouchUpdate(touchId uint32, x, y int, pressure uint8) error { + return nil +} + +func (d *dummy) TouchEnd(touchId uint32, x, y int, pressure uint8) error { + return nil +} diff --git a/server/pkg/xinput/types.go b/server/pkg/xinput/types.go new file mode 100644 index 000000000..7f94044d0 --- /dev/null +++ b/server/pkg/xinput/types.go @@ -0,0 +1,61 @@ +package xinput + +import "time" + +const ( + // absolute coordinates used in driver + AbsX = 0xffff + AbsY = 0xffff +) + +const ( + XI_TouchBegin = 18 + XI_TouchUpdate = 19 + XI_TouchEnd = 20 +) + +type Message struct { + _type uint16 + touchId uint32 + x int32 // can be negative? + y int32 // can be negative? + pressure uint8 +} + +func (msg *Message) Unpack(buffer []byte) { + msg._type = uint16(buffer[0]) + msg.touchId = uint32(buffer[1]) | (uint32(buffer[2]) << 8) + msg.x = int32(buffer[3]) | (int32(buffer[4]) << 8) | (int32(buffer[5]) << 16) | (int32(buffer[6]) << 24) + msg.y = int32(buffer[7]) | (int32(buffer[8]) << 8) | (int32(buffer[9]) << 16) | (int32(buffer[10]) << 24) + msg.pressure = uint8(buffer[11]) +} + +func (msg *Message) Pack() []byte { + var buffer [12]byte + + buffer[0] = byte(msg._type) + buffer[1] = byte(msg.touchId) + buffer[2] = byte(msg.touchId >> 8) + buffer[3] = byte(msg.x) + buffer[4] = byte(msg.x >> 8) + buffer[5] = byte(msg.x >> 16) + buffer[6] = byte(msg.x >> 24) + buffer[7] = byte(msg.y) + buffer[8] = byte(msg.y >> 8) + buffer[9] = byte(msg.y >> 16) + buffer[10] = byte(msg.y >> 24) + buffer[11] = byte(msg.pressure) + + return buffer[:] +} + +type Driver interface { + Connect() error + Close() error + // release touches, that were not updated for duration + Debounce(duration time.Duration) + // touch events + TouchBegin(touchId uint32, x, y int, pressure uint8) error + TouchUpdate(touchId uint32, x, y int, pressure uint8) error + TouchEnd(touchId uint32, x, y int, pressure uint8) error +} diff --git a/server/pkg/xinput/xinput.go b/server/pkg/xinput/xinput.go new file mode 100644 index 000000000..a6ce10330 --- /dev/null +++ b/server/pkg/xinput/xinput.go @@ -0,0 +1,122 @@ +/* custom xf86 input driver communication protocol */ +package xinput + +import ( + "fmt" + "net" + "sync" + "time" +) + +type driver struct { + mu sync.Mutex + socket string + conn net.Conn + + debounceTouchIds map[uint32]time.Time +} + +func NewDriver(socket string) Driver { + return &driver{ + socket: socket, + + debounceTouchIds: make(map[uint32]time.Time), + } +} + +func (d *driver) Connect() error { + c, err := net.Dial("unix", d.socket) + if err != nil { + return err + } + d.conn = c + return nil +} + +func (d *driver) Close() error { + return d.conn.Close() +} + +func (d *driver) Debounce(duration time.Duration) { + d.mu.Lock() + defer d.mu.Unlock() + + t := time.Now() + for touchId, start := range d.debounceTouchIds { + if t.Sub(start) < duration { + continue + } + + msg := Message{ + _type: XI_TouchEnd, + touchId: touchId, + x: -1, + y: -1, + } + _, _ = d.conn.Write(msg.Pack()) + delete(d.debounceTouchIds, touchId) + } +} + +func (d *driver) TouchBegin(touchId uint32, x, y int, pressure uint8) error { + d.mu.Lock() + defer d.mu.Unlock() + + if _, ok := d.debounceTouchIds[touchId]; ok { + return fmt.Errorf("debounced touch id %v", touchId) + } + + d.debounceTouchIds[touchId] = time.Now() + + msg := Message{ + _type: XI_TouchBegin, + touchId: touchId, + x: int32(x), + y: int32(y), + pressure: pressure, + } + _, err := d.conn.Write(msg.Pack()) + return err +} + +func (d *driver) TouchUpdate(touchId uint32, x, y int, pressure uint8) error { + d.mu.Lock() + defer d.mu.Unlock() + + if _, ok := d.debounceTouchIds[touchId]; !ok { + return fmt.Errorf("unknown touch id %v", touchId) + } + + d.debounceTouchIds[touchId] = time.Now() + + msg := Message{ + _type: XI_TouchUpdate, + touchId: touchId, + x: int32(x), + y: int32(y), + pressure: pressure, + } + _, err := d.conn.Write(msg.Pack()) + return err +} + +func (d *driver) TouchEnd(touchId uint32, x, y int, pressure uint8) error { + d.mu.Lock() + defer d.mu.Unlock() + + if _, ok := d.debounceTouchIds[touchId]; !ok { + return fmt.Errorf("unknown touch id %v", touchId) + } + + delete(d.debounceTouchIds, touchId) + + msg := Message{ + _type: XI_TouchEnd, + touchId: touchId, + x: int32(x), + y: int32(y), + pressure: pressure, + } + _, err := d.conn.Write(msg.Pack()) + return err +} diff --git a/server/pkg/xorg/keysymdef.go b/server/pkg/xorg/keysymdef.go new file mode 100644 index 000000000..763587696 --- /dev/null +++ b/server/pkg/xorg/keysymdef.go @@ -0,0 +1,2498 @@ +package xorg +/*********************************************************** +Copyright 1987, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +/* + * The "X11 Window System Protocol" standard defines in Appendix A the + * keysym codes. These 29-bit integer values identify characters or + * functions associated with each key (e.g., via the visible + * engraving) of a keyboard layout. This file assigns mnemonic macro + * names for these keysyms. + * + * This file is also compiled (by src/util/makekeys.c in libX11) into + * hash tables that can be accessed with X11 library functions such as + * XStringToKeysym() and XKeysymToString(). + * + * Where a keysym corresponds one-to-one to an ISO 10646 / Unicode + * character, this is noted in a comment that provides both the U+xxxx + * Unicode position, as well as the official Unicode name of the + * character. + * + * Where the correspondence is either not one-to-one or semantically + * unclear, the Unicode position and name are enclosed in + * parentheses. Such legacy keysyms should be considered deprecated + * and are not recommended for use in future keyboard mappings. + * + * For any future extension of the keysyms with characters already + * found in ISO 10646 / Unicode, the following algorithm shall be + * used. The new keysym code position will simply be the character's + * Unicode number plus 0x01000000. The keysym values in the range + * 0x01000100 to 0x0110ffff are reserved to represent Unicode + * characters in the range U+0100 to U+10FFFF. + * + * While most newer Unicode-based X11 clients do already accept + * Unicode-mapped keysyms in the range 0x01000100 to 0x0110ffff, it + * will remain necessary for clients -- in the interest of + * compatibility with existing servers -- to also understand the + * existing legacy keysym values in the range 0x0100 to 0x20ff. + * + * Where several mnemonic names are defined for the same keysym in this + * file, all but the first one listed should be considered deprecated. + * + * Mnemonic names for keysyms are defined in this file with lines + * that match one of these Perl regular expressions: + * + * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\* U+([0-9A-F]{4,6}) (.*) \*\/\s*$/ + * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*\/\*\(U+([0-9A-F]{4,6}) (.*)\)\*\/\s*$/ + * /^\#define XK_([a-zA-Z_0-9]+)\s+0x([0-9a-f]+)\s*(\/\*\s*(.*)\s*\*\/)?\s*$/ + * + * Before adding new keysyms, please do consider the following: In + * addition to the keysym names defined in this file, the + * XStringToKeysym() and XKeysymToString() functions will also handle + * any keysym string of the form "U0020" to "U007E" and "U00A0" to + * "U10FFFF" for all possible Unicode characters. In other words, + * every possible Unicode character has already a keysym string + * defined algorithmically, even if it is not listed here. Therefore, + * defining an additional keysym macro is only necessary where a + * non-hexadecimal mnemonic name is needed, or where the new keysym + * does not represent any existing Unicode character. + * + * When adding new keysyms to this file, do not forget to also update the + * following as needed: + * + * - the mappings in src/KeyBind.c in the repo + * git://anongit.freedesktop.org/xorg/lib/libX11.git + * + * - the protocol specification in specs/keysyms.xml + * in the repo git://anongit.freedesktop.org/xorg/proto/x11proto.git + * + */ + +const XK_VoidSymbol = 0xffffff /* Void symbol */ + +//ifdef XK_MISCELLANY +/* + * TTY function keys, cleverly chosen to map to ASCII, for convenience of + * programming, but could have been arbitrary (at the cost of lookup + * tables in client code). + */ + +const XK_BackSpace = 0xff08 /* Back space, back char */ +const XK_Tab = 0xff09 +const XK_Linefeed = 0xff0a /* Linefeed, LF */ +const XK_Clear = 0xff0b +const XK_Return = 0xff0d /* Return, enter */ +const XK_Pause = 0xff13 /* Pause, hold */ +const XK_Scroll_Lock = 0xff14 +const XK_Sys_Req = 0xff15 +const XK_Escape = 0xff1b +const XK_Delete = 0xffff /* Delete, rubout */ + + + +/* International & multi-key character composition */ + +const XK_Multi_key = 0xff20 /* Multi-key character compose */ +const XK_Codeinput = 0xff37 +const XK_SingleCandidate = 0xff3c +const XK_MultipleCandidate = 0xff3d +const XK_PreviousCandidate = 0xff3e + +/* Japanese keyboard support */ + +const XK_Kanji = 0xff21 /* Kanji, Kanji convert */ +const XK_Muhenkan = 0xff22 /* Cancel Conversion */ +const XK_Henkan_Mode = 0xff23 /* Start/Stop Conversion */ +const XK_Henkan = 0xff23 /* Alias for Henkan_Mode */ +const XK_Romaji = 0xff24 /* to Romaji */ +const XK_Hiragana = 0xff25 /* to Hiragana */ +const XK_Katakana = 0xff26 /* to Katakana */ +const XK_Hiragana_Katakana = 0xff27 /* Hiragana/Katakana toggle */ +const XK_Zenkaku = 0xff28 /* to Zenkaku */ +const XK_Hankaku = 0xff29 /* to Hankaku */ +const XK_Zenkaku_Hankaku = 0xff2a /* Zenkaku/Hankaku toggle */ +const XK_Touroku = 0xff2b /* Add to Dictionary */ +const XK_Massyo = 0xff2c /* Delete from Dictionary */ +const XK_Kana_Lock = 0xff2d /* Kana Lock */ +const XK_Kana_Shift = 0xff2e /* Kana Shift */ +const XK_Eisu_Shift = 0xff2f /* Alphanumeric Shift */ +const XK_Eisu_toggle = 0xff30 /* Alphanumeric toggle */ +const XK_Kanji_Bangou = 0xff37 /* Codeinput */ +const XK_Zen_Koho = 0xff3d /* Multiple/All Candidate(s) */ +const XK_Mae_Koho = 0xff3e /* Previous Candidate */ + +/* 0xff31 thru 0xff3f are under XK_KOREAN */ + +/* Cursor control & motion */ + +const XK_Home = 0xff50 +const XK_Left = 0xff51 /* Move left, left arrow */ +const XK_Up = 0xff52 /* Move up, up arrow */ +const XK_Right = 0xff53 /* Move right, right arrow */ +const XK_Down = 0xff54 /* Move down, down arrow */ +const XK_Prior = 0xff55 /* Prior, previous */ +const XK_Page_Up = 0xff55 +const XK_Next = 0xff56 /* Next */ +const XK_Page_Down = 0xff56 +const XK_End = 0xff57 /* EOL */ +const XK_Begin = 0xff58 /* BOL */ + + +/* Misc functions */ + +const XK_Select = 0xff60 /* Select, mark */ +const XK_Print = 0xff61 +const XK_Execute = 0xff62 /* Execute, run, do */ +const XK_Insert = 0xff63 /* Insert, insert here */ +const XK_Undo = 0xff65 +const XK_Redo = 0xff66 /* Redo, again */ +const XK_Menu = 0xff67 +const XK_Find = 0xff68 /* Find, search */ +const XK_Cancel = 0xff69 /* Cancel, stop, abort, exit */ +const XK_Help = 0xff6a /* Help */ +const XK_Break = 0xff6b +const XK_Mode_switch = 0xff7e /* Character set switch */ +const XK_script_switch = 0xff7e /* Alias for mode_switch */ +const XK_Num_Lock = 0xff7f + +/* Keypad functions, keypad numbers cleverly chosen to map to ASCII */ + +const XK_KP_Space = 0xff80 /* Space */ +const XK_KP_Tab = 0xff89 +const XK_KP_Enter = 0xff8d /* Enter */ +const XK_KP_F1 = 0xff91 /* PF1, KP_A, ... */ +const XK_KP_F2 = 0xff92 +const XK_KP_F3 = 0xff93 +const XK_KP_F4 = 0xff94 +const XK_KP_Home = 0xff95 +const XK_KP_Left = 0xff96 +const XK_KP_Up = 0xff97 +const XK_KP_Right = 0xff98 +const XK_KP_Down = 0xff99 +const XK_KP_Prior = 0xff9a +const XK_KP_Page_Up = 0xff9a +const XK_KP_Next = 0xff9b +const XK_KP_Page_Down = 0xff9b +const XK_KP_End = 0xff9c +const XK_KP_Begin = 0xff9d +const XK_KP_Insert = 0xff9e +const XK_KP_Delete = 0xff9f +const XK_KP_Equal = 0xffbd /* Equals */ +const XK_KP_Multiply = 0xffaa +const XK_KP_Add = 0xffab +const XK_KP_Separator = 0xffac /* Separator, often comma */ +const XK_KP_Subtract = 0xffad +const XK_KP_Decimal = 0xffae +const XK_KP_Divide = 0xffaf + +const XK_KP_0 = 0xffb0 +const XK_KP_1 = 0xffb1 +const XK_KP_2 = 0xffb2 +const XK_KP_3 = 0xffb3 +const XK_KP_4 = 0xffb4 +const XK_KP_5 = 0xffb5 +const XK_KP_6 = 0xffb6 +const XK_KP_7 = 0xffb7 +const XK_KP_8 = 0xffb8 +const XK_KP_9 = 0xffb9 + + + +/* + * Auxiliary functions; note the duplicate definitions for left and right + * function keys; Sun keyboards and a few other manufacturers have such + * function key groups on the left and/or right sides of the keyboard. + * We've not found a keyboard with more than 35 function keys total. + */ + +const XK_F1 = 0xffbe +const XK_F2 = 0xffbf +const XK_F3 = 0xffc0 +const XK_F4 = 0xffc1 +const XK_F5 = 0xffc2 +const XK_F6 = 0xffc3 +const XK_F7 = 0xffc4 +const XK_F8 = 0xffc5 +const XK_F9 = 0xffc6 +const XK_F10 = 0xffc7 +const XK_F11 = 0xffc8 +const XK_L1 = 0xffc8 +const XK_F12 = 0xffc9 +const XK_L2 = 0xffc9 +const XK_F13 = 0xffca +const XK_L3 = 0xffca +const XK_F14 = 0xffcb +const XK_L4 = 0xffcb +const XK_F15 = 0xffcc +const XK_L5 = 0xffcc +const XK_F16 = 0xffcd +const XK_L6 = 0xffcd +const XK_F17 = 0xffce +const XK_L7 = 0xffce +const XK_F18 = 0xffcf +const XK_L8 = 0xffcf +const XK_F19 = 0xffd0 +const XK_L9 = 0xffd0 +const XK_F20 = 0xffd1 +const XK_L10 = 0xffd1 +const XK_F21 = 0xffd2 +const XK_R1 = 0xffd2 +const XK_F22 = 0xffd3 +const XK_R2 = 0xffd3 +const XK_F23 = 0xffd4 +const XK_R3 = 0xffd4 +const XK_F24 = 0xffd5 +const XK_R4 = 0xffd5 +const XK_F25 = 0xffd6 +const XK_R5 = 0xffd6 +const XK_F26 = 0xffd7 +const XK_R6 = 0xffd7 +const XK_F27 = 0xffd8 +const XK_R7 = 0xffd8 +const XK_F28 = 0xffd9 +const XK_R8 = 0xffd9 +const XK_F29 = 0xffda +const XK_R9 = 0xffda +const XK_F30 = 0xffdb +const XK_R10 = 0xffdb +const XK_F31 = 0xffdc +const XK_R11 = 0xffdc +const XK_F32 = 0xffdd +const XK_R12 = 0xffdd +const XK_F33 = 0xffde +const XK_R13 = 0xffde +const XK_F34 = 0xffdf +const XK_R14 = 0xffdf +const XK_F35 = 0xffe0 +const XK_R15 = 0xffe0 + +/* Modifiers */ + +const XK_Shift_L = 0xffe1 /* Left shift */ +const XK_Shift_R = 0xffe2 /* Right shift */ +const XK_Control_L = 0xffe3 /* Left control */ +const XK_Control_R = 0xffe4 /* Right control */ +const XK_Caps_Lock = 0xffe5 /* Caps lock */ +const XK_Shift_Lock = 0xffe6 /* Shift lock */ + +const XK_Meta_L = 0xffe7 /* Left meta */ +const XK_Meta_R = 0xffe8 /* Right meta */ +const XK_Alt_L = 0xffe9 /* Left alt */ +const XK_Alt_R = 0xffea /* Right alt */ +const XK_Super_L = 0xffeb /* Left super */ +const XK_Super_R = 0xffec /* Right super */ +const XK_Hyper_L = 0xffed /* Left hyper */ +const XK_Hyper_R = 0xffee /* Right hyper */ +//endif /* XK_MISCELLANY */ + +/* + * Keyboard (XKB) Extension function and modifier keys + * (from Appendix C of "The X Keyboard Extension: Protocol Specification") + * Byte 3 = 0xfe + */ + +//ifdef XK_XKB_KEYS +const XK_ISO_Lock = 0xfe01 +const XK_ISO_Level2_Latch = 0xfe02 +const XK_ISO_Level3_Shift = 0xfe03 +const XK_ISO_Level3_Latch = 0xfe04 +const XK_ISO_Level3_Lock = 0xfe05 +const XK_ISO_Level5_Shift = 0xfe11 +const XK_ISO_Level5_Latch = 0xfe12 +const XK_ISO_Level5_Lock = 0xfe13 +const XK_ISO_Group_Shift = 0xff7e /* Alias for mode_switch */ +const XK_ISO_Group_Latch = 0xfe06 +const XK_ISO_Group_Lock = 0xfe07 +const XK_ISO_Next_Group = 0xfe08 +const XK_ISO_Next_Group_Lock = 0xfe09 +const XK_ISO_Prev_Group = 0xfe0a +const XK_ISO_Prev_Group_Lock = 0xfe0b +const XK_ISO_First_Group = 0xfe0c +const XK_ISO_First_Group_Lock = 0xfe0d +const XK_ISO_Last_Group = 0xfe0e +const XK_ISO_Last_Group_Lock = 0xfe0f + +const XK_ISO_Left_Tab = 0xfe20 +const XK_ISO_Move_Line_Up = 0xfe21 +const XK_ISO_Move_Line_Down = 0xfe22 +const XK_ISO_Partial_Line_Up = 0xfe23 +const XK_ISO_Partial_Line_Down = 0xfe24 +const XK_ISO_Partial_Space_Left = 0xfe25 +const XK_ISO_Partial_Space_Right = 0xfe26 +const XK_ISO_Set_Margin_Left = 0xfe27 +const XK_ISO_Set_Margin_Right = 0xfe28 +const XK_ISO_Release_Margin_Left = 0xfe29 +const XK_ISO_Release_Margin_Right = 0xfe2a +const XK_ISO_Release_Both_Margins = 0xfe2b +const XK_ISO_Fast_Cursor_Left = 0xfe2c +const XK_ISO_Fast_Cursor_Right = 0xfe2d +const XK_ISO_Fast_Cursor_Up = 0xfe2e +const XK_ISO_Fast_Cursor_Down = 0xfe2f +const XK_ISO_Continuous_Underline = 0xfe30 +const XK_ISO_Discontinuous_Underline = 0xfe31 +const XK_ISO_Emphasize = 0xfe32 +const XK_ISO_Center_Object = 0xfe33 +const XK_ISO_Enter = 0xfe34 + +const XK_dead_grave = 0xfe50 +const XK_dead_acute = 0xfe51 +const XK_dead_circumflex = 0xfe52 +const XK_dead_tilde = 0xfe53 +const XK_dead_perispomeni = 0xfe53 /* alias for dead_tilde */ +const XK_dead_macron = 0xfe54 +const XK_dead_breve = 0xfe55 +const XK_dead_abovedot = 0xfe56 +const XK_dead_diaeresis = 0xfe57 +const XK_dead_abovering = 0xfe58 +const XK_dead_doubleacute = 0xfe59 +const XK_dead_caron = 0xfe5a +const XK_dead_cedilla = 0xfe5b +const XK_dead_ogonek = 0xfe5c +const XK_dead_iota = 0xfe5d +const XK_dead_voiced_sound = 0xfe5e +const XK_dead_semivoiced_sound = 0xfe5f +const XK_dead_belowdot = 0xfe60 +const XK_dead_hook = 0xfe61 +const XK_dead_horn = 0xfe62 +const XK_dead_stroke = 0xfe63 +const XK_dead_abovecomma = 0xfe64 +const XK_dead_psili = 0xfe64 /* alias for dead_abovecomma */ +const XK_dead_abovereversedcomma = 0xfe65 +const XK_dead_dasia = 0xfe65 /* alias for dead_abovereversedcomma */ +const XK_dead_doublegrave = 0xfe66 +const XK_dead_belowring = 0xfe67 +const XK_dead_belowmacron = 0xfe68 +const XK_dead_belowcircumflex = 0xfe69 +const XK_dead_belowtilde = 0xfe6a +const XK_dead_belowbreve = 0xfe6b +const XK_dead_belowdiaeresis = 0xfe6c +const XK_dead_invertedbreve = 0xfe6d +const XK_dead_belowcomma = 0xfe6e +const XK_dead_currency = 0xfe6f + +/* extra dead elements for German T3 layout */ +const XK_dead_lowline = 0xfe90 +const XK_dead_aboveverticalline = 0xfe91 +const XK_dead_belowverticalline = 0xfe92 +const XK_dead_longsolidusoverlay = 0xfe93 + +/* dead vowels for universal syllable entry */ +const XK_dead_a = 0xfe80 +const XK_dead_A = 0xfe81 +const XK_dead_e = 0xfe82 +const XK_dead_E = 0xfe83 +const XK_dead_i = 0xfe84 +const XK_dead_I = 0xfe85 +const XK_dead_o = 0xfe86 +const XK_dead_O = 0xfe87 +const XK_dead_u = 0xfe88 +const XK_dead_U = 0xfe89 +const XK_dead_small_schwa = 0xfe8a +const XK_dead_capital_schwa = 0xfe8b + +const XK_dead_greek = 0xfe8c + +const XK_First_Virtual_Screen = 0xfed0 +const XK_Prev_Virtual_Screen = 0xfed1 +const XK_Next_Virtual_Screen = 0xfed2 +const XK_Last_Virtual_Screen = 0xfed4 +const XK_Terminate_Server = 0xfed5 + +const XK_AccessX_Enable = 0xfe70 +const XK_AccessX_Feedback_Enable = 0xfe71 +const XK_RepeatKeys_Enable = 0xfe72 +const XK_SlowKeys_Enable = 0xfe73 +const XK_BounceKeys_Enable = 0xfe74 +const XK_StickyKeys_Enable = 0xfe75 +const XK_MouseKeys_Enable = 0xfe76 +const XK_MouseKeys_Accel_Enable = 0xfe77 +const XK_Overlay1_Enable = 0xfe78 +const XK_Overlay2_Enable = 0xfe79 +const XK_AudibleBell_Enable = 0xfe7a + +const XK_Pointer_Left = 0xfee0 +const XK_Pointer_Right = 0xfee1 +const XK_Pointer_Up = 0xfee2 +const XK_Pointer_Down = 0xfee3 +const XK_Pointer_UpLeft = 0xfee4 +const XK_Pointer_UpRight = 0xfee5 +const XK_Pointer_DownLeft = 0xfee6 +const XK_Pointer_DownRight = 0xfee7 +const XK_Pointer_Button_Dflt = 0xfee8 +const XK_Pointer_Button1 = 0xfee9 +const XK_Pointer_Button2 = 0xfeea +const XK_Pointer_Button3 = 0xfeeb +const XK_Pointer_Button4 = 0xfeec +const XK_Pointer_Button5 = 0xfeed +const XK_Pointer_DblClick_Dflt = 0xfeee +const XK_Pointer_DblClick1 = 0xfeef +const XK_Pointer_DblClick2 = 0xfef0 +const XK_Pointer_DblClick3 = 0xfef1 +const XK_Pointer_DblClick4 = 0xfef2 +const XK_Pointer_DblClick5 = 0xfef3 +const XK_Pointer_Drag_Dflt = 0xfef4 +const XK_Pointer_Drag1 = 0xfef5 +const XK_Pointer_Drag2 = 0xfef6 +const XK_Pointer_Drag3 = 0xfef7 +const XK_Pointer_Drag4 = 0xfef8 +const XK_Pointer_Drag5 = 0xfefd + +const XK_Pointer_EnableKeys = 0xfef9 +const XK_Pointer_Accelerate = 0xfefa +const XK_Pointer_DfltBtnNext = 0xfefb +const XK_Pointer_DfltBtnPrev = 0xfefc + +/* Single-Stroke Multiple-Character N-Graph Keysyms For The X Input Method */ + +const XK_ch = 0xfea0 +const XK_Ch = 0xfea1 +const XK_CH = 0xfea2 +const XK_c_h = 0xfea3 +const XK_C_h = 0xfea4 +const XK_C_H = 0xfea5 + +//endif /* XK_XKB_KEYS */ + +/* + * 3270 Terminal Keys + * Byte 3 = 0xfd + */ + +//ifdef XK_3270 +const XK_3270_Duplicate = 0xfd01 +const XK_3270_FieldMark = 0xfd02 +const XK_3270_Right2 = 0xfd03 +const XK_3270_Left2 = 0xfd04 +const XK_3270_BackTab = 0xfd05 +const XK_3270_EraseEOF = 0xfd06 +const XK_3270_EraseInput = 0xfd07 +const XK_3270_Reset = 0xfd08 +const XK_3270_Quit = 0xfd09 +const XK_3270_PA1 = 0xfd0a +const XK_3270_PA2 = 0xfd0b +const XK_3270_PA3 = 0xfd0c +const XK_3270_Test = 0xfd0d +const XK_3270_Attn = 0xfd0e +const XK_3270_CursorBlink = 0xfd0f +const XK_3270_AltCursor = 0xfd10 +const XK_3270_KeyClick = 0xfd11 +const XK_3270_Jump = 0xfd12 +const XK_3270_Ident = 0xfd13 +const XK_3270_Rule = 0xfd14 +const XK_3270_Copy = 0xfd15 +const XK_3270_Play = 0xfd16 +const XK_3270_Setup = 0xfd17 +const XK_3270_Record = 0xfd18 +const XK_3270_ChangeScreen = 0xfd19 +const XK_3270_DeleteWord = 0xfd1a +const XK_3270_ExSelect = 0xfd1b +const XK_3270_CursorSelect = 0xfd1c +const XK_3270_PrintScreen = 0xfd1d +const XK_3270_Enter = 0xfd1e +//endif /* XK_3270 */ + +/* + * Latin 1 + * (ISO/IEC 8859-1 = Unicode U+0020..U+00FF) + * Byte 3 = 0 + */ +//ifdef XK_LATIN1 +const XK_space = 0x0020 /* U+0020 SPACE */ +const XK_exclam = 0x0021 /* U+0021 EXCLAMATION MARK */ +const XK_quotedbl = 0x0022 /* U+0022 QUOTATION MARK */ +const XK_numbersign = 0x0023 /* U+0023 NUMBER SIGN */ +const XK_dollar = 0x0024 /* U+0024 DOLLAR SIGN */ +const XK_percent = 0x0025 /* U+0025 PERCENT SIGN */ +const XK_ampersand = 0x0026 /* U+0026 AMPERSAND */ +const XK_apostrophe = 0x0027 /* U+0027 APOSTROPHE */ +const XK_quoteright = 0x0027 /* deprecated */ +const XK_parenleft = 0x0028 /* U+0028 LEFT PARENTHESIS */ +const XK_parenright = 0x0029 /* U+0029 RIGHT PARENTHESIS */ +const XK_asterisk = 0x002a /* U+002A ASTERISK */ +const XK_plus = 0x002b /* U+002B PLUS SIGN */ +const XK_comma = 0x002c /* U+002C COMMA */ +const XK_minus = 0x002d /* U+002D HYPHEN-MINUS */ +const XK_period = 0x002e /* U+002E FULL STOP */ +const XK_slash = 0x002f /* U+002F SOLIDUS */ +const XK_0 = 0x0030 /* U+0030 DIGIT ZERO */ +const XK_1 = 0x0031 /* U+0031 DIGIT ONE */ +const XK_2 = 0x0032 /* U+0032 DIGIT TWO */ +const XK_3 = 0x0033 /* U+0033 DIGIT THREE */ +const XK_4 = 0x0034 /* U+0034 DIGIT FOUR */ +const XK_5 = 0x0035 /* U+0035 DIGIT FIVE */ +const XK_6 = 0x0036 /* U+0036 DIGIT SIX */ +const XK_7 = 0x0037 /* U+0037 DIGIT SEVEN */ +const XK_8 = 0x0038 /* U+0038 DIGIT EIGHT */ +const XK_9 = 0x0039 /* U+0039 DIGIT NINE */ +const XK_colon = 0x003a /* U+003A COLON */ +const XK_semicolon = 0x003b /* U+003B SEMICOLON */ +const XK_less = 0x003c /* U+003C LESS-THAN SIGN */ +const XK_equal = 0x003d /* U+003D EQUALS SIGN */ +const XK_greater = 0x003e /* U+003E GREATER-THAN SIGN */ +const XK_question = 0x003f /* U+003F QUESTION MARK */ +const XK_at = 0x0040 /* U+0040 COMMERCIAL AT */ +const XK_A = 0x0041 /* U+0041 LATIN CAPITAL LETTER A */ +const XK_B = 0x0042 /* U+0042 LATIN CAPITAL LETTER B */ +const XK_C = 0x0043 /* U+0043 LATIN CAPITAL LETTER C */ +const XK_D = 0x0044 /* U+0044 LATIN CAPITAL LETTER D */ +const XK_E = 0x0045 /* U+0045 LATIN CAPITAL LETTER E */ +const XK_F = 0x0046 /* U+0046 LATIN CAPITAL LETTER F */ +const XK_G = 0x0047 /* U+0047 LATIN CAPITAL LETTER G */ +const XK_H = 0x0048 /* U+0048 LATIN CAPITAL LETTER H */ +const XK_I = 0x0049 /* U+0049 LATIN CAPITAL LETTER I */ +const XK_J = 0x004a /* U+004A LATIN CAPITAL LETTER J */ +const XK_K = 0x004b /* U+004B LATIN CAPITAL LETTER K */ +const XK_L = 0x004c /* U+004C LATIN CAPITAL LETTER L */ +const XK_M = 0x004d /* U+004D LATIN CAPITAL LETTER M */ +const XK_N = 0x004e /* U+004E LATIN CAPITAL LETTER N */ +const XK_O = 0x004f /* U+004F LATIN CAPITAL LETTER O */ +const XK_P = 0x0050 /* U+0050 LATIN CAPITAL LETTER P */ +const XK_Q = 0x0051 /* U+0051 LATIN CAPITAL LETTER Q */ +const XK_R = 0x0052 /* U+0052 LATIN CAPITAL LETTER R */ +const XK_S = 0x0053 /* U+0053 LATIN CAPITAL LETTER S */ +const XK_T = 0x0054 /* U+0054 LATIN CAPITAL LETTER T */ +const XK_U = 0x0055 /* U+0055 LATIN CAPITAL LETTER U */ +const XK_V = 0x0056 /* U+0056 LATIN CAPITAL LETTER V */ +const XK_W = 0x0057 /* U+0057 LATIN CAPITAL LETTER W */ +const XK_X = 0x0058 /* U+0058 LATIN CAPITAL LETTER X */ +const XK_Y = 0x0059 /* U+0059 LATIN CAPITAL LETTER Y */ +const XK_Z = 0x005a /* U+005A LATIN CAPITAL LETTER Z */ +const XK_bracketleft = 0x005b /* U+005B LEFT SQUARE BRACKET */ +const XK_backslash = 0x005c /* U+005C REVERSE SOLIDUS */ +const XK_bracketright = 0x005d /* U+005D RIGHT SQUARE BRACKET */ +const XK_asciicircum = 0x005e /* U+005E CIRCUMFLEX ACCENT */ +const XK_underscore = 0x005f /* U+005F LOW LINE */ +const XK_grave = 0x0060 /* U+0060 GRAVE ACCENT */ +const XK_quoteleft = 0x0060 /* deprecated */ +const XK_a = 0x0061 /* U+0061 LATIN SMALL LETTER A */ +const XK_b = 0x0062 /* U+0062 LATIN SMALL LETTER B */ +const XK_c = 0x0063 /* U+0063 LATIN SMALL LETTER C */ +const XK_d = 0x0064 /* U+0064 LATIN SMALL LETTER D */ +const XK_e = 0x0065 /* U+0065 LATIN SMALL LETTER E */ +const XK_f = 0x0066 /* U+0066 LATIN SMALL LETTER F */ +const XK_g = 0x0067 /* U+0067 LATIN SMALL LETTER G */ +const XK_h = 0x0068 /* U+0068 LATIN SMALL LETTER H */ +const XK_i = 0x0069 /* U+0069 LATIN SMALL LETTER I */ +const XK_j = 0x006a /* U+006A LATIN SMALL LETTER J */ +const XK_k = 0x006b /* U+006B LATIN SMALL LETTER K */ +const XK_l = 0x006c /* U+006C LATIN SMALL LETTER L */ +const XK_m = 0x006d /* U+006D LATIN SMALL LETTER M */ +const XK_n = 0x006e /* U+006E LATIN SMALL LETTER N */ +const XK_o = 0x006f /* U+006F LATIN SMALL LETTER O */ +const XK_p = 0x0070 /* U+0070 LATIN SMALL LETTER P */ +const XK_q = 0x0071 /* U+0071 LATIN SMALL LETTER Q */ +const XK_r = 0x0072 /* U+0072 LATIN SMALL LETTER R */ +const XK_s = 0x0073 /* U+0073 LATIN SMALL LETTER S */ +const XK_t = 0x0074 /* U+0074 LATIN SMALL LETTER T */ +const XK_u = 0x0075 /* U+0075 LATIN SMALL LETTER U */ +const XK_v = 0x0076 /* U+0076 LATIN SMALL LETTER V */ +const XK_w = 0x0077 /* U+0077 LATIN SMALL LETTER W */ +const XK_x = 0x0078 /* U+0078 LATIN SMALL LETTER X */ +const XK_y = 0x0079 /* U+0079 LATIN SMALL LETTER Y */ +const XK_z = 0x007a /* U+007A LATIN SMALL LETTER Z */ +const XK_braceleft = 0x007b /* U+007B LEFT CURLY BRACKET */ +const XK_bar = 0x007c /* U+007C VERTICAL LINE */ +const XK_braceright = 0x007d /* U+007D RIGHT CURLY BRACKET */ +const XK_asciitilde = 0x007e /* U+007E TILDE */ + +const XK_nobreakspace = 0x00a0 /* U+00A0 NO-BREAK SPACE */ +const XK_exclamdown = 0x00a1 /* U+00A1 INVERTED EXCLAMATION MARK */ +const XK_cent = 0x00a2 /* U+00A2 CENT SIGN */ +const XK_sterling = 0x00a3 /* U+00A3 POUND SIGN */ +const XK_currency = 0x00a4 /* U+00A4 CURRENCY SIGN */ +const XK_yen = 0x00a5 /* U+00A5 YEN SIGN */ +const XK_brokenbar = 0x00a6 /* U+00A6 BROKEN BAR */ +const XK_section = 0x00a7 /* U+00A7 SECTION SIGN */ +const XK_diaeresis = 0x00a8 /* U+00A8 DIAERESIS */ +const XK_copyright = 0x00a9 /* U+00A9 COPYRIGHT SIGN */ +const XK_ordfeminine = 0x00aa /* U+00AA FEMININE ORDINAL INDICATOR */ +const XK_guillemotleft = 0x00ab /* U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ +const XK_notsign = 0x00ac /* U+00AC NOT SIGN */ +const XK_hyphen = 0x00ad /* U+00AD SOFT HYPHEN */ +const XK_registered = 0x00ae /* U+00AE REGISTERED SIGN */ +const XK_macron = 0x00af /* U+00AF MACRON */ +const XK_degree = 0x00b0 /* U+00B0 DEGREE SIGN */ +const XK_plusminus = 0x00b1 /* U+00B1 PLUS-MINUS SIGN */ +const XK_twosuperior = 0x00b2 /* U+00B2 SUPERSCRIPT TWO */ +const XK_threesuperior = 0x00b3 /* U+00B3 SUPERSCRIPT THREE */ +const XK_acute = 0x00b4 /* U+00B4 ACUTE ACCENT */ +const XK_mu = 0x00b5 /* U+00B5 MICRO SIGN */ +const XK_paragraph = 0x00b6 /* U+00B6 PILCROW SIGN */ +const XK_periodcentered = 0x00b7 /* U+00B7 MIDDLE DOT */ +const XK_cedilla = 0x00b8 /* U+00B8 CEDILLA */ +const XK_onesuperior = 0x00b9 /* U+00B9 SUPERSCRIPT ONE */ +const XK_masculine = 0x00ba /* U+00BA MASCULINE ORDINAL INDICATOR */ +const XK_guillemotright = 0x00bb /* U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ +const XK_onequarter = 0x00bc /* U+00BC VULGAR FRACTION ONE QUARTER */ +const XK_onehalf = 0x00bd /* U+00BD VULGAR FRACTION ONE HALF */ +const XK_threequarters = 0x00be /* U+00BE VULGAR FRACTION THREE QUARTERS */ +const XK_questiondown = 0x00bf /* U+00BF INVERTED QUESTION MARK */ +const XK_Agrave = 0x00c0 /* U+00C0 LATIN CAPITAL LETTER A WITH GRAVE */ +const XK_Aacute = 0x00c1 /* U+00C1 LATIN CAPITAL LETTER A WITH ACUTE */ +const XK_Acircumflex = 0x00c2 /* U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ +const XK_Atilde = 0x00c3 /* U+00C3 LATIN CAPITAL LETTER A WITH TILDE */ +const XK_Adiaeresis = 0x00c4 /* U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS */ +const XK_Aring = 0x00c5 /* U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE */ +const XK_AE = 0x00c6 /* U+00C6 LATIN CAPITAL LETTER AE */ +const XK_Ccedilla = 0x00c7 /* U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA */ +const XK_Egrave = 0x00c8 /* U+00C8 LATIN CAPITAL LETTER E WITH GRAVE */ +const XK_Eacute = 0x00c9 /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */ +const XK_Ecircumflex = 0x00ca /* U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX */ +const XK_Ediaeresis = 0x00cb /* U+00CB LATIN CAPITAL LETTER E WITH DIAERESIS */ +const XK_Igrave = 0x00cc /* U+00CC LATIN CAPITAL LETTER I WITH GRAVE */ +const XK_Iacute = 0x00cd /* U+00CD LATIN CAPITAL LETTER I WITH ACUTE */ +const XK_Icircumflex = 0x00ce /* U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */ +const XK_Idiaeresis = 0x00cf /* U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS */ +const XK_ETH = 0x00d0 /* U+00D0 LATIN CAPITAL LETTER ETH */ +const XK_Eth = 0x00d0 /* deprecated */ +const XK_Ntilde = 0x00d1 /* U+00D1 LATIN CAPITAL LETTER N WITH TILDE */ +const XK_Ograve = 0x00d2 /* U+00D2 LATIN CAPITAL LETTER O WITH GRAVE */ +const XK_Oacute = 0x00d3 /* U+00D3 LATIN CAPITAL LETTER O WITH ACUTE */ +const XK_Ocircumflex = 0x00d4 /* U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ +const XK_Otilde = 0x00d5 /* U+00D5 LATIN CAPITAL LETTER O WITH TILDE */ +const XK_Odiaeresis = 0x00d6 /* U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS */ +const XK_multiply = 0x00d7 /* U+00D7 MULTIPLICATION SIGN */ +const XK_Oslash = 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */ +const XK_Ooblique = 0x00d8 /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */ +const XK_Ugrave = 0x00d9 /* U+00D9 LATIN CAPITAL LETTER U WITH GRAVE */ +const XK_Uacute = 0x00da /* U+00DA LATIN CAPITAL LETTER U WITH ACUTE */ +const XK_Ucircumflex = 0x00db /* U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ +const XK_Udiaeresis = 0x00dc /* U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS */ +const XK_Yacute = 0x00dd /* U+00DD LATIN CAPITAL LETTER Y WITH ACUTE */ +const XK_THORN = 0x00de /* U+00DE LATIN CAPITAL LETTER THORN */ +const XK_Thorn = 0x00de /* deprecated */ +const XK_ssharp = 0x00df /* U+00DF LATIN SMALL LETTER SHARP S */ +const XK_agrave = 0x00e0 /* U+00E0 LATIN SMALL LETTER A WITH GRAVE */ +const XK_aacute = 0x00e1 /* U+00E1 LATIN SMALL LETTER A WITH ACUTE */ +const XK_acircumflex = 0x00e2 /* U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX */ +const XK_atilde = 0x00e3 /* U+00E3 LATIN SMALL LETTER A WITH TILDE */ +const XK_adiaeresis = 0x00e4 /* U+00E4 LATIN SMALL LETTER A WITH DIAERESIS */ +const XK_aring = 0x00e5 /* U+00E5 LATIN SMALL LETTER A WITH RING ABOVE */ +const XK_ae = 0x00e6 /* U+00E6 LATIN SMALL LETTER AE */ +const XK_ccedilla = 0x00e7 /* U+00E7 LATIN SMALL LETTER C WITH CEDILLA */ +const XK_egrave = 0x00e8 /* U+00E8 LATIN SMALL LETTER E WITH GRAVE */ +const XK_eacute = 0x00e9 /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */ +const XK_ecircumflex = 0x00ea /* U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX */ +const XK_ediaeresis = 0x00eb /* U+00EB LATIN SMALL LETTER E WITH DIAERESIS */ +const XK_igrave = 0x00ec /* U+00EC LATIN SMALL LETTER I WITH GRAVE */ +const XK_iacute = 0x00ed /* U+00ED LATIN SMALL LETTER I WITH ACUTE */ +const XK_icircumflex = 0x00ee /* U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX */ +const XK_idiaeresis = 0x00ef /* U+00EF LATIN SMALL LETTER I WITH DIAERESIS */ +const XK_eth = 0x00f0 /* U+00F0 LATIN SMALL LETTER ETH */ +const XK_ntilde = 0x00f1 /* U+00F1 LATIN SMALL LETTER N WITH TILDE */ +const XK_ograve = 0x00f2 /* U+00F2 LATIN SMALL LETTER O WITH GRAVE */ +const XK_oacute = 0x00f3 /* U+00F3 LATIN SMALL LETTER O WITH ACUTE */ +const XK_ocircumflex = 0x00f4 /* U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX */ +const XK_otilde = 0x00f5 /* U+00F5 LATIN SMALL LETTER O WITH TILDE */ +const XK_odiaeresis = 0x00f6 /* U+00F6 LATIN SMALL LETTER O WITH DIAERESIS */ +const XK_division = 0x00f7 /* U+00F7 DIVISION SIGN */ +const XK_oslash = 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */ +const XK_ooblique = 0x00f8 /* U+00F8 LATIN SMALL LETTER O WITH STROKE */ +const XK_ugrave = 0x00f9 /* U+00F9 LATIN SMALL LETTER U WITH GRAVE */ +const XK_uacute = 0x00fa /* U+00FA LATIN SMALL LETTER U WITH ACUTE */ +const XK_ucircumflex = 0x00fb /* U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX */ +const XK_udiaeresis = 0x00fc /* U+00FC LATIN SMALL LETTER U WITH DIAERESIS */ +const XK_yacute = 0x00fd /* U+00FD LATIN SMALL LETTER Y WITH ACUTE */ +const XK_thorn = 0x00fe /* U+00FE LATIN SMALL LETTER THORN */ +const XK_ydiaeresis = 0x00ff /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */ +//endif /* XK_LATIN1 */ + +/* + * Latin 2 + * Byte 3 = 1 + */ + +//ifdef XK_LATIN2 +const XK_Aogonek = 0x01a1 /* U+0104 LATIN CAPITAL LETTER A WITH OGONEK */ +const XK_breve = 0x01a2 /* U+02D8 BREVE */ +const XK_Lstroke = 0x01a3 /* U+0141 LATIN CAPITAL LETTER L WITH STROKE */ +const XK_Lcaron = 0x01a5 /* U+013D LATIN CAPITAL LETTER L WITH CARON */ +const XK_Sacute = 0x01a6 /* U+015A LATIN CAPITAL LETTER S WITH ACUTE */ +const XK_Scaron = 0x01a9 /* U+0160 LATIN CAPITAL LETTER S WITH CARON */ +const XK_Scedilla = 0x01aa /* U+015E LATIN CAPITAL LETTER S WITH CEDILLA */ +const XK_Tcaron = 0x01ab /* U+0164 LATIN CAPITAL LETTER T WITH CARON */ +const XK_Zacute = 0x01ac /* U+0179 LATIN CAPITAL LETTER Z WITH ACUTE */ +const XK_Zcaron = 0x01ae /* U+017D LATIN CAPITAL LETTER Z WITH CARON */ +const XK_Zabovedot = 0x01af /* U+017B LATIN CAPITAL LETTER Z WITH DOT ABOVE */ +const XK_aogonek = 0x01b1 /* U+0105 LATIN SMALL LETTER A WITH OGONEK */ +const XK_ogonek = 0x01b2 /* U+02DB OGONEK */ +const XK_lstroke = 0x01b3 /* U+0142 LATIN SMALL LETTER L WITH STROKE */ +const XK_lcaron = 0x01b5 /* U+013E LATIN SMALL LETTER L WITH CARON */ +const XK_sacute = 0x01b6 /* U+015B LATIN SMALL LETTER S WITH ACUTE */ +const XK_caron = 0x01b7 /* U+02C7 CARON */ +const XK_scaron = 0x01b9 /* U+0161 LATIN SMALL LETTER S WITH CARON */ +const XK_scedilla = 0x01ba /* U+015F LATIN SMALL LETTER S WITH CEDILLA */ +const XK_tcaron = 0x01bb /* U+0165 LATIN SMALL LETTER T WITH CARON */ +const XK_zacute = 0x01bc /* U+017A LATIN SMALL LETTER Z WITH ACUTE */ +const XK_doubleacute = 0x01bd /* U+02DD DOUBLE ACUTE ACCENT */ +const XK_zcaron = 0x01be /* U+017E LATIN SMALL LETTER Z WITH CARON */ +const XK_zabovedot = 0x01bf /* U+017C LATIN SMALL LETTER Z WITH DOT ABOVE */ +const XK_Racute = 0x01c0 /* U+0154 LATIN CAPITAL LETTER R WITH ACUTE */ +const XK_Abreve = 0x01c3 /* U+0102 LATIN CAPITAL LETTER A WITH BREVE */ +const XK_Lacute = 0x01c5 /* U+0139 LATIN CAPITAL LETTER L WITH ACUTE */ +const XK_Cacute = 0x01c6 /* U+0106 LATIN CAPITAL LETTER C WITH ACUTE */ +const XK_Ccaron = 0x01c8 /* U+010C LATIN CAPITAL LETTER C WITH CARON */ +const XK_Eogonek = 0x01ca /* U+0118 LATIN CAPITAL LETTER E WITH OGONEK */ +const XK_Ecaron = 0x01cc /* U+011A LATIN CAPITAL LETTER E WITH CARON */ +const XK_Dcaron = 0x01cf /* U+010E LATIN CAPITAL LETTER D WITH CARON */ +const XK_Dstroke = 0x01d0 /* U+0110 LATIN CAPITAL LETTER D WITH STROKE */ +const XK_Nacute = 0x01d1 /* U+0143 LATIN CAPITAL LETTER N WITH ACUTE */ +const XK_Ncaron = 0x01d2 /* U+0147 LATIN CAPITAL LETTER N WITH CARON */ +const XK_Odoubleacute = 0x01d5 /* U+0150 LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */ +const XK_Rcaron = 0x01d8 /* U+0158 LATIN CAPITAL LETTER R WITH CARON */ +const XK_Uring = 0x01d9 /* U+016E LATIN CAPITAL LETTER U WITH RING ABOVE */ +const XK_Udoubleacute = 0x01db /* U+0170 LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */ +const XK_Tcedilla = 0x01de /* U+0162 LATIN CAPITAL LETTER T WITH CEDILLA */ +const XK_racute = 0x01e0 /* U+0155 LATIN SMALL LETTER R WITH ACUTE */ +const XK_abreve = 0x01e3 /* U+0103 LATIN SMALL LETTER A WITH BREVE */ +const XK_lacute = 0x01e5 /* U+013A LATIN SMALL LETTER L WITH ACUTE */ +const XK_cacute = 0x01e6 /* U+0107 LATIN SMALL LETTER C WITH ACUTE */ +const XK_ccaron = 0x01e8 /* U+010D LATIN SMALL LETTER C WITH CARON */ +const XK_eogonek = 0x01ea /* U+0119 LATIN SMALL LETTER E WITH OGONEK */ +const XK_ecaron = 0x01ec /* U+011B LATIN SMALL LETTER E WITH CARON */ +const XK_dcaron = 0x01ef /* U+010F LATIN SMALL LETTER D WITH CARON */ +const XK_dstroke = 0x01f0 /* U+0111 LATIN SMALL LETTER D WITH STROKE */ +const XK_nacute = 0x01f1 /* U+0144 LATIN SMALL LETTER N WITH ACUTE */ +const XK_ncaron = 0x01f2 /* U+0148 LATIN SMALL LETTER N WITH CARON */ +const XK_odoubleacute = 0x01f5 /* U+0151 LATIN SMALL LETTER O WITH DOUBLE ACUTE */ +const XK_rcaron = 0x01f8 /* U+0159 LATIN SMALL LETTER R WITH CARON */ +const XK_uring = 0x01f9 /* U+016F LATIN SMALL LETTER U WITH RING ABOVE */ +const XK_udoubleacute = 0x01fb /* U+0171 LATIN SMALL LETTER U WITH DOUBLE ACUTE */ +const XK_tcedilla = 0x01fe /* U+0163 LATIN SMALL LETTER T WITH CEDILLA */ +const XK_abovedot = 0x01ff /* U+02D9 DOT ABOVE */ +//endif /* XK_LATIN2 */ + +/* + * Latin 3 + * Byte 3 = 2 + */ + +//ifdef XK_LATIN3 +const XK_Hstroke = 0x02a1 /* U+0126 LATIN CAPITAL LETTER H WITH STROKE */ +const XK_Hcircumflex = 0x02a6 /* U+0124 LATIN CAPITAL LETTER H WITH CIRCUMFLEX */ +const XK_Iabovedot = 0x02a9 /* U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE */ +const XK_Gbreve = 0x02ab /* U+011E LATIN CAPITAL LETTER G WITH BREVE */ +const XK_Jcircumflex = 0x02ac /* U+0134 LATIN CAPITAL LETTER J WITH CIRCUMFLEX */ +const XK_hstroke = 0x02b1 /* U+0127 LATIN SMALL LETTER H WITH STROKE */ +const XK_hcircumflex = 0x02b6 /* U+0125 LATIN SMALL LETTER H WITH CIRCUMFLEX */ +const XK_idotless = 0x02b9 /* U+0131 LATIN SMALL LETTER DOTLESS I */ +const XK_gbreve = 0x02bb /* U+011F LATIN SMALL LETTER G WITH BREVE */ +const XK_jcircumflex = 0x02bc /* U+0135 LATIN SMALL LETTER J WITH CIRCUMFLEX */ +const XK_Cabovedot = 0x02c5 /* U+010A LATIN CAPITAL LETTER C WITH DOT ABOVE */ +const XK_Ccircumflex = 0x02c6 /* U+0108 LATIN CAPITAL LETTER C WITH CIRCUMFLEX */ +const XK_Gabovedot = 0x02d5 /* U+0120 LATIN CAPITAL LETTER G WITH DOT ABOVE */ +const XK_Gcircumflex = 0x02d8 /* U+011C LATIN CAPITAL LETTER G WITH CIRCUMFLEX */ +const XK_Ubreve = 0x02dd /* U+016C LATIN CAPITAL LETTER U WITH BREVE */ +const XK_Scircumflex = 0x02de /* U+015C LATIN CAPITAL LETTER S WITH CIRCUMFLEX */ +const XK_cabovedot = 0x02e5 /* U+010B LATIN SMALL LETTER C WITH DOT ABOVE */ +const XK_ccircumflex = 0x02e6 /* U+0109 LATIN SMALL LETTER C WITH CIRCUMFLEX */ +const XK_gabovedot = 0x02f5 /* U+0121 LATIN SMALL LETTER G WITH DOT ABOVE */ +const XK_gcircumflex = 0x02f8 /* U+011D LATIN SMALL LETTER G WITH CIRCUMFLEX */ +const XK_ubreve = 0x02fd /* U+016D LATIN SMALL LETTER U WITH BREVE */ +const XK_scircumflex = 0x02fe /* U+015D LATIN SMALL LETTER S WITH CIRCUMFLEX */ +//endif /* XK_LATIN3 */ + + +/* + * Latin 4 + * Byte 3 = 3 + */ + +//ifdef XK_LATIN4 +const XK_kra = 0x03a2 /* U+0138 LATIN SMALL LETTER KRA */ +const XK_kappa = 0x03a2 /* deprecated */ +const XK_Rcedilla = 0x03a3 /* U+0156 LATIN CAPITAL LETTER R WITH CEDILLA */ +const XK_Itilde = 0x03a5 /* U+0128 LATIN CAPITAL LETTER I WITH TILDE */ +const XK_Lcedilla = 0x03a6 /* U+013B LATIN CAPITAL LETTER L WITH CEDILLA */ +const XK_Emacron = 0x03aa /* U+0112 LATIN CAPITAL LETTER E WITH MACRON */ +const XK_Gcedilla = 0x03ab /* U+0122 LATIN CAPITAL LETTER G WITH CEDILLA */ +const XK_Tslash = 0x03ac /* U+0166 LATIN CAPITAL LETTER T WITH STROKE */ +const XK_rcedilla = 0x03b3 /* U+0157 LATIN SMALL LETTER R WITH CEDILLA */ +const XK_itilde = 0x03b5 /* U+0129 LATIN SMALL LETTER I WITH TILDE */ +const XK_lcedilla = 0x03b6 /* U+013C LATIN SMALL LETTER L WITH CEDILLA */ +const XK_emacron = 0x03ba /* U+0113 LATIN SMALL LETTER E WITH MACRON */ +const XK_gcedilla = 0x03bb /* U+0123 LATIN SMALL LETTER G WITH CEDILLA */ +const XK_tslash = 0x03bc /* U+0167 LATIN SMALL LETTER T WITH STROKE */ +const XK_ENG = 0x03bd /* U+014A LATIN CAPITAL LETTER ENG */ +const XK_eng = 0x03bf /* U+014B LATIN SMALL LETTER ENG */ +const XK_Amacron = 0x03c0 /* U+0100 LATIN CAPITAL LETTER A WITH MACRON */ +const XK_Iogonek = 0x03c7 /* U+012E LATIN CAPITAL LETTER I WITH OGONEK */ +const XK_Eabovedot = 0x03cc /* U+0116 LATIN CAPITAL LETTER E WITH DOT ABOVE */ +const XK_Imacron = 0x03cf /* U+012A LATIN CAPITAL LETTER I WITH MACRON */ +const XK_Ncedilla = 0x03d1 /* U+0145 LATIN CAPITAL LETTER N WITH CEDILLA */ +const XK_Omacron = 0x03d2 /* U+014C LATIN CAPITAL LETTER O WITH MACRON */ +const XK_Kcedilla = 0x03d3 /* U+0136 LATIN CAPITAL LETTER K WITH CEDILLA */ +const XK_Uogonek = 0x03d9 /* U+0172 LATIN CAPITAL LETTER U WITH OGONEK */ +const XK_Utilde = 0x03dd /* U+0168 LATIN CAPITAL LETTER U WITH TILDE */ +const XK_Umacron = 0x03de /* U+016A LATIN CAPITAL LETTER U WITH MACRON */ +const XK_amacron = 0x03e0 /* U+0101 LATIN SMALL LETTER A WITH MACRON */ +const XK_iogonek = 0x03e7 /* U+012F LATIN SMALL LETTER I WITH OGONEK */ +const XK_eabovedot = 0x03ec /* U+0117 LATIN SMALL LETTER E WITH DOT ABOVE */ +const XK_imacron = 0x03ef /* U+012B LATIN SMALL LETTER I WITH MACRON */ +const XK_ncedilla = 0x03f1 /* U+0146 LATIN SMALL LETTER N WITH CEDILLA */ +const XK_omacron = 0x03f2 /* U+014D LATIN SMALL LETTER O WITH MACRON */ +const XK_kcedilla = 0x03f3 /* U+0137 LATIN SMALL LETTER K WITH CEDILLA */ +const XK_uogonek = 0x03f9 /* U+0173 LATIN SMALL LETTER U WITH OGONEK */ +const XK_utilde = 0x03fd /* U+0169 LATIN SMALL LETTER U WITH TILDE */ +const XK_umacron = 0x03fe /* U+016B LATIN SMALL LETTER U WITH MACRON */ +//endif /* XK_LATIN4 */ + +/* + * Latin 8 + */ +//ifdef XK_LATIN8 +const XK_Wcircumflex = 0x1000174 /* U+0174 LATIN CAPITAL LETTER W WITH CIRCUMFLEX */ +const XK_wcircumflex = 0x1000175 /* U+0175 LATIN SMALL LETTER W WITH CIRCUMFLEX */ +const XK_Ycircumflex = 0x1000176 /* U+0176 LATIN CAPITAL LETTER Y WITH CIRCUMFLEX */ +const XK_ycircumflex = 0x1000177 /* U+0177 LATIN SMALL LETTER Y WITH CIRCUMFLEX */ +const XK_Babovedot = 0x1001e02 /* U+1E02 LATIN CAPITAL LETTER B WITH DOT ABOVE */ +const XK_babovedot = 0x1001e03 /* U+1E03 LATIN SMALL LETTER B WITH DOT ABOVE */ +const XK_Dabovedot = 0x1001e0a /* U+1E0A LATIN CAPITAL LETTER D WITH DOT ABOVE */ +const XK_dabovedot = 0x1001e0b /* U+1E0B LATIN SMALL LETTER D WITH DOT ABOVE */ +const XK_Fabovedot = 0x1001e1e /* U+1E1E LATIN CAPITAL LETTER F WITH DOT ABOVE */ +const XK_fabovedot = 0x1001e1f /* U+1E1F LATIN SMALL LETTER F WITH DOT ABOVE */ +const XK_Mabovedot = 0x1001e40 /* U+1E40 LATIN CAPITAL LETTER M WITH DOT ABOVE */ +const XK_mabovedot = 0x1001e41 /* U+1E41 LATIN SMALL LETTER M WITH DOT ABOVE */ +const XK_Pabovedot = 0x1001e56 /* U+1E56 LATIN CAPITAL LETTER P WITH DOT ABOVE */ +const XK_pabovedot = 0x1001e57 /* U+1E57 LATIN SMALL LETTER P WITH DOT ABOVE */ +const XK_Sabovedot = 0x1001e60 /* U+1E60 LATIN CAPITAL LETTER S WITH DOT ABOVE */ +const XK_sabovedot = 0x1001e61 /* U+1E61 LATIN SMALL LETTER S WITH DOT ABOVE */ +const XK_Tabovedot = 0x1001e6a /* U+1E6A LATIN CAPITAL LETTER T WITH DOT ABOVE */ +const XK_tabovedot = 0x1001e6b /* U+1E6B LATIN SMALL LETTER T WITH DOT ABOVE */ +const XK_Wgrave = 0x1001e80 /* U+1E80 LATIN CAPITAL LETTER W WITH GRAVE */ +const XK_wgrave = 0x1001e81 /* U+1E81 LATIN SMALL LETTER W WITH GRAVE */ +const XK_Wacute = 0x1001e82 /* U+1E82 LATIN CAPITAL LETTER W WITH ACUTE */ +const XK_wacute = 0x1001e83 /* U+1E83 LATIN SMALL LETTER W WITH ACUTE */ +const XK_Wdiaeresis = 0x1001e84 /* U+1E84 LATIN CAPITAL LETTER W WITH DIAERESIS */ +const XK_wdiaeresis = 0x1001e85 /* U+1E85 LATIN SMALL LETTER W WITH DIAERESIS */ +const XK_Ygrave = 0x1001ef2 /* U+1EF2 LATIN CAPITAL LETTER Y WITH GRAVE */ +const XK_ygrave = 0x1001ef3 /* U+1EF3 LATIN SMALL LETTER Y WITH GRAVE */ +//endif /* XK_LATIN8 */ + +/* + * Latin 9 + * Byte 3 = 0x13 + */ + +//ifdef XK_LATIN9 +const XK_OE = 0x13bc /* U+0152 LATIN CAPITAL LIGATURE OE */ +const XK_oe = 0x13bd /* U+0153 LATIN SMALL LIGATURE OE */ +const XK_Ydiaeresis = 0x13be /* U+0178 LATIN CAPITAL LETTER Y WITH DIAERESIS */ +//endif /* XK_LATIN9 */ + +/* + * Katakana + * Byte 3 = 4 + */ + +//ifdef XK_KATAKANA +const XK_overline = 0x047e /* U+203E OVERLINE */ +const XK_kana_fullstop = 0x04a1 /* U+3002 IDEOGRAPHIC FULL STOP */ +const XK_kana_openingbracket = 0x04a2 /* U+300C LEFT CORNER BRACKET */ +const XK_kana_closingbracket = 0x04a3 /* U+300D RIGHT CORNER BRACKET */ +const XK_kana_comma = 0x04a4 /* U+3001 IDEOGRAPHIC COMMA */ +const XK_kana_conjunctive = 0x04a5 /* U+30FB KATAKANA MIDDLE DOT */ +const XK_kana_middledot = 0x04a5 /* deprecated */ +const XK_kana_WO = 0x04a6 /* U+30F2 KATAKANA LETTER WO */ +const XK_kana_a = 0x04a7 /* U+30A1 KATAKANA LETTER SMALL A */ +const XK_kana_i = 0x04a8 /* U+30A3 KATAKANA LETTER SMALL I */ +const XK_kana_u = 0x04a9 /* U+30A5 KATAKANA LETTER SMALL U */ +const XK_kana_e = 0x04aa /* U+30A7 KATAKANA LETTER SMALL E */ +const XK_kana_o = 0x04ab /* U+30A9 KATAKANA LETTER SMALL O */ +const XK_kana_ya = 0x04ac /* U+30E3 KATAKANA LETTER SMALL YA */ +const XK_kana_yu = 0x04ad /* U+30E5 KATAKANA LETTER SMALL YU */ +const XK_kana_yo = 0x04ae /* U+30E7 KATAKANA LETTER SMALL YO */ +const XK_kana_tsu = 0x04af /* U+30C3 KATAKANA LETTER SMALL TU */ +const XK_kana_tu = 0x04af /* deprecated */ +const XK_prolongedsound = 0x04b0 /* U+30FC KATAKANA-HIRAGANA PROLONGED SOUND MARK */ +const XK_kana_A = 0x04b1 /* U+30A2 KATAKANA LETTER A */ +const XK_kana_I = 0x04b2 /* U+30A4 KATAKANA LETTER I */ +const XK_kana_U = 0x04b3 /* U+30A6 KATAKANA LETTER U */ +const XK_kana_E = 0x04b4 /* U+30A8 KATAKANA LETTER E */ +const XK_kana_O = 0x04b5 /* U+30AA KATAKANA LETTER O */ +const XK_kana_KA = 0x04b6 /* U+30AB KATAKANA LETTER KA */ +const XK_kana_KI = 0x04b7 /* U+30AD KATAKANA LETTER KI */ +const XK_kana_KU = 0x04b8 /* U+30AF KATAKANA LETTER KU */ +const XK_kana_KE = 0x04b9 /* U+30B1 KATAKANA LETTER KE */ +const XK_kana_KO = 0x04ba /* U+30B3 KATAKANA LETTER KO */ +const XK_kana_SA = 0x04bb /* U+30B5 KATAKANA LETTER SA */ +const XK_kana_SHI = 0x04bc /* U+30B7 KATAKANA LETTER SI */ +const XK_kana_SU = 0x04bd /* U+30B9 KATAKANA LETTER SU */ +const XK_kana_SE = 0x04be /* U+30BB KATAKANA LETTER SE */ +const XK_kana_SO = 0x04bf /* U+30BD KATAKANA LETTER SO */ +const XK_kana_TA = 0x04c0 /* U+30BF KATAKANA LETTER TA */ +const XK_kana_CHI = 0x04c1 /* U+30C1 KATAKANA LETTER TI */ +const XK_kana_TI = 0x04c1 /* deprecated */ +const XK_kana_TSU = 0x04c2 /* U+30C4 KATAKANA LETTER TU */ +const XK_kana_TU = 0x04c2 /* deprecated */ +const XK_kana_TE = 0x04c3 /* U+30C6 KATAKANA LETTER TE */ +const XK_kana_TO = 0x04c4 /* U+30C8 KATAKANA LETTER TO */ +const XK_kana_NA = 0x04c5 /* U+30CA KATAKANA LETTER NA */ +const XK_kana_NI = 0x04c6 /* U+30CB KATAKANA LETTER NI */ +const XK_kana_NU = 0x04c7 /* U+30CC KATAKANA LETTER NU */ +const XK_kana_NE = 0x04c8 /* U+30CD KATAKANA LETTER NE */ +const XK_kana_NO = 0x04c9 /* U+30CE KATAKANA LETTER NO */ +const XK_kana_HA = 0x04ca /* U+30CF KATAKANA LETTER HA */ +const XK_kana_HI = 0x04cb /* U+30D2 KATAKANA LETTER HI */ +const XK_kana_FU = 0x04cc /* U+30D5 KATAKANA LETTER HU */ +const XK_kana_HU = 0x04cc /* deprecated */ +const XK_kana_HE = 0x04cd /* U+30D8 KATAKANA LETTER HE */ +const XK_kana_HO = 0x04ce /* U+30DB KATAKANA LETTER HO */ +const XK_kana_MA = 0x04cf /* U+30DE KATAKANA LETTER MA */ +const XK_kana_MI = 0x04d0 /* U+30DF KATAKANA LETTER MI */ +const XK_kana_MU = 0x04d1 /* U+30E0 KATAKANA LETTER MU */ +const XK_kana_ME = 0x04d2 /* U+30E1 KATAKANA LETTER ME */ +const XK_kana_MO = 0x04d3 /* U+30E2 KATAKANA LETTER MO */ +const XK_kana_YA = 0x04d4 /* U+30E4 KATAKANA LETTER YA */ +const XK_kana_YU = 0x04d5 /* U+30E6 KATAKANA LETTER YU */ +const XK_kana_YO = 0x04d6 /* U+30E8 KATAKANA LETTER YO */ +const XK_kana_RA = 0x04d7 /* U+30E9 KATAKANA LETTER RA */ +const XK_kana_RI = 0x04d8 /* U+30EA KATAKANA LETTER RI */ +const XK_kana_RU = 0x04d9 /* U+30EB KATAKANA LETTER RU */ +const XK_kana_RE = 0x04da /* U+30EC KATAKANA LETTER RE */ +const XK_kana_RO = 0x04db /* U+30ED KATAKANA LETTER RO */ +const XK_kana_WA = 0x04dc /* U+30EF KATAKANA LETTER WA */ +const XK_kana_N = 0x04dd /* U+30F3 KATAKANA LETTER N */ +const XK_voicedsound = 0x04de /* U+309B KATAKANA-HIRAGANA VOICED SOUND MARK */ +const XK_semivoicedsound = 0x04df /* U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */ +const XK_kana_switch = 0xff7e /* Alias for mode_switch */ +//endif /* XK_KATAKANA */ + +/* + * Arabic + * Byte 3 = 5 + */ + +//ifdef XK_ARABIC +const XK_Farsi_0 = 0x10006f0 /* U+06F0 EXTENDED ARABIC-INDIC DIGIT ZERO */ +const XK_Farsi_1 = 0x10006f1 /* U+06F1 EXTENDED ARABIC-INDIC DIGIT ONE */ +const XK_Farsi_2 = 0x10006f2 /* U+06F2 EXTENDED ARABIC-INDIC DIGIT TWO */ +const XK_Farsi_3 = 0x10006f3 /* U+06F3 EXTENDED ARABIC-INDIC DIGIT THREE */ +const XK_Farsi_4 = 0x10006f4 /* U+06F4 EXTENDED ARABIC-INDIC DIGIT FOUR */ +const XK_Farsi_5 = 0x10006f5 /* U+06F5 EXTENDED ARABIC-INDIC DIGIT FIVE */ +const XK_Farsi_6 = 0x10006f6 /* U+06F6 EXTENDED ARABIC-INDIC DIGIT SIX */ +const XK_Farsi_7 = 0x10006f7 /* U+06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN */ +const XK_Farsi_8 = 0x10006f8 /* U+06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT */ +const XK_Farsi_9 = 0x10006f9 /* U+06F9 EXTENDED ARABIC-INDIC DIGIT NINE */ +const XK_Arabic_percent = 0x100066a /* U+066A ARABIC PERCENT SIGN */ +const XK_Arabic_superscript_alef = 0x1000670 /* U+0670 ARABIC LETTER SUPERSCRIPT ALEF */ +const XK_Arabic_tteh = 0x1000679 /* U+0679 ARABIC LETTER TTEH */ +const XK_Arabic_peh = 0x100067e /* U+067E ARABIC LETTER PEH */ +const XK_Arabic_tcheh = 0x1000686 /* U+0686 ARABIC LETTER TCHEH */ +const XK_Arabic_ddal = 0x1000688 /* U+0688 ARABIC LETTER DDAL */ +const XK_Arabic_rreh = 0x1000691 /* U+0691 ARABIC LETTER RREH */ +const XK_Arabic_comma = 0x05ac /* U+060C ARABIC COMMA */ +const XK_Arabic_fullstop = 0x10006d4 /* U+06D4 ARABIC FULL STOP */ +const XK_Arabic_0 = 0x1000660 /* U+0660 ARABIC-INDIC DIGIT ZERO */ +const XK_Arabic_1 = 0x1000661 /* U+0661 ARABIC-INDIC DIGIT ONE */ +const XK_Arabic_2 = 0x1000662 /* U+0662 ARABIC-INDIC DIGIT TWO */ +const XK_Arabic_3 = 0x1000663 /* U+0663 ARABIC-INDIC DIGIT THREE */ +const XK_Arabic_4 = 0x1000664 /* U+0664 ARABIC-INDIC DIGIT FOUR */ +const XK_Arabic_5 = 0x1000665 /* U+0665 ARABIC-INDIC DIGIT FIVE */ +const XK_Arabic_6 = 0x1000666 /* U+0666 ARABIC-INDIC DIGIT SIX */ +const XK_Arabic_7 = 0x1000667 /* U+0667 ARABIC-INDIC DIGIT SEVEN */ +const XK_Arabic_8 = 0x1000668 /* U+0668 ARABIC-INDIC DIGIT EIGHT */ +const XK_Arabic_9 = 0x1000669 /* U+0669 ARABIC-INDIC DIGIT NINE */ +const XK_Arabic_semicolon = 0x05bb /* U+061B ARABIC SEMICOLON */ +const XK_Arabic_question_mark = 0x05bf /* U+061F ARABIC QUESTION MARK */ +const XK_Arabic_hamza = 0x05c1 /* U+0621 ARABIC LETTER HAMZA */ +const XK_Arabic_maddaonalef = 0x05c2 /* U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE */ +const XK_Arabic_hamzaonalef = 0x05c3 /* U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE */ +const XK_Arabic_hamzaonwaw = 0x05c4 /* U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE */ +const XK_Arabic_hamzaunderalef = 0x05c5 /* U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW */ +const XK_Arabic_hamzaonyeh = 0x05c6 /* U+0626 ARABIC LETTER YEH WITH HAMZA ABOVE */ +const XK_Arabic_alef = 0x05c7 /* U+0627 ARABIC LETTER ALEF */ +const XK_Arabic_beh = 0x05c8 /* U+0628 ARABIC LETTER BEH */ +const XK_Arabic_tehmarbuta = 0x05c9 /* U+0629 ARABIC LETTER TEH MARBUTA */ +const XK_Arabic_teh = 0x05ca /* U+062A ARABIC LETTER TEH */ +const XK_Arabic_theh = 0x05cb /* U+062B ARABIC LETTER THEH */ +const XK_Arabic_jeem = 0x05cc /* U+062C ARABIC LETTER JEEM */ +const XK_Arabic_hah = 0x05cd /* U+062D ARABIC LETTER HAH */ +const XK_Arabic_khah = 0x05ce /* U+062E ARABIC LETTER KHAH */ +const XK_Arabic_dal = 0x05cf /* U+062F ARABIC LETTER DAL */ +const XK_Arabic_thal = 0x05d0 /* U+0630 ARABIC LETTER THAL */ +const XK_Arabic_ra = 0x05d1 /* U+0631 ARABIC LETTER REH */ +const XK_Arabic_zain = 0x05d2 /* U+0632 ARABIC LETTER ZAIN */ +const XK_Arabic_seen = 0x05d3 /* U+0633 ARABIC LETTER SEEN */ +const XK_Arabic_sheen = 0x05d4 /* U+0634 ARABIC LETTER SHEEN */ +const XK_Arabic_sad = 0x05d5 /* U+0635 ARABIC LETTER SAD */ +const XK_Arabic_dad = 0x05d6 /* U+0636 ARABIC LETTER DAD */ +const XK_Arabic_tah = 0x05d7 /* U+0637 ARABIC LETTER TAH */ +const XK_Arabic_zah = 0x05d8 /* U+0638 ARABIC LETTER ZAH */ +const XK_Arabic_ain = 0x05d9 /* U+0639 ARABIC LETTER AIN */ +const XK_Arabic_ghain = 0x05da /* U+063A ARABIC LETTER GHAIN */ +const XK_Arabic_tatweel = 0x05e0 /* U+0640 ARABIC TATWEEL */ +const XK_Arabic_feh = 0x05e1 /* U+0641 ARABIC LETTER FEH */ +const XK_Arabic_qaf = 0x05e2 /* U+0642 ARABIC LETTER QAF */ +const XK_Arabic_kaf = 0x05e3 /* U+0643 ARABIC LETTER KAF */ +const XK_Arabic_lam = 0x05e4 /* U+0644 ARABIC LETTER LAM */ +const XK_Arabic_meem = 0x05e5 /* U+0645 ARABIC LETTER MEEM */ +const XK_Arabic_noon = 0x05e6 /* U+0646 ARABIC LETTER NOON */ +const XK_Arabic_ha = 0x05e7 /* U+0647 ARABIC LETTER HEH */ +const XK_Arabic_heh = 0x05e7 /* deprecated */ +const XK_Arabic_waw = 0x05e8 /* U+0648 ARABIC LETTER WAW */ +const XK_Arabic_alefmaksura = 0x05e9 /* U+0649 ARABIC LETTER ALEF MAKSURA */ +const XK_Arabic_yeh = 0x05ea /* U+064A ARABIC LETTER YEH */ +const XK_Arabic_fathatan = 0x05eb /* U+064B ARABIC FATHATAN */ +const XK_Arabic_dammatan = 0x05ec /* U+064C ARABIC DAMMATAN */ +const XK_Arabic_kasratan = 0x05ed /* U+064D ARABIC KASRATAN */ +const XK_Arabic_fatha = 0x05ee /* U+064E ARABIC FATHA */ +const XK_Arabic_damma = 0x05ef /* U+064F ARABIC DAMMA */ +const XK_Arabic_kasra = 0x05f0 /* U+0650 ARABIC KASRA */ +const XK_Arabic_shadda = 0x05f1 /* U+0651 ARABIC SHADDA */ +const XK_Arabic_sukun = 0x05f2 /* U+0652 ARABIC SUKUN */ +const XK_Arabic_madda_above = 0x1000653 /* U+0653 ARABIC MADDAH ABOVE */ +const XK_Arabic_hamza_above = 0x1000654 /* U+0654 ARABIC HAMZA ABOVE */ +const XK_Arabic_hamza_below = 0x1000655 /* U+0655 ARABIC HAMZA BELOW */ +const XK_Arabic_jeh = 0x1000698 /* U+0698 ARABIC LETTER JEH */ +const XK_Arabic_veh = 0x10006a4 /* U+06A4 ARABIC LETTER VEH */ +const XK_Arabic_keheh = 0x10006a9 /* U+06A9 ARABIC LETTER KEHEH */ +const XK_Arabic_gaf = 0x10006af /* U+06AF ARABIC LETTER GAF */ +const XK_Arabic_noon_ghunna = 0x10006ba /* U+06BA ARABIC LETTER NOON GHUNNA */ +const XK_Arabic_heh_doachashmee = 0x10006be /* U+06BE ARABIC LETTER HEH DOACHASHMEE */ +const XK_Farsi_yeh = 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */ +const XK_Arabic_farsi_yeh = 0x10006cc /* U+06CC ARABIC LETTER FARSI YEH */ +const XK_Arabic_yeh_baree = 0x10006d2 /* U+06D2 ARABIC LETTER YEH BARREE */ +const XK_Arabic_heh_goal = 0x10006c1 /* U+06C1 ARABIC LETTER HEH GOAL */ +const XK_Arabic_switch = 0xff7e /* Alias for mode_switch */ +//endif /* XK_ARABIC */ + +/* + * Cyrillic + * Byte 3 = 6 + */ +//ifdef XK_CYRILLIC +const XK_Cyrillic_GHE_bar = 0x1000492 /* U+0492 CYRILLIC CAPITAL LETTER GHE WITH STROKE */ +const XK_Cyrillic_ghe_bar = 0x1000493 /* U+0493 CYRILLIC SMALL LETTER GHE WITH STROKE */ +const XK_Cyrillic_ZHE_descender = 0x1000496 /* U+0496 CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER */ +const XK_Cyrillic_zhe_descender = 0x1000497 /* U+0497 CYRILLIC SMALL LETTER ZHE WITH DESCENDER */ +const XK_Cyrillic_KA_descender = 0x100049a /* U+049A CYRILLIC CAPITAL LETTER KA WITH DESCENDER */ +const XK_Cyrillic_ka_descender = 0x100049b /* U+049B CYRILLIC SMALL LETTER KA WITH DESCENDER */ +const XK_Cyrillic_KA_vertstroke = 0x100049c /* U+049C CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE */ +const XK_Cyrillic_ka_vertstroke = 0x100049d /* U+049D CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE */ +const XK_Cyrillic_EN_descender = 0x10004a2 /* U+04A2 CYRILLIC CAPITAL LETTER EN WITH DESCENDER */ +const XK_Cyrillic_en_descender = 0x10004a3 /* U+04A3 CYRILLIC SMALL LETTER EN WITH DESCENDER */ +const XK_Cyrillic_U_straight = 0x10004ae /* U+04AE CYRILLIC CAPITAL LETTER STRAIGHT U */ +const XK_Cyrillic_u_straight = 0x10004af /* U+04AF CYRILLIC SMALL LETTER STRAIGHT U */ +const XK_Cyrillic_U_straight_bar = 0x10004b0 /* U+04B0 CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE */ +const XK_Cyrillic_u_straight_bar = 0x10004b1 /* U+04B1 CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE */ +const XK_Cyrillic_HA_descender = 0x10004b2 /* U+04B2 CYRILLIC CAPITAL LETTER HA WITH DESCENDER */ +const XK_Cyrillic_ha_descender = 0x10004b3 /* U+04B3 CYRILLIC SMALL LETTER HA WITH DESCENDER */ +const XK_Cyrillic_CHE_descender = 0x10004b6 /* U+04B6 CYRILLIC CAPITAL LETTER CHE WITH DESCENDER */ +const XK_Cyrillic_che_descender = 0x10004b7 /* U+04B7 CYRILLIC SMALL LETTER CHE WITH DESCENDER */ +const XK_Cyrillic_CHE_vertstroke = 0x10004b8 /* U+04B8 CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE */ +const XK_Cyrillic_che_vertstroke = 0x10004b9 /* U+04B9 CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE */ +const XK_Cyrillic_SHHA = 0x10004ba /* U+04BA CYRILLIC CAPITAL LETTER SHHA */ +const XK_Cyrillic_shha = 0x10004bb /* U+04BB CYRILLIC SMALL LETTER SHHA */ + +const XK_Cyrillic_SCHWA = 0x10004d8 /* U+04D8 CYRILLIC CAPITAL LETTER SCHWA */ +const XK_Cyrillic_schwa = 0x10004d9 /* U+04D9 CYRILLIC SMALL LETTER SCHWA */ +const XK_Cyrillic_I_macron = 0x10004e2 /* U+04E2 CYRILLIC CAPITAL LETTER I WITH MACRON */ +const XK_Cyrillic_i_macron = 0x10004e3 /* U+04E3 CYRILLIC SMALL LETTER I WITH MACRON */ +const XK_Cyrillic_O_bar = 0x10004e8 /* U+04E8 CYRILLIC CAPITAL LETTER BARRED O */ +const XK_Cyrillic_o_bar = 0x10004e9 /* U+04E9 CYRILLIC SMALL LETTER BARRED O */ +const XK_Cyrillic_U_macron = 0x10004ee /* U+04EE CYRILLIC CAPITAL LETTER U WITH MACRON */ +const XK_Cyrillic_u_macron = 0x10004ef /* U+04EF CYRILLIC SMALL LETTER U WITH MACRON */ + +const XK_Serbian_dje = 0x06a1 /* U+0452 CYRILLIC SMALL LETTER DJE */ +const XK_Macedonia_gje = 0x06a2 /* U+0453 CYRILLIC SMALL LETTER GJE */ +const XK_Cyrillic_io = 0x06a3 /* U+0451 CYRILLIC SMALL LETTER IO */ +const XK_Ukrainian_ie = 0x06a4 /* U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE */ +const XK_Ukranian_je = 0x06a4 /* deprecated */ +const XK_Macedonia_dse = 0x06a5 /* U+0455 CYRILLIC SMALL LETTER DZE */ +const XK_Ukrainian_i = 0x06a6 /* U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */ +const XK_Ukranian_i = 0x06a6 /* deprecated */ +const XK_Ukrainian_yi = 0x06a7 /* U+0457 CYRILLIC SMALL LETTER YI */ +const XK_Ukranian_yi = 0x06a7 /* deprecated */ +const XK_Cyrillic_je = 0x06a8 /* U+0458 CYRILLIC SMALL LETTER JE */ +const XK_Serbian_je = 0x06a8 /* deprecated */ +const XK_Cyrillic_lje = 0x06a9 /* U+0459 CYRILLIC SMALL LETTER LJE */ +const XK_Serbian_lje = 0x06a9 /* deprecated */ +const XK_Cyrillic_nje = 0x06aa /* U+045A CYRILLIC SMALL LETTER NJE */ +const XK_Serbian_nje = 0x06aa /* deprecated */ +const XK_Serbian_tshe = 0x06ab /* U+045B CYRILLIC SMALL LETTER TSHE */ +const XK_Macedonia_kje = 0x06ac /* U+045C CYRILLIC SMALL LETTER KJE */ +const XK_Ukrainian_ghe_with_upturn = 0x06ad /* U+0491 CYRILLIC SMALL LETTER GHE WITH UPTURN */ +const XK_Byelorussian_shortu = 0x06ae /* U+045E CYRILLIC SMALL LETTER SHORT U */ +const XK_Cyrillic_dzhe = 0x06af /* U+045F CYRILLIC SMALL LETTER DZHE */ +const XK_Serbian_dze = 0x06af /* deprecated */ +const XK_numerosign = 0x06b0 /* U+2116 NUMERO SIGN */ +const XK_Serbian_DJE = 0x06b1 /* U+0402 CYRILLIC CAPITAL LETTER DJE */ +const XK_Macedonia_GJE = 0x06b2 /* U+0403 CYRILLIC CAPITAL LETTER GJE */ +const XK_Cyrillic_IO = 0x06b3 /* U+0401 CYRILLIC CAPITAL LETTER IO */ +const XK_Ukrainian_IE = 0x06b4 /* U+0404 CYRILLIC CAPITAL LETTER UKRAINIAN IE */ +const XK_Ukranian_JE = 0x06b4 /* deprecated */ +const XK_Macedonia_DSE = 0x06b5 /* U+0405 CYRILLIC CAPITAL LETTER DZE */ +const XK_Ukrainian_I = 0x06b6 /* U+0406 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */ +const XK_Ukranian_I = 0x06b6 /* deprecated */ +const XK_Ukrainian_YI = 0x06b7 /* U+0407 CYRILLIC CAPITAL LETTER YI */ +const XK_Ukranian_YI = 0x06b7 /* deprecated */ +const XK_Cyrillic_JE = 0x06b8 /* U+0408 CYRILLIC CAPITAL LETTER JE */ +const XK_Serbian_JE = 0x06b8 /* deprecated */ +const XK_Cyrillic_LJE = 0x06b9 /* U+0409 CYRILLIC CAPITAL LETTER LJE */ +const XK_Serbian_LJE = 0x06b9 /* deprecated */ +const XK_Cyrillic_NJE = 0x06ba /* U+040A CYRILLIC CAPITAL LETTER NJE */ +const XK_Serbian_NJE = 0x06ba /* deprecated */ +const XK_Serbian_TSHE = 0x06bb /* U+040B CYRILLIC CAPITAL LETTER TSHE */ +const XK_Macedonia_KJE = 0x06bc /* U+040C CYRILLIC CAPITAL LETTER KJE */ +const XK_Ukrainian_GHE_WITH_UPTURN = 0x06bd /* U+0490 CYRILLIC CAPITAL LETTER GHE WITH UPTURN */ +const XK_Byelorussian_SHORTU = 0x06be /* U+040E CYRILLIC CAPITAL LETTER SHORT U */ +const XK_Cyrillic_DZHE = 0x06bf /* U+040F CYRILLIC CAPITAL LETTER DZHE */ +const XK_Serbian_DZE = 0x06bf /* deprecated */ +const XK_Cyrillic_yu = 0x06c0 /* U+044E CYRILLIC SMALL LETTER YU */ +const XK_Cyrillic_a = 0x06c1 /* U+0430 CYRILLIC SMALL LETTER A */ +const XK_Cyrillic_be = 0x06c2 /* U+0431 CYRILLIC SMALL LETTER BE */ +const XK_Cyrillic_tse = 0x06c3 /* U+0446 CYRILLIC SMALL LETTER TSE */ +const XK_Cyrillic_de = 0x06c4 /* U+0434 CYRILLIC SMALL LETTER DE */ +const XK_Cyrillic_ie = 0x06c5 /* U+0435 CYRILLIC SMALL LETTER IE */ +const XK_Cyrillic_ef = 0x06c6 /* U+0444 CYRILLIC SMALL LETTER EF */ +const XK_Cyrillic_ghe = 0x06c7 /* U+0433 CYRILLIC SMALL LETTER GHE */ +const XK_Cyrillic_ha = 0x06c8 /* U+0445 CYRILLIC SMALL LETTER HA */ +const XK_Cyrillic_i = 0x06c9 /* U+0438 CYRILLIC SMALL LETTER I */ +const XK_Cyrillic_shorti = 0x06ca /* U+0439 CYRILLIC SMALL LETTER SHORT I */ +const XK_Cyrillic_ka = 0x06cb /* U+043A CYRILLIC SMALL LETTER KA */ +const XK_Cyrillic_el = 0x06cc /* U+043B CYRILLIC SMALL LETTER EL */ +const XK_Cyrillic_em = 0x06cd /* U+043C CYRILLIC SMALL LETTER EM */ +const XK_Cyrillic_en = 0x06ce /* U+043D CYRILLIC SMALL LETTER EN */ +const XK_Cyrillic_o = 0x06cf /* U+043E CYRILLIC SMALL LETTER O */ +const XK_Cyrillic_pe = 0x06d0 /* U+043F CYRILLIC SMALL LETTER PE */ +const XK_Cyrillic_ya = 0x06d1 /* U+044F CYRILLIC SMALL LETTER YA */ +const XK_Cyrillic_er = 0x06d2 /* U+0440 CYRILLIC SMALL LETTER ER */ +const XK_Cyrillic_es = 0x06d3 /* U+0441 CYRILLIC SMALL LETTER ES */ +const XK_Cyrillic_te = 0x06d4 /* U+0442 CYRILLIC SMALL LETTER TE */ +const XK_Cyrillic_u = 0x06d5 /* U+0443 CYRILLIC SMALL LETTER U */ +const XK_Cyrillic_zhe = 0x06d6 /* U+0436 CYRILLIC SMALL LETTER ZHE */ +const XK_Cyrillic_ve = 0x06d7 /* U+0432 CYRILLIC SMALL LETTER VE */ +const XK_Cyrillic_softsign = 0x06d8 /* U+044C CYRILLIC SMALL LETTER SOFT SIGN */ +const XK_Cyrillic_yeru = 0x06d9 /* U+044B CYRILLIC SMALL LETTER YERU */ +const XK_Cyrillic_ze = 0x06da /* U+0437 CYRILLIC SMALL LETTER ZE */ +const XK_Cyrillic_sha = 0x06db /* U+0448 CYRILLIC SMALL LETTER SHA */ +const XK_Cyrillic_e = 0x06dc /* U+044D CYRILLIC SMALL LETTER E */ +const XK_Cyrillic_shcha = 0x06dd /* U+0449 CYRILLIC SMALL LETTER SHCHA */ +const XK_Cyrillic_che = 0x06de /* U+0447 CYRILLIC SMALL LETTER CHE */ +const XK_Cyrillic_hardsign = 0x06df /* U+044A CYRILLIC SMALL LETTER HARD SIGN */ +const XK_Cyrillic_YU = 0x06e0 /* U+042E CYRILLIC CAPITAL LETTER YU */ +const XK_Cyrillic_A = 0x06e1 /* U+0410 CYRILLIC CAPITAL LETTER A */ +const XK_Cyrillic_BE = 0x06e2 /* U+0411 CYRILLIC CAPITAL LETTER BE */ +const XK_Cyrillic_TSE = 0x06e3 /* U+0426 CYRILLIC CAPITAL LETTER TSE */ +const XK_Cyrillic_DE = 0x06e4 /* U+0414 CYRILLIC CAPITAL LETTER DE */ +const XK_Cyrillic_IE = 0x06e5 /* U+0415 CYRILLIC CAPITAL LETTER IE */ +const XK_Cyrillic_EF = 0x06e6 /* U+0424 CYRILLIC CAPITAL LETTER EF */ +const XK_Cyrillic_GHE = 0x06e7 /* U+0413 CYRILLIC CAPITAL LETTER GHE */ +const XK_Cyrillic_HA = 0x06e8 /* U+0425 CYRILLIC CAPITAL LETTER HA */ +const XK_Cyrillic_I = 0x06e9 /* U+0418 CYRILLIC CAPITAL LETTER I */ +const XK_Cyrillic_SHORTI = 0x06ea /* U+0419 CYRILLIC CAPITAL LETTER SHORT I */ +const XK_Cyrillic_KA = 0x06eb /* U+041A CYRILLIC CAPITAL LETTER KA */ +const XK_Cyrillic_EL = 0x06ec /* U+041B CYRILLIC CAPITAL LETTER EL */ +const XK_Cyrillic_EM = 0x06ed /* U+041C CYRILLIC CAPITAL LETTER EM */ +const XK_Cyrillic_EN = 0x06ee /* U+041D CYRILLIC CAPITAL LETTER EN */ +const XK_Cyrillic_O = 0x06ef /* U+041E CYRILLIC CAPITAL LETTER O */ +const XK_Cyrillic_PE = 0x06f0 /* U+041F CYRILLIC CAPITAL LETTER PE */ +const XK_Cyrillic_YA = 0x06f1 /* U+042F CYRILLIC CAPITAL LETTER YA */ +const XK_Cyrillic_ER = 0x06f2 /* U+0420 CYRILLIC CAPITAL LETTER ER */ +const XK_Cyrillic_ES = 0x06f3 /* U+0421 CYRILLIC CAPITAL LETTER ES */ +const XK_Cyrillic_TE = 0x06f4 /* U+0422 CYRILLIC CAPITAL LETTER TE */ +const XK_Cyrillic_U = 0x06f5 /* U+0423 CYRILLIC CAPITAL LETTER U */ +const XK_Cyrillic_ZHE = 0x06f6 /* U+0416 CYRILLIC CAPITAL LETTER ZHE */ +const XK_Cyrillic_VE = 0x06f7 /* U+0412 CYRILLIC CAPITAL LETTER VE */ +const XK_Cyrillic_SOFTSIGN = 0x06f8 /* U+042C CYRILLIC CAPITAL LETTER SOFT SIGN */ +const XK_Cyrillic_YERU = 0x06f9 /* U+042B CYRILLIC CAPITAL LETTER YERU */ +const XK_Cyrillic_ZE = 0x06fa /* U+0417 CYRILLIC CAPITAL LETTER ZE */ +const XK_Cyrillic_SHA = 0x06fb /* U+0428 CYRILLIC CAPITAL LETTER SHA */ +const XK_Cyrillic_E = 0x06fc /* U+042D CYRILLIC CAPITAL LETTER E */ +const XK_Cyrillic_SHCHA = 0x06fd /* U+0429 CYRILLIC CAPITAL LETTER SHCHA */ +const XK_Cyrillic_CHE = 0x06fe /* U+0427 CYRILLIC CAPITAL LETTER CHE */ +const XK_Cyrillic_HARDSIGN = 0x06ff /* U+042A CYRILLIC CAPITAL LETTER HARD SIGN */ +//endif /* XK_CYRILLIC */ + +/* + * Greek + * (based on an early draft of, and not quite identical to, ISO/IEC 8859-7) + * Byte 3 = 7 + */ + +//ifdef XK_GREEK +const XK_Greek_ALPHAaccent = 0x07a1 /* U+0386 GREEK CAPITAL LETTER ALPHA WITH TONOS */ +const XK_Greek_EPSILONaccent = 0x07a2 /* U+0388 GREEK CAPITAL LETTER EPSILON WITH TONOS */ +const XK_Greek_ETAaccent = 0x07a3 /* U+0389 GREEK CAPITAL LETTER ETA WITH TONOS */ +const XK_Greek_IOTAaccent = 0x07a4 /* U+038A GREEK CAPITAL LETTER IOTA WITH TONOS */ +const XK_Greek_IOTAdieresis = 0x07a5 /* U+03AA GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */ +const XK_Greek_IOTAdiaeresis = 0x07a5 /* old typo */ +const XK_Greek_OMICRONaccent = 0x07a7 /* U+038C GREEK CAPITAL LETTER OMICRON WITH TONOS */ +const XK_Greek_UPSILONaccent = 0x07a8 /* U+038E GREEK CAPITAL LETTER UPSILON WITH TONOS */ +const XK_Greek_UPSILONdieresis = 0x07a9 /* U+03AB GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */ +const XK_Greek_OMEGAaccent = 0x07ab /* U+038F GREEK CAPITAL LETTER OMEGA WITH TONOS */ +const XK_Greek_accentdieresis = 0x07ae /* U+0385 GREEK DIALYTIKA TONOS */ +const XK_Greek_horizbar = 0x07af /* U+2015 HORIZONTAL BAR */ +const XK_Greek_alphaaccent = 0x07b1 /* U+03AC GREEK SMALL LETTER ALPHA WITH TONOS */ +const XK_Greek_epsilonaccent = 0x07b2 /* U+03AD GREEK SMALL LETTER EPSILON WITH TONOS */ +const XK_Greek_etaaccent = 0x07b3 /* U+03AE GREEK SMALL LETTER ETA WITH TONOS */ +const XK_Greek_iotaaccent = 0x07b4 /* U+03AF GREEK SMALL LETTER IOTA WITH TONOS */ +const XK_Greek_iotadieresis = 0x07b5 /* U+03CA GREEK SMALL LETTER IOTA WITH DIALYTIKA */ +const XK_Greek_iotaaccentdieresis = 0x07b6 /* U+0390 GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */ +const XK_Greek_omicronaccent = 0x07b7 /* U+03CC GREEK SMALL LETTER OMICRON WITH TONOS */ +const XK_Greek_upsilonaccent = 0x07b8 /* U+03CD GREEK SMALL LETTER UPSILON WITH TONOS */ +const XK_Greek_upsilondieresis = 0x07b9 /* U+03CB GREEK SMALL LETTER UPSILON WITH DIALYTIKA */ +const XK_Greek_upsilonaccentdieresis = 0x07ba /* U+03B0 GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */ +const XK_Greek_omegaaccent = 0x07bb /* U+03CE GREEK SMALL LETTER OMEGA WITH TONOS */ +const XK_Greek_ALPHA = 0x07c1 /* U+0391 GREEK CAPITAL LETTER ALPHA */ +const XK_Greek_BETA = 0x07c2 /* U+0392 GREEK CAPITAL LETTER BETA */ +const XK_Greek_GAMMA = 0x07c3 /* U+0393 GREEK CAPITAL LETTER GAMMA */ +const XK_Greek_DELTA = 0x07c4 /* U+0394 GREEK CAPITAL LETTER DELTA */ +const XK_Greek_EPSILON = 0x07c5 /* U+0395 GREEK CAPITAL LETTER EPSILON */ +const XK_Greek_ZETA = 0x07c6 /* U+0396 GREEK CAPITAL LETTER ZETA */ +const XK_Greek_ETA = 0x07c7 /* U+0397 GREEK CAPITAL LETTER ETA */ +const XK_Greek_THETA = 0x07c8 /* U+0398 GREEK CAPITAL LETTER THETA */ +const XK_Greek_IOTA = 0x07c9 /* U+0399 GREEK CAPITAL LETTER IOTA */ +const XK_Greek_KAPPA = 0x07ca /* U+039A GREEK CAPITAL LETTER KAPPA */ +const XK_Greek_LAMDA = 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */ +const XK_Greek_LAMBDA = 0x07cb /* U+039B GREEK CAPITAL LETTER LAMDA */ +const XK_Greek_MU = 0x07cc /* U+039C GREEK CAPITAL LETTER MU */ +const XK_Greek_NU = 0x07cd /* U+039D GREEK CAPITAL LETTER NU */ +const XK_Greek_XI = 0x07ce /* U+039E GREEK CAPITAL LETTER XI */ +const XK_Greek_OMICRON = 0x07cf /* U+039F GREEK CAPITAL LETTER OMICRON */ +const XK_Greek_PI = 0x07d0 /* U+03A0 GREEK CAPITAL LETTER PI */ +const XK_Greek_RHO = 0x07d1 /* U+03A1 GREEK CAPITAL LETTER RHO */ +const XK_Greek_SIGMA = 0x07d2 /* U+03A3 GREEK CAPITAL LETTER SIGMA */ +const XK_Greek_TAU = 0x07d4 /* U+03A4 GREEK CAPITAL LETTER TAU */ +const XK_Greek_UPSILON = 0x07d5 /* U+03A5 GREEK CAPITAL LETTER UPSILON */ +const XK_Greek_PHI = 0x07d6 /* U+03A6 GREEK CAPITAL LETTER PHI */ +const XK_Greek_CHI = 0x07d7 /* U+03A7 GREEK CAPITAL LETTER CHI */ +const XK_Greek_PSI = 0x07d8 /* U+03A8 GREEK CAPITAL LETTER PSI */ +const XK_Greek_OMEGA = 0x07d9 /* U+03A9 GREEK CAPITAL LETTER OMEGA */ +const XK_Greek_alpha = 0x07e1 /* U+03B1 GREEK SMALL LETTER ALPHA */ +const XK_Greek_beta = 0x07e2 /* U+03B2 GREEK SMALL LETTER BETA */ +const XK_Greek_gamma = 0x07e3 /* U+03B3 GREEK SMALL LETTER GAMMA */ +const XK_Greek_delta = 0x07e4 /* U+03B4 GREEK SMALL LETTER DELTA */ +const XK_Greek_epsilon = 0x07e5 /* U+03B5 GREEK SMALL LETTER EPSILON */ +const XK_Greek_zeta = 0x07e6 /* U+03B6 GREEK SMALL LETTER ZETA */ +const XK_Greek_eta = 0x07e7 /* U+03B7 GREEK SMALL LETTER ETA */ +const XK_Greek_theta = 0x07e8 /* U+03B8 GREEK SMALL LETTER THETA */ +const XK_Greek_iota = 0x07e9 /* U+03B9 GREEK SMALL LETTER IOTA */ +const XK_Greek_kappa = 0x07ea /* U+03BA GREEK SMALL LETTER KAPPA */ +const XK_Greek_lamda = 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */ +const XK_Greek_lambda = 0x07eb /* U+03BB GREEK SMALL LETTER LAMDA */ +const XK_Greek_mu = 0x07ec /* U+03BC GREEK SMALL LETTER MU */ +const XK_Greek_nu = 0x07ed /* U+03BD GREEK SMALL LETTER NU */ +const XK_Greek_xi = 0x07ee /* U+03BE GREEK SMALL LETTER XI */ +const XK_Greek_omicron = 0x07ef /* U+03BF GREEK SMALL LETTER OMICRON */ +const XK_Greek_pi = 0x07f0 /* U+03C0 GREEK SMALL LETTER PI */ +const XK_Greek_rho = 0x07f1 /* U+03C1 GREEK SMALL LETTER RHO */ +const XK_Greek_sigma = 0x07f2 /* U+03C3 GREEK SMALL LETTER SIGMA */ +const XK_Greek_finalsmallsigma = 0x07f3 /* U+03C2 GREEK SMALL LETTER FINAL SIGMA */ +const XK_Greek_tau = 0x07f4 /* U+03C4 GREEK SMALL LETTER TAU */ +const XK_Greek_upsilon = 0x07f5 /* U+03C5 GREEK SMALL LETTER UPSILON */ +const XK_Greek_phi = 0x07f6 /* U+03C6 GREEK SMALL LETTER PHI */ +const XK_Greek_chi = 0x07f7 /* U+03C7 GREEK SMALL LETTER CHI */ +const XK_Greek_psi = 0x07f8 /* U+03C8 GREEK SMALL LETTER PSI */ +const XK_Greek_omega = 0x07f9 /* U+03C9 GREEK SMALL LETTER OMEGA */ +const XK_Greek_switch = 0xff7e /* Alias for mode_switch */ +//endif /* XK_GREEK */ + +/* + * Technical + * (from the DEC VT330/VT420 Technical Character Set, http://vt100.net/charsets/technical.html) + * Byte 3 = 8 + */ + +//ifdef XK_TECHNICAL +const XK_leftradical = 0x08a1 /* U+23B7 RADICAL SYMBOL BOTTOM */ +const XK_topleftradical = 0x08a2 /*(U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT)*/ +const XK_horizconnector = 0x08a3 /*(U+2500 BOX DRAWINGS LIGHT HORIZONTAL)*/ +const XK_topintegral = 0x08a4 /* U+2320 TOP HALF INTEGRAL */ +const XK_botintegral = 0x08a5 /* U+2321 BOTTOM HALF INTEGRAL */ +const XK_vertconnector = 0x08a6 /*(U+2502 BOX DRAWINGS LIGHT VERTICAL)*/ +const XK_topleftsqbracket = 0x08a7 /* U+23A1 LEFT SQUARE BRACKET UPPER CORNER */ +const XK_botleftsqbracket = 0x08a8 /* U+23A3 LEFT SQUARE BRACKET LOWER CORNER */ +const XK_toprightsqbracket = 0x08a9 /* U+23A4 RIGHT SQUARE BRACKET UPPER CORNER */ +const XK_botrightsqbracket = 0x08aa /* U+23A6 RIGHT SQUARE BRACKET LOWER CORNER */ +const XK_topleftparens = 0x08ab /* U+239B LEFT PARENTHESIS UPPER HOOK */ +const XK_botleftparens = 0x08ac /* U+239D LEFT PARENTHESIS LOWER HOOK */ +const XK_toprightparens = 0x08ad /* U+239E RIGHT PARENTHESIS UPPER HOOK */ +const XK_botrightparens = 0x08ae /* U+23A0 RIGHT PARENTHESIS LOWER HOOK */ +const XK_leftmiddlecurlybrace = 0x08af /* U+23A8 LEFT CURLY BRACKET MIDDLE PIECE */ +const XK_rightmiddlecurlybrace = 0x08b0 /* U+23AC RIGHT CURLY BRACKET MIDDLE PIECE */ +const XK_topleftsummation = 0x08b1 +const XK_botleftsummation = 0x08b2 +const XK_topvertsummationconnector = 0x08b3 +const XK_botvertsummationconnector = 0x08b4 +const XK_toprightsummation = 0x08b5 +const XK_botrightsummation = 0x08b6 +const XK_rightmiddlesummation = 0x08b7 +const XK_lessthanequal = 0x08bc /* U+2264 LESS-THAN OR EQUAL TO */ +const XK_notequal = 0x08bd /* U+2260 NOT EQUAL TO */ +const XK_greaterthanequal = 0x08be /* U+2265 GREATER-THAN OR EQUAL TO */ +const XK_integral = 0x08bf /* U+222B INTEGRAL */ +const XK_therefore = 0x08c0 /* U+2234 THEREFORE */ +const XK_variation = 0x08c1 /* U+221D PROPORTIONAL TO */ +const XK_infinity = 0x08c2 /* U+221E INFINITY */ +const XK_nabla = 0x08c5 /* U+2207 NABLA */ +const XK_approximate = 0x08c8 /* U+223C TILDE OPERATOR */ +const XK_similarequal = 0x08c9 /* U+2243 ASYMPTOTICALLY EQUAL TO */ +const XK_ifonlyif = 0x08cd /* U+21D4 LEFT RIGHT DOUBLE ARROW */ +const XK_implies = 0x08ce /* U+21D2 RIGHTWARDS DOUBLE ARROW */ +const XK_identical = 0x08cf /* U+2261 IDENTICAL TO */ +const XK_radical = 0x08d6 /* U+221A SQUARE ROOT */ +const XK_includedin = 0x08da /* U+2282 SUBSET OF */ +const XK_includes = 0x08db /* U+2283 SUPERSET OF */ +const XK_intersection = 0x08dc /* U+2229 INTERSECTION */ +const XK_union = 0x08dd /* U+222A UNION */ +const XK_logicaland = 0x08de /* U+2227 LOGICAL AND */ +const XK_logicalor = 0x08df /* U+2228 LOGICAL OR */ +const XK_partialderivative = 0x08ef /* U+2202 PARTIAL DIFFERENTIAL */ +const XK_function = 0x08f6 /* U+0192 LATIN SMALL LETTER F WITH HOOK */ +const XK_leftarrow = 0x08fb /* U+2190 LEFTWARDS ARROW */ +const XK_uparrow = 0x08fc /* U+2191 UPWARDS ARROW */ +const XK_rightarrow = 0x08fd /* U+2192 RIGHTWARDS ARROW */ +const XK_downarrow = 0x08fe /* U+2193 DOWNWARDS ARROW */ +//endif /* XK_TECHNICAL */ + +/* + * Special + * (from the DEC VT100 Special Graphics Character Set) + * Byte 3 = 9 + */ + +//ifdef XK_SPECIAL +const XK_blank = 0x09df +const XK_soliddiamond = 0x09e0 /* U+25C6 BLACK DIAMOND */ +const XK_checkerboard = 0x09e1 /* U+2592 MEDIUM SHADE */ +const XK_ht = 0x09e2 /* U+2409 SYMBOL FOR HORIZONTAL TABULATION */ +const XK_ff = 0x09e3 /* U+240C SYMBOL FOR FORM FEED */ +const XK_cr = 0x09e4 /* U+240D SYMBOL FOR CARRIAGE RETURN */ +const XK_lf = 0x09e5 /* U+240A SYMBOL FOR LINE FEED */ +const XK_nl = 0x09e8 /* U+2424 SYMBOL FOR NEWLINE */ +const XK_vt = 0x09e9 /* U+240B SYMBOL FOR VERTICAL TABULATION */ +const XK_lowrightcorner = 0x09ea /* U+2518 BOX DRAWINGS LIGHT UP AND LEFT */ +const XK_uprightcorner = 0x09eb /* U+2510 BOX DRAWINGS LIGHT DOWN AND LEFT */ +const XK_upleftcorner = 0x09ec /* U+250C BOX DRAWINGS LIGHT DOWN AND RIGHT */ +const XK_lowleftcorner = 0x09ed /* U+2514 BOX DRAWINGS LIGHT UP AND RIGHT */ +const XK_crossinglines = 0x09ee /* U+253C BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */ +const XK_horizlinescan1 = 0x09ef /* U+23BA HORIZONTAL SCAN LINE-1 */ +const XK_horizlinescan3 = 0x09f0 /* U+23BB HORIZONTAL SCAN LINE-3 */ +const XK_horizlinescan5 = 0x09f1 /* U+2500 BOX DRAWINGS LIGHT HORIZONTAL */ +const XK_horizlinescan7 = 0x09f2 /* U+23BC HORIZONTAL SCAN LINE-7 */ +const XK_horizlinescan9 = 0x09f3 /* U+23BD HORIZONTAL SCAN LINE-9 */ +const XK_leftt = 0x09f4 /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */ +const XK_rightt = 0x09f5 /* U+2524 BOX DRAWINGS LIGHT VERTICAL AND LEFT */ +const XK_bott = 0x09f6 /* U+2534 BOX DRAWINGS LIGHT UP AND HORIZONTAL */ +const XK_topt = 0x09f7 /* U+252C BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */ +const XK_vertbar = 0x09f8 /* U+2502 BOX DRAWINGS LIGHT VERTICAL */ +//endif /* XK_SPECIAL */ + +/* + * Publishing + * (these are probably from a long forgotten DEC Publishing + * font that once shipped with DECwrite) + * Byte 3 = 0x0a + */ + +//ifdef XK_PUBLISHING +const XK_emspace = 0x0aa1 /* U+2003 EM SPACE */ +const XK_enspace = 0x0aa2 /* U+2002 EN SPACE */ +const XK_em3space = 0x0aa3 /* U+2004 THREE-PER-EM SPACE */ +const XK_em4space = 0x0aa4 /* U+2005 FOUR-PER-EM SPACE */ +const XK_digitspace = 0x0aa5 /* U+2007 FIGURE SPACE */ +const XK_punctspace = 0x0aa6 /* U+2008 PUNCTUATION SPACE */ +const XK_thinspace = 0x0aa7 /* U+2009 THIN SPACE */ +const XK_hairspace = 0x0aa8 /* U+200A HAIR SPACE */ +const XK_emdash = 0x0aa9 /* U+2014 EM DASH */ +const XK_endash = 0x0aaa /* U+2013 EN DASH */ +const XK_signifblank = 0x0aac /*(U+2423 OPEN BOX)*/ +const XK_ellipsis = 0x0aae /* U+2026 HORIZONTAL ELLIPSIS */ +const XK_doubbaselinedot = 0x0aaf /* U+2025 TWO DOT LEADER */ +const XK_onethird = 0x0ab0 /* U+2153 VULGAR FRACTION ONE THIRD */ +const XK_twothirds = 0x0ab1 /* U+2154 VULGAR FRACTION TWO THIRDS */ +const XK_onefifth = 0x0ab2 /* U+2155 VULGAR FRACTION ONE FIFTH */ +const XK_twofifths = 0x0ab3 /* U+2156 VULGAR FRACTION TWO FIFTHS */ +const XK_threefifths = 0x0ab4 /* U+2157 VULGAR FRACTION THREE FIFTHS */ +const XK_fourfifths = 0x0ab5 /* U+2158 VULGAR FRACTION FOUR FIFTHS */ +const XK_onesixth = 0x0ab6 /* U+2159 VULGAR FRACTION ONE SIXTH */ +const XK_fivesixths = 0x0ab7 /* U+215A VULGAR FRACTION FIVE SIXTHS */ +const XK_careof = 0x0ab8 /* U+2105 CARE OF */ +const XK_figdash = 0x0abb /* U+2012 FIGURE DASH */ +const XK_leftanglebracket = 0x0abc /*(U+27E8 MATHEMATICAL LEFT ANGLE BRACKET)*/ +const XK_decimalpoint = 0x0abd /*(U+002E FULL STOP)*/ +const XK_rightanglebracket = 0x0abe /*(U+27E9 MATHEMATICAL RIGHT ANGLE BRACKET)*/ +const XK_marker = 0x0abf +const XK_oneeighth = 0x0ac3 /* U+215B VULGAR FRACTION ONE EIGHTH */ +const XK_threeeighths = 0x0ac4 /* U+215C VULGAR FRACTION THREE EIGHTHS */ +const XK_fiveeighths = 0x0ac5 /* U+215D VULGAR FRACTION FIVE EIGHTHS */ +const XK_seveneighths = 0x0ac6 /* U+215E VULGAR FRACTION SEVEN EIGHTHS */ +const XK_trademark = 0x0ac9 /* U+2122 TRADE MARK SIGN */ +const XK_signaturemark = 0x0aca /*(U+2613 SALTIRE)*/ +const XK_trademarkincircle = 0x0acb +const XK_leftopentriangle = 0x0acc /*(U+25C1 WHITE LEFT-POINTING TRIANGLE)*/ +const XK_rightopentriangle = 0x0acd /*(U+25B7 WHITE RIGHT-POINTING TRIANGLE)*/ +const XK_emopencircle = 0x0ace /*(U+25CB WHITE CIRCLE)*/ +const XK_emopenrectangle = 0x0acf /*(U+25AF WHITE VERTICAL RECTANGLE)*/ +const XK_leftsinglequotemark = 0x0ad0 /* U+2018 LEFT SINGLE QUOTATION MARK */ +const XK_rightsinglequotemark = 0x0ad1 /* U+2019 RIGHT SINGLE QUOTATION MARK */ +const XK_leftdoublequotemark = 0x0ad2 /* U+201C LEFT DOUBLE QUOTATION MARK */ +const XK_rightdoublequotemark = 0x0ad3 /* U+201D RIGHT DOUBLE QUOTATION MARK */ +const XK_prescription = 0x0ad4 /* U+211E PRESCRIPTION TAKE */ +const XK_permille = 0x0ad5 /* U+2030 PER MILLE SIGN */ +const XK_minutes = 0x0ad6 /* U+2032 PRIME */ +const XK_seconds = 0x0ad7 /* U+2033 DOUBLE PRIME */ +const XK_latincross = 0x0ad9 /* U+271D LATIN CROSS */ +const XK_hexagram = 0x0ada +const XK_filledrectbullet = 0x0adb /*(U+25AC BLACK RECTANGLE)*/ +const XK_filledlefttribullet = 0x0adc /*(U+25C0 BLACK LEFT-POINTING TRIANGLE)*/ +const XK_filledrighttribullet = 0x0add /*(U+25B6 BLACK RIGHT-POINTING TRIANGLE)*/ +const XK_emfilledcircle = 0x0ade /*(U+25CF BLACK CIRCLE)*/ +const XK_emfilledrect = 0x0adf /*(U+25AE BLACK VERTICAL RECTANGLE)*/ +const XK_enopencircbullet = 0x0ae0 /*(U+25E6 WHITE BULLET)*/ +const XK_enopensquarebullet = 0x0ae1 /*(U+25AB WHITE SMALL SQUARE)*/ +const XK_openrectbullet = 0x0ae2 /*(U+25AD WHITE RECTANGLE)*/ +const XK_opentribulletup = 0x0ae3 /*(U+25B3 WHITE UP-POINTING TRIANGLE)*/ +const XK_opentribulletdown = 0x0ae4 /*(U+25BD WHITE DOWN-POINTING TRIANGLE)*/ +const XK_openstar = 0x0ae5 /*(U+2606 WHITE STAR)*/ +const XK_enfilledcircbullet = 0x0ae6 /*(U+2022 BULLET)*/ +const XK_enfilledsqbullet = 0x0ae7 /*(U+25AA BLACK SMALL SQUARE)*/ +const XK_filledtribulletup = 0x0ae8 /*(U+25B2 BLACK UP-POINTING TRIANGLE)*/ +const XK_filledtribulletdown = 0x0ae9 /*(U+25BC BLACK DOWN-POINTING TRIANGLE)*/ +const XK_leftpointer = 0x0aea /*(U+261C WHITE LEFT POINTING INDEX)*/ +const XK_rightpointer = 0x0aeb /*(U+261E WHITE RIGHT POINTING INDEX)*/ +const XK_club = 0x0aec /* U+2663 BLACK CLUB SUIT */ +const XK_diamond = 0x0aed /* U+2666 BLACK DIAMOND SUIT */ +const XK_heart = 0x0aee /* U+2665 BLACK HEART SUIT */ +const XK_maltesecross = 0x0af0 /* U+2720 MALTESE CROSS */ +const XK_dagger = 0x0af1 /* U+2020 DAGGER */ +const XK_doubledagger = 0x0af2 /* U+2021 DOUBLE DAGGER */ +const XK_checkmark = 0x0af3 /* U+2713 CHECK MARK */ +const XK_ballotcross = 0x0af4 /* U+2717 BALLOT X */ +const XK_musicalsharp = 0x0af5 /* U+266F MUSIC SHARP SIGN */ +const XK_musicalflat = 0x0af6 /* U+266D MUSIC FLAT SIGN */ +const XK_malesymbol = 0x0af7 /* U+2642 MALE SIGN */ +const XK_femalesymbol = 0x0af8 /* U+2640 FEMALE SIGN */ +const XK_telephone = 0x0af9 /* U+260E BLACK TELEPHONE */ +const XK_telephonerecorder = 0x0afa /* U+2315 TELEPHONE RECORDER */ +const XK_phonographcopyright = 0x0afb /* U+2117 SOUND RECORDING COPYRIGHT */ +const XK_caret = 0x0afc /* U+2038 CARET */ +const XK_singlelowquotemark = 0x0afd /* U+201A SINGLE LOW-9 QUOTATION MARK */ +const XK_doublelowquotemark = 0x0afe /* U+201E DOUBLE LOW-9 QUOTATION MARK */ +const XK_cursor = 0x0aff +//endif /* XK_PUBLISHING */ + +/* + * APL + * Byte 3 = 0x0b + */ + +//ifdef XK_APL +const XK_leftcaret = 0x0ba3 /*(U+003C LESS-THAN SIGN)*/ +const XK_rightcaret = 0x0ba6 /*(U+003E GREATER-THAN SIGN)*/ +const XK_downcaret = 0x0ba8 /*(U+2228 LOGICAL OR)*/ +const XK_upcaret = 0x0ba9 /*(U+2227 LOGICAL AND)*/ +const XK_overbar = 0x0bc0 /*(U+00AF MACRON)*/ +const XK_downtack = 0x0bc2 /* U+22A4 DOWN TACK */ +const XK_upshoe = 0x0bc3 /*(U+2229 INTERSECTION)*/ +const XK_downstile = 0x0bc4 /* U+230A LEFT FLOOR */ +const XK_underbar = 0x0bc6 /*(U+005F LOW LINE)*/ +const XK_jot = 0x0bca /* U+2218 RING OPERATOR */ +const XK_quad = 0x0bcc /* U+2395 APL FUNCTIONAL SYMBOL QUAD */ +const XK_uptack = 0x0bce /* U+22A5 UP TACK */ +const XK_circle = 0x0bcf /* U+25CB WHITE CIRCLE */ +const XK_upstile = 0x0bd3 /* U+2308 LEFT CEILING */ +const XK_downshoe = 0x0bd6 /*(U+222A UNION)*/ +const XK_rightshoe = 0x0bd8 /*(U+2283 SUPERSET OF)*/ +const XK_leftshoe = 0x0bda /*(U+2282 SUBSET OF)*/ +const XK_lefttack = 0x0bdc /* U+22A3 LEFT TACK */ +const XK_righttack = 0x0bfc /* U+22A2 RIGHT TACK */ +//endif /* XK_APL */ + +/* + * Hebrew + * Byte 3 = 0x0c + */ + +//ifdef XK_HEBREW +const XK_hebrew_doublelowline = 0x0cdf /* U+2017 DOUBLE LOW LINE */ +const XK_hebrew_aleph = 0x0ce0 /* U+05D0 HEBREW LETTER ALEF */ +const XK_hebrew_bet = 0x0ce1 /* U+05D1 HEBREW LETTER BET */ +const XK_hebrew_beth = 0x0ce1 /* deprecated */ +const XK_hebrew_gimel = 0x0ce2 /* U+05D2 HEBREW LETTER GIMEL */ +const XK_hebrew_gimmel = 0x0ce2 /* deprecated */ +const XK_hebrew_dalet = 0x0ce3 /* U+05D3 HEBREW LETTER DALET */ +const XK_hebrew_daleth = 0x0ce3 /* deprecated */ +const XK_hebrew_he = 0x0ce4 /* U+05D4 HEBREW LETTER HE */ +const XK_hebrew_waw = 0x0ce5 /* U+05D5 HEBREW LETTER VAV */ +const XK_hebrew_zain = 0x0ce6 /* U+05D6 HEBREW LETTER ZAYIN */ +const XK_hebrew_zayin = 0x0ce6 /* deprecated */ +const XK_hebrew_chet = 0x0ce7 /* U+05D7 HEBREW LETTER HET */ +const XK_hebrew_het = 0x0ce7 /* deprecated */ +const XK_hebrew_tet = 0x0ce8 /* U+05D8 HEBREW LETTER TET */ +const XK_hebrew_teth = 0x0ce8 /* deprecated */ +const XK_hebrew_yod = 0x0ce9 /* U+05D9 HEBREW LETTER YOD */ +const XK_hebrew_finalkaph = 0x0cea /* U+05DA HEBREW LETTER FINAL KAF */ +const XK_hebrew_kaph = 0x0ceb /* U+05DB HEBREW LETTER KAF */ +const XK_hebrew_lamed = 0x0cec /* U+05DC HEBREW LETTER LAMED */ +const XK_hebrew_finalmem = 0x0ced /* U+05DD HEBREW LETTER FINAL MEM */ +const XK_hebrew_mem = 0x0cee /* U+05DE HEBREW LETTER MEM */ +const XK_hebrew_finalnun = 0x0cef /* U+05DF HEBREW LETTER FINAL NUN */ +const XK_hebrew_nun = 0x0cf0 /* U+05E0 HEBREW LETTER NUN */ +const XK_hebrew_samech = 0x0cf1 /* U+05E1 HEBREW LETTER SAMEKH */ +const XK_hebrew_samekh = 0x0cf1 /* deprecated */ +const XK_hebrew_ayin = 0x0cf2 /* U+05E2 HEBREW LETTER AYIN */ +const XK_hebrew_finalpe = 0x0cf3 /* U+05E3 HEBREW LETTER FINAL PE */ +const XK_hebrew_pe = 0x0cf4 /* U+05E4 HEBREW LETTER PE */ +const XK_hebrew_finalzade = 0x0cf5 /* U+05E5 HEBREW LETTER FINAL TSADI */ +const XK_hebrew_finalzadi = 0x0cf5 /* deprecated */ +const XK_hebrew_zade = 0x0cf6 /* U+05E6 HEBREW LETTER TSADI */ +const XK_hebrew_zadi = 0x0cf6 /* deprecated */ +const XK_hebrew_qoph = 0x0cf7 /* U+05E7 HEBREW LETTER QOF */ +const XK_hebrew_kuf = 0x0cf7 /* deprecated */ +const XK_hebrew_resh = 0x0cf8 /* U+05E8 HEBREW LETTER RESH */ +const XK_hebrew_shin = 0x0cf9 /* U+05E9 HEBREW LETTER SHIN */ +const XK_hebrew_taw = 0x0cfa /* U+05EA HEBREW LETTER TAV */ +const XK_hebrew_taf = 0x0cfa /* deprecated */ +const XK_Hebrew_switch = 0xff7e /* Alias for mode_switch */ +//endif /* XK_HEBREW */ + +/* + * Thai + * Byte 3 = 0x0d + */ + +//ifdef XK_THAI +const XK_Thai_kokai = 0x0da1 /* U+0E01 THAI CHARACTER KO KAI */ +const XK_Thai_khokhai = 0x0da2 /* U+0E02 THAI CHARACTER KHO KHAI */ +const XK_Thai_khokhuat = 0x0da3 /* U+0E03 THAI CHARACTER KHO KHUAT */ +const XK_Thai_khokhwai = 0x0da4 /* U+0E04 THAI CHARACTER KHO KHWAI */ +const XK_Thai_khokhon = 0x0da5 /* U+0E05 THAI CHARACTER KHO KHON */ +const XK_Thai_khorakhang = 0x0da6 /* U+0E06 THAI CHARACTER KHO RAKHANG */ +const XK_Thai_ngongu = 0x0da7 /* U+0E07 THAI CHARACTER NGO NGU */ +const XK_Thai_chochan = 0x0da8 /* U+0E08 THAI CHARACTER CHO CHAN */ +const XK_Thai_choching = 0x0da9 /* U+0E09 THAI CHARACTER CHO CHING */ +const XK_Thai_chochang = 0x0daa /* U+0E0A THAI CHARACTER CHO CHANG */ +const XK_Thai_soso = 0x0dab /* U+0E0B THAI CHARACTER SO SO */ +const XK_Thai_chochoe = 0x0dac /* U+0E0C THAI CHARACTER CHO CHOE */ +const XK_Thai_yoying = 0x0dad /* U+0E0D THAI CHARACTER YO YING */ +const XK_Thai_dochada = 0x0dae /* U+0E0E THAI CHARACTER DO CHADA */ +const XK_Thai_topatak = 0x0daf /* U+0E0F THAI CHARACTER TO PATAK */ +const XK_Thai_thothan = 0x0db0 /* U+0E10 THAI CHARACTER THO THAN */ +const XK_Thai_thonangmontho = 0x0db1 /* U+0E11 THAI CHARACTER THO NANGMONTHO */ +const XK_Thai_thophuthao = 0x0db2 /* U+0E12 THAI CHARACTER THO PHUTHAO */ +const XK_Thai_nonen = 0x0db3 /* U+0E13 THAI CHARACTER NO NEN */ +const XK_Thai_dodek = 0x0db4 /* U+0E14 THAI CHARACTER DO DEK */ +const XK_Thai_totao = 0x0db5 /* U+0E15 THAI CHARACTER TO TAO */ +const XK_Thai_thothung = 0x0db6 /* U+0E16 THAI CHARACTER THO THUNG */ +const XK_Thai_thothahan = 0x0db7 /* U+0E17 THAI CHARACTER THO THAHAN */ +const XK_Thai_thothong = 0x0db8 /* U+0E18 THAI CHARACTER THO THONG */ +const XK_Thai_nonu = 0x0db9 /* U+0E19 THAI CHARACTER NO NU */ +const XK_Thai_bobaimai = 0x0dba /* U+0E1A THAI CHARACTER BO BAIMAI */ +const XK_Thai_popla = 0x0dbb /* U+0E1B THAI CHARACTER PO PLA */ +const XK_Thai_phophung = 0x0dbc /* U+0E1C THAI CHARACTER PHO PHUNG */ +const XK_Thai_fofa = 0x0dbd /* U+0E1D THAI CHARACTER FO FA */ +const XK_Thai_phophan = 0x0dbe /* U+0E1E THAI CHARACTER PHO PHAN */ +const XK_Thai_fofan = 0x0dbf /* U+0E1F THAI CHARACTER FO FAN */ +const XK_Thai_phosamphao = 0x0dc0 /* U+0E20 THAI CHARACTER PHO SAMPHAO */ +const XK_Thai_moma = 0x0dc1 /* U+0E21 THAI CHARACTER MO MA */ +const XK_Thai_yoyak = 0x0dc2 /* U+0E22 THAI CHARACTER YO YAK */ +const XK_Thai_rorua = 0x0dc3 /* U+0E23 THAI CHARACTER RO RUA */ +const XK_Thai_ru = 0x0dc4 /* U+0E24 THAI CHARACTER RU */ +const XK_Thai_loling = 0x0dc5 /* U+0E25 THAI CHARACTER LO LING */ +const XK_Thai_lu = 0x0dc6 /* U+0E26 THAI CHARACTER LU */ +const XK_Thai_wowaen = 0x0dc7 /* U+0E27 THAI CHARACTER WO WAEN */ +const XK_Thai_sosala = 0x0dc8 /* U+0E28 THAI CHARACTER SO SALA */ +const XK_Thai_sorusi = 0x0dc9 /* U+0E29 THAI CHARACTER SO RUSI */ +const XK_Thai_sosua = 0x0dca /* U+0E2A THAI CHARACTER SO SUA */ +const XK_Thai_hohip = 0x0dcb /* U+0E2B THAI CHARACTER HO HIP */ +const XK_Thai_lochula = 0x0dcc /* U+0E2C THAI CHARACTER LO CHULA */ +const XK_Thai_oang = 0x0dcd /* U+0E2D THAI CHARACTER O ANG */ +const XK_Thai_honokhuk = 0x0dce /* U+0E2E THAI CHARACTER HO NOKHUK */ +const XK_Thai_paiyannoi = 0x0dcf /* U+0E2F THAI CHARACTER PAIYANNOI */ +const XK_Thai_saraa = 0x0dd0 /* U+0E30 THAI CHARACTER SARA A */ +const XK_Thai_maihanakat = 0x0dd1 /* U+0E31 THAI CHARACTER MAI HAN-AKAT */ +const XK_Thai_saraaa = 0x0dd2 /* U+0E32 THAI CHARACTER SARA AA */ +const XK_Thai_saraam = 0x0dd3 /* U+0E33 THAI CHARACTER SARA AM */ +const XK_Thai_sarai = 0x0dd4 /* U+0E34 THAI CHARACTER SARA I */ +const XK_Thai_saraii = 0x0dd5 /* U+0E35 THAI CHARACTER SARA II */ +const XK_Thai_saraue = 0x0dd6 /* U+0E36 THAI CHARACTER SARA UE */ +const XK_Thai_sarauee = 0x0dd7 /* U+0E37 THAI CHARACTER SARA UEE */ +const XK_Thai_sarau = 0x0dd8 /* U+0E38 THAI CHARACTER SARA U */ +const XK_Thai_sarauu = 0x0dd9 /* U+0E39 THAI CHARACTER SARA UU */ +const XK_Thai_phinthu = 0x0dda /* U+0E3A THAI CHARACTER PHINTHU */ +const XK_Thai_maihanakat_maitho = 0x0dde +const XK_Thai_baht = 0x0ddf /* U+0E3F THAI CURRENCY SYMBOL BAHT */ +const XK_Thai_sarae = 0x0de0 /* U+0E40 THAI CHARACTER SARA E */ +const XK_Thai_saraae = 0x0de1 /* U+0E41 THAI CHARACTER SARA AE */ +const XK_Thai_sarao = 0x0de2 /* U+0E42 THAI CHARACTER SARA O */ +const XK_Thai_saraaimaimuan = 0x0de3 /* U+0E43 THAI CHARACTER SARA AI MAIMUAN */ +const XK_Thai_saraaimaimalai = 0x0de4 /* U+0E44 THAI CHARACTER SARA AI MAIMALAI */ +const XK_Thai_lakkhangyao = 0x0de5 /* U+0E45 THAI CHARACTER LAKKHANGYAO */ +const XK_Thai_maiyamok = 0x0de6 /* U+0E46 THAI CHARACTER MAIYAMOK */ +const XK_Thai_maitaikhu = 0x0de7 /* U+0E47 THAI CHARACTER MAITAIKHU */ +const XK_Thai_maiek = 0x0de8 /* U+0E48 THAI CHARACTER MAI EK */ +const XK_Thai_maitho = 0x0de9 /* U+0E49 THAI CHARACTER MAI THO */ +const XK_Thai_maitri = 0x0dea /* U+0E4A THAI CHARACTER MAI TRI */ +const XK_Thai_maichattawa = 0x0deb /* U+0E4B THAI CHARACTER MAI CHATTAWA */ +const XK_Thai_thanthakhat = 0x0dec /* U+0E4C THAI CHARACTER THANTHAKHAT */ +const XK_Thai_nikhahit = 0x0ded /* U+0E4D THAI CHARACTER NIKHAHIT */ +const XK_Thai_leksun = 0x0df0 /* U+0E50 THAI DIGIT ZERO */ +const XK_Thai_leknung = 0x0df1 /* U+0E51 THAI DIGIT ONE */ +const XK_Thai_leksong = 0x0df2 /* U+0E52 THAI DIGIT TWO */ +const XK_Thai_leksam = 0x0df3 /* U+0E53 THAI DIGIT THREE */ +const XK_Thai_leksi = 0x0df4 /* U+0E54 THAI DIGIT FOUR */ +const XK_Thai_lekha = 0x0df5 /* U+0E55 THAI DIGIT FIVE */ +const XK_Thai_lekhok = 0x0df6 /* U+0E56 THAI DIGIT SIX */ +const XK_Thai_lekchet = 0x0df7 /* U+0E57 THAI DIGIT SEVEN */ +const XK_Thai_lekpaet = 0x0df8 /* U+0E58 THAI DIGIT EIGHT */ +const XK_Thai_lekkao = 0x0df9 /* U+0E59 THAI DIGIT NINE */ +//endif /* XK_THAI */ + +/* + * Korean + * Byte 3 = 0x0e + */ + +//ifdef XK_KOREAN + +const XK_Hangul = 0xff31 /* Hangul start/stop(toggle) */ +const XK_Hangul_Start = 0xff32 /* Hangul start */ +const XK_Hangul_End = 0xff33 /* Hangul end, English start */ +const XK_Hangul_Hanja = 0xff34 /* Start Hangul->Hanja Conversion */ +const XK_Hangul_Jamo = 0xff35 /* Hangul Jamo mode */ +const XK_Hangul_Romaja = 0xff36 /* Hangul Romaja mode */ +const XK_Hangul_Codeinput = 0xff37 /* Hangul code input mode */ +const XK_Hangul_Jeonja = 0xff38 /* Jeonja mode */ +const XK_Hangul_Banja = 0xff39 /* Banja mode */ +const XK_Hangul_PreHanja = 0xff3a /* Pre Hanja conversion */ +const XK_Hangul_PostHanja = 0xff3b /* Post Hanja conversion */ +const XK_Hangul_SingleCandidate = 0xff3c /* Single candidate */ +const XK_Hangul_MultipleCandidate = 0xff3d /* Multiple candidate */ +const XK_Hangul_PreviousCandidate = 0xff3e /* Previous candidate */ +const XK_Hangul_Special = 0xff3f /* Special symbols */ +const XK_Hangul_switch = 0xff7e /* Alias for mode_switch */ + +/* Hangul Consonant Characters */ +const XK_Hangul_Kiyeog = 0x0ea1 +const XK_Hangul_SsangKiyeog = 0x0ea2 +const XK_Hangul_KiyeogSios = 0x0ea3 +const XK_Hangul_Nieun = 0x0ea4 +const XK_Hangul_NieunJieuj = 0x0ea5 +const XK_Hangul_NieunHieuh = 0x0ea6 +const XK_Hangul_Dikeud = 0x0ea7 +const XK_Hangul_SsangDikeud = 0x0ea8 +const XK_Hangul_Rieul = 0x0ea9 +const XK_Hangul_RieulKiyeog = 0x0eaa +const XK_Hangul_RieulMieum = 0x0eab +const XK_Hangul_RieulPieub = 0x0eac +const XK_Hangul_RieulSios = 0x0ead +const XK_Hangul_RieulTieut = 0x0eae +const XK_Hangul_RieulPhieuf = 0x0eaf +const XK_Hangul_RieulHieuh = 0x0eb0 +const XK_Hangul_Mieum = 0x0eb1 +const XK_Hangul_Pieub = 0x0eb2 +const XK_Hangul_SsangPieub = 0x0eb3 +const XK_Hangul_PieubSios = 0x0eb4 +const XK_Hangul_Sios = 0x0eb5 +const XK_Hangul_SsangSios = 0x0eb6 +const XK_Hangul_Ieung = 0x0eb7 +const XK_Hangul_Jieuj = 0x0eb8 +const XK_Hangul_SsangJieuj = 0x0eb9 +const XK_Hangul_Cieuc = 0x0eba +const XK_Hangul_Khieuq = 0x0ebb +const XK_Hangul_Tieut = 0x0ebc +const XK_Hangul_Phieuf = 0x0ebd +const XK_Hangul_Hieuh = 0x0ebe + +/* Hangul Vowel Characters */ +const XK_Hangul_A = 0x0ebf +const XK_Hangul_AE = 0x0ec0 +const XK_Hangul_YA = 0x0ec1 +const XK_Hangul_YAE = 0x0ec2 +const XK_Hangul_EO = 0x0ec3 +const XK_Hangul_E = 0x0ec4 +const XK_Hangul_YEO = 0x0ec5 +const XK_Hangul_YE = 0x0ec6 +const XK_Hangul_O = 0x0ec7 +const XK_Hangul_WA = 0x0ec8 +const XK_Hangul_WAE = 0x0ec9 +const XK_Hangul_OE = 0x0eca +const XK_Hangul_YO = 0x0ecb +const XK_Hangul_U = 0x0ecc +const XK_Hangul_WEO = 0x0ecd +const XK_Hangul_WE = 0x0ece +const XK_Hangul_WI = 0x0ecf +const XK_Hangul_YU = 0x0ed0 +const XK_Hangul_EU = 0x0ed1 +const XK_Hangul_YI = 0x0ed2 +const XK_Hangul_I = 0x0ed3 + +/* Hangul syllable-final (JongSeong) Characters */ +const XK_Hangul_J_Kiyeog = 0x0ed4 +const XK_Hangul_J_SsangKiyeog = 0x0ed5 +const XK_Hangul_J_KiyeogSios = 0x0ed6 +const XK_Hangul_J_Nieun = 0x0ed7 +const XK_Hangul_J_NieunJieuj = 0x0ed8 +const XK_Hangul_J_NieunHieuh = 0x0ed9 +const XK_Hangul_J_Dikeud = 0x0eda +const XK_Hangul_J_Rieul = 0x0edb +const XK_Hangul_J_RieulKiyeog = 0x0edc +const XK_Hangul_J_RieulMieum = 0x0edd +const XK_Hangul_J_RieulPieub = 0x0ede +const XK_Hangul_J_RieulSios = 0x0edf +const XK_Hangul_J_RieulTieut = 0x0ee0 +const XK_Hangul_J_RieulPhieuf = 0x0ee1 +const XK_Hangul_J_RieulHieuh = 0x0ee2 +const XK_Hangul_J_Mieum = 0x0ee3 +const XK_Hangul_J_Pieub = 0x0ee4 +const XK_Hangul_J_PieubSios = 0x0ee5 +const XK_Hangul_J_Sios = 0x0ee6 +const XK_Hangul_J_SsangSios = 0x0ee7 +const XK_Hangul_J_Ieung = 0x0ee8 +const XK_Hangul_J_Jieuj = 0x0ee9 +const XK_Hangul_J_Cieuc = 0x0eea +const XK_Hangul_J_Khieuq = 0x0eeb +const XK_Hangul_J_Tieut = 0x0eec +const XK_Hangul_J_Phieuf = 0x0eed +const XK_Hangul_J_Hieuh = 0x0eee + +/* Ancient Hangul Consonant Characters */ +const XK_Hangul_RieulYeorinHieuh = 0x0eef +const XK_Hangul_SunkyeongeumMieum = 0x0ef0 +const XK_Hangul_SunkyeongeumPieub = 0x0ef1 +const XK_Hangul_PanSios = 0x0ef2 +const XK_Hangul_KkogjiDalrinIeung = 0x0ef3 +const XK_Hangul_SunkyeongeumPhieuf = 0x0ef4 +const XK_Hangul_YeorinHieuh = 0x0ef5 + +/* Ancient Hangul Vowel Characters */ +const XK_Hangul_AraeA = 0x0ef6 +const XK_Hangul_AraeAE = 0x0ef7 + +/* Ancient Hangul syllable-final (JongSeong) Characters */ +const XK_Hangul_J_PanSios = 0x0ef8 +const XK_Hangul_J_KkogjiDalrinIeung = 0x0ef9 +const XK_Hangul_J_YeorinHieuh = 0x0efa + +/* Korean currency symbol */ +const XK_Korean_Won = 0x0eff /*(U+20A9 WON SIGN)*/ + +//endif /* XK_KOREAN */ + +/* + * Armenian + */ + +//ifdef XK_ARMENIAN +const XK_Armenian_ligature_ew = 0x1000587 /* U+0587 ARMENIAN SMALL LIGATURE ECH YIWN */ +const XK_Armenian_full_stop = 0x1000589 /* U+0589 ARMENIAN FULL STOP */ +const XK_Armenian_verjaket = 0x1000589 /* U+0589 ARMENIAN FULL STOP */ +const XK_Armenian_separation_mark = 0x100055d /* U+055D ARMENIAN COMMA */ +const XK_Armenian_but = 0x100055d /* U+055D ARMENIAN COMMA */ +const XK_Armenian_hyphen = 0x100058a /* U+058A ARMENIAN HYPHEN */ +const XK_Armenian_yentamna = 0x100058a /* U+058A ARMENIAN HYPHEN */ +const XK_Armenian_exclam = 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */ +const XK_Armenian_amanak = 0x100055c /* U+055C ARMENIAN EXCLAMATION MARK */ +const XK_Armenian_accent = 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */ +const XK_Armenian_shesht = 0x100055b /* U+055B ARMENIAN EMPHASIS MARK */ +const XK_Armenian_question = 0x100055e /* U+055E ARMENIAN QUESTION MARK */ +const XK_Armenian_paruyk = 0x100055e /* U+055E ARMENIAN QUESTION MARK */ +const XK_Armenian_AYB = 0x1000531 /* U+0531 ARMENIAN CAPITAL LETTER AYB */ +const XK_Armenian_ayb = 0x1000561 /* U+0561 ARMENIAN SMALL LETTER AYB */ +const XK_Armenian_BEN = 0x1000532 /* U+0532 ARMENIAN CAPITAL LETTER BEN */ +const XK_Armenian_ben = 0x1000562 /* U+0562 ARMENIAN SMALL LETTER BEN */ +const XK_Armenian_GIM = 0x1000533 /* U+0533 ARMENIAN CAPITAL LETTER GIM */ +const XK_Armenian_gim = 0x1000563 /* U+0563 ARMENIAN SMALL LETTER GIM */ +const XK_Armenian_DA = 0x1000534 /* U+0534 ARMENIAN CAPITAL LETTER DA */ +const XK_Armenian_da = 0x1000564 /* U+0564 ARMENIAN SMALL LETTER DA */ +const XK_Armenian_YECH = 0x1000535 /* U+0535 ARMENIAN CAPITAL LETTER ECH */ +const XK_Armenian_yech = 0x1000565 /* U+0565 ARMENIAN SMALL LETTER ECH */ +const XK_Armenian_ZA = 0x1000536 /* U+0536 ARMENIAN CAPITAL LETTER ZA */ +const XK_Armenian_za = 0x1000566 /* U+0566 ARMENIAN SMALL LETTER ZA */ +const XK_Armenian_E = 0x1000537 /* U+0537 ARMENIAN CAPITAL LETTER EH */ +const XK_Armenian_e = 0x1000567 /* U+0567 ARMENIAN SMALL LETTER EH */ +const XK_Armenian_AT = 0x1000538 /* U+0538 ARMENIAN CAPITAL LETTER ET */ +const XK_Armenian_at = 0x1000568 /* U+0568 ARMENIAN SMALL LETTER ET */ +const XK_Armenian_TO = 0x1000539 /* U+0539 ARMENIAN CAPITAL LETTER TO */ +const XK_Armenian_to = 0x1000569 /* U+0569 ARMENIAN SMALL LETTER TO */ +const XK_Armenian_ZHE = 0x100053a /* U+053A ARMENIAN CAPITAL LETTER ZHE */ +const XK_Armenian_zhe = 0x100056a /* U+056A ARMENIAN SMALL LETTER ZHE */ +const XK_Armenian_INI = 0x100053b /* U+053B ARMENIAN CAPITAL LETTER INI */ +const XK_Armenian_ini = 0x100056b /* U+056B ARMENIAN SMALL LETTER INI */ +const XK_Armenian_LYUN = 0x100053c /* U+053C ARMENIAN CAPITAL LETTER LIWN */ +const XK_Armenian_lyun = 0x100056c /* U+056C ARMENIAN SMALL LETTER LIWN */ +const XK_Armenian_KHE = 0x100053d /* U+053D ARMENIAN CAPITAL LETTER XEH */ +const XK_Armenian_khe = 0x100056d /* U+056D ARMENIAN SMALL LETTER XEH */ +const XK_Armenian_TSA = 0x100053e /* U+053E ARMENIAN CAPITAL LETTER CA */ +const XK_Armenian_tsa = 0x100056e /* U+056E ARMENIAN SMALL LETTER CA */ +const XK_Armenian_KEN = 0x100053f /* U+053F ARMENIAN CAPITAL LETTER KEN */ +const XK_Armenian_ken = 0x100056f /* U+056F ARMENIAN SMALL LETTER KEN */ +const XK_Armenian_HO = 0x1000540 /* U+0540 ARMENIAN CAPITAL LETTER HO */ +const XK_Armenian_ho = 0x1000570 /* U+0570 ARMENIAN SMALL LETTER HO */ +const XK_Armenian_DZA = 0x1000541 /* U+0541 ARMENIAN CAPITAL LETTER JA */ +const XK_Armenian_dza = 0x1000571 /* U+0571 ARMENIAN SMALL LETTER JA */ +const XK_Armenian_GHAT = 0x1000542 /* U+0542 ARMENIAN CAPITAL LETTER GHAD */ +const XK_Armenian_ghat = 0x1000572 /* U+0572 ARMENIAN SMALL LETTER GHAD */ +const XK_Armenian_TCHE = 0x1000543 /* U+0543 ARMENIAN CAPITAL LETTER CHEH */ +const XK_Armenian_tche = 0x1000573 /* U+0573 ARMENIAN SMALL LETTER CHEH */ +const XK_Armenian_MEN = 0x1000544 /* U+0544 ARMENIAN CAPITAL LETTER MEN */ +const XK_Armenian_men = 0x1000574 /* U+0574 ARMENIAN SMALL LETTER MEN */ +const XK_Armenian_HI = 0x1000545 /* U+0545 ARMENIAN CAPITAL LETTER YI */ +const XK_Armenian_hi = 0x1000575 /* U+0575 ARMENIAN SMALL LETTER YI */ +const XK_Armenian_NU = 0x1000546 /* U+0546 ARMENIAN CAPITAL LETTER NOW */ +const XK_Armenian_nu = 0x1000576 /* U+0576 ARMENIAN SMALL LETTER NOW */ +const XK_Armenian_SHA = 0x1000547 /* U+0547 ARMENIAN CAPITAL LETTER SHA */ +const XK_Armenian_sha = 0x1000577 /* U+0577 ARMENIAN SMALL LETTER SHA */ +const XK_Armenian_VO = 0x1000548 /* U+0548 ARMENIAN CAPITAL LETTER VO */ +const XK_Armenian_vo = 0x1000578 /* U+0578 ARMENIAN SMALL LETTER VO */ +const XK_Armenian_CHA = 0x1000549 /* U+0549 ARMENIAN CAPITAL LETTER CHA */ +const XK_Armenian_cha = 0x1000579 /* U+0579 ARMENIAN SMALL LETTER CHA */ +const XK_Armenian_PE = 0x100054a /* U+054A ARMENIAN CAPITAL LETTER PEH */ +const XK_Armenian_pe = 0x100057a /* U+057A ARMENIAN SMALL LETTER PEH */ +const XK_Armenian_JE = 0x100054b /* U+054B ARMENIAN CAPITAL LETTER JHEH */ +const XK_Armenian_je = 0x100057b /* U+057B ARMENIAN SMALL LETTER JHEH */ +const XK_Armenian_RA = 0x100054c /* U+054C ARMENIAN CAPITAL LETTER RA */ +const XK_Armenian_ra = 0x100057c /* U+057C ARMENIAN SMALL LETTER RA */ +const XK_Armenian_SE = 0x100054d /* U+054D ARMENIAN CAPITAL LETTER SEH */ +const XK_Armenian_se = 0x100057d /* U+057D ARMENIAN SMALL LETTER SEH */ +const XK_Armenian_VEV = 0x100054e /* U+054E ARMENIAN CAPITAL LETTER VEW */ +const XK_Armenian_vev = 0x100057e /* U+057E ARMENIAN SMALL LETTER VEW */ +const XK_Armenian_TYUN = 0x100054f /* U+054F ARMENIAN CAPITAL LETTER TIWN */ +const XK_Armenian_tyun = 0x100057f /* U+057F ARMENIAN SMALL LETTER TIWN */ +const XK_Armenian_RE = 0x1000550 /* U+0550 ARMENIAN CAPITAL LETTER REH */ +const XK_Armenian_re = 0x1000580 /* U+0580 ARMENIAN SMALL LETTER REH */ +const XK_Armenian_TSO = 0x1000551 /* U+0551 ARMENIAN CAPITAL LETTER CO */ +const XK_Armenian_tso = 0x1000581 /* U+0581 ARMENIAN SMALL LETTER CO */ +const XK_Armenian_VYUN = 0x1000552 /* U+0552 ARMENIAN CAPITAL LETTER YIWN */ +const XK_Armenian_vyun = 0x1000582 /* U+0582 ARMENIAN SMALL LETTER YIWN */ +const XK_Armenian_PYUR = 0x1000553 /* U+0553 ARMENIAN CAPITAL LETTER PIWR */ +const XK_Armenian_pyur = 0x1000583 /* U+0583 ARMENIAN SMALL LETTER PIWR */ +const XK_Armenian_KE = 0x1000554 /* U+0554 ARMENIAN CAPITAL LETTER KEH */ +const XK_Armenian_ke = 0x1000584 /* U+0584 ARMENIAN SMALL LETTER KEH */ +const XK_Armenian_O = 0x1000555 /* U+0555 ARMENIAN CAPITAL LETTER OH */ +const XK_Armenian_o = 0x1000585 /* U+0585 ARMENIAN SMALL LETTER OH */ +const XK_Armenian_FE = 0x1000556 /* U+0556 ARMENIAN CAPITAL LETTER FEH */ +const XK_Armenian_fe = 0x1000586 /* U+0586 ARMENIAN SMALL LETTER FEH */ +const XK_Armenian_apostrophe = 0x100055a /* U+055A ARMENIAN APOSTROPHE */ +//endif /* XK_ARMENIAN */ + +/* + * Georgian + */ + +//ifdef XK_GEORGIAN +const XK_Georgian_an = 0x10010d0 /* U+10D0 GEORGIAN LETTER AN */ +const XK_Georgian_ban = 0x10010d1 /* U+10D1 GEORGIAN LETTER BAN */ +const XK_Georgian_gan = 0x10010d2 /* U+10D2 GEORGIAN LETTER GAN */ +const XK_Georgian_don = 0x10010d3 /* U+10D3 GEORGIAN LETTER DON */ +const XK_Georgian_en = 0x10010d4 /* U+10D4 GEORGIAN LETTER EN */ +const XK_Georgian_vin = 0x10010d5 /* U+10D5 GEORGIAN LETTER VIN */ +const XK_Georgian_zen = 0x10010d6 /* U+10D6 GEORGIAN LETTER ZEN */ +const XK_Georgian_tan = 0x10010d7 /* U+10D7 GEORGIAN LETTER TAN */ +const XK_Georgian_in = 0x10010d8 /* U+10D8 GEORGIAN LETTER IN */ +const XK_Georgian_kan = 0x10010d9 /* U+10D9 GEORGIAN LETTER KAN */ +const XK_Georgian_las = 0x10010da /* U+10DA GEORGIAN LETTER LAS */ +const XK_Georgian_man = 0x10010db /* U+10DB GEORGIAN LETTER MAN */ +const XK_Georgian_nar = 0x10010dc /* U+10DC GEORGIAN LETTER NAR */ +const XK_Georgian_on = 0x10010dd /* U+10DD GEORGIAN LETTER ON */ +const XK_Georgian_par = 0x10010de /* U+10DE GEORGIAN LETTER PAR */ +const XK_Georgian_zhar = 0x10010df /* U+10DF GEORGIAN LETTER ZHAR */ +const XK_Georgian_rae = 0x10010e0 /* U+10E0 GEORGIAN LETTER RAE */ +const XK_Georgian_san = 0x10010e1 /* U+10E1 GEORGIAN LETTER SAN */ +const XK_Georgian_tar = 0x10010e2 /* U+10E2 GEORGIAN LETTER TAR */ +const XK_Georgian_un = 0x10010e3 /* U+10E3 GEORGIAN LETTER UN */ +const XK_Georgian_phar = 0x10010e4 /* U+10E4 GEORGIAN LETTER PHAR */ +const XK_Georgian_khar = 0x10010e5 /* U+10E5 GEORGIAN LETTER KHAR */ +const XK_Georgian_ghan = 0x10010e6 /* U+10E6 GEORGIAN LETTER GHAN */ +const XK_Georgian_qar = 0x10010e7 /* U+10E7 GEORGIAN LETTER QAR */ +const XK_Georgian_shin = 0x10010e8 /* U+10E8 GEORGIAN LETTER SHIN */ +const XK_Georgian_chin = 0x10010e9 /* U+10E9 GEORGIAN LETTER CHIN */ +const XK_Georgian_can = 0x10010ea /* U+10EA GEORGIAN LETTER CAN */ +const XK_Georgian_jil = 0x10010eb /* U+10EB GEORGIAN LETTER JIL */ +const XK_Georgian_cil = 0x10010ec /* U+10EC GEORGIAN LETTER CIL */ +const XK_Georgian_char = 0x10010ed /* U+10ED GEORGIAN LETTER CHAR */ +const XK_Georgian_xan = 0x10010ee /* U+10EE GEORGIAN LETTER XAN */ +const XK_Georgian_jhan = 0x10010ef /* U+10EF GEORGIAN LETTER JHAN */ +const XK_Georgian_hae = 0x10010f0 /* U+10F0 GEORGIAN LETTER HAE */ +const XK_Georgian_he = 0x10010f1 /* U+10F1 GEORGIAN LETTER HE */ +const XK_Georgian_hie = 0x10010f2 /* U+10F2 GEORGIAN LETTER HIE */ +const XK_Georgian_we = 0x10010f3 /* U+10F3 GEORGIAN LETTER WE */ +const XK_Georgian_har = 0x10010f4 /* U+10F4 GEORGIAN LETTER HAR */ +const XK_Georgian_hoe = 0x10010f5 /* U+10F5 GEORGIAN LETTER HOE */ +const XK_Georgian_fi = 0x10010f6 /* U+10F6 GEORGIAN LETTER FI */ +//endif /* XK_GEORGIAN */ + +/* + * Azeri (and other Turkic or Caucasian languages) + */ + +//ifdef XK_CAUCASUS +/* latin */ +const XK_Xabovedot = 0x1001e8a /* U+1E8A LATIN CAPITAL LETTER X WITH DOT ABOVE */ +const XK_Ibreve = 0x100012c /* U+012C LATIN CAPITAL LETTER I WITH BREVE */ +const XK_Zstroke = 0x10001b5 /* U+01B5 LATIN CAPITAL LETTER Z WITH STROKE */ +const XK_Gcaron = 0x10001e6 /* U+01E6 LATIN CAPITAL LETTER G WITH CARON */ +const XK_Ocaron = 0x10001d1 /* U+01D2 LATIN CAPITAL LETTER O WITH CARON */ +const XK_Obarred = 0x100019f /* U+019F LATIN CAPITAL LETTER O WITH MIDDLE TILDE */ +const XK_xabovedot = 0x1001e8b /* U+1E8B LATIN SMALL LETTER X WITH DOT ABOVE */ +const XK_ibreve = 0x100012d /* U+012D LATIN SMALL LETTER I WITH BREVE */ +const XK_zstroke = 0x10001b6 /* U+01B6 LATIN SMALL LETTER Z WITH STROKE */ +const XK_gcaron = 0x10001e7 /* U+01E7 LATIN SMALL LETTER G WITH CARON */ +const XK_ocaron = 0x10001d2 /* U+01D2 LATIN SMALL LETTER O WITH CARON */ +const XK_obarred = 0x1000275 /* U+0275 LATIN SMALL LETTER BARRED O */ +const XK_SCHWA = 0x100018f /* U+018F LATIN CAPITAL LETTER SCHWA */ +const XK_schwa = 0x1000259 /* U+0259 LATIN SMALL LETTER SCHWA */ +const XK_EZH = 0x10001b7 /* U+01B7 LATIN CAPITAL LETTER EZH */ +const XK_ezh = 0x1000292 /* U+0292 LATIN SMALL LETTER EZH */ +/* those are not really Caucasus */ +/* For Inupiak */ +const XK_Lbelowdot = 0x1001e36 /* U+1E36 LATIN CAPITAL LETTER L WITH DOT BELOW */ +const XK_lbelowdot = 0x1001e37 /* U+1E37 LATIN SMALL LETTER L WITH DOT BELOW */ +//endif /* XK_CAUCASUS */ + +/* + * Vietnamese + */ + +//ifdef XK_VIETNAMESE +const XK_Abelowdot = 0x1001ea0 /* U+1EA0 LATIN CAPITAL LETTER A WITH DOT BELOW */ +const XK_abelowdot = 0x1001ea1 /* U+1EA1 LATIN SMALL LETTER A WITH DOT BELOW */ +const XK_Ahook = 0x1001ea2 /* U+1EA2 LATIN CAPITAL LETTER A WITH HOOK ABOVE */ +const XK_ahook = 0x1001ea3 /* U+1EA3 LATIN SMALL LETTER A WITH HOOK ABOVE */ +const XK_Acircumflexacute = 0x1001ea4 /* U+1EA4 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE */ +const XK_acircumflexacute = 0x1001ea5 /* U+1EA5 LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE */ +const XK_Acircumflexgrave = 0x1001ea6 /* U+1EA6 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE */ +const XK_acircumflexgrave = 0x1001ea7 /* U+1EA7 LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE */ +const XK_Acircumflexhook = 0x1001ea8 /* U+1EA8 LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */ +const XK_acircumflexhook = 0x1001ea9 /* U+1EA9 LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */ +const XK_Acircumflextilde = 0x1001eaa /* U+1EAA LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE */ +const XK_acircumflextilde = 0x1001eab /* U+1EAB LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE */ +const XK_Acircumflexbelowdot = 0x1001eac /* U+1EAC LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW */ +const XK_acircumflexbelowdot = 0x1001ead /* U+1EAD LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW */ +const XK_Abreveacute = 0x1001eae /* U+1EAE LATIN CAPITAL LETTER A WITH BREVE AND ACUTE */ +const XK_abreveacute = 0x1001eaf /* U+1EAF LATIN SMALL LETTER A WITH BREVE AND ACUTE */ +const XK_Abrevegrave = 0x1001eb0 /* U+1EB0 LATIN CAPITAL LETTER A WITH BREVE AND GRAVE */ +const XK_abrevegrave = 0x1001eb1 /* U+1EB1 LATIN SMALL LETTER A WITH BREVE AND GRAVE */ +const XK_Abrevehook = 0x1001eb2 /* U+1EB2 LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE */ +const XK_abrevehook = 0x1001eb3 /* U+1EB3 LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE */ +const XK_Abrevetilde = 0x1001eb4 /* U+1EB4 LATIN CAPITAL LETTER A WITH BREVE AND TILDE */ +const XK_abrevetilde = 0x1001eb5 /* U+1EB5 LATIN SMALL LETTER A WITH BREVE AND TILDE */ +const XK_Abrevebelowdot = 0x1001eb6 /* U+1EB6 LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW */ +const XK_abrevebelowdot = 0x1001eb7 /* U+1EB7 LATIN SMALL LETTER A WITH BREVE AND DOT BELOW */ +const XK_Ebelowdot = 0x1001eb8 /* U+1EB8 LATIN CAPITAL LETTER E WITH DOT BELOW */ +const XK_ebelowdot = 0x1001eb9 /* U+1EB9 LATIN SMALL LETTER E WITH DOT BELOW */ +const XK_Ehook = 0x1001eba /* U+1EBA LATIN CAPITAL LETTER E WITH HOOK ABOVE */ +const XK_ehook = 0x1001ebb /* U+1EBB LATIN SMALL LETTER E WITH HOOK ABOVE */ +const XK_Etilde = 0x1001ebc /* U+1EBC LATIN CAPITAL LETTER E WITH TILDE */ +const XK_etilde = 0x1001ebd /* U+1EBD LATIN SMALL LETTER E WITH TILDE */ +const XK_Ecircumflexacute = 0x1001ebe /* U+1EBE LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE */ +const XK_ecircumflexacute = 0x1001ebf /* U+1EBF LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE */ +const XK_Ecircumflexgrave = 0x1001ec0 /* U+1EC0 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE */ +const XK_ecircumflexgrave = 0x1001ec1 /* U+1EC1 LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE */ +const XK_Ecircumflexhook = 0x1001ec2 /* U+1EC2 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */ +const XK_ecircumflexhook = 0x1001ec3 /* U+1EC3 LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */ +const XK_Ecircumflextilde = 0x1001ec4 /* U+1EC4 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE */ +const XK_ecircumflextilde = 0x1001ec5 /* U+1EC5 LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE */ +const XK_Ecircumflexbelowdot = 0x1001ec6 /* U+1EC6 LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW */ +const XK_ecircumflexbelowdot = 0x1001ec7 /* U+1EC7 LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW */ +const XK_Ihook = 0x1001ec8 /* U+1EC8 LATIN CAPITAL LETTER I WITH HOOK ABOVE */ +const XK_ihook = 0x1001ec9 /* U+1EC9 LATIN SMALL LETTER I WITH HOOK ABOVE */ +const XK_Ibelowdot = 0x1001eca /* U+1ECA LATIN CAPITAL LETTER I WITH DOT BELOW */ +const XK_ibelowdot = 0x1001ecb /* U+1ECB LATIN SMALL LETTER I WITH DOT BELOW */ +const XK_Obelowdot = 0x1001ecc /* U+1ECC LATIN CAPITAL LETTER O WITH DOT BELOW */ +const XK_obelowdot = 0x1001ecd /* U+1ECD LATIN SMALL LETTER O WITH DOT BELOW */ +const XK_Ohook = 0x1001ece /* U+1ECE LATIN CAPITAL LETTER O WITH HOOK ABOVE */ +const XK_ohook = 0x1001ecf /* U+1ECF LATIN SMALL LETTER O WITH HOOK ABOVE */ +const XK_Ocircumflexacute = 0x1001ed0 /* U+1ED0 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE */ +const XK_ocircumflexacute = 0x1001ed1 /* U+1ED1 LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE */ +const XK_Ocircumflexgrave = 0x1001ed2 /* U+1ED2 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE */ +const XK_ocircumflexgrave = 0x1001ed3 /* U+1ED3 LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE */ +const XK_Ocircumflexhook = 0x1001ed4 /* U+1ED4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */ +const XK_ocircumflexhook = 0x1001ed5 /* U+1ED5 LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */ +const XK_Ocircumflextilde = 0x1001ed6 /* U+1ED6 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE */ +const XK_ocircumflextilde = 0x1001ed7 /* U+1ED7 LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE */ +const XK_Ocircumflexbelowdot = 0x1001ed8 /* U+1ED8 LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELOW */ +const XK_ocircumflexbelowdot = 0x1001ed9 /* U+1ED9 LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW */ +const XK_Ohornacute = 0x1001eda /* U+1EDA LATIN CAPITAL LETTER O WITH HORN AND ACUTE */ +const XK_ohornacute = 0x1001edb /* U+1EDB LATIN SMALL LETTER O WITH HORN AND ACUTE */ +const XK_Ohorngrave = 0x1001edc /* U+1EDC LATIN CAPITAL LETTER O WITH HORN AND GRAVE */ +const XK_ohorngrave = 0x1001edd /* U+1EDD LATIN SMALL LETTER O WITH HORN AND GRAVE */ +const XK_Ohornhook = 0x1001ede /* U+1EDE LATIN CAPITAL LETTER O WITH HORN AND HOOK ABOVE */ +const XK_ohornhook = 0x1001edf /* U+1EDF LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE */ +const XK_Ohorntilde = 0x1001ee0 /* U+1EE0 LATIN CAPITAL LETTER O WITH HORN AND TILDE */ +const XK_ohorntilde = 0x1001ee1 /* U+1EE1 LATIN SMALL LETTER O WITH HORN AND TILDE */ +const XK_Ohornbelowdot = 0x1001ee2 /* U+1EE2 LATIN CAPITAL LETTER O WITH HORN AND DOT BELOW */ +const XK_ohornbelowdot = 0x1001ee3 /* U+1EE3 LATIN SMALL LETTER O WITH HORN AND DOT BELOW */ +const XK_Ubelowdot = 0x1001ee4 /* U+1EE4 LATIN CAPITAL LETTER U WITH DOT BELOW */ +const XK_ubelowdot = 0x1001ee5 /* U+1EE5 LATIN SMALL LETTER U WITH DOT BELOW */ +const XK_Uhook = 0x1001ee6 /* U+1EE6 LATIN CAPITAL LETTER U WITH HOOK ABOVE */ +const XK_uhook = 0x1001ee7 /* U+1EE7 LATIN SMALL LETTER U WITH HOOK ABOVE */ +const XK_Uhornacute = 0x1001ee8 /* U+1EE8 LATIN CAPITAL LETTER U WITH HORN AND ACUTE */ +const XK_uhornacute = 0x1001ee9 /* U+1EE9 LATIN SMALL LETTER U WITH HORN AND ACUTE */ +const XK_Uhorngrave = 0x1001eea /* U+1EEA LATIN CAPITAL LETTER U WITH HORN AND GRAVE */ +const XK_uhorngrave = 0x1001eeb /* U+1EEB LATIN SMALL LETTER U WITH HORN AND GRAVE */ +const XK_Uhornhook = 0x1001eec /* U+1EEC LATIN CAPITAL LETTER U WITH HORN AND HOOK ABOVE */ +const XK_uhornhook = 0x1001eed /* U+1EED LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE */ +const XK_Uhorntilde = 0x1001eee /* U+1EEE LATIN CAPITAL LETTER U WITH HORN AND TILDE */ +const XK_uhorntilde = 0x1001eef /* U+1EEF LATIN SMALL LETTER U WITH HORN AND TILDE */ +const XK_Uhornbelowdot = 0x1001ef0 /* U+1EF0 LATIN CAPITAL LETTER U WITH HORN AND DOT BELOW */ +const XK_uhornbelowdot = 0x1001ef1 /* U+1EF1 LATIN SMALL LETTER U WITH HORN AND DOT BELOW */ +const XK_Ybelowdot = 0x1001ef4 /* U+1EF4 LATIN CAPITAL LETTER Y WITH DOT BELOW */ +const XK_ybelowdot = 0x1001ef5 /* U+1EF5 LATIN SMALL LETTER Y WITH DOT BELOW */ +const XK_Yhook = 0x1001ef6 /* U+1EF6 LATIN CAPITAL LETTER Y WITH HOOK ABOVE */ +const XK_yhook = 0x1001ef7 /* U+1EF7 LATIN SMALL LETTER Y WITH HOOK ABOVE */ +const XK_Ytilde = 0x1001ef8 /* U+1EF8 LATIN CAPITAL LETTER Y WITH TILDE */ +const XK_ytilde = 0x1001ef9 /* U+1EF9 LATIN SMALL LETTER Y WITH TILDE */ +const XK_Ohorn = 0x10001a0 /* U+01A0 LATIN CAPITAL LETTER O WITH HORN */ +const XK_ohorn = 0x10001a1 /* U+01A1 LATIN SMALL LETTER O WITH HORN */ +const XK_Uhorn = 0x10001af /* U+01AF LATIN CAPITAL LETTER U WITH HORN */ +const XK_uhorn = 0x10001b0 /* U+01B0 LATIN SMALL LETTER U WITH HORN */ + +//endif /* XK_VIETNAMESE */ + +//ifdef XK_CURRENCY +const XK_EcuSign = 0x10020a0 /* U+20A0 EURO-CURRENCY SIGN */ +const XK_ColonSign = 0x10020a1 /* U+20A1 COLON SIGN */ +const XK_CruzeiroSign = 0x10020a2 /* U+20A2 CRUZEIRO SIGN */ +const XK_FFrancSign = 0x10020a3 /* U+20A3 FRENCH FRANC SIGN */ +const XK_LiraSign = 0x10020a4 /* U+20A4 LIRA SIGN */ +const XK_MillSign = 0x10020a5 /* U+20A5 MILL SIGN */ +const XK_NairaSign = 0x10020a6 /* U+20A6 NAIRA SIGN */ +const XK_PesetaSign = 0x10020a7 /* U+20A7 PESETA SIGN */ +const XK_RupeeSign = 0x10020a8 /* U+20A8 RUPEE SIGN */ +const XK_WonSign = 0x10020a9 /* U+20A9 WON SIGN */ +const XK_NewSheqelSign = 0x10020aa /* U+20AA NEW SHEQEL SIGN */ +const XK_DongSign = 0x10020ab /* U+20AB DONG SIGN */ +const XK_EuroSign = 0x20ac /* U+20AC EURO SIGN */ +//endif /* XK_CURRENCY */ + +//ifdef XK_MATHEMATICAL +/* one, two and three are defined above. */ +const XK_zerosuperior = 0x1002070 /* U+2070 SUPERSCRIPT ZERO */ +const XK_foursuperior = 0x1002074 /* U+2074 SUPERSCRIPT FOUR */ +const XK_fivesuperior = 0x1002075 /* U+2075 SUPERSCRIPT FIVE */ +const XK_sixsuperior = 0x1002076 /* U+2076 SUPERSCRIPT SIX */ +const XK_sevensuperior = 0x1002077 /* U+2077 SUPERSCRIPT SEVEN */ +const XK_eightsuperior = 0x1002078 /* U+2078 SUPERSCRIPT EIGHT */ +const XK_ninesuperior = 0x1002079 /* U+2079 SUPERSCRIPT NINE */ +const XK_zerosubscript = 0x1002080 /* U+2080 SUBSCRIPT ZERO */ +const XK_onesubscript = 0x1002081 /* U+2081 SUBSCRIPT ONE */ +const XK_twosubscript = 0x1002082 /* U+2082 SUBSCRIPT TWO */ +const XK_threesubscript = 0x1002083 /* U+2083 SUBSCRIPT THREE */ +const XK_foursubscript = 0x1002084 /* U+2084 SUBSCRIPT FOUR */ +const XK_fivesubscript = 0x1002085 /* U+2085 SUBSCRIPT FIVE */ +const XK_sixsubscript = 0x1002086 /* U+2086 SUBSCRIPT SIX */ +const XK_sevensubscript = 0x1002087 /* U+2087 SUBSCRIPT SEVEN */ +const XK_eightsubscript = 0x1002088 /* U+2088 SUBSCRIPT EIGHT */ +const XK_ninesubscript = 0x1002089 /* U+2089 SUBSCRIPT NINE */ +const XK_partdifferential = 0x1002202 /* U+2202 PARTIAL DIFFERENTIAL */ +const XK_emptyset = 0x1002205 /* U+2205 NULL SET */ +const XK_elementof = 0x1002208 /* U+2208 ELEMENT OF */ +const XK_notelementof = 0x1002209 /* U+2209 NOT AN ELEMENT OF */ +const XK_containsas = 0x100220B /* U+220B CONTAINS AS MEMBER */ +const XK_squareroot = 0x100221A /* U+221A SQUARE ROOT */ +const XK_cuberoot = 0x100221B /* U+221B CUBE ROOT */ +const XK_fourthroot = 0x100221C /* U+221C FOURTH ROOT */ +const XK_dintegral = 0x100222C /* U+222C DOUBLE INTEGRAL */ +const XK_tintegral = 0x100222D /* U+222D TRIPLE INTEGRAL */ +const XK_because = 0x1002235 /* U+2235 BECAUSE */ +const XK_approxeq = 0x1002248 /* U+2245 ALMOST EQUAL TO */ +const XK_notapproxeq = 0x1002247 /* U+2247 NOT ALMOST EQUAL TO */ +const XK_notidentical = 0x1002262 /* U+2262 NOT IDENTICAL TO */ +const XK_stricteq = 0x1002263 /* U+2263 STRICTLY EQUIVALENT TO */ +//endif /* XK_MATHEMATICAL */ + +//ifdef XK_BRAILLE +const XK_braille_dot_1 = 0xfff1 +const XK_braille_dot_2 = 0xfff2 +const XK_braille_dot_3 = 0xfff3 +const XK_braille_dot_4 = 0xfff4 +const XK_braille_dot_5 = 0xfff5 +const XK_braille_dot_6 = 0xfff6 +const XK_braille_dot_7 = 0xfff7 +const XK_braille_dot_8 = 0xfff8 +const XK_braille_dot_9 = 0xfff9 +const XK_braille_dot_10 = 0xfffa +const XK_braille_blank = 0x1002800 /* U+2800 BRAILLE PATTERN BLANK */ +const XK_braille_dots_1 = 0x1002801 /* U+2801 BRAILLE PATTERN DOTS-1 */ +const XK_braille_dots_2 = 0x1002802 /* U+2802 BRAILLE PATTERN DOTS-2 */ +const XK_braille_dots_12 = 0x1002803 /* U+2803 BRAILLE PATTERN DOTS-12 */ +const XK_braille_dots_3 = 0x1002804 /* U+2804 BRAILLE PATTERN DOTS-3 */ +const XK_braille_dots_13 = 0x1002805 /* U+2805 BRAILLE PATTERN DOTS-13 */ +const XK_braille_dots_23 = 0x1002806 /* U+2806 BRAILLE PATTERN DOTS-23 */ +const XK_braille_dots_123 = 0x1002807 /* U+2807 BRAILLE PATTERN DOTS-123 */ +const XK_braille_dots_4 = 0x1002808 /* U+2808 BRAILLE PATTERN DOTS-4 */ +const XK_braille_dots_14 = 0x1002809 /* U+2809 BRAILLE PATTERN DOTS-14 */ +const XK_braille_dots_24 = 0x100280a /* U+280a BRAILLE PATTERN DOTS-24 */ +const XK_braille_dots_124 = 0x100280b /* U+280b BRAILLE PATTERN DOTS-124 */ +const XK_braille_dots_34 = 0x100280c /* U+280c BRAILLE PATTERN DOTS-34 */ +const XK_braille_dots_134 = 0x100280d /* U+280d BRAILLE PATTERN DOTS-134 */ +const XK_braille_dots_234 = 0x100280e /* U+280e BRAILLE PATTERN DOTS-234 */ +const XK_braille_dots_1234 = 0x100280f /* U+280f BRAILLE PATTERN DOTS-1234 */ +const XK_braille_dots_5 = 0x1002810 /* U+2810 BRAILLE PATTERN DOTS-5 */ +const XK_braille_dots_15 = 0x1002811 /* U+2811 BRAILLE PATTERN DOTS-15 */ +const XK_braille_dots_25 = 0x1002812 /* U+2812 BRAILLE PATTERN DOTS-25 */ +const XK_braille_dots_125 = 0x1002813 /* U+2813 BRAILLE PATTERN DOTS-125 */ +const XK_braille_dots_35 = 0x1002814 /* U+2814 BRAILLE PATTERN DOTS-35 */ +const XK_braille_dots_135 = 0x1002815 /* U+2815 BRAILLE PATTERN DOTS-135 */ +const XK_braille_dots_235 = 0x1002816 /* U+2816 BRAILLE PATTERN DOTS-235 */ +const XK_braille_dots_1235 = 0x1002817 /* U+2817 BRAILLE PATTERN DOTS-1235 */ +const XK_braille_dots_45 = 0x1002818 /* U+2818 BRAILLE PATTERN DOTS-45 */ +const XK_braille_dots_145 = 0x1002819 /* U+2819 BRAILLE PATTERN DOTS-145 */ +const XK_braille_dots_245 = 0x100281a /* U+281a BRAILLE PATTERN DOTS-245 */ +const XK_braille_dots_1245 = 0x100281b /* U+281b BRAILLE PATTERN DOTS-1245 */ +const XK_braille_dots_345 = 0x100281c /* U+281c BRAILLE PATTERN DOTS-345 */ +const XK_braille_dots_1345 = 0x100281d /* U+281d BRAILLE PATTERN DOTS-1345 */ +const XK_braille_dots_2345 = 0x100281e /* U+281e BRAILLE PATTERN DOTS-2345 */ +const XK_braille_dots_12345 = 0x100281f /* U+281f BRAILLE PATTERN DOTS-12345 */ +const XK_braille_dots_6 = 0x1002820 /* U+2820 BRAILLE PATTERN DOTS-6 */ +const XK_braille_dots_16 = 0x1002821 /* U+2821 BRAILLE PATTERN DOTS-16 */ +const XK_braille_dots_26 = 0x1002822 /* U+2822 BRAILLE PATTERN DOTS-26 */ +const XK_braille_dots_126 = 0x1002823 /* U+2823 BRAILLE PATTERN DOTS-126 */ +const XK_braille_dots_36 = 0x1002824 /* U+2824 BRAILLE PATTERN DOTS-36 */ +const XK_braille_dots_136 = 0x1002825 /* U+2825 BRAILLE PATTERN DOTS-136 */ +const XK_braille_dots_236 = 0x1002826 /* U+2826 BRAILLE PATTERN DOTS-236 */ +const XK_braille_dots_1236 = 0x1002827 /* U+2827 BRAILLE PATTERN DOTS-1236 */ +const XK_braille_dots_46 = 0x1002828 /* U+2828 BRAILLE PATTERN DOTS-46 */ +const XK_braille_dots_146 = 0x1002829 /* U+2829 BRAILLE PATTERN DOTS-146 */ +const XK_braille_dots_246 = 0x100282a /* U+282a BRAILLE PATTERN DOTS-246 */ +const XK_braille_dots_1246 = 0x100282b /* U+282b BRAILLE PATTERN DOTS-1246 */ +const XK_braille_dots_346 = 0x100282c /* U+282c BRAILLE PATTERN DOTS-346 */ +const XK_braille_dots_1346 = 0x100282d /* U+282d BRAILLE PATTERN DOTS-1346 */ +const XK_braille_dots_2346 = 0x100282e /* U+282e BRAILLE PATTERN DOTS-2346 */ +const XK_braille_dots_12346 = 0x100282f /* U+282f BRAILLE PATTERN DOTS-12346 */ +const XK_braille_dots_56 = 0x1002830 /* U+2830 BRAILLE PATTERN DOTS-56 */ +const XK_braille_dots_156 = 0x1002831 /* U+2831 BRAILLE PATTERN DOTS-156 */ +const XK_braille_dots_256 = 0x1002832 /* U+2832 BRAILLE PATTERN DOTS-256 */ +const XK_braille_dots_1256 = 0x1002833 /* U+2833 BRAILLE PATTERN DOTS-1256 */ +const XK_braille_dots_356 = 0x1002834 /* U+2834 BRAILLE PATTERN DOTS-356 */ +const XK_braille_dots_1356 = 0x1002835 /* U+2835 BRAILLE PATTERN DOTS-1356 */ +const XK_braille_dots_2356 = 0x1002836 /* U+2836 BRAILLE PATTERN DOTS-2356 */ +const XK_braille_dots_12356 = 0x1002837 /* U+2837 BRAILLE PATTERN DOTS-12356 */ +const XK_braille_dots_456 = 0x1002838 /* U+2838 BRAILLE PATTERN DOTS-456 */ +const XK_braille_dots_1456 = 0x1002839 /* U+2839 BRAILLE PATTERN DOTS-1456 */ +const XK_braille_dots_2456 = 0x100283a /* U+283a BRAILLE PATTERN DOTS-2456 */ +const XK_braille_dots_12456 = 0x100283b /* U+283b BRAILLE PATTERN DOTS-12456 */ +const XK_braille_dots_3456 = 0x100283c /* U+283c BRAILLE PATTERN DOTS-3456 */ +const XK_braille_dots_13456 = 0x100283d /* U+283d BRAILLE PATTERN DOTS-13456 */ +const XK_braille_dots_23456 = 0x100283e /* U+283e BRAILLE PATTERN DOTS-23456 */ +const XK_braille_dots_123456 = 0x100283f /* U+283f BRAILLE PATTERN DOTS-123456 */ +const XK_braille_dots_7 = 0x1002840 /* U+2840 BRAILLE PATTERN DOTS-7 */ +const XK_braille_dots_17 = 0x1002841 /* U+2841 BRAILLE PATTERN DOTS-17 */ +const XK_braille_dots_27 = 0x1002842 /* U+2842 BRAILLE PATTERN DOTS-27 */ +const XK_braille_dots_127 = 0x1002843 /* U+2843 BRAILLE PATTERN DOTS-127 */ +const XK_braille_dots_37 = 0x1002844 /* U+2844 BRAILLE PATTERN DOTS-37 */ +const XK_braille_dots_137 = 0x1002845 /* U+2845 BRAILLE PATTERN DOTS-137 */ +const XK_braille_dots_237 = 0x1002846 /* U+2846 BRAILLE PATTERN DOTS-237 */ +const XK_braille_dots_1237 = 0x1002847 /* U+2847 BRAILLE PATTERN DOTS-1237 */ +const XK_braille_dots_47 = 0x1002848 /* U+2848 BRAILLE PATTERN DOTS-47 */ +const XK_braille_dots_147 = 0x1002849 /* U+2849 BRAILLE PATTERN DOTS-147 */ +const XK_braille_dots_247 = 0x100284a /* U+284a BRAILLE PATTERN DOTS-247 */ +const XK_braille_dots_1247 = 0x100284b /* U+284b BRAILLE PATTERN DOTS-1247 */ +const XK_braille_dots_347 = 0x100284c /* U+284c BRAILLE PATTERN DOTS-347 */ +const XK_braille_dots_1347 = 0x100284d /* U+284d BRAILLE PATTERN DOTS-1347 */ +const XK_braille_dots_2347 = 0x100284e /* U+284e BRAILLE PATTERN DOTS-2347 */ +const XK_braille_dots_12347 = 0x100284f /* U+284f BRAILLE PATTERN DOTS-12347 */ +const XK_braille_dots_57 = 0x1002850 /* U+2850 BRAILLE PATTERN DOTS-57 */ +const XK_braille_dots_157 = 0x1002851 /* U+2851 BRAILLE PATTERN DOTS-157 */ +const XK_braille_dots_257 = 0x1002852 /* U+2852 BRAILLE PATTERN DOTS-257 */ +const XK_braille_dots_1257 = 0x1002853 /* U+2853 BRAILLE PATTERN DOTS-1257 */ +const XK_braille_dots_357 = 0x1002854 /* U+2854 BRAILLE PATTERN DOTS-357 */ +const XK_braille_dots_1357 = 0x1002855 /* U+2855 BRAILLE PATTERN DOTS-1357 */ +const XK_braille_dots_2357 = 0x1002856 /* U+2856 BRAILLE PATTERN DOTS-2357 */ +const XK_braille_dots_12357 = 0x1002857 /* U+2857 BRAILLE PATTERN DOTS-12357 */ +const XK_braille_dots_457 = 0x1002858 /* U+2858 BRAILLE PATTERN DOTS-457 */ +const XK_braille_dots_1457 = 0x1002859 /* U+2859 BRAILLE PATTERN DOTS-1457 */ +const XK_braille_dots_2457 = 0x100285a /* U+285a BRAILLE PATTERN DOTS-2457 */ +const XK_braille_dots_12457 = 0x100285b /* U+285b BRAILLE PATTERN DOTS-12457 */ +const XK_braille_dots_3457 = 0x100285c /* U+285c BRAILLE PATTERN DOTS-3457 */ +const XK_braille_dots_13457 = 0x100285d /* U+285d BRAILLE PATTERN DOTS-13457 */ +const XK_braille_dots_23457 = 0x100285e /* U+285e BRAILLE PATTERN DOTS-23457 */ +const XK_braille_dots_123457 = 0x100285f /* U+285f BRAILLE PATTERN DOTS-123457 */ +const XK_braille_dots_67 = 0x1002860 /* U+2860 BRAILLE PATTERN DOTS-67 */ +const XK_braille_dots_167 = 0x1002861 /* U+2861 BRAILLE PATTERN DOTS-167 */ +const XK_braille_dots_267 = 0x1002862 /* U+2862 BRAILLE PATTERN DOTS-267 */ +const XK_braille_dots_1267 = 0x1002863 /* U+2863 BRAILLE PATTERN DOTS-1267 */ +const XK_braille_dots_367 = 0x1002864 /* U+2864 BRAILLE PATTERN DOTS-367 */ +const XK_braille_dots_1367 = 0x1002865 /* U+2865 BRAILLE PATTERN DOTS-1367 */ +const XK_braille_dots_2367 = 0x1002866 /* U+2866 BRAILLE PATTERN DOTS-2367 */ +const XK_braille_dots_12367 = 0x1002867 /* U+2867 BRAILLE PATTERN DOTS-12367 */ +const XK_braille_dots_467 = 0x1002868 /* U+2868 BRAILLE PATTERN DOTS-467 */ +const XK_braille_dots_1467 = 0x1002869 /* U+2869 BRAILLE PATTERN DOTS-1467 */ +const XK_braille_dots_2467 = 0x100286a /* U+286a BRAILLE PATTERN DOTS-2467 */ +const XK_braille_dots_12467 = 0x100286b /* U+286b BRAILLE PATTERN DOTS-12467 */ +const XK_braille_dots_3467 = 0x100286c /* U+286c BRAILLE PATTERN DOTS-3467 */ +const XK_braille_dots_13467 = 0x100286d /* U+286d BRAILLE PATTERN DOTS-13467 */ +const XK_braille_dots_23467 = 0x100286e /* U+286e BRAILLE PATTERN DOTS-23467 */ +const XK_braille_dots_123467 = 0x100286f /* U+286f BRAILLE PATTERN DOTS-123467 */ +const XK_braille_dots_567 = 0x1002870 /* U+2870 BRAILLE PATTERN DOTS-567 */ +const XK_braille_dots_1567 = 0x1002871 /* U+2871 BRAILLE PATTERN DOTS-1567 */ +const XK_braille_dots_2567 = 0x1002872 /* U+2872 BRAILLE PATTERN DOTS-2567 */ +const XK_braille_dots_12567 = 0x1002873 /* U+2873 BRAILLE PATTERN DOTS-12567 */ +const XK_braille_dots_3567 = 0x1002874 /* U+2874 BRAILLE PATTERN DOTS-3567 */ +const XK_braille_dots_13567 = 0x1002875 /* U+2875 BRAILLE PATTERN DOTS-13567 */ +const XK_braille_dots_23567 = 0x1002876 /* U+2876 BRAILLE PATTERN DOTS-23567 */ +const XK_braille_dots_123567 = 0x1002877 /* U+2877 BRAILLE PATTERN DOTS-123567 */ +const XK_braille_dots_4567 = 0x1002878 /* U+2878 BRAILLE PATTERN DOTS-4567 */ +const XK_braille_dots_14567 = 0x1002879 /* U+2879 BRAILLE PATTERN DOTS-14567 */ +const XK_braille_dots_24567 = 0x100287a /* U+287a BRAILLE PATTERN DOTS-24567 */ +const XK_braille_dots_124567 = 0x100287b /* U+287b BRAILLE PATTERN DOTS-124567 */ +const XK_braille_dots_34567 = 0x100287c /* U+287c BRAILLE PATTERN DOTS-34567 */ +const XK_braille_dots_134567 = 0x100287d /* U+287d BRAILLE PATTERN DOTS-134567 */ +const XK_braille_dots_234567 = 0x100287e /* U+287e BRAILLE PATTERN DOTS-234567 */ +const XK_braille_dots_1234567 = 0x100287f /* U+287f BRAILLE PATTERN DOTS-1234567 */ +const XK_braille_dots_8 = 0x1002880 /* U+2880 BRAILLE PATTERN DOTS-8 */ +const XK_braille_dots_18 = 0x1002881 /* U+2881 BRAILLE PATTERN DOTS-18 */ +const XK_braille_dots_28 = 0x1002882 /* U+2882 BRAILLE PATTERN DOTS-28 */ +const XK_braille_dots_128 = 0x1002883 /* U+2883 BRAILLE PATTERN DOTS-128 */ +const XK_braille_dots_38 = 0x1002884 /* U+2884 BRAILLE PATTERN DOTS-38 */ +const XK_braille_dots_138 = 0x1002885 /* U+2885 BRAILLE PATTERN DOTS-138 */ +const XK_braille_dots_238 = 0x1002886 /* U+2886 BRAILLE PATTERN DOTS-238 */ +const XK_braille_dots_1238 = 0x1002887 /* U+2887 BRAILLE PATTERN DOTS-1238 */ +const XK_braille_dots_48 = 0x1002888 /* U+2888 BRAILLE PATTERN DOTS-48 */ +const XK_braille_dots_148 = 0x1002889 /* U+2889 BRAILLE PATTERN DOTS-148 */ +const XK_braille_dots_248 = 0x100288a /* U+288a BRAILLE PATTERN DOTS-248 */ +const XK_braille_dots_1248 = 0x100288b /* U+288b BRAILLE PATTERN DOTS-1248 */ +const XK_braille_dots_348 = 0x100288c /* U+288c BRAILLE PATTERN DOTS-348 */ +const XK_braille_dots_1348 = 0x100288d /* U+288d BRAILLE PATTERN DOTS-1348 */ +const XK_braille_dots_2348 = 0x100288e /* U+288e BRAILLE PATTERN DOTS-2348 */ +const XK_braille_dots_12348 = 0x100288f /* U+288f BRAILLE PATTERN DOTS-12348 */ +const XK_braille_dots_58 = 0x1002890 /* U+2890 BRAILLE PATTERN DOTS-58 */ +const XK_braille_dots_158 = 0x1002891 /* U+2891 BRAILLE PATTERN DOTS-158 */ +const XK_braille_dots_258 = 0x1002892 /* U+2892 BRAILLE PATTERN DOTS-258 */ +const XK_braille_dots_1258 = 0x1002893 /* U+2893 BRAILLE PATTERN DOTS-1258 */ +const XK_braille_dots_358 = 0x1002894 /* U+2894 BRAILLE PATTERN DOTS-358 */ +const XK_braille_dots_1358 = 0x1002895 /* U+2895 BRAILLE PATTERN DOTS-1358 */ +const XK_braille_dots_2358 = 0x1002896 /* U+2896 BRAILLE PATTERN DOTS-2358 */ +const XK_braille_dots_12358 = 0x1002897 /* U+2897 BRAILLE PATTERN DOTS-12358 */ +const XK_braille_dots_458 = 0x1002898 /* U+2898 BRAILLE PATTERN DOTS-458 */ +const XK_braille_dots_1458 = 0x1002899 /* U+2899 BRAILLE PATTERN DOTS-1458 */ +const XK_braille_dots_2458 = 0x100289a /* U+289a BRAILLE PATTERN DOTS-2458 */ +const XK_braille_dots_12458 = 0x100289b /* U+289b BRAILLE PATTERN DOTS-12458 */ +const XK_braille_dots_3458 = 0x100289c /* U+289c BRAILLE PATTERN DOTS-3458 */ +const XK_braille_dots_13458 = 0x100289d /* U+289d BRAILLE PATTERN DOTS-13458 */ +const XK_braille_dots_23458 = 0x100289e /* U+289e BRAILLE PATTERN DOTS-23458 */ +const XK_braille_dots_123458 = 0x100289f /* U+289f BRAILLE PATTERN DOTS-123458 */ +const XK_braille_dots_68 = 0x10028a0 /* U+28a0 BRAILLE PATTERN DOTS-68 */ +const XK_braille_dots_168 = 0x10028a1 /* U+28a1 BRAILLE PATTERN DOTS-168 */ +const XK_braille_dots_268 = 0x10028a2 /* U+28a2 BRAILLE PATTERN DOTS-268 */ +const XK_braille_dots_1268 = 0x10028a3 /* U+28a3 BRAILLE PATTERN DOTS-1268 */ +const XK_braille_dots_368 = 0x10028a4 /* U+28a4 BRAILLE PATTERN DOTS-368 */ +const XK_braille_dots_1368 = 0x10028a5 /* U+28a5 BRAILLE PATTERN DOTS-1368 */ +const XK_braille_dots_2368 = 0x10028a6 /* U+28a6 BRAILLE PATTERN DOTS-2368 */ +const XK_braille_dots_12368 = 0x10028a7 /* U+28a7 BRAILLE PATTERN DOTS-12368 */ +const XK_braille_dots_468 = 0x10028a8 /* U+28a8 BRAILLE PATTERN DOTS-468 */ +const XK_braille_dots_1468 = 0x10028a9 /* U+28a9 BRAILLE PATTERN DOTS-1468 */ +const XK_braille_dots_2468 = 0x10028aa /* U+28aa BRAILLE PATTERN DOTS-2468 */ +const XK_braille_dots_12468 = 0x10028ab /* U+28ab BRAILLE PATTERN DOTS-12468 */ +const XK_braille_dots_3468 = 0x10028ac /* U+28ac BRAILLE PATTERN DOTS-3468 */ +const XK_braille_dots_13468 = 0x10028ad /* U+28ad BRAILLE PATTERN DOTS-13468 */ +const XK_braille_dots_23468 = 0x10028ae /* U+28ae BRAILLE PATTERN DOTS-23468 */ +const XK_braille_dots_123468 = 0x10028af /* U+28af BRAILLE PATTERN DOTS-123468 */ +const XK_braille_dots_568 = 0x10028b0 /* U+28b0 BRAILLE PATTERN DOTS-568 */ +const XK_braille_dots_1568 = 0x10028b1 /* U+28b1 BRAILLE PATTERN DOTS-1568 */ +const XK_braille_dots_2568 = 0x10028b2 /* U+28b2 BRAILLE PATTERN DOTS-2568 */ +const XK_braille_dots_12568 = 0x10028b3 /* U+28b3 BRAILLE PATTERN DOTS-12568 */ +const XK_braille_dots_3568 = 0x10028b4 /* U+28b4 BRAILLE PATTERN DOTS-3568 */ +const XK_braille_dots_13568 = 0x10028b5 /* U+28b5 BRAILLE PATTERN DOTS-13568 */ +const XK_braille_dots_23568 = 0x10028b6 /* U+28b6 BRAILLE PATTERN DOTS-23568 */ +const XK_braille_dots_123568 = 0x10028b7 /* U+28b7 BRAILLE PATTERN DOTS-123568 */ +const XK_braille_dots_4568 = 0x10028b8 /* U+28b8 BRAILLE PATTERN DOTS-4568 */ +const XK_braille_dots_14568 = 0x10028b9 /* U+28b9 BRAILLE PATTERN DOTS-14568 */ +const XK_braille_dots_24568 = 0x10028ba /* U+28ba BRAILLE PATTERN DOTS-24568 */ +const XK_braille_dots_124568 = 0x10028bb /* U+28bb BRAILLE PATTERN DOTS-124568 */ +const XK_braille_dots_34568 = 0x10028bc /* U+28bc BRAILLE PATTERN DOTS-34568 */ +const XK_braille_dots_134568 = 0x10028bd /* U+28bd BRAILLE PATTERN DOTS-134568 */ +const XK_braille_dots_234568 = 0x10028be /* U+28be BRAILLE PATTERN DOTS-234568 */ +const XK_braille_dots_1234568 = 0x10028bf /* U+28bf BRAILLE PATTERN DOTS-1234568 */ +const XK_braille_dots_78 = 0x10028c0 /* U+28c0 BRAILLE PATTERN DOTS-78 */ +const XK_braille_dots_178 = 0x10028c1 /* U+28c1 BRAILLE PATTERN DOTS-178 */ +const XK_braille_dots_278 = 0x10028c2 /* U+28c2 BRAILLE PATTERN DOTS-278 */ +const XK_braille_dots_1278 = 0x10028c3 /* U+28c3 BRAILLE PATTERN DOTS-1278 */ +const XK_braille_dots_378 = 0x10028c4 /* U+28c4 BRAILLE PATTERN DOTS-378 */ +const XK_braille_dots_1378 = 0x10028c5 /* U+28c5 BRAILLE PATTERN DOTS-1378 */ +const XK_braille_dots_2378 = 0x10028c6 /* U+28c6 BRAILLE PATTERN DOTS-2378 */ +const XK_braille_dots_12378 = 0x10028c7 /* U+28c7 BRAILLE PATTERN DOTS-12378 */ +const XK_braille_dots_478 = 0x10028c8 /* U+28c8 BRAILLE PATTERN DOTS-478 */ +const XK_braille_dots_1478 = 0x10028c9 /* U+28c9 BRAILLE PATTERN DOTS-1478 */ +const XK_braille_dots_2478 = 0x10028ca /* U+28ca BRAILLE PATTERN DOTS-2478 */ +const XK_braille_dots_12478 = 0x10028cb /* U+28cb BRAILLE PATTERN DOTS-12478 */ +const XK_braille_dots_3478 = 0x10028cc /* U+28cc BRAILLE PATTERN DOTS-3478 */ +const XK_braille_dots_13478 = 0x10028cd /* U+28cd BRAILLE PATTERN DOTS-13478 */ +const XK_braille_dots_23478 = 0x10028ce /* U+28ce BRAILLE PATTERN DOTS-23478 */ +const XK_braille_dots_123478 = 0x10028cf /* U+28cf BRAILLE PATTERN DOTS-123478 */ +const XK_braille_dots_578 = 0x10028d0 /* U+28d0 BRAILLE PATTERN DOTS-578 */ +const XK_braille_dots_1578 = 0x10028d1 /* U+28d1 BRAILLE PATTERN DOTS-1578 */ +const XK_braille_dots_2578 = 0x10028d2 /* U+28d2 BRAILLE PATTERN DOTS-2578 */ +const XK_braille_dots_12578 = 0x10028d3 /* U+28d3 BRAILLE PATTERN DOTS-12578 */ +const XK_braille_dots_3578 = 0x10028d4 /* U+28d4 BRAILLE PATTERN DOTS-3578 */ +const XK_braille_dots_13578 = 0x10028d5 /* U+28d5 BRAILLE PATTERN DOTS-13578 */ +const XK_braille_dots_23578 = 0x10028d6 /* U+28d6 BRAILLE PATTERN DOTS-23578 */ +const XK_braille_dots_123578 = 0x10028d7 /* U+28d7 BRAILLE PATTERN DOTS-123578 */ +const XK_braille_dots_4578 = 0x10028d8 /* U+28d8 BRAILLE PATTERN DOTS-4578 */ +const XK_braille_dots_14578 = 0x10028d9 /* U+28d9 BRAILLE PATTERN DOTS-14578 */ +const XK_braille_dots_24578 = 0x10028da /* U+28da BRAILLE PATTERN DOTS-24578 */ +const XK_braille_dots_124578 = 0x10028db /* U+28db BRAILLE PATTERN DOTS-124578 */ +const XK_braille_dots_34578 = 0x10028dc /* U+28dc BRAILLE PATTERN DOTS-34578 */ +const XK_braille_dots_134578 = 0x10028dd /* U+28dd BRAILLE PATTERN DOTS-134578 */ +const XK_braille_dots_234578 = 0x10028de /* U+28de BRAILLE PATTERN DOTS-234578 */ +const XK_braille_dots_1234578 = 0x10028df /* U+28df BRAILLE PATTERN DOTS-1234578 */ +const XK_braille_dots_678 = 0x10028e0 /* U+28e0 BRAILLE PATTERN DOTS-678 */ +const XK_braille_dots_1678 = 0x10028e1 /* U+28e1 BRAILLE PATTERN DOTS-1678 */ +const XK_braille_dots_2678 = 0x10028e2 /* U+28e2 BRAILLE PATTERN DOTS-2678 */ +const XK_braille_dots_12678 = 0x10028e3 /* U+28e3 BRAILLE PATTERN DOTS-12678 */ +const XK_braille_dots_3678 = 0x10028e4 /* U+28e4 BRAILLE PATTERN DOTS-3678 */ +const XK_braille_dots_13678 = 0x10028e5 /* U+28e5 BRAILLE PATTERN DOTS-13678 */ +const XK_braille_dots_23678 = 0x10028e6 /* U+28e6 BRAILLE PATTERN DOTS-23678 */ +const XK_braille_dots_123678 = 0x10028e7 /* U+28e7 BRAILLE PATTERN DOTS-123678 */ +const XK_braille_dots_4678 = 0x10028e8 /* U+28e8 BRAILLE PATTERN DOTS-4678 */ +const XK_braille_dots_14678 = 0x10028e9 /* U+28e9 BRAILLE PATTERN DOTS-14678 */ +const XK_braille_dots_24678 = 0x10028ea /* U+28ea BRAILLE PATTERN DOTS-24678 */ +const XK_braille_dots_124678 = 0x10028eb /* U+28eb BRAILLE PATTERN DOTS-124678 */ +const XK_braille_dots_34678 = 0x10028ec /* U+28ec BRAILLE PATTERN DOTS-34678 */ +const XK_braille_dots_134678 = 0x10028ed /* U+28ed BRAILLE PATTERN DOTS-134678 */ +const XK_braille_dots_234678 = 0x10028ee /* U+28ee BRAILLE PATTERN DOTS-234678 */ +const XK_braille_dots_1234678 = 0x10028ef /* U+28ef BRAILLE PATTERN DOTS-1234678 */ +const XK_braille_dots_5678 = 0x10028f0 /* U+28f0 BRAILLE PATTERN DOTS-5678 */ +const XK_braille_dots_15678 = 0x10028f1 /* U+28f1 BRAILLE PATTERN DOTS-15678 */ +const XK_braille_dots_25678 = 0x10028f2 /* U+28f2 BRAILLE PATTERN DOTS-25678 */ +const XK_braille_dots_125678 = 0x10028f3 /* U+28f3 BRAILLE PATTERN DOTS-125678 */ +const XK_braille_dots_35678 = 0x10028f4 /* U+28f4 BRAILLE PATTERN DOTS-35678 */ +const XK_braille_dots_135678 = 0x10028f5 /* U+28f5 BRAILLE PATTERN DOTS-135678 */ +const XK_braille_dots_235678 = 0x10028f6 /* U+28f6 BRAILLE PATTERN DOTS-235678 */ +const XK_braille_dots_1235678 = 0x10028f7 /* U+28f7 BRAILLE PATTERN DOTS-1235678 */ +const XK_braille_dots_45678 = 0x10028f8 /* U+28f8 BRAILLE PATTERN DOTS-45678 */ +const XK_braille_dots_145678 = 0x10028f9 /* U+28f9 BRAILLE PATTERN DOTS-145678 */ +const XK_braille_dots_245678 = 0x10028fa /* U+28fa BRAILLE PATTERN DOTS-245678 */ +const XK_braille_dots_1245678 = 0x10028fb /* U+28fb BRAILLE PATTERN DOTS-1245678 */ +const XK_braille_dots_345678 = 0x10028fc /* U+28fc BRAILLE PATTERN DOTS-345678 */ +const XK_braille_dots_1345678 = 0x10028fd /* U+28fd BRAILLE PATTERN DOTS-1345678 */ +const XK_braille_dots_2345678 = 0x10028fe /* U+28fe BRAILLE PATTERN DOTS-2345678 */ +const XK_braille_dots_12345678 = 0x10028ff /* U+28ff BRAILLE PATTERN DOTS-12345678 */ +//endif /* XK_BRAILLE */ + +/* + * Sinhala (http://unicode.org/charts/PDF/U0D80.pdf) + * http://www.nongnu.org/sinhala/doc/transliteration/sinhala-transliteration_6.html + */ + +//ifdef XK_SINHALA +const XK_Sinh_ng = 0x1000d82 /* U+0D82 SINHALA ANUSVARAYA */ +const XK_Sinh_h2 = 0x1000d83 /* U+0D83 SINHALA VISARGAYA */ +const XK_Sinh_a = 0x1000d85 /* U+0D85 SINHALA AYANNA */ +const XK_Sinh_aa = 0x1000d86 /* U+0D86 SINHALA AAYANNA */ +const XK_Sinh_ae = 0x1000d87 /* U+0D87 SINHALA AEYANNA */ +const XK_Sinh_aee = 0x1000d88 /* U+0D88 SINHALA AEEYANNA */ +const XK_Sinh_i = 0x1000d89 /* U+0D89 SINHALA IYANNA */ +const XK_Sinh_ii = 0x1000d8a /* U+0D8A SINHALA IIYANNA */ +const XK_Sinh_u = 0x1000d8b /* U+0D8B SINHALA UYANNA */ +const XK_Sinh_uu = 0x1000d8c /* U+0D8C SINHALA UUYANNA */ +const XK_Sinh_ri = 0x1000d8d /* U+0D8D SINHALA IRUYANNA */ +const XK_Sinh_rii = 0x1000d8e /* U+0D8E SINHALA IRUUYANNA */ +const XK_Sinh_lu = 0x1000d8f /* U+0D8F SINHALA ILUYANNA */ +const XK_Sinh_luu = 0x1000d90 /* U+0D90 SINHALA ILUUYANNA */ +const XK_Sinh_e = 0x1000d91 /* U+0D91 SINHALA EYANNA */ +const XK_Sinh_ee = 0x1000d92 /* U+0D92 SINHALA EEYANNA */ +const XK_Sinh_ai = 0x1000d93 /* U+0D93 SINHALA AIYANNA */ +const XK_Sinh_o = 0x1000d94 /* U+0D94 SINHALA OYANNA */ +const XK_Sinh_oo = 0x1000d95 /* U+0D95 SINHALA OOYANNA */ +const XK_Sinh_au = 0x1000d96 /* U+0D96 SINHALA AUYANNA */ +const XK_Sinh_ka = 0x1000d9a /* U+0D9A SINHALA KAYANNA */ +const XK_Sinh_kha = 0x1000d9b /* U+0D9B SINHALA MAHA. KAYANNA */ +const XK_Sinh_ga = 0x1000d9c /* U+0D9C SINHALA GAYANNA */ +const XK_Sinh_gha = 0x1000d9d /* U+0D9D SINHALA MAHA. GAYANNA */ +const XK_Sinh_ng2 = 0x1000d9e /* U+0D9E SINHALA KANTAJA NAASIKYAYA */ +const XK_Sinh_nga = 0x1000d9f /* U+0D9F SINHALA SANYAKA GAYANNA */ +const XK_Sinh_ca = 0x1000da0 /* U+0DA0 SINHALA CAYANNA */ +const XK_Sinh_cha = 0x1000da1 /* U+0DA1 SINHALA MAHA. CAYANNA */ +const XK_Sinh_ja = 0x1000da2 /* U+0DA2 SINHALA JAYANNA */ +const XK_Sinh_jha = 0x1000da3 /* U+0DA3 SINHALA MAHA. JAYANNA */ +const XK_Sinh_nya = 0x1000da4 /* U+0DA4 SINHALA TAALUJA NAASIKYAYA */ +const XK_Sinh_jnya = 0x1000da5 /* U+0DA5 SINHALA TAALUJA SANYOOGA NAASIKYAYA */ +const XK_Sinh_nja = 0x1000da6 /* U+0DA6 SINHALA SANYAKA JAYANNA */ +const XK_Sinh_tta = 0x1000da7 /* U+0DA7 SINHALA TTAYANNA */ +const XK_Sinh_ttha = 0x1000da8 /* U+0DA8 SINHALA MAHA. TTAYANNA */ +const XK_Sinh_dda = 0x1000da9 /* U+0DA9 SINHALA DDAYANNA */ +const XK_Sinh_ddha = 0x1000daa /* U+0DAA SINHALA MAHA. DDAYANNA */ +const XK_Sinh_nna = 0x1000dab /* U+0DAB SINHALA MUURDHAJA NAYANNA */ +const XK_Sinh_ndda = 0x1000dac /* U+0DAC SINHALA SANYAKA DDAYANNA */ +const XK_Sinh_tha = 0x1000dad /* U+0DAD SINHALA TAYANNA */ +const XK_Sinh_thha = 0x1000dae /* U+0DAE SINHALA MAHA. TAYANNA */ +const XK_Sinh_dha = 0x1000daf /* U+0DAF SINHALA DAYANNA */ +const XK_Sinh_dhha = 0x1000db0 /* U+0DB0 SINHALA MAHA. DAYANNA */ +const XK_Sinh_na = 0x1000db1 /* U+0DB1 SINHALA DANTAJA NAYANNA */ +const XK_Sinh_ndha = 0x1000db3 /* U+0DB3 SINHALA SANYAKA DAYANNA */ +const XK_Sinh_pa = 0x1000db4 /* U+0DB4 SINHALA PAYANNA */ +const XK_Sinh_pha = 0x1000db5 /* U+0DB5 SINHALA MAHA. PAYANNA */ +const XK_Sinh_ba = 0x1000db6 /* U+0DB6 SINHALA BAYANNA */ +const XK_Sinh_bha = 0x1000db7 /* U+0DB7 SINHALA MAHA. BAYANNA */ +const XK_Sinh_ma = 0x1000db8 /* U+0DB8 SINHALA MAYANNA */ +const XK_Sinh_mba = 0x1000db9 /* U+0DB9 SINHALA AMBA BAYANNA */ +const XK_Sinh_ya = 0x1000dba /* U+0DBA SINHALA YAYANNA */ +const XK_Sinh_ra = 0x1000dbb /* U+0DBB SINHALA RAYANNA */ +const XK_Sinh_la = 0x1000dbd /* U+0DBD SINHALA DANTAJA LAYANNA */ +const XK_Sinh_va = 0x1000dc0 /* U+0DC0 SINHALA VAYANNA */ +const XK_Sinh_sha = 0x1000dc1 /* U+0DC1 SINHALA TAALUJA SAYANNA */ +const XK_Sinh_ssha = 0x1000dc2 /* U+0DC2 SINHALA MUURDHAJA SAYANNA */ +const XK_Sinh_sa = 0x1000dc3 /* U+0DC3 SINHALA DANTAJA SAYANNA */ +const XK_Sinh_ha = 0x1000dc4 /* U+0DC4 SINHALA HAYANNA */ +const XK_Sinh_lla = 0x1000dc5 /* U+0DC5 SINHALA MUURDHAJA LAYANNA */ +const XK_Sinh_fa = 0x1000dc6 /* U+0DC6 SINHALA FAYANNA */ +const XK_Sinh_al = 0x1000dca /* U+0DCA SINHALA AL-LAKUNA */ +const XK_Sinh_aa2 = 0x1000dcf /* U+0DCF SINHALA AELA-PILLA */ +const XK_Sinh_ae2 = 0x1000dd0 /* U+0DD0 SINHALA AEDA-PILLA */ +const XK_Sinh_aee2 = 0x1000dd1 /* U+0DD1 SINHALA DIGA AEDA-PILLA */ +const XK_Sinh_i2 = 0x1000dd2 /* U+0DD2 SINHALA IS-PILLA */ +const XK_Sinh_ii2 = 0x1000dd3 /* U+0DD3 SINHALA DIGA IS-PILLA */ +const XK_Sinh_u2 = 0x1000dd4 /* U+0DD4 SINHALA PAA-PILLA */ +const XK_Sinh_uu2 = 0x1000dd6 /* U+0DD6 SINHALA DIGA PAA-PILLA */ +const XK_Sinh_ru2 = 0x1000dd8 /* U+0DD8 SINHALA GAETTA-PILLA */ +const XK_Sinh_e2 = 0x1000dd9 /* U+0DD9 SINHALA KOMBUVA */ +const XK_Sinh_ee2 = 0x1000dda /* U+0DDA SINHALA DIGA KOMBUVA */ +const XK_Sinh_ai2 = 0x1000ddb /* U+0DDB SINHALA KOMBU DEKA */ +const XK_Sinh_o2 = 0x1000ddc /* U+0DDC SINHALA KOMBUVA HAA AELA-PILLA*/ +const XK_Sinh_oo2 = 0x1000ddd /* U+0DDD SINHALA KOMBUVA HAA DIGA AELA-PILLA*/ +const XK_Sinh_au2 = 0x1000dde /* U+0DDE SINHALA KOMBUVA HAA GAYANUKITTA */ +const XK_Sinh_lu2 = 0x1000ddf /* U+0DDF SINHALA GAYANUKITTA */ +const XK_Sinh_ruu2 = 0x1000df2 /* U+0DF2 SINHALA DIGA GAETTA-PILLA */ +const XK_Sinh_luu2 = 0x1000df3 /* U+0DF3 SINHALA DIGA GAYANUKITTA */ +const XK_Sinh_kunddaliya = 0x1000df4 /* U+0DF4 SINHALA KUNDDALIYA */ +//endif /* XK_SINHALA */ diff --git a/server/pkg/xorg/keysymdef.sh b/server/pkg/xorg/keysymdef.sh new file mode 100755 index 000000000..90d933d9b --- /dev/null +++ b/server/pkg/xorg/keysymdef.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +wget https://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h +sed -i -E 's/\#define (XK_[a-zA-Z_0-9]+\s+)(0x[0-9a-f]+)/const \1 = \2/g' keysymdef.h +sed -i -E 's/^\#/\/\//g' keysymdef.h +echo "package xorg" | cat - keysymdef.h > keysymdef.go && rm keysymdef.h diff --git a/server/internal/desktop/xorg/xorg.c b/server/pkg/xorg/xorg.c similarity index 64% rename from server/internal/desktop/xorg/xorg.c rename to server/pkg/xorg/xorg.c index aa4e98f7d..e2c04dcc2 100644 --- a/server/internal/desktop/xorg/xorg.c +++ b/server/pkg/xorg/xorg.c @@ -30,33 +30,33 @@ void XCursorPosition(int *x, int *y) { XQueryPointer(display, root, &root, &window, x, y, &i, &i, &mask); } -void XScroll(int x, int y) { - int ydir = 4; /* Button 4 is up, 5 is down. */ - int xdir = 6; - +void XScroll(int deltaX, int deltaY) { Display *display = getXDisplay(); - if (y < 0) { - ydir = 5; + int ydir; + if (deltaY > 0) { + ydir = 4; // button 4 is up + } else { + ydir = 5; // button 5 is down } - if (x < 0) { - xdir = 7; + int xdir; + if (deltaX > 0) { + xdir = 6; // button 6 is right + } else { + xdir = 7; // button 7 is left } - int xi; - int yi; + for (int i = 0; i < abs(deltaY); i++) { + XTestFakeButtonEvent(display, ydir, 1, CurrentTime); + XTestFakeButtonEvent(display, ydir, 0, CurrentTime); + } - for (xi = 0; xi < abs(x); xi++) { + for (int i = 0; i < abs(deltaX); i++) { XTestFakeButtonEvent(display, xdir, 1, CurrentTime); XTestFakeButtonEvent(display, xdir, 0, CurrentTime); } - for (yi = 0; yi < abs(y); yi++) { - XTestFakeButtonEvent(display, ydir, 1, CurrentTime); - XTestFakeButtonEvent(display, ydir, 0, CurrentTime); - } - XSync(display, 0); } @@ -229,9 +229,62 @@ void XKey(KeySym keysym, int down) { XSync(display, 0); } +Status XSetScreenConfiguration(int width, int height, short rate) { + Display *display = getXDisplay(); + Window root = DefaultRootWindow(display); + XRRScreenConfiguration *conf = XRRGetScreenInfo(display, root); + + XRRScreenSize *xrrs; + int num_sizes; + xrrs = XRRConfigSizes(conf, &num_sizes); + + int size_index = -1; + for (int i = 0; i < num_sizes; i++) { + if (xrrs[i].width == width && xrrs[i].height == height) { + size_index = i; + break; + } + } + + // if we cannot find the size + if (size_index == -1) { + return RRSetConfigFailed; + } + + Status status; + status = XRRSetScreenConfigAndRate(display, conf, root, size_index, RR_Rotate_0, rate, CurrentTime); + + XRRFreeScreenConfigInfo(conf); + return status; +} + +void XGetScreenConfiguration(int *width, int *height, short *rate) { + Display *display = getXDisplay(); + Window root = DefaultRootWindow(display); + XRRScreenConfiguration *conf = XRRGetScreenInfo(display, root); + + Rotation current_rotation; + SizeID current_size_id = XRRConfigCurrentConfiguration(conf, ¤t_rotation); + + XRRScreenSize *xrrs; + int num_sizes; + xrrs = XRRConfigSizes(conf, &num_sizes); + + // if we cannot find the size + if (current_size_id >= num_sizes) { + return; + } + + *width = xrrs[current_size_id].width; + *height = xrrs[current_size_id].height; + *rate = XRRConfigCurrentRate(conf); + + XRRFreeScreenConfigInfo(conf); +} + void XGetScreenConfigurations() { Display *display = getXDisplay(); - Window root = RootWindow(display, 0); + Window root = DefaultRootWindow(display); XRRScreenSize *xrrs; int num_sizes; @@ -248,36 +301,74 @@ void XGetScreenConfigurations() { } } -void XSetScreenConfiguration(int index, short rate) { +// Inspired by https://github.com/raboof/xrandr/blob/master/xrandr.c +void XCreateScreenMode(int width, int height, short rate) { Display *display = getXDisplay(); - Window root = RootWindow(display, 0); - XRRSetScreenConfigAndRate(display, XRRGetScreenInfo(display, root), root, index, RR_Rotate_0, rate, CurrentTime); -} + Window root = DefaultRootWindow(display); -int XGetScreenSize() { - Display *display = getXDisplay(); - XRRScreenConfiguration *conf = XRRGetScreenInfo(display, RootWindow(display, 0)); - Rotation original_rotation; - return XRRConfigCurrentConfiguration(conf, &original_rotation); + // create new mode info + XRRModeInfo *mode_info = XCreateScreenModeInfo(width, height, rate); + + // create new mode + RRMode mode = XRRCreateMode(display, root, mode_info); + XSync(display, 0); + + // add new mode to all outputs + XRRScreenResources *resources = XRRGetScreenResources(display, root); + for (int i = 0; i < resources->noutput; ++i) { + XRRAddOutputMode(display, resources->outputs[i], mode); + } + + XRRFreeScreenResources(resources); + XRRFreeModeInfo(mode_info); } -short XGetScreenRate() { - Display *display = getXDisplay(); - XRRScreenConfiguration *conf = XRRGetScreenInfo(display, RootWindow(display, 0)); - return XRRConfigCurrentRate(conf); +// Inspired by https://fossies.org/linux/xwayland/hw/xwayland/xwayland-cvt.c +XRRModeInfo *XCreateScreenModeInfo(int hdisplay, int vdisplay, short vrefresh) { + char name[128]; + snprintf(name, sizeof name, "%dx%d_%d", hdisplay, vdisplay, vrefresh); + XRRModeInfo *modeinfo = XRRAllocModeInfo(name, strlen(name)); + +#ifdef _LIBCVT_H_ + struct libxcvt_mode_info *mode_info; + + // get screen mode from libxcvt, if available + mode_info = libxcvt_gen_mode_info(hdisplay, vdisplay, vrefresh, false, false); + + modeinfo->width = mode_info->hdisplay; + modeinfo->height = mode_info->vdisplay; + modeinfo->dotClock = mode_info->dot_clock * 1000; + modeinfo->hSyncStart = mode_info->hsync_start; + modeinfo->hSyncEnd = mode_info->hsync_end; + modeinfo->hTotal = mode_info->htotal; + modeinfo->vSyncStart = mode_info->vsync_start; + modeinfo->vSyncEnd = mode_info->vsync_end; + modeinfo->vTotal = mode_info->vtotal; + modeinfo->modeFlags = mode_info->mode_flags; + + free(mode_info); +#else + // fallback to a simple mode without refresh rate + modeinfo->width = hdisplay; + modeinfo->height = vdisplay; +#endif + + return modeinfo; } -void XSetKeyboardModifier(int mod, int on) { +void XSetKeyboardModifier(unsigned char mod, int on) { Display *display = getXDisplay(); XkbLockModifiers(display, XkbUseCoreKbd, mod, on ? mod : 0); XFlush(display); } -char XGetKeyboardModifiers() { +unsigned char XGetKeyboardModifiers() { XkbStateRec xkbState; Display *display = getXDisplay(); XkbGetState(display, XkbUseCoreKbd, &xkbState); - return xkbState.locked_mods; + // XkbStateFieldFromRec() doesn't work properly because + // state.lookup_mods isn't properly updated, so we do this manually + return XkbBuildCoreState(XkbStateMods(&xkbState), xkbState.group); } XFixesCursorImage *XGetCursorImage(void) { diff --git a/server/internal/desktop/xorg/xorg.go b/server/pkg/xorg/xorg.go similarity index 67% rename from server/internal/desktop/xorg/xorg.go rename to server/pkg/xorg/xorg.go index 0c9ed9184..b948ed9a5 100644 --- a/server/internal/desktop/xorg/xorg.go +++ b/server/pkg/xorg/xorg.go @@ -1,7 +1,7 @@ package xorg /* -#cgo LDFLAGS: -lX11 -lXrandr -lXtst -lXfixes +#cgo LDFLAGS: -lX11 -lXrandr -lXtst -lXfixes -lxcvt #include "xorg.h" */ @@ -15,7 +15,7 @@ import ( "time" "unsafe" - "m1k1o/neko/internal/types" + "m1k1o/neko/pkg/types" ) //go:generate ./keysymdef.sh @@ -23,11 +23,23 @@ import ( type KbdMod uint8 const ( - KbdModCapsLock KbdMod = 2 - KbdModNumLock KbdMod = 16 + KbdModShift KbdMod = C.ShiftMask + KbdModCapsLock KbdMod = C.LockMask + KbdModControl KbdMod = C.ControlMask + KbdModAlt KbdMod = C.Mod1Mask + KbdModNumLock KbdMod = C.Mod2Mask + KbdModMeta KbdMod = C.Mod3Mask + KbdModSuper KbdMod = C.Mod4Mask + KbdModAltGr KbdMod = C.Mod5Mask ) -var ScreenConfigurations = make(map[int]types.ScreenConfiguration) +type ScreenConfiguration struct { + Width int + Height int + Rates map[int]int16 +} + +var ScreenConfigurations = make(map[int]ScreenConfiguration) var debounce_button = make(map[uint32]time.Time) var debounce_key = make(map[uint32]time.Time) @@ -76,11 +88,16 @@ func GetCursorPosition() (int, int) { return int(x), int(y) } -func Scroll(x, y int) { +func Scroll(deltaX, deltaY int, controlKey bool) { mu.Lock() defer mu.Unlock() - C.XScroll(C.int(x), C.int(y)) + if controlKey { + C.XSetKeyboardModifier(C.uchar(C.ControlMask), 1) + defer C.XSetKeyboardModifier(C.uchar(C.ControlMask), 0) + } + + C.XScroll(C.int(deltaX), C.int(deltaY)) } func ButtonDown(code uint32) error { @@ -178,40 +195,59 @@ func CheckKeys(duration time.Duration) { } } -func ChangeScreenSize(width int, height int, rate int16) error { +// set screen configuration, create new one if not exists +func ChangeScreenSize(s types.ScreenSize) (types.ScreenSize, error) { mu.Lock() defer mu.Unlock() - for index, size := range ScreenConfigurations { - if size.Width == width && size.Height == height { - for _, fps := range size.Rates { - if rate == fps { - C.XSetScreenConfiguration(C.int(index), C.short(fps)) - return nil - } - } - } + // round width to 8, because of Xorg + s.Width = s.Width - (s.Width % 8) + + // if rate is 0, set it to 60 + if s.Rate == 0 { + s.Rate = 60 } - return fmt.Errorf("unknown screen configuration %dx%d@%d", width, height, rate) + // convert variables to C types + c_width, c_height, c_rate := C.int(s.Width), C.int(s.Height), C.short(s.Rate) + + // if screen configuration already exists, just set it + status := C.XSetScreenConfiguration(c_width, c_height, c_rate) + if status != C.RRSetConfigSuccess { + // create new screen configuration + C.XCreateScreenMode(c_width, c_height, c_rate) + + // screen configuration should exist now, set it + status = C.XSetScreenConfiguration(c_width, c_height, c_rate) + } + + var err error + + // if screen configuration was not set successfully, return error + if status != C.RRSetConfigSuccess { + err = fmt.Errorf("unknown screen configuration %s", s.String()) + } + + // if specified rate is not supported a BadValue error is returned + if status == C.BadValue { + err = fmt.Errorf("unsupported screen rate %d", s.Rate) + } + + return s, err } -func GetScreenSize() *types.ScreenSize { +func GetScreenSize() types.ScreenSize { mu.Lock() defer mu.Unlock() - index := int(C.XGetScreenSize()) - rate := int16(C.XGetScreenRate()) + c_width, c_height, c_rate := C.int(0), C.int(0), C.short(0) + C.XGetScreenConfiguration(&c_width, &c_height, &c_rate) - if conf, ok := ScreenConfigurations[index]; ok { - return &types.ScreenSize{ - Width: conf.Width, - Height: conf.Height, - Rate: rate, - } + return types.ScreenSize{ + Width: int(c_width), + Height: int(c_height), + Rate: int16(c_rate), } - - return nil } func SetKeyboardModifier(mod KbdMod, active bool) { @@ -223,7 +259,7 @@ func SetKeyboardModifier(mod KbdMod, active bool) { num = C.int(1) } - C.XSetKeyboardModifier(C.int(mod), num) + C.XSetKeyboardModifier(C.uchar(mod), num) } func GetKeyboardModifiers() KbdMod { @@ -300,7 +336,7 @@ func GetScreenshotImage() *image.RGBA { //export goCreateScreenSize func goCreateScreenSize(index C.int, width C.int, height C.int, mwidth C.int, mheight C.int) { - ScreenConfigurations[int(index)] = types.ScreenConfiguration{ + ScreenConfigurations[int(index)] = ScreenConfiguration{ Width: int(width), Height: int(height), Rates: make(map[int]int16), @@ -309,12 +345,5 @@ func goCreateScreenSize(index C.int, width C.int, height C.int, mwidth C.int, mh //export goSetScreenRates func goSetScreenRates(index C.int, rate_index C.int, rateC C.short) { - rate := int16(rateC) - - // filter out all irrelevant rates - if rate > 60 || (rate > 30 && rate%10 != 0) { - return - } - - ScreenConfigurations[int(index)].Rates[int(rate_index)] = rate + ScreenConfigurations[int(index)].Rates[int(rate_index)] = int16(rateC) } diff --git a/server/internal/desktop/xorg/xorg.h b/server/pkg/xorg/xorg.h similarity index 65% rename from server/internal/desktop/xorg/xorg.h rename to server/pkg/xorg/xorg.h index 59a2b2c1d..781bcef81 100644 --- a/server/internal/desktop/xorg/xorg.h +++ b/server/pkg/xorg/xorg.h @@ -7,6 +7,11 @@ #include #include #include +#include +#include + +// for computing xrandr modelines at runtime +#include extern void goCreateScreenSize(int index, int width, int height, int mwidth, int mheight); extern void goSetScreenRates(int index, int rate_index, short rate); @@ -17,7 +22,7 @@ void XDisplayClose(void); void XMove(int x, int y); void XCursorPosition(int *x, int *y); -void XScroll(int x, int y); +void XScroll(int deltaX, int deltaY); void XButton(unsigned int button, int down); typedef struct xkeyentry_t { @@ -26,23 +31,19 @@ typedef struct xkeyentry_t { struct xkeyentry_t *next; } xkeyentry_t; -typedef struct xkeycode_t { - KeyCode keycode; - struct xkeycode_t *next; -} xkeycode_t; - static void XKeyEntryAdd(KeySym keysym, KeyCode keycode); static KeyCode XKeyEntryGet(KeySym keysym); static KeyCode XkbKeysymToKeycode(Display *dpy, KeySym keysym); void XKey(KeySym keysym, int down); +Status XSetScreenConfiguration(int width, int height, short rate); +void XGetScreenConfiguration(int *width, int *height, short *rate); void XGetScreenConfigurations(); -void XSetScreenConfiguration(int index, short rate); -int XGetScreenSize(); -short XGetScreenRate(); +void XCreateScreenMode(int width, int height, short rate); +XRRModeInfo *XCreateScreenModeInfo(int hdisplay, int vdisplay, short vrefresh); -void XSetKeyboardModifier(int mod, int on); -char XGetKeyboardModifiers(); +void XSetKeyboardModifier(unsigned char mod, int on); +unsigned char XGetKeyboardModifiers(); XFixesCursorImage *XGetCursorImage(void); char *XGetScreenshot(int *w, int *h); diff --git a/server/plugins/.gitkeep b/server/plugins/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/server/runtime/.Xresources b/server/runtime/.Xresources new file mode 100644 index 000000000..13e6900f6 --- /dev/null +++ b/server/runtime/.Xresources @@ -0,0 +1 @@ +Xcursor.size: 16 diff --git a/server/runtime/dbus b/server/runtime/dbus new file mode 100755 index 000000000..bf0d4375d --- /dev/null +++ b/server/runtime/dbus @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ ! -d /var/run/dbus ]; then + mkdir -p /var/run/dbus +fi + +if [ -f /var/run/dbus/pid ]; then + rm -f /var/run/dbus/pid +fi + +/usr/bin/dbus-daemon --nofork --print-pid --config-file=/usr/share/dbus-1/system.conf diff --git a/server/runtime/default.pa b/server/runtime/default.pa new file mode 100644 index 000000000..dbcd0a4e9 --- /dev/null +++ b/server/runtime/default.pa @@ -0,0 +1,16 @@ +#!/usr/bin/pulseaudio -nF + +### Create virtual output device sink +load-module module-null-sink sink_name=audio_output sink_properties=device.description="Virtual_Audio_Output" + +### Create virtual input device sink +load-module module-null-sink sink_name=audio_input sink_properties=device.description="Virtual_Audio_Input" + +### Create a virtual audio source linked up to the virtual input device +load-module module-virtual-source source_name=microphone master=audio_input.monitor source_properties=device.description="Virtual_Microphone" + +### Allow pulse audio to be accessed via TCP (from localhost only), to allow other users to access the virtual devices +load-module module-native-protocol-unix socket=/tmp/pulseaudio.socket auth-anonymous=1 + +### Make sure we always have a sink around, even if it is a null sink. +load-module module-always-sink diff --git a/server/runtime/fontconfig/75-emoji.conf b/server/runtime/fontconfig/75-emoji.conf new file mode 100644 index 000000000..f47023e5f --- /dev/null +++ b/server/runtime/fontconfig/75-emoji.conf @@ -0,0 +1,118 @@ + + + + + + + + + emoji + Noto Color Emoji + + + + + + + sans + Noto Color Emoji + + + + serif + Noto Color Emoji + + + + sans-serif + Noto Color Emoji + + + + monospace + Noto Color Emoji + + + + + + + + + + Symbola + + + + + + + + + + Android Emoji + Noto Color Emoji + + + + Apple Color Emoji + Noto Color Emoji + + + + EmojiSymbols + Noto Color Emoji + + + + Emoji Two + Noto Color Emoji + + + + EmojiTwo + Noto Color Emoji + + + + Noto Color Emoji + Noto Color Emoji + + + + Segoe UI Emoji + Noto Color Emoji + + + + Segoe UI Symbol + Noto Color Emoji + + + + Symbola + Noto Color Emoji + + + + Twemoji + Noto Color Emoji + + + + Twemoji Mozilla + Noto Color Emoji + + + + TwemojiMozilla + Noto Color Emoji + + + + Twitter Color Emoji + Noto Color Emoji + + + + diff --git a/server/runtime/fonts/.gitkeep b/server/runtime/fonts/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/server/runtime/icon-theme/.gitkeep b/server/runtime/icon-theme/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/server/runtime/supervisord.conf b/server/runtime/supervisord.conf new file mode 100644 index 000000000..d7c2ec20c --- /dev/null +++ b/server/runtime/supervisord.conf @@ -0,0 +1,52 @@ +[supervisord] +nodaemon=true +user=root +pidfile=/var/run/supervisord.pid +logfile=/dev/stderr +logfile_maxbytes=0 + +[include] +files=/etc/neko/supervisord/*.conf + +[program:x-server] +environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s" +command=/usr/bin/X %(ENV_DISPLAY)s -config /etc/neko/xorg.conf -noreset -nolisten tcp +autorestart=true +priority=300 +user=%(ENV_USER)s +stdout_logfile=/dev/stderr +stdout_logfile_maxbytes=0 +redirect_stderr=true + +[program:pulseaudio] +environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s" +command=/usr/bin/pulseaudio --log-level=error --disallow-module-loading --disallow-exit --exit-idle-time=-1 +autorestart=true +priority=300 +user=%(ENV_USER)s +stdout_logfile=/dev/stderr +stdout_logfile_maxbytes=0 +redirect_stderr=true + +[program:neko] +environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s",DISPLAY="%(ENV_DISPLAY)s" +command=/usr/bin/neko serve +stopsignal=INT +stopwaitsecs=3 +autorestart=true +priority=800 +user=%(ENV_USER)s +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +redirect_stderr=true + +[unix_http_server] +file=/var/run/supervisor.sock +chmod=0770 +chown=root:neko + +[supervisorctl] +serverurl=unix:///var/run/supervisor.sock + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface diff --git a/server/runtime/supervisord.dbus.conf b/server/runtime/supervisord.dbus.conf new file mode 100644 index 000000000..4a03f43cd --- /dev/null +++ b/server/runtime/supervisord.dbus.conf @@ -0,0 +1,9 @@ +[program:dbus] +environment=HOME="/root",USER="root" +command=/usr/bin/dbus +autorestart=true +priority=100 +user=root +stdout_logfile=/dev/stderr +stdout_logfile_maxbytes=0 +redirect_stderr=true diff --git a/server/runtime/xorg.conf b/server/runtime/xorg.conf new file mode 100644 index 000000000..ed0e84889 --- /dev/null +++ b/server/runtime/xorg.conf @@ -0,0 +1,118 @@ +# This xorg configuration file is meant to be used by xpra +# to start a dummy X11 server. +# For details, please see: +# https://xpra.org/trac/wiki/Xdummy + +Section "ServerFlags" + Option "DontVTSwitch" "true" + Option "AllowMouseOpenFail" "true" + Option "PciForceNone" "true" + Option "AutoEnableDevices" "false" + Option "AutoAddDevices" "false" +EndSection + +Section "InputDevice" + Identifier "dummy_mouse" + Option "CorePointer" "true" + Driver "void" +EndSection + +Section "InputDevice" + Identifier "dummy_keyboard" + Option "CoreKeyboard" "true" + Driver "void" +EndSection + +Section "InputDevice" + Identifier "dummy_touchscreen" + Option "SendCoreEvents" "On" + Option "SocketName" "/tmp/xf86-input-neko.sock" + Driver "neko" +EndSection + +Section "Device" + Identifier "dummy_videocard" + Driver "dummy" + Option "ConstantDPI" "true" + VideoRam 1024000 + #VideoRam 512000 + #VideoRam 256000 + #VideoRam 192000 +EndSection + +Section "Monitor" + Identifier "dummy_monitor" + HorizSync 5.0 - 1000.0 + VertRefresh 5.0 - 200.0 + #This can be used to get a specific DPI, but only for the default resolution: + #DisplaySize 508 317 + #NOTE: the highest modes will not work without increasing the VideoRam + # for the dummy video card. + # https://arachnoid.com/modelines/ + + # 1920x1080 @ 60.00 Hz (GTF) hsync: 67.08 kHz; pclk: 172.80 MHz + Modeline "1920x1080_60.00" 172.80 1920 2040 2248 2576 1080 1081 1084 1118 -HSync +Vsync + # 1280x720 @ 60.00 Hz (GTF) hsync: 44.76 kHz; pclk: 74.48 MHz + Modeline "1280x720_60.00" 74.48 1280 1336 1472 1664 720 721 724 746 -HSync +Vsync + # 1152x648 @ 60.00 Hz (GTF) hsync: 40.26 kHz; pclk: 59.91 MHz + Modeline "1152x648_60.00" 59.91 1152 1200 1320 1488 648 649 652 671 -HSync +Vsync + # 1024x576 @ 60.00 Hz (GTF) hsync: 35.82 kHz; pclk: 47.00 MHz + Modeline "1024x576_60.00" 47.00 1024 1064 1168 1312 576 577 580 597 -HSync +Vsync + # 960x720 @ 60.00 Hz (GTF) hsync: 44.76 kHz; pclk: 55.86 MHz + Modeline "960x720_60.00" 55.86 960 1008 1104 1248 720 721 724 746 -HSync +Vsync + # 800x600 @ 60.00 Hz (GTF) hsync: 37.32 kHz; pclk: 38.22 MHz + Modeline "800x600_60.00" 38.22 800 832 912 1024 600 601 604 622 -HSync +Vsync + + # 2560x1440 @ 30.00 Hz (GTF) hsync: 43.95 kHz; pclk: 146.27 MHz + Modeline "2560x1440_30.00" 146.27 2560 2680 2944 3328 1440 1441 1444 1465 -HSync +Vsync + # 1920x1080 @ 30.00 Hz (GTF) hsync: 32.97 kHz; pclk: 80.18 MHz + Modeline "1920x1080_30.00" 80.18 1920 1984 2176 2432 1080 1081 1084 1099 -HSync +Vsync + # 1368x768 @ 30.00 Hz (GTF) hsync: 23.46 kHz; pclk: 38.85 MHz + Modeline "1368x768_30.00" 38.85 1368 1376 1512 1656 768 769 772 782 -HSync +Vsync + # 1280x720 @ 30.00 Hz (GTF) hsync: 21.99 kHz; pclk: 33.78 MHz + Modeline "1280x720_30.00" 33.78 1280 1288 1408 1536 720 721 724 733 -HSync +Vsync + # 1152x648 @ 30.00 Hz (GTF) hsync: 19.80 kHz; pclk: 26.93 MHz + Modeline "1152x648_30.00" 26.93 1152 1144 1256 1360 648 649 652 660 -HSync +Vsync + # 1024x576 @ 30.00 Hz (GTF) hsync: 17.61 kHz; pclk: 20.85 MHz + Modeline "1024x576_30.00" 20.85 1024 1008 1104 1184 576 577 580 587 -HSync +Vsync + # 960x720 @ 30.00 Hz (GTF) hsync: 21.99 kHz; pclk: 25.33 MHz + Modeline "960x720_30.00" 25.33 960 960 1056 1152 720 721 724 733 -HSync +Vsync + # 800x600 @ 30.00 Hz (GTF) hsync: 18.33 kHz; pclk: 17.01 MHz + Modeline "800x600_30.00" 17.01 800 792 864 928 600 601 604 611 -HSync +Vsync + + # 800x1600 @ 30.00 Hz (GTF) hsync: 48.84 kHz; pclk: 51.58 MHz + Modeline "800x1600_30.00" 51.58 800 840 928 1056 1600 1601 1604 1628 -HSync +Vsync + + # 3840x2160 @ 25.00 Hz (GTF) hsync: 54.77 kHz; pclk: 278.70 MHz + Modeline "3840x2160_25.00" 278.70 3840 4056 4464 5088 2160 2161 2164 2191 -HSync +Vsync + # 2560x1440 @ 24.96 Hz (CVT) hsync: 36.53 kHz; pclk: 119.25 MHz + Modeline "2560x1440_25.00" 119.25 2560 2656 2912 3264 1440 1443 1448 1464 -Hsync +Vsync + # 1920x1080 @ 25.00 Hz (GTF) hsync: 27.40 kHz; pclk: 64.88 MHz + Modeline "1920x1080_25.00" 64.88 1920 1952 2144 2368 1080 1081 1084 1096 -HSync +Vsync + # 1600x900 @ 24.97 Hz (CVT) hsync: 22.88 kHz; pclk: 45.75 MHz + Modeline "1600x900_25.00" 45.75 1600 1648 1800 2000 900 903 908 916 -Hsync +Vsync + # 1368x768 @ 24.89 Hz (CVT) hsync: 19.51 kHz; pclk: 33.25 MHz + Modeline "1368x768_25.00" 33.25 1368 1408 1536 1704 768 771 781 784 -Hsync +Vsync + # 800x1600 @ 24.92 Hz (CVT) hsync: 40.53 kHz; pclk: 41.50 MHz + Modeline "800x1600_25.00" 41.50 800 832 912 1024 1600 1603 1613 1626 -Hsync +Vsync +EndSection + +Section "Screen" + Identifier "dummy_screen" + Device "dummy_videocard" + Monitor "dummy_monitor" + DefaultDepth 24 + SubSection "Display" + Viewport 0 0 + Depth 24 + Modes "1920x1080_60.00" "1280x720_60.00" "1152x648_60.00" "1024x576_60.00" "960x720_60.00" "800x600_60.00" "2560x1440_30.00" "1920x1080_30.00" "1368x768_30.00" "1280x720_30.00" "1152x648_30.00" "1024x576_30.00" "960x720_30.00" "800x600_30.00" "3840x2160_25.00" "2560x1440_25.00" "1920x1080_25.00" "1600x900_25.00" "1368x768_25.00" "800x1600_30.00" "800x1600_25.00" + EndSubSection +EndSection + +Section "ServerLayout" + Identifier "dummy_layout" + Screen "dummy_screen" + InputDevice "dummy_mouse" + InputDevice "dummy_keyboard" + InputDevice "dummy_touchscreen" "CorePointer" +EndSection diff --git a/server/xorg/xf86-input-neko/.gitignore b/server/xorg/xf86-input-neko/.gitignore new file mode 100644 index 000000000..2cb082415 --- /dev/null +++ b/server/xorg/xf86-input-neko/.gitignore @@ -0,0 +1,67 @@ +# Object files +*.o +*.ko +*.obj +*.elf + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su + +# generated files +aclocal.m4 +config.h.in +config.guess +configure +config.sub +depcomp +install-sh +ltmain.sh +Makefile +Makefile.in +src/Makefile +src/Makefile.in +missing +autom4te.cache/ +compile +config.h +config.h.in~ +config.log +config.status +libtool +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 +src/.deps/ +stamp-h1 +src/.libs/ +*.pc + +# build folder +build/ diff --git a/server/xorg/xf86-input-neko/80-neko.conf b/server/xorg/xf86-input-neko/80-neko.conf new file mode 100644 index 000000000..29a315bfc --- /dev/null +++ b/server/xorg/xf86-input-neko/80-neko.conf @@ -0,0 +1,9 @@ +# +# Create new Xorg input device for Neko +# + +Section "InputDevice" + Identifier "dummy_touchscreen" + Option "SocketName" "/tmp/xf86-input-neko.sock" + Driver "neko" +EndSection diff --git a/server/xorg/xf86-input-neko/COPYING b/server/xorg/xf86-input-neko/COPYING new file mode 100644 index 000000000..668f45b21 --- /dev/null +++ b/server/xorg/xf86-input-neko/COPYING @@ -0,0 +1,27 @@ +The MIT License + +Copyright 1999 Frederic Lepied, France +Copyright 2005 Adam Jackson +Copyright 2005 Sun Microsystems, Inc. +Copyright 2006 Sascha Hauer, Pengutronix +Copyright 2007 Clement Chauplannaz, Thales e-Transactions +Copyright 2017 Martin Kepplinger +Copyright 2023 Miroslav Sedivy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/server/xorg/xf86-input-neko/Dockerfile b/server/xorg/xf86-input-neko/Dockerfile new file mode 100644 index 000000000..4eb666e06 --- /dev/null +++ b/server/xorg/xf86-input-neko/Dockerfile @@ -0,0 +1,22 @@ +FROM debian:bullseye-slim + +ENV DEBIAN_FRONTEND=noninteractive + +RUN set -eux; \ + apt-get update; \ + apt-get install -y \ + gcc pkgconf autoconf automake libtool make xorg-dev xutils-dev \ + && rm -rf /var/lib/apt/lists/*; + +WORKDIR /app + +COPY ./ /app/ + +RUN set -eux; \ + ./autogen.sh --prefix=/usr; \ + ./configure; \ + make -j$(nproc); \ + make install; + +# docker build -t xf86-input-neko . +# docker run -v $PWD/build:/app/build --rm xf86-input-neko make install DESTDIR=/app/build diff --git a/server/xorg/xf86-input-neko/Makefile.am b/server/xorg/xf86-input-neko/Makefile.am new file mode 100644 index 000000000..215bddac8 --- /dev/null +++ b/server/xorg/xf86-input-neko/Makefile.am @@ -0,0 +1,30 @@ +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +AUTOMAKE_OPTIONS = foreign +SUBDIRS = src +ACLOCAL_AMFLAGS = -I m4 + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = xorg-neko.pc + +dist_xorgconf_DATA = 80-neko.conf + +EXTRA_DIST = README.md diff --git a/server/xorg/xf86-input-neko/README.md b/server/xorg/xf86-input-neko/README.md new file mode 100644 index 000000000..5ed64d0ab --- /dev/null +++ b/server/xorg/xf86-input-neko/README.md @@ -0,0 +1,19 @@ +# xf86-input-neko +[X.org](https://x.org/) [neko](http://m1k1o/neko) input driver + +### how to use +xf86-input-neko assumes you have only one virtual touchscreen device available, see +`80-neko.conf`. If there are multiple in your system, please specify one config +section for each. +xf86-input-neko aims to make [neko](http://m1k1o/neko) easy to use and doesn't +offer special configuration options. + +* `./configure --prefix=/usr` +* `make` +* `sudo make install` + +Done. + +To _uninstall_, again go inside the extracted directory, and do + + sudo make uninstall diff --git a/server/xorg/xf86-input-neko/autogen-clean.sh b/server/xorg/xf86-input-neko/autogen-clean.sh new file mode 100755 index 000000000..125888800 --- /dev/null +++ b/server/xorg/xf86-input-neko/autogen-clean.sh @@ -0,0 +1,8 @@ +#!/bin/sh +if [ -f Makefile ]; then + echo "Making make distclean..." + make distclean +fi +echo "Removing autogenned files..." +rm -f config.guess config.sub configure install-sh missing mkinstalldirs Makefile.in ltmain.sh stamp-h.in */Makefile.in ltconfig stamp-h config.h.in* aclocal.m4 compile depcomp +echo "Done." diff --git a/server/xorg/xf86-input-neko/autogen.sh b/server/xorg/xf86-input-neko/autogen.sh new file mode 100755 index 000000000..4d7b2f31a --- /dev/null +++ b/server/xorg/xf86-input-neko/autogen.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +autoreconf -f -i -I $(pwd)/m4 +exit $? + +echo -n "Libtoolize..." +libtoolize --force --copy +echo "Done." +echo -n "Aclocal..." +aclocal +echo "Done." +echo -n "Autoheader..." +autoheader +echo "Done." +echo -n "Automake..." +automake --add-missing --copy +echo "Done." +echo -n "Autoconf..." +autoconf +echo "Done." +#./configure $* +echo "Now you can do ./configure, make, make install." diff --git a/server/xorg/xf86-input-neko/configure.ac b/server/xorg/xf86-input-neko/configure.ac new file mode 100644 index 000000000..c0a2e9072 --- /dev/null +++ b/server/xorg/xf86-input-neko/configure.ac @@ -0,0 +1,109 @@ +# Copyright 2005 Adam Jackson. +# Copyright 2017 Martin Kepplinger. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Process this file with autoconf to produce a configure script + +AC_PREREQ(2.59) +AC_INIT([xf86-input-neko],[0.0.1],[https://github.com/m1k1o/neko/issues],[xf86-input-neko],[https://github.com/m1k1o/neko]) + +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_AUX_DIR(.) +AC_CONFIG_MACRO_DIR([m4]) +AM_INIT_AUTOMAKE([dist-bzip2 dist-xz]) + +DRIVER_NAME=neko +AC_SUBST([DRIVER_NAME]) + +AC_CONFIG_HEADERS(config.h) + +# Checks for programs. +AC_DISABLE_STATIC +AC_PROG_LIBTOOL +AC_PROG_CC + +# Initialize libtool +LT_INIT + +m4_ifndef([XORG_MACROS_VERSION], + [m4_fatal([you must install xorg-macros before running autoconf/autogen. + Hint: either install from source, git://anongit.freedesktop.org/xorg/util/macros or, + depending on you distribution, try package 'xutils-dev' or 'xorg-x11-util-macros'])]) +XORG_DEFAULT_OPTIONS + +AH_TOP([#include "xorg-server.h"]) + +#AC_DEFINE(XFree86LOADER,1,[Stub define for loadable drivers]) +# +#AC_ARG_ENABLE(XINPUT, AS_HELP_STRING([--enable-xinput], +# [Build XInput support (default: yes)]), +# [XINPUT=$enableval],[XINPUT=yes]) +#AM_CONDITIONAL(XINPUT, test "x$XINPUT" = "xyes") +#if test "x$XINPUT" = "xyes" ; then +# AC_DEFINE(XINPUT,1,[Enable XInput support]) +#fi +# +#AC_ARG_ENABLE(XKB, AS_HELP_STRING([--enable-xkb], +# [Build XKB support (default: yes)]), +# [XKB=$enableval],[XKB=yes]) +#AM_CONDITIONAL(XKB, test "x$XKB" = "xyes") +#if test "x$XKB" = "xyes" ; then +# AC_DEFINE(XKB,1,[Enable XKB support]) +#fi + +AC_ARG_WITH(xorg-module-dir, + AS_HELP_STRING(--with-xorg-module-dir=DIR,Default xorg module directory [[default=$libdir/xorg/modules]]), + [moduledir="$withval"], + [moduledir="$libdir/xorg/modules"]) +inputdir=${moduledir}/input +AC_SUBST(inputdir) + +AC_ARG_WITH(xorg-conf-dir, + AC_HELP_STRING([--with-xorg-conf-dir=DIR], + [Default xorg.conf.d directory [[default=${prefix}/share/X11/xorg.conf.d/]]]), + [xorgconfdir="$withval"], + [xorgconfdir='${prefix}/share/X11/xorg.conf.d']) +AC_SUBST(xorgconfdir) + +# Checks for extensions +XORG_DRIVER_CHECK_EXT(RANDR, randrproto) +XORG_DRIVER_CHECK_EXT(XINPUT, inputproto) + +# Checks for pkg-config packages +PKG_CHECK_MODULES(XORG, xorg-server xproto $REQUIRED_MODULES) +sdkdir=$(pkg-config --variable=sdkdir xorg-server) + +CFLAGS="$CFLAGS $XORG_CFLAGS "' -I$(top_srcdir)/src' +CFLAGS="-O2 -Wall -W -fPIC $CFLAGS" +AC_SUBST([CFLAGS]) + +# Checks for libraries. +#AC_CHECK_LIB(ts, ts_open, [], [ +# echo "Error! You need to have libts." +# exit -1 +# ]) + +# Checks for header files. +AC_HEADER_STDC + +AC_CONFIG_FILES([Makefile + src/Makefile + xorg-neko.pc]) +AC_OUTPUT diff --git a/server/xorg/xf86-input-neko/m4/.gitkeep b/server/xorg/xf86-input-neko/m4/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/server/xorg/xf86-input-neko/release.sh b/server/xorg/xf86-input-neko/release.sh new file mode 100755 index 000000000..02830e0c4 --- /dev/null +++ b/server/xorg/xf86-input-neko/release.sh @@ -0,0 +1,121 @@ +#!/bin/bash +: 'Copyright (C) 2017, Martin Kepplinger + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.' + +# Script to build release-archives with. This requires a checkout from git. +# Before running it, change the version in configure.ac. Only do this. Do +# *not* commit this change. This script will do it. + +# WARNING: This script is very dangerous! It may delete any untracked files. + +have_version=0 + +usage() +{ + echo "Usage: $0 -v version" +} + +args=$(getopt -o v:s -- "$@") +if [ $? -ne 0 ] ; then + usage + exit 1 +fi +eval set -- "$args" +while [ $# -gt 0 ] +do + case "$1" in + -v) + version=$2 + have_version=1 + shift + ;; + --) + shift + break + ;; + *) + echo "Invalid option: $1" + usage + exit 1 + ;; + esac + shift +done + +# Do we have a desired version number? +if [ "$have_version" -gt 0 ] ; then + echo "trying to build version $version" +else + echo "please specify a version" + usage + exit 1 +fi + +# Version number sanity check +if grep ${version} configure.ac +then + echo "configurations seems ok" +else + echo "please check your configure.ac" + exit 1 +fi + +# Check that we are on master +branch=$(git rev-parse --abbrev-ref HEAD) +echo "we are on branch $branch" + +if [ ! "${branch}" = "master" ] ; then + echo "you don't seem to be on the master branch" + exit 1 +fi + +if git diff-index --quiet HEAD --; then + # no changes + echo "there are no uncommitted changes (version bump)" + exit 1 +fi +echo "======================================================" +echo " are you fine with the following version bump?" +echo "======================================================" +git diff +echo "======================================================" +read -p " Press enter to continue" +echo "======================================================" + +./autogen.sh && ./configure && make distcheck +./autogen-clean.sh +git clean -d -f + +git commit -a -m "xf86-input-neko ${version}" +git tag -s ${version} -m "xf86-input-neko ${version}" + +./autogen.sh && ./configure && make distcheck +sha256sum xf86-input-neko-${version}.tar.xz > xf86-input-neko-${version}.tar.xz.sha256 +sha256sum xf86-input-neko-${version}.tar.gz > xf86-input-neko-${version}.tar.gz.sha256 +sha256sum xf86-input-neko-${version}.tar.bz2 > xf86-input-neko-${version}.tar.bz2.sha256 + +sha512sum xf86-input-neko-${version}.tar.xz > xf86-input-neko-${version}.tar.xz.sha512 +sha512sum xf86-input-neko-${version}.tar.gz > xf86-input-neko-${version}.tar.gz.sha512 +sha512sum xf86-input-neko-${version}.tar.bz2 > xf86-input-neko-${version}.tar.bz2.sha512 + +gpg -b -a xf86-input-neko-${version}.tar.xz +gpg -b -a xf86-input-neko-${version}.tar.gz +gpg -b -a xf86-input-neko-${version}.tar.bz2 + diff --git a/server/xorg/xf86-input-neko/src/Makefile.am b/server/xorg/xf86-input-neko/src/Makefile.am new file mode 100644 index 000000000..2221bbcc7 --- /dev/null +++ b/server/xorg/xf86-input-neko/src/Makefile.am @@ -0,0 +1,31 @@ +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +# this is obnoxious: +# -module lets us name the module exactly how we want +# -avoid-version prevents gratuitous .0.0.0 version numbers on the end +# _ladir passes a dummy rpath to libtool so the thing will actually link +# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. +@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la +@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version +@DRIVER_NAME@_drv_ladir = @inputdir@ + +@DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c diff --git a/server/xorg/xf86-input-neko/src/neko.c b/server/xorg/xf86-input-neko/src/neko.c new file mode 100644 index 000000000..3d8f88d61 --- /dev/null +++ b/server/xorg/xf86-input-neko/src/neko.c @@ -0,0 +1,518 @@ +/* + * (c) 2017 Martin Kepplinger + * (c) 2007 Clement Chauplannaz, Thales e-Transactions + * (c) 2006 Sascha Hauer, Pengutronix + * (c) 2023 Miroslav Sedivy + * + * derived from the xf86-input-void driver + * Copyright 1999 by Frederic Lepied, France. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Frederic Lepied not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Frederic Lepied makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * SPDX-License-Identifier: MIT + * License-Filename: COPYING + */ + +/* neko input driver */ +// https://www.x.org/releases/X11R7.7/doc/xorg-server/Xinput.html + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define DEF_SOCKET_NAME "/tmp/xf86-input-neko.sock" +#define BUFFER_SIZE 12 + +#include +#include +#include +#include +#include +#include +#if !defined(DGUX) +#include +#endif +#include +#include +#include /* Needed for InitValuator/Proximity stuff */ +#include +#include +#include +#include + +#define MAX_USED_VALUATORS 3 /* x, y, pressure */ +#define TOUCH_MAX_SLOTS 10 /* max number of simultaneous touches */ + +struct neko_message +{ + uint16_t type; + uint32_t touchId; + int32_t x; + int32_t y; + uint8_t pressure; +}; + +struct neko_priv +{ + pthread_t thread; + /* config */ + int height; + int width; + int pmax; + ValuatorMask *valuators; + uint16_t slots; + /* socket */ + struct sockaddr_un addr; + int listen_socket; + char *socket_name; +}; + +// from binary representation to struct +static void +UnpackNekoMessage(struct neko_message *msg, unsigned char *buffer) +{ + msg->type = buffer[0]; // TODO: use full 16bit type + msg->touchId = buffer[1] | (buffer[2] << 8); // TODO: use full 32bit touchId + msg->x = buffer[3] | (buffer[4] << 8) | (buffer[5] << 16) | (buffer[6] << 24); + msg->y = buffer[7] | (buffer[8] << 8) | (buffer[9] << 16) | (buffer[10] << 24); + msg->pressure = buffer[11]; +} + +static void +ReadInput(InputInfoPtr pInfo) +{ + struct neko_priv *priv = (struct neko_priv *) (pInfo->private); + struct neko_message msg; + int ret; + + int data_socket; + unsigned char buffer[BUFFER_SIZE]; + + for (;;) + { + /* Wait for incoming connection. */ + data_socket = accept(priv->listen_socket, NULL, NULL); + + /* Handle error conditions. */ + if (data_socket == -1) + { + xf86IDrvMsg(pInfo, X_ERROR, "unable to accept connection\n"); + break; + } + + xf86IDrvMsg(pInfo, X_INFO, "accepted connection\n"); + + for(;;) + { + /* Wait for next data packet. */ + ret = read(data_socket, buffer, BUFFER_SIZE); + + /* Handle error conditions. */ + if (ret == -1) + { + xf86IDrvMsg(pInfo, X_ERROR, "unable to read data\n"); + break; + } + + /* Connection closed by client. */ + if (ret == 0) + { + xf86IDrvMsg(pInfo, X_INFO, "connection closed\n"); + break; + } + + /* Ensure message is long enough. */ + if (ret != BUFFER_SIZE) + { + xf86IDrvMsg(pInfo, X_ERROR, "invalid message size\n"); + break; + } + + UnpackNekoMessage(&msg, buffer); + + ValuatorMask *m = priv->valuators; + valuator_mask_zero(m); + + // do not send valuators if x and y are -1 + if (msg.x != -1 && msg.y != -1) + { + valuator_mask_set_double(m, 0, msg.x); + valuator_mask_set_double(m, 1, msg.y); + valuator_mask_set_double(m, 2, msg.pressure); + } + + // TODO: extend to other types, such as keyboard and mouse + xf86PostTouchEvent(pInfo->dev, msg.touchId, msg.type, 0, m); + } + + /* Close socket. */ + close(data_socket); + + xf86IDrvMsg(pInfo, X_INFO, "closed connection\n"); + } +} + +static void +PointerCtrl(__attribute__ ((unused)) DeviceIntPtr device, + __attribute__ ((unused)) PtrCtrl *ctrl) +{ +} + +static int +InitTouch(InputInfoPtr pInfo) +{ + // custom private data + struct neko_priv *priv = pInfo->private; + + const int nbtns = 11; + const int naxes = 3; + + unsigned char map[nbtns + 1]; + Atom btn_labels[nbtns]; + Atom axis_labels[naxes]; + + // init button map + memset(map, 0, sizeof(map)); + for (int i = 0; i < nbtns; i++) + { + map[i + 1] = i + 1; + } + + // init btn_labels + memset(btn_labels, 0, ARRAY_SIZE(btn_labels) * sizeof(Atom)); + btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); + btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); + btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); + btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP); + btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN); + btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT); + btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT); + btn_labels[7] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_SIDE); + btn_labels[8] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_EXTRA); + btn_labels[9] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_FORWARD); + btn_labels[10] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_BACK); + + // init axis labels + memset(axis_labels, 0, ARRAY_SIZE(axis_labels) * sizeof(Atom)); + axis_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_X); + axis_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_Y); + axis_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_PRESSURE); + + /* initialize mouse emulation valuators */ + if (InitPointerDeviceStruct((DevicePtr)pInfo->dev, + map, + nbtns, btn_labels, + PointerCtrl, + GetMotionHistorySize(), + naxes, axis_labels) == FALSE) + { + xf86IDrvMsg(pInfo, X_ERROR, + "unable to allocate PointerDeviceStruct\n"); + return !Success; + } + + /* + This function is provided to initialize an XAxisInfoRec, and should be + called for core and extension devices that have valuators. The space + for the XAxisInfoRec is allocated by the InitValuatorClassDeviceStruct + function, but is not initialized. + + InitValuatorAxisStruct should be called once for each axis of motion + reported by the device. Each invocation should be passed the axis + number (starting with 0), the minimum value for that axis, the maximum + value for that axis, and the resolution of the device in counts per meter. + If the device reports relative motion, 0 should be reported as the + minimum and maximum values. + + InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution) + DeviceIntPtr dev; + int axnum; + int minval; + int maxval; + int resolution; + */ + xf86InitValuatorAxisStruct(pInfo->dev, 0, + XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_X), + 0, /* min val */ + priv->width - 1, /* max val */ + priv->width, /* resolution */ + 0, /* min_res */ + priv->width, /* max_res */ + Absolute); + + xf86InitValuatorAxisStruct(pInfo->dev, 1, + XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_Y), + 0, /* min val */ + priv->height - 1, /* max val */ + priv->height, /* resolution */ + 0, /* min_res */ + priv->height, /* max_res */ + Absolute); + + xf86InitValuatorAxisStruct(pInfo->dev, 2, + XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_PRESSURE), + 0, /* min val */ + priv->pmax, /* max val */ + priv->pmax + 1, /* resolution */ + 0, /* min_res */ + priv->pmax + 1, /* max_res */ + Absolute); + + /* + The mode field is either XIDirectTouch for direct−input touch devices + such as touchscreens or XIDependentTouch for indirect input devices such + as touchpads. For XIDirectTouch devices, touch events are sent to window + at the position the touch occured. For XIDependentTouch devices, touch + events are sent to the window at the position of the device's sprite. + + The num_touches field defines the maximum number of simultaneous touches + the device supports. A num_touches of 0 means the maximum number of + simultaneous touches is undefined or unspecified. This field should be + used as a guide only, devices will lie about their capabilities. + */ + if (InitTouchClassDeviceStruct(pInfo->dev, + priv->slots, + XIDirectTouch, + naxes) == FALSE) + { + xf86IDrvMsg(pInfo, X_ERROR, + "unable to allocate TouchClassDeviceStruct\n"); + return !Success; + } + + return Success; +} + +static int +DeviceControl(DeviceIntPtr device, int what) +{ + // device pInfo + InputInfoPtr pInfo = device->public.devicePrivate; + // custom private data + struct neko_priv *priv = pInfo->private; + + switch (what) { + case DEVICE_INIT: + device->public.on = FALSE; + + if (InitTouch(pInfo) != Success) + { + xf86IDrvMsg(pInfo, X_ERROR, "unable to init touch\n"); + return !Success; + } + break; + + case DEVICE_ON: + xf86IDrvMsg(pInfo, X_INFO, "DEVICE ON\n"); + device->public.on = TRUE; + + if (priv->thread == 0) + { + /* start thread */ + pthread_create(&priv->thread, NULL, (void *)ReadInput, pInfo); + } + break; + + case DEVICE_OFF: + case DEVICE_CLOSE: + xf86IDrvMsg(pInfo, X_INFO, "DEVICE OFF\n"); + device->public.on = FALSE; + break; + } + + return Success; +} + +static int +PreInit(__attribute__ ((unused)) InputDriverPtr drv, + InputInfoPtr pInfo, + __attribute__ ((unused)) int flags) +{ + struct neko_priv *priv; + int ret; + + priv = calloc(1, sizeof (struct neko_priv)); + if (!priv) + { + xf86IDrvMsg(pInfo, X_ERROR, "%s: out of memory\n", __FUNCTION__); + return BadValue; + } + + pInfo->type_name = (char*)XI_TOUCHSCREEN; + pInfo->device_control = DeviceControl; + pInfo->read_input = NULL; + pInfo->control_proc = NULL; + pInfo->switch_mode = NULL; /* Only support Absolute mode */ + pInfo->private = priv; + pInfo->fd = -1; + + /* get socket name from config */ + priv->socket_name = xf86SetStrOption(pInfo->options, "SocketName", DEF_SOCKET_NAME); + + /* + * In case the program exited inadvertently on the last run, + * remove the socket. + */ + + unlink(priv->socket_name); + + /* Create local socket. */ + priv->listen_socket = socket(AF_UNIX, SOCK_STREAM, 0); + if (priv->listen_socket == -1) + { + xf86IDrvMsg(pInfo, X_ERROR, "unable to create socket\n"); + return BadValue; + } + + /* + * For portability clear the whole structure, since some + * implementations have additional (nonstandard) fields in + * the structure. + */ + + memset(&priv->addr, 0, sizeof(struct sockaddr_un)); + + /* Bind socket to socket name. */ + + priv->addr.sun_family = AF_UNIX; + strncpy(priv->addr.sun_path, priv->socket_name, sizeof(priv->addr.sun_path) - 1); + + ret = bind(priv->listen_socket, (const struct sockaddr *) &priv->addr, sizeof(struct sockaddr_un)); + if (ret == -1) + { + xf86IDrvMsg(pInfo, X_ERROR, "unable to bind socket\n"); + return BadValue; + } + + /* + * Prepare for accepting connections. The backlog size is set + * to 5. So while one request is being processed other requests + * can be waiting. + */ + + ret = listen(priv->listen_socket, 5); + if (ret == -1) + { + xf86IDrvMsg(pInfo, X_ERROR, "unable to listen on socket\n"); + return BadValue; + } + + /* process generic options */ + xf86CollectInputOptions(pInfo, NULL); + xf86ProcessCommonOptions(pInfo, pInfo->options); + + /* create valuators */ + priv->valuators = valuator_mask_new(MAX_USED_VALUATORS); + if (!priv->valuators) + { + xf86IDrvMsg(pInfo, X_ERROR, "%s: out of memory\n", __FUNCTION__); + return BadValue; + } + + priv->slots = TOUCH_MAX_SLOTS; + priv->width = 0xffff; + priv->height = 0xffff; + priv->pmax = 255; + priv->thread = 0; + + /* Return the configured device */ + return Success; +} + +static void +UnInit(__attribute__ ((unused)) InputDriverPtr drv, + InputInfoPtr pInfo, + __attribute__ ((unused)) int flags) +{ + struct neko_priv *priv = (struct neko_priv *)(pInfo->private); + + /* close socket */ + close(priv->listen_socket); + /* remove socket file */ + unlink(priv->socket_name); + + if (priv->thread) + { + /* cancel thread */ + pthread_cancel(priv->thread); + /* wait for thread to finish */ + pthread_join(priv->thread, NULL); + /* ensure thread is not cancelled again */ + priv->thread = 0; + } + + /* free valuators */ + valuator_mask_free(&priv->valuators); + + free(pInfo->private); + pInfo->private = NULL; + xf86DeleteInput(pInfo, 0); +} + +/** + * X module information and plug / unplug routines + */ + +_X_EXPORT InputDriverRec NEKO = +{ + .driverVersion = 1, + .driverName = "neko", + .Identify = NULL, + .PreInit = PreInit, + .UnInit = UnInit, + .module = NULL +}; + +static pointer +Plug(pointer module, + __attribute__ ((unused)) pointer options, + __attribute__ ((unused)) int *errmaj, + __attribute__ ((unused)) int *errmin) +{ + xf86AddInputDriver(&NEKO, module, 0); + return module; +} + +static void +Unplug(__attribute__ ((unused)) pointer module) +{ +} + +static XF86ModuleVersionInfo versionRec = +{ + .modname = "neko", + .vendor = MODULEVENDORSTRING, + ._modinfo1_ = MODINFOSTRING1, + ._modinfo2_ = MODINFOSTRING2, + .xf86version = XORG_VERSION_CURRENT, + .majorversion = PACKAGE_VERSION_MAJOR, + .minorversion = PACKAGE_VERSION_MINOR, + .patchlevel = PACKAGE_VERSION_PATCHLEVEL, + .abiclass = ABI_CLASS_XINPUT, + .abiversion = ABI_XINPUT_VERSION, + .moduleclass = MOD_CLASS_XINPUT, + .checksum = {0, 0, 0, 0} /* signature, to be patched into the file by a tool */ +}; + +_X_EXPORT XF86ModuleData nekoModuleData = +{ + .vers = &versionRec, + .setup = Plug, + .teardown = Unplug +}; diff --git a/server/xorg/xf86-input-neko/xorg-neko.pc.in b/server/xorg/xf86-input-neko/xorg-neko.pc.in new file mode 100644 index 000000000..37dea7e3c --- /dev/null +++ b/server/xorg/xf86-input-neko/xorg-neko.pc.in @@ -0,0 +1,5 @@ +Name: xorg-neko +Description: X.Org neko input driver. +Version: @PACKAGE_VERSION@ +Libs: -L${libdir} +Cflags: -I${includedir} diff --git a/server/xorg/xf86-video-dummy/01_v0.3.8_xdummy-randr.patch b/server/xorg/xf86-video-dummy/01_v0.3.8_xdummy-randr.patch new file mode 100644 index 000000000..b7e330267 --- /dev/null +++ b/server/xorg/xf86-video-dummy/01_v0.3.8_xdummy-randr.patch @@ -0,0 +1,316 @@ +diff --git a/src/dummy.h b/src/dummy.h +index c3fdd6e..9c74f56 100644 +--- a/src/dummy.h ++++ b/src/dummy.h +@@ -13,6 +13,8 @@ + + #include "compat-api.h" + ++#define DUMMY_MAX_SCREENS 4 ++ + /* Supported chipsets */ + typedef enum { + DUMMY_CHIP +@@ -72,6 +74,12 @@ typedef struct dummyRec + pointer* FBBase; + Bool (*CreateWindow)() ; /* wrapped CreateWindow */ + Bool prop; ++ /* XRANDR support begin */ ++ int num_screens; ++ struct _xf86Crtc *paCrtcs[DUMMY_MAX_SCREENS]; ++ struct _xf86Output *paOutputs[DUMMY_MAX_SCREENS]; ++ int connected_outputs; ++ /* XRANDR support end */ + } DUMMYRec, *DUMMYPtr; + + /* The privates of the DUMMY driver */ +diff --git a/src/dummy_driver.c b/src/dummy_driver.c +index 2656602..069e330 100644 +--- a/src/dummy_driver.c ++++ b/src/dummy_driver.c +@@ -34,6 +34,8 @@ + #include + #endif + ++#include "xf86Crtc.h" ++ + /* + * Driver data structures. + */ +@@ -141,6 +143,219 @@ static XF86ModuleVersionInfo dummyVersRec = + {0,0,0,0} + }; + ++ ++/************************ ++ * XRANDR support begin * ++ ************************/ ++ ++static Bool dummy_config_resize(ScrnInfoPtr pScrn, int cw, int ch); ++static Bool DUMMYAdjustScreenPixmap(ScrnInfoPtr pScrn, int width, int height); ++ ++static const xf86CrtcConfigFuncsRec DUMMYCrtcConfigFuncs = { ++ .resize = dummy_config_resize ++}; ++ ++ ++static void ++dummy_crtc_dpms(xf86CrtcPtr crtc, int mode) ++{ ++} ++ ++static Bool ++dummy_crtc_lock (xf86CrtcPtr crtc) ++{ ++ return FALSE; ++} ++ ++static Bool ++dummy_crtc_mode_fixup (xf86CrtcPtr crtc, DisplayModePtr mode, ++ DisplayModePtr adjusted_mode) ++{ ++ return TRUE; ++} ++ ++static void ++dummy_crtc_stub (xf86CrtcPtr crtc) ++{ ++} ++ ++static void ++dummy_crtc_gamma_set (xf86CrtcPtr crtc, CARD16 *red, ++ CARD16 *green, CARD16 *blue, int size) ++{ ++} ++ ++static void * ++dummy_crtc_shadow_allocate (xf86CrtcPtr crtc, int width, int height) ++{ ++ return NULL; ++} ++ ++static void ++dummy_crtc_mode_set (xf86CrtcPtr crtc, DisplayModePtr mode, ++ DisplayModePtr adjusted_mode, int x, int y) ++{ ++} ++ ++static const xf86CrtcFuncsRec DUMMYCrtcFuncs = { ++ .dpms = dummy_crtc_dpms, ++ .save = NULL, /* These two are never called by the server. */ ++ .restore = NULL, ++ .lock = dummy_crtc_lock, ++ .unlock = NULL, /* This will not be invoked if lock returns FALSE. */ ++ .mode_fixup = dummy_crtc_mode_fixup, ++ .prepare = dummy_crtc_stub, ++ .mode_set = dummy_crtc_mode_set, ++ .commit = dummy_crtc_stub, ++ .gamma_set = dummy_crtc_gamma_set, ++ .shadow_allocate = dummy_crtc_shadow_allocate, ++ .shadow_create = NULL, /* These two should not be invoked if allocate ++ returns NULL. */ ++ .shadow_destroy = NULL, ++ .set_cursor_colors = NULL, ++ .set_cursor_position = NULL, ++ .show_cursor = NULL, ++ .hide_cursor = NULL, ++ .load_cursor_argb = NULL, ++ .destroy = dummy_crtc_stub ++}; ++ ++static void ++dummy_output_stub (xf86OutputPtr output) ++{ ++} ++ ++static void ++dummy_output_dpms (xf86OutputPtr output, int mode) ++{ ++} ++ ++static int ++dummy_output_mode_valid (xf86OutputPtr output, DisplayModePtr mode) ++{ ++ return MODE_OK; ++} ++ ++static Bool ++dummy_output_mode_fixup (xf86OutputPtr output, DisplayModePtr mode, ++ DisplayModePtr adjusted_mode) ++{ ++ return TRUE; ++} ++ ++static void ++dummy_output_mode_set (xf86OutputPtr output, DisplayModePtr mode, ++ DisplayModePtr adjusted_mode) ++{ ++ DUMMYPtr dPtr = DUMMYPTR(output->scrn); ++ int index = (int64_t)output->driver_private; ++ ++ /* set to connected at first mode set */ ++ dPtr->connected_outputs |= 1 << index; ++} ++ ++/* The first virtual monitor is always connected. Others only after setting its ++ * mode */ ++static xf86OutputStatus ++dummy_output_detect (xf86OutputPtr output) ++{ ++ DUMMYPtr dPtr = DUMMYPTR(output->scrn); ++ int index = (int64_t)output->driver_private; ++ ++ if (dPtr->connected_outputs & (1 << index)) ++ return XF86OutputStatusConnected; ++ else ++ return XF86OutputStatusDisconnected; ++} ++ ++static DisplayModePtr ++dummy_output_get_modes (xf86OutputPtr output) ++{ ++ DisplayModePtr pModes = NULL, pMode, pModeSrc; ++ ++ /* copy modes from config */ ++ for (pModeSrc = output->scrn->modes; pModeSrc; pModeSrc = pModeSrc->next) ++ { ++ pMode = xnfcalloc(1, sizeof(DisplayModeRec)); ++ memcpy(pMode, pModeSrc, sizeof(DisplayModeRec)); ++ pMode->next = NULL; ++ pMode->prev = NULL; ++ pMode->name = strdup(pModeSrc->name); ++ pModes = xf86ModesAdd(pModes, pMode); ++ if (pModeSrc->next == output->scrn->modes) ++ break; ++ } ++ return pModes; ++} ++ ++ ++static const xf86OutputFuncsRec DUMMYOutputFuncs = { ++ .create_resources = dummy_output_stub, ++ .dpms = dummy_output_dpms, ++ .save = NULL, /* These two are never called by the server. */ ++ .restore = NULL, ++ .mode_valid = dummy_output_mode_valid, ++ .mode_fixup = dummy_output_mode_fixup, ++ .prepare = dummy_output_stub, ++ .commit = dummy_output_stub, ++ .mode_set = dummy_output_mode_set, ++ .detect = dummy_output_detect, ++ .get_modes = dummy_output_get_modes, ++#ifdef RANDR_12_INTERFACE ++ .set_property = NULL, ++#endif ++ .destroy = dummy_output_stub ++}; ++ ++static Bool ++dummy_config_resize(ScrnInfoPtr pScrn, int cw, int ch) ++{ ++ if (!pScrn->vtSema) { ++ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, ++ "We do not own the active VT, exiting.\n"); ++ return TRUE; ++ } ++ return DUMMYAdjustScreenPixmap(pScrn, cw, ch); ++} ++ ++Bool DUMMYAdjustScreenPixmap(ScrnInfoPtr pScrn, int width, int height) ++{ ++ ScreenPtr pScreen = pScrn->pScreen; ++ PixmapPtr pPixmap = pScreen->GetScreenPixmap(pScreen); ++ DUMMYPtr dPtr = DUMMYPTR(pScrn); ++ uint64_t cbLine = (width * xf86GetBppFromDepth(pScrn, pScrn->depth) / 8 + 3) & ~3; ++ int displayWidth = cbLine * 8 / xf86GetBppFromDepth(pScrn, pScrn->depth); ++ ++ if ( width == pScrn->virtualX ++ && height == pScrn->virtualY ++ && displayWidth == pScrn->displayWidth) ++ return TRUE; ++ if (!pPixmap) { ++ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, ++ "Failed to get the screen pixmap.\n"); ++ return FALSE; ++ } ++ if (cbLine > UINT32_MAX || cbLine * height >= pScrn->videoRam * 1024) ++ { ++ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, ++ "Unable to set up a virtual screen size of %dx%d with %d Kb of video memory available. Please increase the video memory size.\n", ++ width, height, pScrn->videoRam); ++ return FALSE; ++ } ++ pScreen->ModifyPixmapHeader(pPixmap, width, height, ++ pScrn->depth, xf86GetBppFromDepth(pScrn, pScrn->depth), cbLine, ++ pPixmap->devPrivate.ptr); ++ pScrn->virtualX = width; ++ pScrn->virtualY = height; ++ pScrn->displayWidth = displayWidth; ++ ++ return TRUE; ++} ++ ++/********************** ++ * XRANDR support end * ++ **********************/ ++ + /* + * This is the module init data. + * Its name has to be the driver name followed by ModuleData +@@ -568,6 +783,56 @@ DUMMYScreenInit(SCREEN_INIT_ARGS_DECL) + + xf86SetBlackWhitePixels(pScreen); + ++ /* initialize XRANDR */ ++ xf86CrtcConfigInit(pScrn, &DUMMYCrtcConfigFuncs); ++ /* FIXME */ ++ dPtr->num_screens = DUMMY_MAX_SCREENS; ++ ++ for (int i=0; i < dPtr->num_screens; i++) { ++ char szOutput[256]; ++ ++ dPtr->paCrtcs[i] = xf86CrtcCreate(pScrn, &DUMMYCrtcFuncs); ++ dPtr->paCrtcs[i]->driver_private = (void *)(uintptr_t)i; ++ ++ /* Set up our virtual outputs. */ ++ snprintf(szOutput, sizeof(szOutput), "DUMMY%u", i); ++ dPtr->paOutputs[i] = xf86OutputCreate(pScrn, &DUMMYOutputFuncs, ++ szOutput); ++ ++ ++ xf86OutputUseScreenMonitor(dPtr->paOutputs[i], FALSE); ++ dPtr->paOutputs[i]->possible_crtcs = 1 << i; ++ dPtr->paOutputs[i]->possible_clones = 0; ++ dPtr->paOutputs[i]->driver_private = (void *)(uintptr_t)i; ++ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Created crtc (%p) and output %s (%p)\n", ++ (void *)dPtr->paCrtcs[i], szOutput, ++ (void *)dPtr->paOutputs[i]); ++ ++ } ++ ++ /* bitmask */ ++ dPtr->connected_outputs = 1; ++ ++ xf86CrtcSetSizeRange(pScrn, 64, 64, DUMMY_MAX_WIDTH, DUMMY_MAX_HEIGHT); ++ ++ ++ /* Now create our initial CRTC/output configuration. */ ++ if (!xf86InitialConfiguration(pScrn, TRUE)) { ++ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Initial CRTC configuration failed!\n"); ++ return (FALSE); ++ } ++ ++ /* Initialise randr 1.2 mode-setting functions and set first mode. ++ * Note that the mode won't be usable until the server has resized the ++ * framebuffer to something reasonable. */ ++ if (!xf86CrtcScreenInit(pScreen)) { ++ return FALSE; ++ } ++ if (!xf86SetDesiredModes(pScrn)) { ++ return FALSE; ++ } ++ /* XRANDR initialization end */ ++ + #ifdef USE_DGA + DUMMYDGAInit(pScreen); + #endif diff --git a/server/xorg/xf86-video-dummy/README.md b/server/xorg/xf86-video-dummy/README.md new file mode 100644 index 000000000..43488ce5b --- /dev/null +++ b/server/xorg/xf86-video-dummy/README.md @@ -0,0 +1,2 @@ +From: https://salsa.debian.org/xorg-team/driver/xserver-xorg-video-dummy +Branch: xserver-xorg-video-dummy-1_0.3.8-2 diff --git a/server/xorg/xf86-video-dummy/v0.3.8/COPYING b/server/xorg/xf86-video-dummy/v0.3.8/COPYING new file mode 100644 index 000000000..3c1ef4812 --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/COPYING @@ -0,0 +1,2 @@ +Copyright 2002, SuSE Linux AG, Author: Egbert Eich + diff --git a/server/xorg/xf86-video-dummy/v0.3.8/ChangeLog b/server/xorg/xf86-video-dummy/v0.3.8/ChangeLog new file mode 100644 index 000000000..9bd1791bf --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/ChangeLog @@ -0,0 +1,809 @@ +commit 4a6df6b4eecae769771eba0136bf8271d01258fb +Author: Julien Cristau +Date: Wed Dec 14 21:57:18 2016 +0100 + + xf86-video-dummy 0.3.8 + + Signed-off-by: Julien Cristau + +commit 52a6346c63c20c79f54c34e2950ccc5f1d2fb138 +Author: Julien Cristau +Date: Wed Dec 14 21:59:29 2016 +0100 + + configure: require xorg-server 1.4.99.901 + + dixChangeWindowProperty was introduced in that release. + + Signed-off-by: Julien Cristau + +commit e434975017eb90fa702653592ae590bc22aa483c +Author: Aaron Plattner +Date: Thu Sep 22 09:14:26 2016 -0700 + + Remove pointless empty functions + + These functions might be useful in a real driver, but with no + hardware, they're pointless. Get rid of them. + + v2: Rebase, get rid of pointless calls to DUMMYAdjustFrame, return TRUE from + DUMMYSwitchMode. + + Signed-off-by: Aaron Plattner + Reviewed-by: Antoine Martin + Tested-by: Antoine Martin + +commit 367c778240b4266958f33cec3653d5389e283557 +Author: Antoine Martin +Date: Tue Sep 20 13:34:40 2016 +0700 + + remove dead code in dummy driver + + Signed-off-by: Antoine Martin + Reviewed-by: Eric Engestrom + Reviewed-by: Aaron Plattner + Signed-off-by: Aaron Plattner + +commit 8706f60ab457867c120dd44e812b8fadc2be7179 +Author: Peter Hutterer +Date: Thu Jan 14 10:30:40 2016 +1000 + + Switch to using dixChangeWindowProperty + + eb36924ead40564325aa56d54a973dc8fb4eae83 removed ChangeWindowProperty from the + server. + + Signed-off-by: Peter Hutterer + Reviewed-by: Jon Turney + +commit 29433844c8b8989ea2ac64bd92b3ad61b6f9cf10 +Author: Antoine Martin +Date: Thu Sep 17 10:55:25 2015 -0400 + + Honor DacSpeed setting in xorg.conf + + Reviewed-by: Adam Jackson + Signed-off-by: Antoine Martin + +commit 0e339b256a858bfd832c92e3c14619023dea826c +Author: Alan Coopersmith +Date: Sat May 31 21:39:32 2014 -0700 + + autogen.sh: Honor NOCONFIGURE=1 + + See http://people.gnome.org/~walters/docs/build-api.txt + + Signed-off-by: Alan Coopersmith + +commit 85402253d0f9ca464d54336e48e9a7ac91fc39bb +Author: Alan Coopersmith +Date: Sat May 31 21:38:41 2014 -0700 + + configure: Drop AM_MAINTAINER_MODE + + Signed-off-by: Alan Coopersmith + +commit 4160421c642fc6b2dd3100a06f236efc6bbe0e08 +Author: Julien Cristau +Date: Mon Sep 9 19:45:23 2013 +0200 + + Bump to 0.3.7 + + Signed-off-by: Julien Cristau + +commit 44f04fd3046043ed31369025f34353c4e0e5c1cd +Author: Adam Jackson +Date: Tue Sep 25 08:54:36 2012 -0400 + + Remove mibstore.h + + Signed-off-by: Adam Jackson + +commit fee6b520a620eed80e22840b8149abc50815f771 +Author: Dave Airlie +Date: Wed Jul 18 19:39:32 2012 +1000 + + dummy: bump to 0.3.6 for release + + Signed-off-by: Dave Airlie + +commit 1491470ee0745bf8303fa085bd30f7464098f1f2 +Author: Dave Airlie +Date: Tue Jun 5 11:14:37 2012 +0100 + + dummy: convert to the new server APIs. + + Signed-off-by: Dave Airlie + +commit 6ff612955a1a8591bf21f6aa56e7b6ebd8e2db48 +Author: Dave Airlie +Date: Wed May 23 11:37:01 2012 +0100 + + dummy: convert to new scrn conversion APIs. + + Generated from util/modular/x-driver-screen-scrn-conv.sh + + Signed-off-by: Dave Airlie + +commit 20fcd59d3f8d7393586d8b64bfac18adede726ca +Author: Dave Airlie +Date: Wed May 23 11:36:22 2012 +0100 + + dummy: add scrn conversion api compat header. + + Signed-off-by: Dave Airlie + +commit a78d524cfb332909dba89df5d709081515f0ed36 +Author: Yaakov Selkowitz +Date: Wed Mar 28 00:07:28 2012 -0500 + + Add XORG_LIBS to LIBADD + + This affects only Cygwin, where drivers must be linked against the + Xorg implib. On other systems, XORG_LIBS will be empty. + + Signed-off-by: Yaakov Selkowitz + Reviewed-by: Alan Coopersmith + Reviewed-by: Jeremy Huddleston + +commit 668223a665af38600b8b20152c7e53e731c76234 +Author: Yaakov Selkowitz +Date: Wed Mar 28 00:06:32 2012 -0500 + + Only include Xv headers if server supports it + + Signed-off-by: Yaakov Selkowitz + Reviewed-by: Jeremy Huddleston + +commit 02918fd53434a23a72fe878a90f4ec48ef0e0416 +Author: Jeremy Huddleston +Date: Mon Jan 9 01:00:40 2012 -0800 + + Don't use XFreeXDGA to determine DGA support + + If our server supports DGA and we want to build the dummy driver without it, + XFreeXDGA will be defined by the server and will be picked up rather than + our configuration option. This change forces us to honor our configuration + hoice. + + Signed-off-by: Jeremy Huddleston + +commit bccf37f052748386902112b770b89d81bddfaeb8 +Author: Cyril Brulebois +Date: Sun Jan 1 07:15:36 2012 +0100 + + dummy 0.3.5 + + Signed-off-by: Cyril Brulebois + +commit dd9be3b21842aacdee5501cd2e0bfafb11b5ec08 +Author: Jeremy Huddleston +Date: Wed Sep 14 14:50:36 2011 -0500 + + Add a configure option to disable dga + + Signed-off-by: Jeremy Huddleston + Reviewed-by: Jamey Sharp + Signed-off-by: Jamey Sharp + +commit dd598ca433d2386687f9543457e4c6ffdb16d7c4 +Author: Jeremy Huddleston +Date: Wed Sep 14 14:32:02 2011 -0500 + + Use malloc/free instead of deprecated X versions + + Signed-off-by: Jeremy Huddleston + Reviewed-by: Jamey Sharp + Signed-off-by: Jamey Sharp + +commit d70dde48087a0d5c3930860ab97585d39de7b57e +Author: Jeremy Huddleston +Date: Wed Sep 14 14:30:55 2011 -0500 + + Dummy drivers don't need PCI. + + Signed-off-by: Jeremy Huddleston + Reviewed-by: Jamey Sharp + Signed-off-by: Jamey Sharp + +commit bdc59411136b16ca3447336f22e95010bf709a53 +Author: Adam Jackson +Date: Wed May 25 06:05:29 2011 -0400 + + Port away from xalloc/xfree + + Signed-off-by: Adam Jackson + +commit 7f57ed6be7c561b83da44a6ecb0562e8f562e48e +Author: Adam Jackson +Date: Wed May 25 06:04:39 2011 -0400 + + Fix DGA includes + + Signed-off-by: Adam Jackson + +commit fb0888f90d5d1c10d69ec2add0a66e88c94f5d5c +Author: Antoine Martin +Date: Wed May 25 06:03:10 2011 -0400 + + Increase the maximum framebuffer size to 32767x32767 + + Reviewed-by: Adam Jackson + Signed-off-by: Antoine Martin + Tested-by: Antoine Martin + +commit f8dc281042b328c2fad4df38f8fb3f967a025c6f +Author: Gaetan Nadon +Date: Wed Jul 21 16:49:04 2010 -0400 + + config: add comments for main statements + +commit ca77f09bd68587e7579f139660c8cef81662fdd0 +Author: Gaetan Nadon +Date: Wed Jul 21 16:07:00 2010 -0400 + + config: replace deprecated use of AC_OUTPUT with AC_CONFIG_FILES + + Signed-off-by: Gaetan Nadon + +commit 945a1619300291ffe08c82f19bea6bb2e1da8f86 +Author: Gaetan Nadon +Date: Wed Jul 21 14:05:22 2010 -0400 + + config: replace deprecated AM_CONFIG_HEADER with AC_CONFIG_HEADERS + + Signed-off-by: Gaetan Nadon + +commit 8fbbafb7ed5988a63d16d3d9fad17dd336a32b82 +Author: Gaetan Nadon +Date: Wed Jul 21 09:27:42 2010 -0400 + + config: complete AC_INIT m4 quoting + + Signed-off-by: Gaetan Nadon + +commit 93898c6d620cb005bca60ed20b89faf9a3b8434e +Author: Gaetan Nadon +Date: Tue Jul 20 20:24:42 2010 -0400 + + config: remove unrequired AC_HEADER_STDC + + Autoconf says: + "This macro is obsolescent, as current systems have conforming + header files. New programs need not use this macro". + + Signed-off-by: Gaetan Nadon + +commit c26603e9c0ab3cb04bcac5a370c9b5de9fe0d1d6 +Author: Gaetan Nadon +Date: Tue Jul 20 19:41:30 2010 -0400 + + config: remove AC_PROG_CC as it overrides AC_PROG_C_C99 + + XORG_STRICT_OPTION from XORG_DEFAULT_OPTIONS calls + AC_PROG_C_C99. This sets gcc with -std=gnu99. + If AC_PROG_CC macro is called afterwards, it resets CC to gcc. + + Signed-off-by: Gaetan Nadon + +commit 839b7420661db5e1a9e6cffe97308a34f3196e58 +Author: Gaetan Nadon +Date: Tue Jul 20 18:45:18 2010 -0400 + + config: update AC_PREREQ statement to 2.60 + + Unrelated to the previous patches, the new value simply reflects + the reality that the minimum level for autoconf to configure + all x.org modules is 2.60 dated June 2006. + + ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz + + Signed-off-by: Gaetan Nadon + +commit 51642de730f264fdfaf1c78f68a767a9347e1520 +Author: Dave Airlie +Date: Mon Jul 5 12:05:40 2010 +1000 + + dummy 0.3.4 + +commit 77ae177fd77e90a6eaeebde9df88911256264329 +Author: Jamey Sharp +Date: Fri Jun 4 16:09:34 2010 -0700 + + Use new server API to find the root window. + + Signed-off-by: Jamey Sharp + +commit 2503a68673c6012a0bf2abba58aa5060654965f9 +Author: Gaetan Nadon +Date: Sat Jun 12 15:39:03 2010 -0400 + + COPYING: replace stub file with actual Copyright notice + + Signed-off-by: Gaetan Nadon + +commit c4134a6cb6bf3d9364fd2374e79647859dbd57c3 +Author: Gaetan Nadon +Date: Mon Feb 8 20:08:52 2010 -0500 + + config: move compiler flags from configure.ac to Makefile.am + + CFLAGS is an automake defined variable that should not be set + by the module. It should not be AC_SUBST either, it already is. + + Use AM_CFLAGS in Makefile.am. This will allow the user to override + the flags as they will be in the right order. + + Signed-off-by: Gaetan Nadon + +commit 3370539eea599ff51a556507ec16a1570b8ed076 +Author: Gaetan Nadon +Date: Mon Feb 8 19:07:22 2010 -0500 + + config: remove unrequired '-I$(top_srcdir)/src' + + The current dir is already included by default in the makefile + top_builddir = .. + DEFAULT_INCLUDES = -I. -I$(top_builddir) + + Signed-off-by: Gaetan Nadon + +commit ea7cc253b0f4ea97a197ec36b3ac06279b0b95f6 +Author: Gaetan Nadon +Date: Mon Feb 8 18:42:52 2010 -0500 + + config: remove unused INCLUDES='-I$(top_srcdir)/src' + + This statement is redundant and not used in the makefile + + Signed-off-by: Gaetan Nadon + +commit bff6fc2f25648df0bbc0ea0723636260df987d34 +Author: Gaetan Nadon +Date: Mon Feb 8 17:45:42 2010 -0500 + + config: remove unused variable XORG_INCS + + Signed-off-by: Gaetan Nadon + +commit 17f6ec36df36a8999a95fd86e17013b1c44a7a2e +Author: Gaetan Nadon +Date: Tue Dec 15 20:59:46 2009 -0500 + + configure.ac: sdkdir usage duplicates the sdk include dir + + The sdkdir variable provides a duplicate copy of the include/xorg + directory. The statement is removed as this was it's only used. + In the Makefile, there is now only one instance of the -I sdkdir + The sdkdir is provided in XORG_CFLAGS. + + Acked-by: Dan Nicholson + Signed-off-by: Gaetan Nadon + +commit 86a7baa4156dc9569b7dde51b3042b7fd8093821 +Author: Michael Olbrich +Date: Thu Dec 10 14:53:50 2009 -0500 + + configure.ac: remove wrong include path. #24675 + + Don't use $(prefix)/include as include path. It can break things + when cross-compiling with DESTDIR and prefix=/usr + + Signed-off-by: Michael Olbrich + Signed-off-by: Gaetan Nadon + +commit 483db0376d08be806c9bd51646f226f9510a4e48 +Author: Adam Jackson +Date: Tue Dec 1 10:51:30 2009 -0500 + + dummy 0.3.3 + + Signed-off-by: Adam Jackson + +commit 1ea8367691e69b289c2b5ca67d8ace39994347f8 +Author: Adam Jackson +Date: Tue Dec 1 10:36:35 2009 -0500 + + Don't try to make an INSTALL file + + INSTALL_CMD is empty. This breaks make distcheck. I don't know why, + but I also don't care. + + Signed-off-by: Adam Jackson + +commit 84b8dac3e6d869aa7e7b012add892fad9c3ce136 +Author: Gaetan Nadon +Date: Mon Nov 23 09:25:05 2009 -0500 + + Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES + + Now that the INSTALL file is generated. + Allows running make maintainer-clean. + +commit be0e614859c5754a18dc7c8ad2dd55090ab166c7 +Author: Gaetan Nadon +Date: Wed Oct 28 14:41:41 2009 -0400 + + INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 + + Automake 'foreign' option is specified in configure.ac. + Remove from Makefile.am + +commit 2fc665b979a56faaac388b065c4cd91e0d2994d3 +Author: Gaetan Nadon +Date: Wed Oct 28 14:09:09 2009 -0400 + + INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206 + + Add missing INSTALL file. Use standard GNU file on building tarball + README may have been updated + Remove AUTHORS file as it is empty and no content available yet. + Remove NEWS file as it is empty and no content available yet. + +commit 27946998e6ec8537e7137fd453e229d81c092f54 +Author: Gaetan Nadon +Date: Mon Oct 26 12:54:21 2009 -0400 + + Several driver modules do not have a ChangeLog target in Makefile.am #23814 + + The git generated ChangeLog replaces the hand written one. + Update configure.ac to xorg-macros level 1.3. + Use XORG_DEFAULT_OPTIONS which replaces four XORG_* macros + Update Makefile.am to add ChangeLog target if missing + Remove ChangeLog from EXTRA_DIST or *CLEAN variables + This is a pre-req for the INSTALL_CMD + +commit 50b546f499ae1cafbdf8e890234616733e2e6633 +Author: Gaetan Nadon +Date: Thu Oct 22 13:00:42 2009 -0400 + + .gitignore: use common defaults with custom section # 24239 + + Using common defaults will reduce errors and maintenance. + Only the very small or inexistent custom section need periodic maintenance + when the structure of the component changes. Do not edit defaults. + +commit 7aefb53beeaac7de52c44be0032a5a699706b74b +Author: Gaetan Nadon +Date: Thu Oct 22 12:34:16 2009 -0400 + + .gitignore: use common defaults with custom section # 24239 + + Using common defaults will reduce errors and maintenance. + Only the very small or inexistent custom section need periodic maintenance + when the structure of the component changes. Do not edit defaults. + +commit 4d4e41812e21490e39da34ac123b2c66bf20598c +Author: Adam Jackson +Date: Wed Nov 18 09:37:49 2009 -0500 + + Canonically re-wrap too. + + Signed-off-by: Adam Jackson + +commit b5983dbbd5f0cb4416b0e484fb43c80208feca25 +Author: Adam Jackson +Date: Wed Nov 18 09:36:34 2009 -0500 + + Compile fix. + + Signed-off-by: Adam Jackson + +commit e39d9a265572c273915f1803a729e7211d7b247b +Author: Adam Jackson +Date: Tue Nov 17 13:46:27 2009 -0500 + + Add support for HW_SKIP_CONSOLE + + Acked-by: Aaron Plattner + Signed-off-by: Adam Jackson + +commit a8366277a70797a7fa9c8c0b739a5fdac066816f +Author: Adam Jackson +Date: Tue Nov 17 13:36:30 2009 -0500 + + Properly un/rewrap CreateWindow + + Acked-by: Aaron Plattner + Signed-off-by: Adam Jackson + +commit ecf513ae11399c5778ff7d988e838a2b6211a88b +Author: Adam Jackson +Date: Thu Jul 2 11:08:25 2009 -0400 + + dummy 0.3.2 + +commit 8fe24e48acc7ec03972ee0acb5d7ab205ecbf7e0 +Author: Adam Jackson +Date: Thu May 28 14:54:17 2009 -0400 + + Remove useless loader symbol lists. + +commit 17885c5cb1dbcfb48ee593260bcd1b1ff2887989 +Author: Alan Coopersmith +Date: Fri Jan 30 20:38:25 2009 -0800 + + Add README with pointers to mailing list, bugzilla & git repos + +commit d876e719969e9d33e7e4502448a544f12eb0fab8 +Author: Julien Cristau +Date: Sun Jan 25 23:25:33 2009 +0100 + + dummy 0.3.1 + +commit 33e86171bd1815a23f35bb992a91c02785c22402 +Author: Adam Jackson +Date: Fri Aug 15 14:05:04 2008 -0400 + + Uninclude xf86Version.h + +commit 0dcdce106d01aa6ff611436c3f8374241e7a8da8 +Author: Adam Jackson +Date: Wed Mar 19 17:31:28 2008 -0400 + + dummy 0.3.0 + +commit ba7ab1d468e9a5ba37c064b3b128fa3bbb721044 +Author: Adam Jackson +Date: Wed Mar 19 17:26:51 2008 -0400 + + Death to RCS tags. + +commit 2aeec40b3d48705bc1de9da3f06deac365c25895 +Author: James Cloos +Date: Mon Sep 3 05:52:30 2007 -0400 + + Add *~ to .gitignore to skip patch/emacs droppings + +commit 1874204e0c807c1686c28782d5eef62bd49fab04 +Author: James Cloos +Date: Thu Aug 23 19:25:48 2007 -0400 + + Rename .cvsignore to .gitignore + +commit 345de2bd048fcc7b177a3b504522fe100b34f1e0 +Author: Brice Goglin +Date: Tue Aug 7 10:50:06 2007 +0200 + + Define DUMMY_*_VERSION* using PACKAGE_VERSION_* + +commit 22e38bed8cd2d1e54c47d0763436012eeccb2d32 +Author: Adam Jackson +Date: Fri Apr 7 18:59:48 2006 +0000 + + VERSION -> DUMMY_VERSION + +commit 7432eaf48b70437bd55e5cc98833cce224d9e131 +Author: Adam Jackson +Date: Fri Apr 7 18:50:19 2006 +0000 + + Unlibcwrap. Bump server version requirement. Bump to 1.1.0. + +commit 474af880791908da7e006c4d500bc7318107bbd1 +Author: Kevin E Martin +Date: Wed Dec 21 02:29:59 2005 +0000 + + Update package version for X11R7 release. + +commit 9b9ea496e698e4d078c67b8f5674fd6479e3b2bb +Author: Adam Jackson +Date: Mon Dec 19 16:25:53 2005 +0000 + + Stub COPYING files + +commit d2cff58c1e7ff03109bd17c5f8247b9b166b71f2 +Author: Kevin E Martin +Date: Thu Dec 15 00:24:17 2005 +0000 + + Update package version number for final X11R7 release candidate. + +commit 39f1e4449acb3e5da96aaaaa86e2544e9be968b1 +Author: Kevin E Martin +Date: Sat Dec 3 05:49:33 2005 +0000 + + Update package version number for X11R7 RC3 release. + +commit 1b47f2e8f47501122a3b613b95ea5de99f76a8c2 +Author: Kevin E Martin +Date: Fri Dec 2 02:16:08 2005 +0000 + + Remove extraneous AC_MSG_RESULT. + +commit c2c245b18409db7013dee0b0b4b7176daae7e290 +Author: Adam Jackson +Date: Tue Nov 29 23:29:58 2005 +0000 + + Only build dlloader modules by default. + +commit e6887d858e8b837c29c7833ab4b55034b736c6d8 +Author: Eric Anholt +Date: Mon Nov 21 10:49:12 2005 +0000 + + Add .cvsignores for drivers. + +commit ec562722d0ae21f82a0dcc1a4a3e45ed52592aed +Author: Kevin E Martin +Date: Tue Nov 15 05:42:03 2005 +0000 + + Add check for DGA extension to fix issues when building with separate build + roots. + +commit 1073cc5a2bd62b6972fcda4d4d9ccbe43f2506d4 +Author: Kevin E Martin +Date: Wed Nov 9 21:15:14 2005 +0000 + + Update package version number for X11R7 RC2 release. + +commit 5ced29a35f7571899f281af094fbd1f242f95e7d +Author: Kevin E Martin +Date: Tue Nov 1 15:08:52 2005 +0000 + + Update pkgcheck depedencies to work with separate build roots. + +commit ffa97f23462ff045834b4abae33cf645ed6c3517 +Author: Kevin E Martin +Date: Wed Oct 19 02:48:02 2005 +0000 + + Update package version number for RC1 release. + +commit 4bb6048d8d0d87f3d91a93fef737882434702bb0 +Author: Alan Coopersmith +Date: Mon Oct 17 00:09:02 2005 +0000 + + Use sed & cpp to substitute variables in driver man pages + +commit f586bde47b9ed6561b5350c03b088acfe2e227f6 +Author: Daniel Stone +Date: Thu Aug 18 09:03:46 2005 +0000 + + Update autogen.sh to one that does objdir != srcdir. + +commit d43c40d00ab34ae85e4684cc3860f641b0bea65c +Author: Søren Sandmann Pedersen +Date: Wed Aug 10 14:07:24 2005 +0000 + + Don\'t lose existing CFLAGS in all the input drivers and some of the video + drivers + +commit ef552d7e1765386c652748a97df67f4ba00beef0 +Author: Kevin E Martin +Date: Fri Jul 29 21:22:43 2005 +0000 + + Various changes preparing packages for RC0: + - Verify and update package version numbers as needed + - Implement versioning scheme + - Change bug address to point to bugzilla bug entry form + - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to + reenable it) + - Fix makedepend to use pkgconfig and pass distcheck + - Update build script to build macros first + - Update modular Xorg version + +commit c5f63f703d838cfae54269c595e14a06ea04f243 +Author: Søren Sandmann Pedersen +Date: Wed Jul 13 21:52:24 2005 +0000 + + Add Makefile.am here. Also, for the record, CVS needs a bullet through its + head + +commit 30a2cce4b61e2b0e550479ee87f25c895cbca513 +Author: Søren Sandmann Pedersen +Date: Wed Jul 13 21:45:21 2005 +0000 + + Build system for dummy video driver + +commit ec9e85771609d6ec8a94b777fc784db4d1026f20 +Author: Adam Jackson +Date: Mon Jul 11 02:29:47 2005 +0000 + + Prep for modular builds by adding guarded #include "config.h" everywhere. + +commit 7b856f1c89ceae998c2133fcd9bba2c1493744e0 +Author: Adam Jackson +Date: Sat Jun 25 21:16:54 2005 +0000 + + Bug #3626: _X_EXPORT tags for video and input drivers. + +commit a467602c6c419bd7288d80ad50a6fa62aeff3ec8 +Author: Daniel Stone +Date: Wed Apr 20 12:25:23 2005 +0000 + + Fix includes right throughout the Xserver tree: + change "foo.h" to for core headers, e.g. X.h, Xpoll.h; + change "foo.h", "extensions/foo.h" and "X11/foo.h" to + for extension headers, e.g. Xv.h; + change "foo.[ch]" to for Xtrans files. + +commit 53407449153e20f7529ed9b403cee5aab25880d0 +Author: Adam Jackson +Date: Fri Feb 25 16:38:34 2005 +0000 + + Bug #2605: Make the cyrix, dummy, glint, neomagic, tga, and trident drivers + build when BuildXF86DGA NO. + (also fix some datestamps in the changelog) + +commit 73816949f2a28a0b8fe39108a8e493f9e47f7718 +Author: Egbert Eich +Date: Fri Jan 28 16:12:59 2005 +0000 + + Modifying X.Org Xserver DDX to allow to run X with ordinary user + permissions when no access to HW registers is required. For API changes + which mostly involve the modifications to make the RRFunc (introduced + with 6.8) more flexible please check Bugzilla #2407. NOTE: This patch + applies changes to OS specific files for other OSes which I cannot + test. + +commit 720c9b05f47c3529aa2561ab4c88319322893780 +Author: Markus Kuhn +Date: Sat Dec 4 00:43:05 2004 +0000 + + Encoding of numerous files changed to UTF-8 + +commit b227226476ae94d094376c561d77e85589592fe6 +Author: Stuart Kreitman +Date: Fri Oct 15 21:09:00 2004 +0000 + + Bugzilla #1644: Attach an atom "VFB" to root window of dummy driver. + Committing in Head. + Modified Files: dummy.h dummy_driver.c + +commit a571d5efb53cfe793d61d1b48c2bddc8d337d381 +Author: Eric Anholt +Date: Wed Jun 16 09:23:03 2004 +0000 + + DRI XFree86-4_3_99_12-merge import + +commit 289ef4abc51e6ba8e902db4093cb5380721cbfe7 +Author: Egbert Eich +Date: Wed May 26 16:24:08 2004 +0000 + + Fixing setting of physical framebuffer base for several drivers. C&T + driver: Fixed setting of minimal clocks for HiQV chipsets. Neomagic + driver: improved support for lowres double scan modes. + +commit 5d8038b2977b7c0ab0ea17e263b3720cef83db59 +Author: Egbert Eich +Date: Fri Apr 23 19:30:15 2004 +0000 + + Merging XORG-CURRENT into trunk + +commit f8e1ff3e00a773139aa1ab0ae72c83dc7792c175 +Author: Egbert Eich +Date: Sun Mar 14 08:33:20 2004 +0000 + + Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 + +commit d268ada4b7e5c48cf48825a632af7f0faeaff6d0 +Author: Egbert Eich +Date: Wed Mar 3 12:12:18 2004 +0000 + + Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 + +commit 2ba39037fa8840a654432f032cc97b6830946cf9 +Author: Egbert Eich +Date: Thu Feb 26 13:35:52 2004 +0000 + + readding XFree86's cvs IDs + +commit f352d52a2a89e4c55689a90db83a9f7e03e562c1 +Author: Egbert Eich +Date: Thu Feb 26 09:23:18 2004 +0000 + + Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 + +commit 77748634e71f2c42d03d708515e65351f0b755cb +Author: Kaleb Keithley +Date: Tue Nov 25 19:28:36 2003 +0000 + + XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks + +commit 106069b23188837f06b1057e03db24cad2018ea3 +Author: Kaleb Keithley +Date: Fri Nov 14 16:48:55 2003 +0000 + + XFree86 4.3.0.1 + +commit ca3b63783fc4aa1df725dbd0e560a446dcc17913 +Author: Kaleb Keithley +Date: Fri Nov 14 16:48:55 2003 +0000 + + Initial revision diff --git a/server/xorg/xf86-video-dummy/v0.3.8/Makefile.am b/server/xorg/xf86-video-dummy/v0.3.8/Makefile.am new file mode 100644 index 000000000..af06d5282 --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/Makefile.am @@ -0,0 +1,29 @@ +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +SUBDIRS = src +MAINTAINERCLEANFILES = ChangeLog + +.PHONY: ChangeLog + +ChangeLog: + $(CHANGELOG_CMD) + +dist-hook: ChangeLog diff --git a/server/xorg/xf86-video-dummy/v0.3.8/Makefile.in b/server/xorg/xf86-video-dummy/v0.3.8/Makefile.in new file mode 100644 index 000000000..e6c730e6b --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/Makefile.in @@ -0,0 +1,865 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +CSCOPE = cscope +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in COPYING \ + ChangeLog README compile config.guess config.sub depcomp \ + install-sh ltmain.sh missing +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +GZIP_ENV = --best +DIST_TARGETS = dist-bzip2 dist-gzip +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_CFLAGS = @BASE_CFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA = @DGA@ +DLLTOOL = @DLLTOOL@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRIVER_NAME = @DRIVER_NAME@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_CMD = @INSTALL_CMD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MAN_SUBSTS = @MAN_SUBSTS@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRICT_CFLAGS = @STRICT_CFLAGS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_LIBS = @XORG_LIBS@ +XORG_MAN_PAGE = @XORG_MAN_PAGE@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = src +MAINTAINERCLEANFILES = ChangeLog +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__post_remove_distdir) +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__post_remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__post_remove_distdir) + +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) all install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--refresh check check-am clean clean-cscope clean-generic \ + clean-libtool cscope cscopelist-am ctags ctags-am dist \ + dist-all dist-bzip2 dist-gzip dist-hook dist-lzip dist-shar \ + dist-tarZ dist-xz dist-zip distcheck distclean \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +.PHONY: ChangeLog + +ChangeLog: + $(CHANGELOG_CMD) + +dist-hook: ChangeLog + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/server/xorg/xf86-video-dummy/v0.3.8/README b/server/xorg/xf86-video-dummy/v0.3.8/README new file mode 100644 index 000000000..917276a7a --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/README @@ -0,0 +1,20 @@ +xf86-video-dummy - virtual/offscreen frame buffer driver for the Xorg X server + +Please submit bugs & patches to the Xorg bugzilla: + + https://bugs.freedesktop.org/enter_bug.cgi?product=xorg + +All questions regarding this software should be directed at the +Xorg mailing list: + + http://lists.freedesktop.org/mailman/listinfo/xorg + +The master development code repository can be found at: + + git://anongit.freedesktop.org/git/xorg/driver/xf86-video-dummy + + http://cgit.freedesktop.org/xorg/driver/xf86-video-dummy + +For more information on the git code manager, see: + + http://wiki.x.org/wiki/GitPage diff --git a/server/xorg/xf86-video-dummy/v0.3.8/aclocal.m4 b/server/xorg/xf86-video-dummy/v0.3.8/aclocal.m4 new file mode 100644 index 000000000..a9cc27551 --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/aclocal.m4 @@ -0,0 +1,12431 @@ +# generated automatically by aclocal 1.15 -*- Autoconf -*- + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) + +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 2014 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +]) + +# serial 58 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS=$ltmain + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_PREPARE_CC_BASENAME +# ----------------------- +m4_defun([_LT_PREPARE_CC_BASENAME], [ +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in @S|@*""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} +])# _LT_PREPARE_CC_BASENAME + + +# _LT_CC_BASENAME(CC) +# ------------------- +# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, +# but that macro is also expanded into generated libtool script, which +# arranges for $SED and $ECHO to be set by different means. +m4_defun([_LT_CC_BASENAME], +[m4_require([_LT_PREPARE_CC_BASENAME])dnl +AC_REQUIRE([_LT_DECL_SED])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl +func_cc_basename $1 +cc_basename=$func_cc_basename_result +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl +m4_require([_LT_CMD_TRUNCATE])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options that allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld=$lt_cv_prog_gnu_ld + +old_CC=$CC +old_CFLAGS=$CFLAGS + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from 'configure', and 'config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# 'config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain=$ac_aux_dir/ltmain.sh +])# _LT_PROG_LTMAIN + + + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the 'libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to 'config.status' so that its +# declaration there will have the same value as in 'configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags='_LT_TAGS'dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into 'config.status', and then the shell code to quote escape them in +# for loops in 'config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +_LT_OUTPUT_LIBTOOL_INIT +]) + +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# '#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test 0 = "$lt_write_fail" && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +'$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test 0 != $[#] +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try '$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try '$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test yes = "$silent" && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options that allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST + fi + + cfgfile=${ofile}T + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL +# Generated automatically by $as_me ($PACKAGE) $VERSION +# NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +_LT_COPYING +_LT_LIBTOOL_TAGS + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +_LT_PREPARE_MUNGE_PATH_LIST +_LT_PREPARE_CC_BASENAME + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +m4_ifndef([AC_PROG_GO], [ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "$LT_MULTI_MODULE"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS=$save_LDFLAGS + ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.[[012]][[,.]]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + fi + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + if test yes = "$lt_cv_ld_force_load"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + m4_if([$1], [CXX], +[ if test yes != "$lt_cv_apple_cc_single_mod"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script that will find a shell with a builtin +# printf (that we can use as an echo command). +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case $ECHO in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac + +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], + [Search for dependent libraries within DIR (or the compiler's sysroot + if not specified).])], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([$with_sysroot]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and where our libraries should be installed.])]) + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test no = "$enable_libtool_lock" || enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE=32 + ;; + *ELF-64*) + HPUX_IA64_MODE=64 + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test yes = "$lt_cv_prog_gnu_ld"; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + emul=elf + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*|x86_64-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD=${LD-ld}_sol2 + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks=$enable_libtool_lock +])# _LT_ENABLE_LOCK + + +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test no = "$lt_cv_ar_at_file"; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[_LT_PROG_AR + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + bitrig* | openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test yes = "[$]$2"; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS +]) + +if test yes = "[$]$2"; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring=ABCD + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n "$lt_cv_sys_max_cmd_len"; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test yes = "$cross_compiling"; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test yes != "$enable_dlopen"; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen=load_add_on + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen=LoadLibrary + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen=shl_load], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen=dlopen], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS=$LDFLAGS + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS=$LIBS + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links=nottested +if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test no = "$hard_links"; then + AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", + [Define to the sub-directory where libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then + + # We can hardcode non-existent directories. + if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && + test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || + test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP"; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_PREPARE_MUNGE_PATH_LIST +# --------------------------- +# Make sure func_munge_path_list() is defined correctly. +m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], +[[# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x@S|@2 in + x) + ;; + *:) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" + ;; + x:*) + eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" + ;; + *) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + esac +} +]])# _LT_PREPARE_PATH_LIST + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test yes = "$GCC"; then + case $host_os in + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary... + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo = "/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +AC_ARG_VAR([LT_SYS_LIBRARY_PATH], +[User-defined run-time library search path.]) + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[[4-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a[(]lib.so.V[)]' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[23]].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[[3-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], + [Detected run-time system search path for libraries]) +_LT_DECL([], [configure_time_lt_sys_library_path], [2], + [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program that can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$1"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac]) +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program that can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test no = "$withval" || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], +[if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi]) +rm -f conftest.i conftest2.i conftest.out]) +])# _LT_PATH_DD + + +# _LT_CMD_TRUNCATE +# ---------------- +# find command to truncate a binary pipe +m4_defun([_LT_CMD_TRUNCATE], +[m4_require([_LT_PATH_DD]) +AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], +[printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) +_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], + [Command to truncate a binary pipe]) +])# _LT_CMD_TRUNCATE + + +# _LT_CHECK_MAGIC_METHOD +# ---------------------- +# how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_MAGIC_METHOD], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +AC_CACHE_CHECK([how to recognize dependent libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[[4-9]]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[[45]]*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM +else + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs + done + : ${lt_cv_path_NM=no} +fi]) +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# _LT_DLL_DEF_P([FILE]) +# --------------------- +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with func_dll_def_p in the libtool script +AC_DEFUN([_LT_DLL_DEF_P], +[dnl + test DEF = "`$SED -n dnl + -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace + -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments + -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl + -e q dnl Only consider the first "real" line + $1`" dnl +])# _LT_DLL_DEF_P + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM=-lm) + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test yes = "$GCC"; then + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test ia64 = "$host_cpu"; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT@&t@_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS=conftstm.$ac_objext + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test yes = "$pipe_works"; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], + [Transform the output of nm into a list of symbols to manually relocate]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([nm_interface], [lt_cv_nm_interface], [1], + [The name lister interface]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test yes = "$GXX"; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + if test ia64 != "$host_cpu"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64, which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd* | netbsdelf*-gnu) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test yes = "$GCC"; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + # old Intel for x86_64, which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test yes = "$with_gnu_ld"; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test yes = "$lt_use_gnu_ld_interface"; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='$wl' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test ia64 != "$host_cpu"; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' + ;; + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GCC"; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + ;; + + hpux10*) + if test yes,no = "$GCC,$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test yes,no = "$GCC,$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + ;; + esac + fi + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS=$save_LDFLAGS]) + if test yes = "$lt_cv_irix_exported_symbol"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + _LT_TAGVAR(link_all_deplibs, $1)=no + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(ld_shlibs, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + osf3*) + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test yes = "$GCC"; then + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. GCC discards it without '$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test yes = "$GCC"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test sequent = "$host_vendor"; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test sni = "$host_vendor"; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting $shlibpath_var if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC=$CC +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report what library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC=$lt_save_CC +])# _LT_LANG_C_CONFIG + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test no != "$CXX" && + ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || + (test g++ != "$CXX"))); then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_caught_CXX_error"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test yes = "$GXX"; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test yes = "$GXX"; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test yes = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='$wl' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GXX"; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag=$shared_flag' $wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + # The "-G" linker flag allows undefined symbols. + _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared + # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require '-G' NOT '-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + + _LT_TAGVAR(GCC, $1)=$GXX + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test yes != "$_lt_caught_CXX_error" + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case @S|@2 in + .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; + *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case $prev$p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test x-L = "$p" || + test x-R = "$p"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test no = "$pre_test_object_deps_done"; then + case $prev in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)=$prev$p + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test no = "$pre_test_object_deps_done"; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)=$p + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)=$p + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test no = "$F77"; then + _lt_disable_F77=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_disable_F77"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${F77-"f77"} + CFLAGS=$FFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)=$G77 + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_F77" + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test no = "$FC"; then + _lt_disable_FC=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_disable_FC"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${FC-"f95"} + CFLAGS=$FCFLAGS + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_FC" + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)=$LD +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)=$LD +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code=$lt_simple_compile_test_code + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f "$lt_ac_sed" && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test 10 -lt "$lt_ac_count" && break + lt_ac_count=`expr $lt_ac_count + 1` + if test "$lt_ac_count" -gt "$lt_ac_max"; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine what file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS + +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software +# Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 8 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option '$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl 'shared' nor 'disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], + [_LT_WITH_AIX_SONAME([aix])]) + ]) +])# _LT_SET_OPTIONS + + + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [1], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the 'shared' and +# 'disable-shared' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the 'static' and +# 'disable-static' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the 'fast-install' +# and 'disable-fast-install' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_AIX_SONAME([DEFAULT]) +# ---------------------------------- +# implement the --with-aix-soname flag, and support the `aix-soname=aix' +# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT +# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. +m4_define([_LT_WITH_AIX_SONAME], +[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl +shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[[5-9]]*,yes) + AC_MSG_CHECKING([which variant of shared library versioning to provide]) + AC_ARG_WITH([aix-soname], + [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], + [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], + [case $withval in + aix|svr4|both) + ;; + *) + AC_MSG_ERROR([Unknown argument to --with-aix-soname]) + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname], + [AC_CACHE_VAL([lt_cv_with_aix_soname], + [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) + with_aix_soname=$lt_cv_with_aix_soname]) + AC_MSG_RESULT([$with_aix_soname]) + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + +_LT_DECL([], [shared_archive_member_spec], [0], + [Shared archive member basename, for filename based shared library versioning on AIX])dnl +])# _LT_WITH_AIX_SONAME + +LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the 'pic-only' and 'no-pic' +# LT_INIT options. +# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [pic_mode=m4_default([$1], [default])]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) + +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software +# Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59, which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) + +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# @configure_input@ + +# serial 4179 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4.6]) +m4_define([LT_PACKAGE_REVISION], [2.4.6]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4.6' +macro_revision='2.4.6' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) + +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software +# Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 5 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) + +dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +dnl serial 11 (pkg-config-0.29) +dnl +dnl Copyright © 2004 Scott James Remnant . +dnl Copyright © 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])dnl _PKG_CONFIG + +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR + +dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. +dnl +dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. +dnl +dnl Permission is hereby granted, free of charge, to any person obtaining a +dnl copy of this software and associated documentation files (the "Software"), +dnl to deal in the Software without restriction, including without limitation +dnl the rights to use, copy, modify, merge, publish, distribute, sublicense, +dnl and/or sell copies of the Software, and to permit persons to whom the +dnl Software is furnished to do so, subject to the following conditions: +dnl +dnl The above copyright notice and this permission notice (including the next +dnl paragraph) shall be included in all copies or substantial portions of the +dnl Software. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +dnl DEALINGS IN THE SOFTWARE. + +# XORG_MACROS_VERSION(required-version) +# ------------------------------------- +# Minimum version: 1.1.0 +# +# If you're using a macro added in Version 1.1 or newer, include this in +# your configure.ac with the minimum required version, such as: +# XORG_MACROS_VERSION(1.1) +# +# To ensure that this macro is defined, also add: +# m4_ifndef([XORG_MACROS_VERSION], +# [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])]) +# +# +# See the "minimum version" comment for each macro you use to see what +# version you require. +m4_defun([XORG_MACROS_VERSION],[ +m4_define([vers_have], [1.19.0]) +m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) +m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) +m4_if(m4_cmp(maj_have, maj_needed), 0,, + [m4_fatal([xorg-macros major version ]maj_needed[ is required but ]vers_have[ found])]) +m4_if(m4_version_compare(vers_have, [$1]), -1, + [m4_fatal([xorg-macros version $1 or higher is required but ]vers_have[ found])]) +m4_undefine([vers_have]) +m4_undefine([maj_have]) +m4_undefine([maj_needed]) +]) # XORG_MACROS_VERSION + +# XORG_PROG_RAWCPP() +# ------------------ +# Minimum version: 1.0.0 +# +# Find cpp program and necessary flags for use in pre-processing text files +# such as man pages and config files +AC_DEFUN([XORG_PROG_RAWCPP],[ +AC_REQUIRE([AC_PROG_CPP]) +AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], + [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib]) + +# Check for flag to avoid builtin definitions - assumes unix is predefined, +# which is not the best choice for supporting other OS'es, but covers most +# of the ones we need for now. +AC_MSG_CHECKING([if $RAWCPP requires -undef]) +AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp redefine unix ?]])]) +if test `${RAWCPP} < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then + AC_MSG_RESULT([no]) +else + if test `${RAWCPP} -undef < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then + RAWCPPFLAGS=-undef + AC_MSG_RESULT([yes]) + # under Cygwin unix is still defined even with -undef + elif test `${RAWCPP} -undef -ansi < conftest.$ac_ext | grep -c 'unix'` -eq 1 ; then + RAWCPPFLAGS="-undef -ansi" + AC_MSG_RESULT([yes, with -ansi]) + else + AC_MSG_ERROR([${RAWCPP} defines unix with or without -undef. I don't know what to do.]) + fi +fi +rm -f conftest.$ac_ext + +AC_MSG_CHECKING([if $RAWCPP requires -traditional]) +AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve "whitespace"?]])]) +if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then + AC_MSG_RESULT([no]) +else + if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then + TRADITIONALCPPFLAGS="-traditional" + RAWCPPFLAGS="${RAWCPPFLAGS} -traditional" + AC_MSG_RESULT([yes]) + else + AC_MSG_ERROR([${RAWCPP} does not preserve whitespace with or without -traditional. I don't know what to do.]) + fi +fi +rm -f conftest.$ac_ext +AC_SUBST(RAWCPPFLAGS) +AC_SUBST(TRADITIONALCPPFLAGS) +]) # XORG_PROG_RAWCPP + +# XORG_MANPAGE_SECTIONS() +# ----------------------- +# Minimum version: 1.0.0 +# +# Determine which sections man pages go in for the different man page types +# on this OS - replaces *ManSuffix settings in old Imake *.cf per-os files. +# Not sure if there's any better way than just hardcoding by OS name. +# Override default settings by setting environment variables +# Added MAN_SUBSTS in version 1.8 +# Added AC_PROG_SED in version 1.8 + +AC_DEFUN([XORG_MANPAGE_SECTIONS],[ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_SED]) + +if test x$APP_MAN_SUFFIX = x ; then + APP_MAN_SUFFIX=1 +fi +if test x$APP_MAN_DIR = x ; then + APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)' +fi + +if test x$LIB_MAN_SUFFIX = x ; then + LIB_MAN_SUFFIX=3 +fi +if test x$LIB_MAN_DIR = x ; then + LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)' +fi + +if test x$FILE_MAN_SUFFIX = x ; then + case $host_os in + solaris*) FILE_MAN_SUFFIX=4 ;; + *) FILE_MAN_SUFFIX=5 ;; + esac +fi +if test x$FILE_MAN_DIR = x ; then + FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)' +fi + +if test x$MISC_MAN_SUFFIX = x ; then + case $host_os in + solaris*) MISC_MAN_SUFFIX=5 ;; + *) MISC_MAN_SUFFIX=7 ;; + esac +fi +if test x$MISC_MAN_DIR = x ; then + MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)' +fi + +if test x$DRIVER_MAN_SUFFIX = x ; then + case $host_os in + solaris*) DRIVER_MAN_SUFFIX=7 ;; + *) DRIVER_MAN_SUFFIX=4 ;; + esac +fi +if test x$DRIVER_MAN_DIR = x ; then + DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)' +fi + +if test x$ADMIN_MAN_SUFFIX = x ; then + case $host_os in + solaris*) ADMIN_MAN_SUFFIX=1m ;; + *) ADMIN_MAN_SUFFIX=8 ;; + esac +fi +if test x$ADMIN_MAN_DIR = x ; then + ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)' +fi + + +AC_SUBST([APP_MAN_SUFFIX]) +AC_SUBST([LIB_MAN_SUFFIX]) +AC_SUBST([FILE_MAN_SUFFIX]) +AC_SUBST([MISC_MAN_SUFFIX]) +AC_SUBST([DRIVER_MAN_SUFFIX]) +AC_SUBST([ADMIN_MAN_SUFFIX]) +AC_SUBST([APP_MAN_DIR]) +AC_SUBST([LIB_MAN_DIR]) +AC_SUBST([FILE_MAN_DIR]) +AC_SUBST([MISC_MAN_DIR]) +AC_SUBST([DRIVER_MAN_DIR]) +AC_SUBST([ADMIN_MAN_DIR]) + +XORG_MAN_PAGE="X Version 11" +AC_SUBST([XORG_MAN_PAGE]) +MAN_SUBSTS="\ + -e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \ + -e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \ + -e 's|__xservername__|Xorg|g' \ + -e 's|__xconfigfile__|xorg.conf|g' \ + -e 's|__projectroot__|\$(prefix)|g' \ + -e 's|__apploaddir__|\$(appdefaultdir)|g' \ + -e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \ + -e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \ + -e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \ + -e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \ + -e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \ + -e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'" +AC_SUBST([MAN_SUBSTS]) + +]) # XORG_MANPAGE_SECTIONS + +# XORG_CHECK_SGML_DOCTOOLS([MIN-VERSION]) +# ------------------------ +# Minimum version: 1.7.0 +# +# Defines the variable XORG_SGML_PATH containing the location of X11/defs.ent +# provided by xorg-sgml-doctools, if installed. +AC_DEFUN([XORG_CHECK_SGML_DOCTOOLS],[ +AC_MSG_CHECKING([for X.Org SGML entities m4_ifval([$1],[>= $1])]) +XORG_SGML_PATH= +PKG_CHECK_EXISTS([xorg-sgml-doctools m4_ifval([$1],[>= $1])], + [XORG_SGML_PATH=`$PKG_CONFIG --variable=sgmlrootdir xorg-sgml-doctools`], + [m4_ifval([$1],[:], + [if test x"$cross_compiling" != x"yes" ; then + AC_CHECK_FILE([$prefix/share/sgml/X11/defs.ent], + [XORG_SGML_PATH=$prefix/share/sgml]) + fi]) + ]) + +# Define variables STYLESHEET_SRCDIR and XSL_STYLESHEET containing +# the path and the name of the doc stylesheet +if test "x$XORG_SGML_PATH" != "x" ; then + AC_MSG_RESULT([$XORG_SGML_PATH]) + STYLESHEET_SRCDIR=$XORG_SGML_PATH/X11 + XSL_STYLESHEET=$STYLESHEET_SRCDIR/xorg.xsl +else + AC_MSG_RESULT([no]) +fi + +AC_SUBST(XORG_SGML_PATH) +AC_SUBST(STYLESHEET_SRCDIR) +AC_SUBST(XSL_STYLESHEET) +AM_CONDITIONAL([HAVE_STYLESHEETS], [test "x$XSL_STYLESHEET" != "x"]) +]) # XORG_CHECK_SGML_DOCTOOLS + +# XORG_CHECK_LINUXDOC +# ------------------- +# Minimum version: 1.0.0 +# +# Defines the variable MAKE_TEXT if the necessary tools and +# files are found. $(MAKE_TEXT) blah.sgml will then produce blah.txt. +# Whether or not the necessary tools and files are found can be checked +# with the AM_CONDITIONAL "BUILD_LINUXDOC" +AC_DEFUN([XORG_CHECK_LINUXDOC],[ +AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS]) +AC_REQUIRE([XORG_WITH_PS2PDF]) + +AC_PATH_PROG(LINUXDOC, linuxdoc) + +AC_MSG_CHECKING([whether to build documentation]) + +if test x$XORG_SGML_PATH != x && test x$LINUXDOC != x ; then + BUILDDOC=yes +else + BUILDDOC=no +fi + +AM_CONDITIONAL(BUILD_LINUXDOC, [test x$BUILDDOC = xyes]) + +AC_MSG_RESULT([$BUILDDOC]) + +AC_MSG_CHECKING([whether to build pdf documentation]) + +if test x$have_ps2pdf != xno && test x$BUILD_PDFDOC != xno; then + BUILDPDFDOC=yes +else + BUILDPDFDOC=no +fi + +AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes]) + +AC_MSG_RESULT([$BUILDPDFDOC]) + +MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH GROFF_NO_SGR=y $LINUXDOC -B txt -f" +MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B latex --papersize=letter --output=ps" +MAKE_PDF="$PS2PDF" +MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $LINUXDOC -B html --split=0" + +AC_SUBST(MAKE_TEXT) +AC_SUBST(MAKE_PS) +AC_SUBST(MAKE_PDF) +AC_SUBST(MAKE_HTML) +]) # XORG_CHECK_LINUXDOC + +# XORG_CHECK_DOCBOOK +# ------------------- +# Minimum version: 1.0.0 +# +# Checks for the ability to build output formats from SGML DocBook source. +# For XXX in {TXT, PDF, PS, HTML}, the AM_CONDITIONAL "BUILD_XXXDOC" +# indicates whether the necessary tools and files are found and, if set, +# $(MAKE_XXX) blah.sgml will produce blah.xxx. +AC_DEFUN([XORG_CHECK_DOCBOOK],[ +AC_REQUIRE([XORG_CHECK_SGML_DOCTOOLS]) + +BUILDTXTDOC=no +BUILDPDFDOC=no +BUILDPSDOC=no +BUILDHTMLDOC=no + +AC_PATH_PROG(DOCBOOKPS, docbook2ps) +AC_PATH_PROG(DOCBOOKPDF, docbook2pdf) +AC_PATH_PROG(DOCBOOKHTML, docbook2html) +AC_PATH_PROG(DOCBOOKTXT, docbook2txt) + +AC_MSG_CHECKING([whether to build text documentation]) +if test x$XORG_SGML_PATH != x && test x$DOCBOOKTXT != x && + test x$BUILD_TXTDOC != xno; then + BUILDTXTDOC=yes +fi +AM_CONDITIONAL(BUILD_TXTDOC, [test x$BUILDTXTDOC = xyes]) +AC_MSG_RESULT([$BUILDTXTDOC]) + +AC_MSG_CHECKING([whether to build PDF documentation]) +if test x$XORG_SGML_PATH != x && test x$DOCBOOKPDF != x && + test x$BUILD_PDFDOC != xno; then + BUILDPDFDOC=yes +fi +AM_CONDITIONAL(BUILD_PDFDOC, [test x$BUILDPDFDOC = xyes]) +AC_MSG_RESULT([$BUILDPDFDOC]) + +AC_MSG_CHECKING([whether to build PostScript documentation]) +if test x$XORG_SGML_PATH != x && test x$DOCBOOKPS != x && + test x$BUILD_PSDOC != xno; then + BUILDPSDOC=yes +fi +AM_CONDITIONAL(BUILD_PSDOC, [test x$BUILDPSDOC = xyes]) +AC_MSG_RESULT([$BUILDPSDOC]) + +AC_MSG_CHECKING([whether to build HTML documentation]) +if test x$XORG_SGML_PATH != x && test x$DOCBOOKHTML != x && + test x$BUILD_HTMLDOC != xno; then + BUILDHTMLDOC=yes +fi +AM_CONDITIONAL(BUILD_HTMLDOC, [test x$BUILDHTMLDOC = xyes]) +AC_MSG_RESULT([$BUILDHTMLDOC]) + +MAKE_TEXT="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKTXT" +MAKE_PS="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPS" +MAKE_PDF="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKPDF" +MAKE_HTML="SGML_SEARCH_PATH=$XORG_SGML_PATH $DOCBOOKHTML" + +AC_SUBST(MAKE_TEXT) +AC_SUBST(MAKE_PS) +AC_SUBST(MAKE_PDF) +AC_SUBST(MAKE_HTML) +]) # XORG_CHECK_DOCBOOK + +# XORG_WITH_XMLTO([MIN-VERSION], [DEFAULT]) +# ---------------- +# Minimum version: 1.5.0 +# Minimum version for optional DEFAULT argument: 1.11.0 +# +# Documentation tools are not always available on all platforms and sometimes +# not at the appropriate level. This macro enables a module to test for the +# presence of the tool and obtain it's path in separate variables. Coupled with +# the --with-xmlto option, it allows maximum flexibilty in making decisions +# as whether or not to use the xmlto package. When DEFAULT is not specified, +# --with-xmlto assumes 'auto'. +# +# Interface to module: +# HAVE_XMLTO: used in makefiles to conditionally generate documentation +# XMLTO: returns the path of the xmlto program found +# returns the path set by the user in the environment +# --with-xmlto: 'yes' user instructs the module to use xmlto +# 'no' user instructs the module not to use xmlto +# +# Added in version 1.10.0 +# HAVE_XMLTO_TEXT: used in makefiles to conditionally generate text documentation +# xmlto for text output requires either lynx, links, or w3m browsers +# +# If the user sets the value of XMLTO, AC_PATH_PROG skips testing the path. +# +AC_DEFUN([XORG_WITH_XMLTO],[ +AC_ARG_VAR([XMLTO], [Path to xmlto command]) +m4_define([_defopt], m4_default([$2], [auto])) +AC_ARG_WITH(xmlto, + AS_HELP_STRING([--with-xmlto], + [Use xmlto to regenerate documentation (default: ]_defopt[)]), + [use_xmlto=$withval], [use_xmlto=]_defopt) +m4_undefine([_defopt]) + +if test "x$use_xmlto" = x"auto"; then + AC_PATH_PROG([XMLTO], [xmlto]) + if test "x$XMLTO" = "x"; then + AC_MSG_WARN([xmlto not found - documentation targets will be skipped]) + have_xmlto=no + else + have_xmlto=yes + fi +elif test "x$use_xmlto" = x"yes" ; then + AC_PATH_PROG([XMLTO], [xmlto]) + if test "x$XMLTO" = "x"; then + AC_MSG_ERROR([--with-xmlto=yes specified but xmlto not found in PATH]) + fi + have_xmlto=yes +elif test "x$use_xmlto" = x"no" ; then + if test "x$XMLTO" != "x"; then + AC_MSG_WARN([ignoring XMLTO environment variable since --with-xmlto=no was specified]) + fi + have_xmlto=no +else + AC_MSG_ERROR([--with-xmlto expects 'yes' or 'no']) +fi + +# Test for a minimum version of xmlto, if provided. +m4_ifval([$1], +[if test "$have_xmlto" = yes; then + # scrape the xmlto version + AC_MSG_CHECKING([the xmlto version]) + xmlto_version=`$XMLTO --version 2>/dev/null | cut -d' ' -f3` + AC_MSG_RESULT([$xmlto_version]) + AS_VERSION_COMPARE([$xmlto_version], [$1], + [if test "x$use_xmlto" = xauto; then + AC_MSG_WARN([xmlto version $xmlto_version found, but $1 needed]) + have_xmlto=no + else + AC_MSG_ERROR([xmlto version $xmlto_version found, but $1 needed]) + fi]) +fi]) + +# Test for the ability of xmlto to generate a text target +# +# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the +# following test for empty XML docbook files. +# For compatibility reasons use the following empty XML docbook file and if +# it fails try it again with a non-empty XML file. +have_xmlto_text=no +cat > conftest.xml << "EOF" +EOF +AS_IF([test "$have_xmlto" = yes], + [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1], + [have_xmlto_text=yes], + [# Try it again with a non-empty XML file. + cat > conftest.xml << "EOF" + +EOF + AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1], + [have_xmlto_text=yes], + [AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])]) +rm -f conftest.xml +AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes]) +AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes]) +]) # XORG_WITH_XMLTO + +# XORG_WITH_XSLTPROC([MIN-VERSION], [DEFAULT]) +# -------------------------------------------- +# Minimum version: 1.12.0 +# Minimum version for optional DEFAULT argument: 1.12.0 +# +# XSLT (Extensible Stylesheet Language Transformations) is a declarative, +# XML-based language used for the transformation of XML documents. +# The xsltproc command line tool is for applying XSLT stylesheets to XML documents. +# It is used under the cover by xmlto to generate html files from DocBook/XML. +# The XSLT processor is often used as a standalone tool for transformations. +# It should not be assumed that this tool is used only to work with documnetation. +# When DEFAULT is not specified, --with-xsltproc assumes 'auto'. +# +# Interface to module: +# HAVE_XSLTPROC: used in makefiles to conditionally generate documentation +# XSLTPROC: returns the path of the xsltproc program found +# returns the path set by the user in the environment +# --with-xsltproc: 'yes' user instructs the module to use xsltproc +# 'no' user instructs the module not to use xsltproc +# have_xsltproc: returns yes if xsltproc found in PATH or no +# +# If the user sets the value of XSLTPROC, AC_PATH_PROG skips testing the path. +# +AC_DEFUN([XORG_WITH_XSLTPROC],[ +AC_ARG_VAR([XSLTPROC], [Path to xsltproc command]) +# Preserves the interface, should it be implemented later +m4_ifval([$1], [m4_warn([syntax], [Checking for xsltproc MIN-VERSION is not implemented])]) +m4_define([_defopt], m4_default([$2], [auto])) +AC_ARG_WITH(xsltproc, + AS_HELP_STRING([--with-xsltproc], + [Use xsltproc for the transformation of XML documents (default: ]_defopt[)]), + [use_xsltproc=$withval], [use_xsltproc=]_defopt) +m4_undefine([_defopt]) + +if test "x$use_xsltproc" = x"auto"; then + AC_PATH_PROG([XSLTPROC], [xsltproc]) + if test "x$XSLTPROC" = "x"; then + AC_MSG_WARN([xsltproc not found - cannot transform XML documents]) + have_xsltproc=no + else + have_xsltproc=yes + fi +elif test "x$use_xsltproc" = x"yes" ; then + AC_PATH_PROG([XSLTPROC], [xsltproc]) + if test "x$XSLTPROC" = "x"; then + AC_MSG_ERROR([--with-xsltproc=yes specified but xsltproc not found in PATH]) + fi + have_xsltproc=yes +elif test "x$use_xsltproc" = x"no" ; then + if test "x$XSLTPROC" != "x"; then + AC_MSG_WARN([ignoring XSLTPROC environment variable since --with-xsltproc=no was specified]) + fi + have_xsltproc=no +else + AC_MSG_ERROR([--with-xsltproc expects 'yes' or 'no']) +fi + +AM_CONDITIONAL([HAVE_XSLTPROC], [test "$have_xsltproc" = yes]) +]) # XORG_WITH_XSLTPROC + +# XORG_WITH_PERL([MIN-VERSION], [DEFAULT]) +# ---------------------------------------- +# Minimum version: 1.15.0 +# +# PERL (Practical Extraction and Report Language) is a language optimized for +# scanning arbitrary text files, extracting information from those text files, +# and printing reports based on that information. +# +# When DEFAULT is not specified, --with-perl assumes 'auto'. +# +# Interface to module: +# HAVE_PERL: used in makefiles to conditionally scan text files +# PERL: returns the path of the perl program found +# returns the path set by the user in the environment +# --with-perl: 'yes' user instructs the module to use perl +# 'no' user instructs the module not to use perl +# have_perl: returns yes if perl found in PATH or no +# +# If the user sets the value of PERL, AC_PATH_PROG skips testing the path. +# +AC_DEFUN([XORG_WITH_PERL],[ +AC_ARG_VAR([PERL], [Path to perl command]) +# Preserves the interface, should it be implemented later +m4_ifval([$1], [m4_warn([syntax], [Checking for perl MIN-VERSION is not implemented])]) +m4_define([_defopt], m4_default([$2], [auto])) +AC_ARG_WITH(perl, + AS_HELP_STRING([--with-perl], + [Use perl for extracting information from files (default: ]_defopt[)]), + [use_perl=$withval], [use_perl=]_defopt) +m4_undefine([_defopt]) + +if test "x$use_perl" = x"auto"; then + AC_PATH_PROG([PERL], [perl]) + if test "x$PERL" = "x"; then + AC_MSG_WARN([perl not found - cannot extract information and report]) + have_perl=no + else + have_perl=yes + fi +elif test "x$use_perl" = x"yes" ; then + AC_PATH_PROG([PERL], [perl]) + if test "x$PERL" = "x"; then + AC_MSG_ERROR([--with-perl=yes specified but perl not found in PATH]) + fi + have_perl=yes +elif test "x$use_perl" = x"no" ; then + if test "x$PERL" != "x"; then + AC_MSG_WARN([ignoring PERL environment variable since --with-perl=no was specified]) + fi + have_perl=no +else + AC_MSG_ERROR([--with-perl expects 'yes' or 'no']) +fi + +AM_CONDITIONAL([HAVE_PERL], [test "$have_perl" = yes]) +]) # XORG_WITH_PERL + +# XORG_WITH_ASCIIDOC([MIN-VERSION], [DEFAULT]) +# ---------------- +# Minimum version: 1.5.0 +# Minimum version for optional DEFAULT argument: 1.11.0 +# +# Documentation tools are not always available on all platforms and sometimes +# not at the appropriate level. This macro enables a module to test for the +# presence of the tool and obtain it's path in separate variables. Coupled with +# the --with-asciidoc option, it allows maximum flexibilty in making decisions +# as whether or not to use the asciidoc package. When DEFAULT is not specified, +# --with-asciidoc assumes 'auto'. +# +# Interface to module: +# HAVE_ASCIIDOC: used in makefiles to conditionally generate documentation +# ASCIIDOC: returns the path of the asciidoc program found +# returns the path set by the user in the environment +# --with-asciidoc: 'yes' user instructs the module to use asciidoc +# 'no' user instructs the module not to use asciidoc +# +# If the user sets the value of ASCIIDOC, AC_PATH_PROG skips testing the path. +# +AC_DEFUN([XORG_WITH_ASCIIDOC],[ +AC_ARG_VAR([ASCIIDOC], [Path to asciidoc command]) +m4_define([_defopt], m4_default([$2], [auto])) +AC_ARG_WITH(asciidoc, + AS_HELP_STRING([--with-asciidoc], + [Use asciidoc to regenerate documentation (default: ]_defopt[)]), + [use_asciidoc=$withval], [use_asciidoc=]_defopt) +m4_undefine([_defopt]) + +if test "x$use_asciidoc" = x"auto"; then + AC_PATH_PROG([ASCIIDOC], [asciidoc]) + if test "x$ASCIIDOC" = "x"; then + AC_MSG_WARN([asciidoc not found - documentation targets will be skipped]) + have_asciidoc=no + else + have_asciidoc=yes + fi +elif test "x$use_asciidoc" = x"yes" ; then + AC_PATH_PROG([ASCIIDOC], [asciidoc]) + if test "x$ASCIIDOC" = "x"; then + AC_MSG_ERROR([--with-asciidoc=yes specified but asciidoc not found in PATH]) + fi + have_asciidoc=yes +elif test "x$use_asciidoc" = x"no" ; then + if test "x$ASCIIDOC" != "x"; then + AC_MSG_WARN([ignoring ASCIIDOC environment variable since --with-asciidoc=no was specified]) + fi + have_asciidoc=no +else + AC_MSG_ERROR([--with-asciidoc expects 'yes' or 'no']) +fi +m4_ifval([$1], +[if test "$have_asciidoc" = yes; then + # scrape the asciidoc version + AC_MSG_CHECKING([the asciidoc version]) + asciidoc_version=`$ASCIIDOC --version 2>/dev/null | cut -d' ' -f2` + AC_MSG_RESULT([$asciidoc_version]) + AS_VERSION_COMPARE([$asciidoc_version], [$1], + [if test "x$use_asciidoc" = xauto; then + AC_MSG_WARN([asciidoc version $asciidoc_version found, but $1 needed]) + have_asciidoc=no + else + AC_MSG_ERROR([asciidoc version $asciidoc_version found, but $1 needed]) + fi]) +fi]) +AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes]) +]) # XORG_WITH_ASCIIDOC + +# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT]) +# ------------------------------------------- +# Minimum version: 1.5.0 +# Minimum version for optional DEFAULT argument: 1.11.0 +# Minimum version for optional DOT checking: 1.18.0 +# +# Documentation tools are not always available on all platforms and sometimes +# not at the appropriate level. This macro enables a module to test for the +# presence of the tool and obtain it's path in separate variables. Coupled with +# the --with-doxygen option, it allows maximum flexibilty in making decisions +# as whether or not to use the doxygen package. When DEFAULT is not specified, +# --with-doxygen assumes 'auto'. +# +# Interface to module: +# HAVE_DOXYGEN: used in makefiles to conditionally generate documentation +# DOXYGEN: returns the path of the doxygen program found +# returns the path set by the user in the environment +# --with-doxygen: 'yes' user instructs the module to use doxygen +# 'no' user instructs the module not to use doxygen +# +# If the user sets the value of DOXYGEN, AC_PATH_PROG skips testing the path. +# +AC_DEFUN([XORG_WITH_DOXYGEN],[ +AC_ARG_VAR([DOXYGEN], [Path to doxygen command]) +AC_ARG_VAR([DOT], [Path to the dot graphics utility]) +m4_define([_defopt], m4_default([$2], [auto])) +AC_ARG_WITH(doxygen, + AS_HELP_STRING([--with-doxygen], + [Use doxygen to regenerate documentation (default: ]_defopt[)]), + [use_doxygen=$withval], [use_doxygen=]_defopt) +m4_undefine([_defopt]) + +if test "x$use_doxygen" = x"auto"; then + AC_PATH_PROG([DOXYGEN], [doxygen]) + if test "x$DOXYGEN" = "x"; then + AC_MSG_WARN([doxygen not found - documentation targets will be skipped]) + have_doxygen=no + else + have_doxygen=yes + fi +elif test "x$use_doxygen" = x"yes" ; then + AC_PATH_PROG([DOXYGEN], [doxygen]) + if test "x$DOXYGEN" = "x"; then + AC_MSG_ERROR([--with-doxygen=yes specified but doxygen not found in PATH]) + fi + have_doxygen=yes +elif test "x$use_doxygen" = x"no" ; then + if test "x$DOXYGEN" != "x"; then + AC_MSG_WARN([ignoring DOXYGEN environment variable since --with-doxygen=no was specified]) + fi + have_doxygen=no +else + AC_MSG_ERROR([--with-doxygen expects 'yes' or 'no']) +fi +m4_ifval([$1], +[if test "$have_doxygen" = yes; then + # scrape the doxygen version + AC_MSG_CHECKING([the doxygen version]) + doxygen_version=`$DOXYGEN --version 2>/dev/null` + AC_MSG_RESULT([$doxygen_version]) + AS_VERSION_COMPARE([$doxygen_version], [$1], + [if test "x$use_doxygen" = xauto; then + AC_MSG_WARN([doxygen version $doxygen_version found, but $1 needed]) + have_doxygen=no + else + AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed]) + fi]) +fi]) + +dnl Check for DOT if we have doxygen. The caller decides if it is mandatory +dnl HAVE_DOT is a variable that can be used in your doxygen.in config file: +dnl HAVE_DOT = @HAVE_DOT@ +HAVE_DOT=no +if test "x$have_doxygen" = "xyes"; then + AC_PATH_PROG([DOT], [dot]) + if test "x$DOT" != "x"; then + HAVE_DOT=yes + fi +fi + +AC_SUBST([HAVE_DOT]) +AM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"]) +AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes]) +]) # XORG_WITH_DOXYGEN + +# XORG_WITH_GROFF([DEFAULT]) +# ---------------- +# Minimum version: 1.6.0 +# Minimum version for optional DEFAULT argument: 1.11.0 +# +# Documentation tools are not always available on all platforms and sometimes +# not at the appropriate level. This macro enables a module to test for the +# presence of the tool and obtain it's path in separate variables. Coupled with +# the --with-groff option, it allows maximum flexibilty in making decisions +# as whether or not to use the groff package. When DEFAULT is not specified, +# --with-groff assumes 'auto'. +# +# Interface to module: +# HAVE_GROFF: used in makefiles to conditionally generate documentation +# HAVE_GROFF_MM: the memorandum macros (-mm) package +# HAVE_GROFF_MS: the -ms macros package +# GROFF: returns the path of the groff program found +# returns the path set by the user in the environment +# --with-groff: 'yes' user instructs the module to use groff +# 'no' user instructs the module not to use groff +# +# Added in version 1.9.0: +# HAVE_GROFF_HTML: groff has dependencies to output HTML format: +# pnmcut pnmcrop pnmtopng pnmtops from the netpbm package. +# psselect from the psutils package. +# the ghostcript package. Refer to the grohtml man pages +# +# If the user sets the value of GROFF, AC_PATH_PROG skips testing the path. +# +# OS and distros often splits groff in a basic and full package, the former +# having the groff program and the later having devices, fonts and macros +# Checking for the groff executable is not enough. +# +# If macros are missing, we cannot assume that groff is useless, so we don't +# unset HAVE_GROFF or GROFF env variables. +# HAVE_GROFF_?? can never be true while HAVE_GROFF is false. +# +AC_DEFUN([XORG_WITH_GROFF],[ +AC_ARG_VAR([GROFF], [Path to groff command]) +m4_define([_defopt], m4_default([$1], [auto])) +AC_ARG_WITH(groff, + AS_HELP_STRING([--with-groff], + [Use groff to regenerate documentation (default: ]_defopt[)]), + [use_groff=$withval], [use_groff=]_defopt) +m4_undefine([_defopt]) + +if test "x$use_groff" = x"auto"; then + AC_PATH_PROG([GROFF], [groff]) + if test "x$GROFF" = "x"; then + AC_MSG_WARN([groff not found - documentation targets will be skipped]) + have_groff=no + else + have_groff=yes + fi +elif test "x$use_groff" = x"yes" ; then + AC_PATH_PROG([GROFF], [groff]) + if test "x$GROFF" = "x"; then + AC_MSG_ERROR([--with-groff=yes specified but groff not found in PATH]) + fi + have_groff=yes +elif test "x$use_groff" = x"no" ; then + if test "x$GROFF" != "x"; then + AC_MSG_WARN([ignoring GROFF environment variable since --with-groff=no was specified]) + fi + have_groff=no +else + AC_MSG_ERROR([--with-groff expects 'yes' or 'no']) +fi + +# We have groff, test for the presence of the macro packages +if test "x$have_groff" = x"yes"; then + AC_MSG_CHECKING([for ${GROFF} -ms macros]) + if ${GROFF} -ms -I. /dev/null >/dev/null 2>&1 ; then + groff_ms_works=yes + else + groff_ms_works=no + fi + AC_MSG_RESULT([$groff_ms_works]) + AC_MSG_CHECKING([for ${GROFF} -mm macros]) + if ${GROFF} -mm -I. /dev/null >/dev/null 2>&1 ; then + groff_mm_works=yes + else + groff_mm_works=no + fi + AC_MSG_RESULT([$groff_mm_works]) +fi + +# We have groff, test for HTML dependencies, one command per package +if test "x$have_groff" = x"yes"; then + AC_PATH_PROGS(GS_PATH, [gs gswin32c]) + AC_PATH_PROG(PNMTOPNG_PATH, [pnmtopng]) + AC_PATH_PROG(PSSELECT_PATH, [psselect]) + if test "x$GS_PATH" != "x" -a "x$PNMTOPNG_PATH" != "x" -a "x$PSSELECT_PATH" != "x"; then + have_groff_html=yes + else + have_groff_html=no + AC_MSG_WARN([grohtml dependencies not found - HTML Documentation skipped. Refer to grohtml man pages]) + fi +fi + +# Set Automake conditionals for Makefiles +AM_CONDITIONAL([HAVE_GROFF], [test "$have_groff" = yes]) +AM_CONDITIONAL([HAVE_GROFF_MS], [test "$groff_ms_works" = yes]) +AM_CONDITIONAL([HAVE_GROFF_MM], [test "$groff_mm_works" = yes]) +AM_CONDITIONAL([HAVE_GROFF_HTML], [test "$have_groff_html" = yes]) +]) # XORG_WITH_GROFF + +# XORG_WITH_FOP([MIN-VERSION], [DEFAULT]) +# --------------------------------------- +# Minimum version: 1.6.0 +# Minimum version for optional DEFAULT argument: 1.11.0 +# Minimum version for optional MIN-VERSION argument: 1.15.0 +# +# Documentation tools are not always available on all platforms and sometimes +# not at the appropriate level. This macro enables a module to test for the +# presence of the tool and obtain it's path in separate variables. Coupled with +# the --with-fop option, it allows maximum flexibilty in making decisions +# as whether or not to use the fop package. When DEFAULT is not specified, +# --with-fop assumes 'auto'. +# +# Interface to module: +# HAVE_FOP: used in makefiles to conditionally generate documentation +# FOP: returns the path of the fop program found +# returns the path set by the user in the environment +# --with-fop: 'yes' user instructs the module to use fop +# 'no' user instructs the module not to use fop +# +# If the user sets the value of FOP, AC_PATH_PROG skips testing the path. +# +AC_DEFUN([XORG_WITH_FOP],[ +AC_ARG_VAR([FOP], [Path to fop command]) +m4_define([_defopt], m4_default([$2], [auto])) +AC_ARG_WITH(fop, + AS_HELP_STRING([--with-fop], + [Use fop to regenerate documentation (default: ]_defopt[)]), + [use_fop=$withval], [use_fop=]_defopt) +m4_undefine([_defopt]) + +if test "x$use_fop" = x"auto"; then + AC_PATH_PROG([FOP], [fop]) + if test "x$FOP" = "x"; then + AC_MSG_WARN([fop not found - documentation targets will be skipped]) + have_fop=no + else + have_fop=yes + fi +elif test "x$use_fop" = x"yes" ; then + AC_PATH_PROG([FOP], [fop]) + if test "x$FOP" = "x"; then + AC_MSG_ERROR([--with-fop=yes specified but fop not found in PATH]) + fi + have_fop=yes +elif test "x$use_fop" = x"no" ; then + if test "x$FOP" != "x"; then + AC_MSG_WARN([ignoring FOP environment variable since --with-fop=no was specified]) + fi + have_fop=no +else + AC_MSG_ERROR([--with-fop expects 'yes' or 'no']) +fi + +# Test for a minimum version of fop, if provided. +m4_ifval([$1], +[if test "$have_fop" = yes; then + # scrape the fop version + AC_MSG_CHECKING([for fop minimum version]) + fop_version=`$FOP -version 2>/dev/null | cut -d' ' -f3` + AC_MSG_RESULT([$fop_version]) + AS_VERSION_COMPARE([$fop_version], [$1], + [if test "x$use_fop" = xauto; then + AC_MSG_WARN([fop version $fop_version found, but $1 needed]) + have_fop=no + else + AC_MSG_ERROR([fop version $fop_version found, but $1 needed]) + fi]) +fi]) +AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes]) +]) # XORG_WITH_FOP + +# XORG_WITH_M4([MIN-VERSION]) +# --------------------------- +# Minimum version: 1.19.0 +# +# This macro attempts to locate an m4 macro processor which supports +# -I option and is only useful for modules relying on M4 in order to +# expand macros in source code files. +# +# Interface to module: +# M4: returns the path of the m4 program found +# returns the path set by the user in the environment +# +AC_DEFUN([XORG_WITH_M4], [ +AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4], + [AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4], + [[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \ + ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]], + [AC_MSG_ERROR([could not find m4 that supports -I option])], + [$PATH:/usr/gnu/bin])]) + +AC_SUBST([M4], [$ac_cv_path_M4]) +]) # XORG_WITH_M4 + +# XORG_WITH_PS2PDF([DEFAULT]) +# ---------------- +# Minimum version: 1.6.0 +# Minimum version for optional DEFAULT argument: 1.11.0 +# +# Documentation tools are not always available on all platforms and sometimes +# not at the appropriate level. This macro enables a module to test for the +# presence of the tool and obtain it's path in separate variables. Coupled with +# the --with-ps2pdf option, it allows maximum flexibilty in making decisions +# as whether or not to use the ps2pdf package. When DEFAULT is not specified, +# --with-ps2pdf assumes 'auto'. +# +# Interface to module: +# HAVE_PS2PDF: used in makefiles to conditionally generate documentation +# PS2PDF: returns the path of the ps2pdf program found +# returns the path set by the user in the environment +# --with-ps2pdf: 'yes' user instructs the module to use ps2pdf +# 'no' user instructs the module not to use ps2pdf +# +# If the user sets the value of PS2PDF, AC_PATH_PROG skips testing the path. +# +AC_DEFUN([XORG_WITH_PS2PDF],[ +AC_ARG_VAR([PS2PDF], [Path to ps2pdf command]) +m4_define([_defopt], m4_default([$1], [auto])) +AC_ARG_WITH(ps2pdf, + AS_HELP_STRING([--with-ps2pdf], + [Use ps2pdf to regenerate documentation (default: ]_defopt[)]), + [use_ps2pdf=$withval], [use_ps2pdf=]_defopt) +m4_undefine([_defopt]) + +if test "x$use_ps2pdf" = x"auto"; then + AC_PATH_PROG([PS2PDF], [ps2pdf]) + if test "x$PS2PDF" = "x"; then + AC_MSG_WARN([ps2pdf not found - documentation targets will be skipped]) + have_ps2pdf=no + else + have_ps2pdf=yes + fi +elif test "x$use_ps2pdf" = x"yes" ; then + AC_PATH_PROG([PS2PDF], [ps2pdf]) + if test "x$PS2PDF" = "x"; then + AC_MSG_ERROR([--with-ps2pdf=yes specified but ps2pdf not found in PATH]) + fi + have_ps2pdf=yes +elif test "x$use_ps2pdf" = x"no" ; then + if test "x$PS2PDF" != "x"; then + AC_MSG_WARN([ignoring PS2PDF environment variable since --with-ps2pdf=no was specified]) + fi + have_ps2pdf=no +else + AC_MSG_ERROR([--with-ps2pdf expects 'yes' or 'no']) +fi +AM_CONDITIONAL([HAVE_PS2PDF], [test "$have_ps2pdf" = yes]) +]) # XORG_WITH_PS2PDF + +# XORG_ENABLE_DOCS (enable_docs=yes) +# ---------------- +# Minimum version: 1.6.0 +# +# Documentation tools are not always available on all platforms and sometimes +# not at the appropriate level. This macro enables a builder to skip all +# documentation targets except traditional man pages. +# Combined with the specific tool checking macros XORG_WITH_*, it provides +# maximum flexibilty in controlling documentation building. +# Refer to: +# XORG_WITH_XMLTO --with-xmlto +# XORG_WITH_ASCIIDOC --with-asciidoc +# XORG_WITH_DOXYGEN --with-doxygen +# XORG_WITH_FOP --with-fop +# XORG_WITH_GROFF --with-groff +# XORG_WITH_PS2PDF --with-ps2pdf +# +# Interface to module: +# ENABLE_DOCS: used in makefiles to conditionally generate documentation +# --enable-docs: 'yes' user instructs the module to generate docs +# 'no' user instructs the module not to generate docs +# parm1: specify the default value, yes or no. +# +AC_DEFUN([XORG_ENABLE_DOCS],[ +m4_define([docs_default], m4_default([$1], [yes])) +AC_ARG_ENABLE(docs, + AS_HELP_STRING([--enable-docs], + [Enable building the documentation (default: ]docs_default[)]), + [build_docs=$enableval], [build_docs=]docs_default) +m4_undefine([docs_default]) +AM_CONDITIONAL(ENABLE_DOCS, [test x$build_docs = xyes]) +AC_MSG_CHECKING([whether to build documentation]) +AC_MSG_RESULT([$build_docs]) +]) # XORG_ENABLE_DOCS + +# XORG_ENABLE_DEVEL_DOCS (enable_devel_docs=yes) +# ---------------- +# Minimum version: 1.6.0 +# +# This macro enables a builder to skip all developer documentation. +# Combined with the specific tool checking macros XORG_WITH_*, it provides +# maximum flexibilty in controlling documentation building. +# Refer to: +# XORG_WITH_XMLTO --with-xmlto +# XORG_WITH_ASCIIDOC --with-asciidoc +# XORG_WITH_DOXYGEN --with-doxygen +# XORG_WITH_FOP --with-fop +# XORG_WITH_GROFF --with-groff +# XORG_WITH_PS2PDF --with-ps2pdf +# +# Interface to module: +# ENABLE_DEVEL_DOCS: used in makefiles to conditionally generate developer docs +# --enable-devel-docs: 'yes' user instructs the module to generate developer docs +# 'no' user instructs the module not to generate developer docs +# parm1: specify the default value, yes or no. +# +AC_DEFUN([XORG_ENABLE_DEVEL_DOCS],[ +m4_define([devel_default], m4_default([$1], [yes])) +AC_ARG_ENABLE(devel-docs, + AS_HELP_STRING([--enable-devel-docs], + [Enable building the developer documentation (default: ]devel_default[)]), + [build_devel_docs=$enableval], [build_devel_docs=]devel_default) +m4_undefine([devel_default]) +AM_CONDITIONAL(ENABLE_DEVEL_DOCS, [test x$build_devel_docs = xyes]) +AC_MSG_CHECKING([whether to build developer documentation]) +AC_MSG_RESULT([$build_devel_docs]) +]) # XORG_ENABLE_DEVEL_DOCS + +# XORG_ENABLE_SPECS (enable_specs=yes) +# ---------------- +# Minimum version: 1.6.0 +# +# This macro enables a builder to skip all functional specification targets. +# Combined with the specific tool checking macros XORG_WITH_*, it provides +# maximum flexibilty in controlling documentation building. +# Refer to: +# XORG_WITH_XMLTO --with-xmlto +# XORG_WITH_ASCIIDOC --with-asciidoc +# XORG_WITH_DOXYGEN --with-doxygen +# XORG_WITH_FOP --with-fop +# XORG_WITH_GROFF --with-groff +# XORG_WITH_PS2PDF --with-ps2pdf +# +# Interface to module: +# ENABLE_SPECS: used in makefiles to conditionally generate specs +# --enable-specs: 'yes' user instructs the module to generate specs +# 'no' user instructs the module not to generate specs +# parm1: specify the default value, yes or no. +# +AC_DEFUN([XORG_ENABLE_SPECS],[ +m4_define([spec_default], m4_default([$1], [yes])) +AC_ARG_ENABLE(specs, + AS_HELP_STRING([--enable-specs], + [Enable building the specs (default: ]spec_default[)]), + [build_specs=$enableval], [build_specs=]spec_default) +m4_undefine([spec_default]) +AM_CONDITIONAL(ENABLE_SPECS, [test x$build_specs = xyes]) +AC_MSG_CHECKING([whether to build functional specifications]) +AC_MSG_RESULT([$build_specs]) +]) # XORG_ENABLE_SPECS + +# XORG_ENABLE_UNIT_TESTS (enable_unit_tests=auto) +# ---------------------------------------------- +# Minimum version: 1.13.0 +# +# This macro enables a builder to enable/disable unit testing +# It makes no assumption about the test cases implementation +# Test cases may or may not use Automake "Support for test suites" +# They may or may not use the software utility library GLib +# +# When used in conjunction with XORG_WITH_GLIB, use both AM_CONDITIONAL +# ENABLE_UNIT_TESTS and HAVE_GLIB. Not all unit tests may use glib. +# The variable enable_unit_tests is used by other macros in this file. +# +# Interface to module: +# ENABLE_UNIT_TESTS: used in makefiles to conditionally build tests +# enable_unit_tests: used in configure.ac for additional configuration +# --enable-unit-tests: 'yes' user instructs the module to build tests +# 'no' user instructs the module not to build tests +# parm1: specify the default value, yes or no. +# +AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[ +AC_BEFORE([$0], [XORG_WITH_GLIB]) +AC_BEFORE([$0], [XORG_LD_WRAP]) +AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS]) +m4_define([_defopt], m4_default([$1], [auto])) +AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests], + [Enable building unit test cases (default: ]_defopt[)]), + [enable_unit_tests=$enableval], [enable_unit_tests=]_defopt) +m4_undefine([_defopt]) +AM_CONDITIONAL(ENABLE_UNIT_TESTS, [test "x$enable_unit_tests" != xno]) +AC_MSG_CHECKING([whether to build unit test cases]) +AC_MSG_RESULT([$enable_unit_tests]) +]) # XORG_ENABLE_UNIT_TESTS + +# XORG_ENABLE_INTEGRATION_TESTS (enable_unit_tests=auto) +# ------------------------------------------------------ +# Minimum version: 1.17.0 +# +# This macro enables a builder to enable/disable integration testing +# It makes no assumption about the test cases' implementation +# Test cases may or may not use Automake "Support for test suites" +# +# Please see XORG_ENABLE_UNIT_TESTS for unit test support. Unit test support +# usually requires less dependencies and may be built and run under less +# stringent environments than integration tests. +# +# Interface to module: +# ENABLE_INTEGRATION_TESTS: used in makefiles to conditionally build tests +# enable_integration_tests: used in configure.ac for additional configuration +# --enable-integration-tests: 'yes' user instructs the module to build tests +# 'no' user instructs the module not to build tests +# parm1: specify the default value, yes or no. +# +AC_DEFUN([XORG_ENABLE_INTEGRATION_TESTS],[ +AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS]) +m4_define([_defopt], m4_default([$1], [auto])) +AC_ARG_ENABLE(integration-tests, AS_HELP_STRING([--enable-integration-tests], + [Enable building integration test cases (default: ]_defopt[)]), + [enable_integration_tests=$enableval], + [enable_integration_tests=]_defopt) +m4_undefine([_defopt]) +AM_CONDITIONAL([ENABLE_INTEGRATION_TESTS], + [test "x$enable_integration_tests" != xno]) +AC_MSG_CHECKING([whether to build unit test cases]) +AC_MSG_RESULT([$enable_integration_tests]) +]) # XORG_ENABLE_INTEGRATION_TESTS + +# XORG_WITH_GLIB([MIN-VERSION], [DEFAULT]) +# ---------------------------------------- +# Minimum version: 1.13.0 +# +# GLib is a library which provides advanced data structures and functions. +# This macro enables a module to test for the presence of Glib. +# +# When used with ENABLE_UNIT_TESTS, it is assumed GLib is used for unit testing. +# Otherwise the value of $enable_unit_tests is blank. +# +# Please see XORG_ENABLE_INTEGRATION_TESTS for integration test support. Unit +# test support usually requires less dependencies and may be built and run under +# less stringent environments than integration tests. +# +# Interface to module: +# HAVE_GLIB: used in makefiles to conditionally build targets +# with_glib: used in configure.ac to know if GLib has been found +# --with-glib: 'yes' user instructs the module to use glib +# 'no' user instructs the module not to use glib +# +AC_DEFUN([XORG_WITH_GLIB],[ +AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +m4_define([_defopt], m4_default([$2], [auto])) +AC_ARG_WITH(glib, AS_HELP_STRING([--with-glib], + [Use GLib library for unit testing (default: ]_defopt[)]), + [with_glib=$withval], [with_glib=]_defopt) +m4_undefine([_defopt]) + +have_glib=no +# Do not probe GLib if user explicitly disabled unit testing +if test "x$enable_unit_tests" != x"no"; then + # Do not probe GLib if user explicitly disabled it + if test "x$with_glib" != x"no"; then + m4_ifval( + [$1], + [PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $1], [have_glib=yes], [have_glib=no])], + [PKG_CHECK_MODULES([GLIB], [glib-2.0], [have_glib=yes], [have_glib=no])] + ) + fi +fi + +# Not having GLib when unit testing has been explicitly requested is an error +if test "x$enable_unit_tests" = x"yes"; then + if test "x$have_glib" = x"no"; then + AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found]) + fi +fi + +# Having unit testing disabled when GLib has been explicitly requested is an error +if test "x$enable_unit_tests" = x"no"; then + if test "x$with_glib" = x"yes"; then + AC_MSG_ERROR([--enable-unit-tests=yes specified but glib-2.0 not found]) + fi +fi + +# Not having GLib when it has been explicitly requested is an error +if test "x$with_glib" = x"yes"; then + if test "x$have_glib" = x"no"; then + AC_MSG_ERROR([--with-glib=yes specified but glib-2.0 not found]) + fi +fi + +AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes]) +]) # XORG_WITH_GLIB + +# XORG_LD_WRAP([required|optional]) +# --------------------------------- +# Minimum version: 1.13.0 +# +# Check if linker supports -wrap, passed via compiler flags +# +# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing. +# Otherwise the value of $enable_unit_tests is blank. +# +# Argument added in 1.16.0 - default is "required", to match existing behavior +# of returning an error if enable_unit_tests is yes, and ld -wrap is not +# available, an argument of "optional" allows use when some unit tests require +# ld -wrap and others do not. +# +AC_DEFUN([XORG_LD_WRAP],[ +XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no], + [AC_LANG_PROGRAM([#include + void __wrap_exit(int status) { return; }], + [exit(0);])]) +# Not having ld wrap when unit testing has been explicitly requested is an error +if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then + if test "x$have_ld_wrap" = x"no"; then + AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available]) + fi +fi +AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes]) +# +]) # XORG_LD_WRAP + +# XORG_CHECK_LINKER_FLAGS +# ----------------------- +# SYNOPSIS +# +# XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE]) +# +# DESCRIPTION +# +# Check whether the given linker FLAGS work with the current language's +# linker, or whether they give an error. +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# PROGRAM-SOURCE is the program source to link with, if needed +# +# NOTE: Based on AX_CHECK_COMPILER_FLAGS. +# +# LICENSE +# +# Copyright (c) 2009 Mike Frysinger +# Copyright (c) 2009 Steven G. Johnson +# Copyright (c) 2009 Matteo Frigo +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well.# +AC_DEFUN([XORG_CHECK_LINKER_FLAGS], +[AC_MSG_CHECKING([whether the linker accepts $1]) +dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: +AS_LITERAL_IF([$1], + [AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [ + ax_save_FLAGS=$LDFLAGS + LDFLAGS="$1" + AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])], + AS_TR_SH(xorg_cv_linker_flags_[$1])=yes, + AS_TR_SH(xorg_cv_linker_flags_[$1])=no) + LDFLAGS=$ax_save_FLAGS])], + [ax_save_FLAGS=$LDFLAGS + LDFLAGS="$1" + AC_LINK_IFELSE([AC_LANG_PROGRAM()], + eval AS_TR_SH(xorg_cv_linker_flags_[$1])=yes, + eval AS_TR_SH(xorg_cv_linker_flags_[$1])=no) + LDFLAGS=$ax_save_FLAGS]) +eval xorg_check_linker_flags=$AS_TR_SH(xorg_cv_linker_flags_[$1]) +AC_MSG_RESULT($xorg_check_linker_flags) +if test "x$xorg_check_linker_flags" = xyes; then + m4_default([$2], :) +else + m4_default([$3], :) +fi +]) # XORG_CHECK_LINKER_FLAGS + +# XORG_MEMORY_CHECK_FLAGS +# ----------------------- +# Minimum version: 1.16.0 +# +# This macro attempts to find appropriate memory checking functionality +# for various platforms which unit testing code may use to catch various +# forms of memory allocation and access errors in testing. +# +# Interface to module: +# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging +# Usually added to TESTS_ENVIRONMENT in Makefile.am +# +# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim. +# +AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[ + +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV], + [Environment variables to enable memory checking in tests]) + +# Check for different types of support on different platforms +case $host_os in + solaris*) + AC_CHECK_LIB([umem], [umem_alloc], + [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default']) + ;; + *-gnu*) # GNU libc - Value is used as a single byte bit pattern, + # both directly and inverted, so should not be 0 or 255. + malloc_debug_env='MALLOC_PERTURB_=15' + ;; + darwin*) + malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib' + ;; + *bsd*) + malloc_debug_env='MallocPreScribble=1 MallocScribble=1' + ;; +esac + +# User supplied flags override default flags +if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then + malloc_debug_env="$XORG_MALLOC_DEBUG_ENV" +fi + +AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env]) +]) # XORG_WITH_LINT + +# XORG_CHECK_MALLOC_ZERO +# ---------------------- +# Minimum version: 1.0.0 +# +# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if +# malloc(0) returns NULL. Packages should add one of these cflags to +# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. +AC_DEFUN([XORG_CHECK_MALLOC_ZERO],[ +AC_ARG_ENABLE(malloc0returnsnull, + AS_HELP_STRING([--enable-malloc0returnsnull], + [malloc(0) returns NULL (default: auto)]), + [MALLOC_ZERO_RETURNS_NULL=$enableval], + [MALLOC_ZERO_RETURNS_NULL=auto]) + +AC_MSG_CHECKING([whether malloc(0) returns NULL]) +if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then +AC_CACHE_VAL([xorg_cv_malloc0_returns_null], + [AC_RUN_IFELSE([AC_LANG_PROGRAM([ +#include +],[ + char *m0, *r0, *c0, *p; + m0 = malloc(0); + p = malloc(10); + r0 = realloc(p,0); + c0 = calloc(0,10); + exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); +])], + [xorg_cv_malloc0_returns_null=yes], + [xorg_cv_malloc0_returns_null=no])]) +MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null +fi +AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) + +if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then + MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL" + XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS + XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC" +else + MALLOC_ZERO_CFLAGS="" + XMALLOC_ZERO_CFLAGS="" + XTMALLOC_ZERO_CFLAGS="" +fi + +AC_SUBST([MALLOC_ZERO_CFLAGS]) +AC_SUBST([XMALLOC_ZERO_CFLAGS]) +AC_SUBST([XTMALLOC_ZERO_CFLAGS]) +]) # XORG_CHECK_MALLOC_ZERO + +# XORG_WITH_LINT() +# ---------------- +# Minimum version: 1.1.0 +# +# This macro enables the use of a tool that flags some suspicious and +# non-portable constructs (likely to be bugs) in C language source code. +# It will attempt to locate the tool and use appropriate options. +# There are various lint type tools on different platforms. +# +# Interface to module: +# LINT: returns the path to the tool found on the platform +# or the value set to LINT on the configure cmd line +# also an Automake conditional +# LINT_FLAGS: an Automake variable with appropriate flags +# +# --with-lint: 'yes' user instructs the module to use lint +# 'no' user instructs the module not to use lint (default) +# +# If the user sets the value of LINT, AC_PATH_PROG skips testing the path. +# If the user sets the value of LINT_FLAGS, they are used verbatim. +# +AC_DEFUN([XORG_WITH_LINT],[ + +AC_ARG_VAR([LINT], [Path to a lint-style command]) +AC_ARG_VAR([LINT_FLAGS], [Flags for the lint-style command]) +AC_ARG_WITH(lint, [AS_HELP_STRING([--with-lint], + [Use a lint-style source code checker (default: disabled)])], + [use_lint=$withval], [use_lint=no]) + +# Obtain platform specific info like program name and options +# The lint program on FreeBSD and NetBSD is different from the one on Solaris +case $host_os in + *linux* | *openbsd* | kfreebsd*-gnu | darwin* | cygwin*) + lint_name=splint + lint_options="-badflag" + ;; + *freebsd* | *netbsd*) + lint_name=lint + lint_options="-u -b" + ;; + *solaris*) + lint_name=lint + lint_options="-u -b -h -erroff=E_INDISTING_FROM_TRUNC2" + ;; +esac + +# Test for the presence of the program (either guessed by the code or spelled out by the user) +if test "x$use_lint" = x"yes" ; then + AC_PATH_PROG([LINT], [$lint_name]) + if test "x$LINT" = "x"; then + AC_MSG_ERROR([--with-lint=yes specified but lint-style tool not found in PATH]) + fi +elif test "x$use_lint" = x"no" ; then + if test "x$LINT" != "x"; then + AC_MSG_WARN([ignoring LINT environment variable since --with-lint=no was specified]) + fi +else + AC_MSG_ERROR([--with-lint expects 'yes' or 'no'. Use LINT variable to specify path.]) +fi + +# User supplied flags override default flags +if test "x$LINT_FLAGS" != "x"; then + lint_options=$LINT_FLAGS +fi + +AC_SUBST([LINT_FLAGS],[$lint_options]) +AM_CONDITIONAL(LINT, [test "x$LINT" != x]) + +]) # XORG_WITH_LINT + +# XORG_LINT_LIBRARY(LIBNAME) +# -------------------------- +# Minimum version: 1.1.0 +# +# Sets up flags for building lint libraries for checking programs that call +# functions in the library. +# +# Interface to module: +# LINTLIB - Automake variable with the name of lint library file to make +# MAKE_LINT_LIB - Automake conditional +# +# --enable-lint-library: - 'yes' user instructs the module to created a lint library +# - 'no' user instructs the module not to create a lint library (default) + +AC_DEFUN([XORG_LINT_LIBRARY],[ +AC_REQUIRE([XORG_WITH_LINT]) +AC_ARG_ENABLE(lint-library, [AS_HELP_STRING([--enable-lint-library], + [Create lint library (default: disabled)])], + [make_lint_lib=$enableval], [make_lint_lib=no]) + +if test "x$make_lint_lib" = x"yes" ; then + LINTLIB=llib-l$1.ln + if test "x$LINT" = "x"; then + AC_MSG_ERROR([Cannot make lint library without --with-lint]) + fi +elif test "x$make_lint_lib" != x"no" ; then + AC_MSG_ERROR([--enable-lint-library expects 'yes' or 'no'.]) +fi + +AC_SUBST(LINTLIB) +AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno]) + +]) # XORG_LINT_LIBRARY + +# XORG_COMPILER_BRAND +# ------------------- +# Minimum version: 1.14.0 +# +# Checks for various brands of compilers and sets flags as appropriate: +# GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes" +# GNU g++ - relies on AC_PROG_CXX to set GXX to "yes" +# clang compiler - sets CLANGCC to "yes" +# Intel compiler - sets INTELCC to "yes" +# Sun/Oracle Solaris Studio cc - sets SUNCC to "yes" +# +AC_DEFUN([XORG_COMPILER_BRAND], [ +AC_LANG_CASE( + [C], [ + AC_REQUIRE([AC_PROG_CC_C99]) + ], + [C++], [ + AC_REQUIRE([AC_PROG_CXX]) + ] +) +AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"]) +AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) +AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) +]) # XORG_COMPILER_BRAND + +# XORG_TESTSET_CFLAG(, , [, ...]) +# --------------- +# Minimum version: 1.16.0 +# +# Test if the compiler works when passed the given flag as a command line argument. +# If it succeeds, the flag is appeneded to the given variable. If not, it tries the +# next flag in the list until there are no more options. +# +# Note that this does not guarantee that the compiler supports the flag as some +# compilers will simply ignore arguments that they do not understand, but we do +# attempt to weed out false positives by using -Werror=unknown-warning-option and +# -Werror=unused-command-line-argument +# +AC_DEFUN([XORG_TESTSET_CFLAG], [ +m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])]) +m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])]) + +AC_LANG_COMPILER_REQUIRE + +AC_LANG_CASE( + [C], [ + AC_REQUIRE([AC_PROG_CC_C99]) + define([PREFIX], [C]) + define([CACHE_PREFIX], [cc]) + define([COMPILER], [$CC]) + ], + [C++], [ + define([PREFIX], [CXX]) + define([CACHE_PREFIX], [cxx]) + define([COMPILER], [$CXX]) + ] +) + +[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]" + +if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "x" ; then + PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" + AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unknown-warning-option], + [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option], + AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], + [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=yes], + [xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option=no])) + [xorg_testset_]CACHE_PREFIX[_unknown_warning_option]=$[xorg_cv_]CACHE_PREFIX[_flag_unknown_warning_option] + PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]" +fi + +if test "x$[xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]" = "x" ; then + if test "x$[xorg_testset_]CACHE_PREFIX[_unknown_warning_option]" = "xyes" ; then + PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" + fi + PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" + AC_CACHE_CHECK([if ]COMPILER[ supports -Werror=unused-command-line-argument], + [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument], + AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], + [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=yes], + [xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument=no])) + [xorg_testset_]CACHE_PREFIX[_unused_command_line_argument]=$[xorg_cv_]CACHE_PREFIX[_flag_unused_command_line_argument] + PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]" +fi + +found="no" +m4_foreach([flag], m4_cdr($@), [ + if test $found = "no" ; then + if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then + PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then + PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" + fi + + PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag[" + +dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname + AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[]) + cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[]) + AC_CACHE_VAL($cacheid, + [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])], + [eval $cacheid=yes], + [eval $cacheid=no])]) + + PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]" + + eval supported=\$$cacheid + AC_MSG_RESULT([$supported]) + if test "$supported" = "yes" ; then + $1="$$1 ]flag[" + found="yes" + fi + fi +]) +]) # XORG_TESTSET_CFLAG + +# XORG_COMPILER_FLAGS +# --------------- +# Minimum version: 1.16.0 +# +# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line +# arguments supported by the selected compiler which do NOT alter the generated +# code. These arguments will cause the compiler to print various warnings +# during compilation AND turn a conservative set of warnings into errors. +# +# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in +# future versions of util-macros as options are added to new compilers. +# +AC_DEFUN([XORG_COMPILER_FLAGS], [ +AC_REQUIRE([XORG_COMPILER_BRAND]) + +AC_ARG_ENABLE(selective-werror, + AS_HELP_STRING([--disable-selective-werror], + [Turn off selective compiler errors. (default: enabled)]), + [SELECTIVE_WERROR=$enableval], + [SELECTIVE_WERROR=yes]) + +AC_LANG_CASE( + [C], [ + define([PREFIX], [C]) + ], + [C++], [ + define([PREFIX], [CXX]) + ] +) +# -v is too short to test reliably with XORG_TESTSET_CFLAG +if test "x$SUNCC" = "xyes"; then + [BASE_]PREFIX[FLAGS]="-v" +else + [BASE_]PREFIX[FLAGS]="" +fi + +# This chunk of warnings were those that existed in the legacy CWARNFLAGS +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat]) + +AC_LANG_CASE( + [C], [ + XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes]) + XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes]) + XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs]) + XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast]) + XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd]) + XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement]) + ] +) + +# This chunk adds additional warnings that could catch undesired effects. +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) + +# These are currently disabled because they are noisy. They will be enabled +# in the future once the codebase is sufficiently modernized to silence +# them. For now, I don't want them to drown out the other warnings. +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) + +# Turn some warnings into errors, so we don't accidently get successful builds +# when there are problems that should be fixed. + +if test "x$SELECTIVE_WERROR" = "xyes" ; then +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION +else +AC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors. This should not be necessary. Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wimplicit]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast]) +fi + +AC_SUBST([BASE_]PREFIX[FLAGS]) +]) # XORG_COMPILER_FLAGS + +# XORG_CWARNFLAGS +# --------------- +# Minimum version: 1.2.0 +# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead) +# +# Defines CWARNFLAGS to enable C compiler warnings. +# +# This function is deprecated because it defines -fno-strict-aliasing +# which alters the code generated by the compiler. If -fno-strict-aliasing +# is needed, then it should be added explicitly in the module when +# it is updated to use BASE_CFLAGS. +# +AC_DEFUN([XORG_CWARNFLAGS], [ +AC_REQUIRE([XORG_COMPILER_FLAGS]) +AC_REQUIRE([XORG_COMPILER_BRAND]) +AC_LANG_CASE( + [C], [ + CWARNFLAGS="$BASE_CFLAGS" + if test "x$GCC" = xyes ; then + CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing" + fi + AC_SUBST(CWARNFLAGS) + ] +) +]) # XORG_CWARNFLAGS + +# XORG_STRICT_OPTION +# ----------------------- +# Minimum version: 1.3.0 +# +# Add configure option to enable strict compilation flags, such as treating +# warnings as fatal errors. +# If --enable-strict-compilation is passed to configure, adds strict flags to +# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS. +# +# Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or +# when strict compilation is unconditionally desired. +AC_DEFUN([XORG_STRICT_OPTION], [ +AC_REQUIRE([XORG_CWARNFLAGS]) +AC_REQUIRE([XORG_COMPILER_FLAGS]) + +AC_ARG_ENABLE(strict-compilation, + AS_HELP_STRING([--enable-strict-compilation], + [Enable all warnings from compiler and make them errors (default: disabled)]), + [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) + +AC_LANG_CASE( + [C], [ + define([PREFIX], [C]) + ], + [C++], [ + define([PREFIX], [CXX]) + ] +) + +[STRICT_]PREFIX[FLAGS]="" +XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic]) +XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn]) + +# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not +# activate it with -Werror, so we add it here explicitly. +XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes]) + +if test "x$STRICT_COMPILE" = "xyes"; then + [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]" + AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"]) +fi +AC_SUBST([STRICT_]PREFIX[FLAGS]) +AC_SUBST([BASE_]PREFIX[FLAGS]) +AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS])) +]) # XORG_STRICT_OPTION + +# XORG_DEFAULT_OPTIONS +# -------------------- +# Minimum version: 1.3.0 +# +# Defines default options for X.Org modules. +# +AC_DEFUN([XORG_DEFAULT_OPTIONS], [ +AC_REQUIRE([AC_PROG_INSTALL]) +XORG_COMPILER_FLAGS +XORG_CWARNFLAGS +XORG_STRICT_OPTION +XORG_RELEASE_VERSION +XORG_CHANGELOG +XORG_INSTALL +XORG_MANPAGE_SECTIONS +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], + [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) +]) # XORG_DEFAULT_OPTIONS + +# XORG_INSTALL() +# ---------------- +# Minimum version: 1.4.0 +# +# Defines the variable INSTALL_CMD as the command to copy +# INSTALL from $prefix/share/util-macros. +# +AC_DEFUN([XORG_INSTALL], [ +AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros` +INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \ +mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \ +|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \ +echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)" +AC_SUBST([INSTALL_CMD]) +]) # XORG_INSTALL +dnl Copyright 2005 Red Hat, Inc +dnl +dnl Permission to use, copy, modify, distribute, and sell this software and its +dnl documentation for any purpose is hereby granted without fee, provided that +dnl the above copyright notice appear in all copies and that both that +dnl copyright notice and this permission notice appear in supporting +dnl documentation. +dnl +dnl The above copyright notice and this permission notice shall be included +dnl in all copies or substantial portions of the Software. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +dnl OTHER DEALINGS IN THE SOFTWARE. +dnl +dnl Except as contained in this notice, the name of the copyright holders shall +dnl not be used in advertising or otherwise to promote the sale, use or +dnl other dealings in this Software without prior written authorization +dnl from the copyright holders. +dnl + +# XORG_RELEASE_VERSION +# -------------------- +# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use. + +AC_DEFUN([XORG_RELEASE_VERSION],[ + AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR], + [`echo $PACKAGE_VERSION | cut -d . -f 1`], + [Major version of this package]) + PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1` + if test "x$PVM" = "x"; then + PVM="0" + fi + AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR], + [$PVM], + [Minor version of this package]) + PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1` + if test "x$PVP" = "x"; then + PVP="0" + fi + AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL], + [$PVP], + [Patch version of this package]) +]) + +# XORG_CHANGELOG() +# ---------------- +# Minimum version: 1.2.0 +# +# Defines the variable CHANGELOG_CMD as the command to generate +# ChangeLog from git. +# +# +AC_DEFUN([XORG_CHANGELOG], [ +CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \ +mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \ +|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \ +echo 'git directory not found: installing possibly empty changelog.' >&2)" +AC_SUBST([CHANGELOG_CMD]) +]) # XORG_CHANGELOG + +dnl Copyright 2005 Red Hat, Inc +dnl +dnl Permission to use, copy, modify, distribute, and sell this software and its +dnl documentation for any purpose is hereby granted without fee, provided that +dnl the above copyright notice appear in all copies and that both that +dnl copyright notice and this permission notice appear in supporting +dnl documentation. +dnl +dnl The above copyright notice and this permission notice shall be included +dnl in all copies or substantial portions of the Software. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +dnl OTHER DEALINGS IN THE SOFTWARE. +dnl +dnl Except as contained in this notice, the name of the copyright holders shall +dnl not be used in advertising or otherwise to promote the sale, use or +dnl other dealings in this Software without prior written authorization +dnl from the copyright holders. +dnl + +# XORG_DRIVER_CHECK_EXT(MACRO, PROTO) +# -------------------------- +# Checks for the MACRO define in xorg-server.h (from the sdk). If it +# is defined, then add the given PROTO to $REQUIRED_MODULES. + +AC_DEFUN([XORG_DRIVER_CHECK_EXT],[ + AC_REQUIRE([PKG_PROG_PKG_CONFIG]) + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I`$PKG_CONFIG --variable=sdkdir xorg-server`" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include "xorg-server.h" +#if !defined $1 +#error $1 not defined +#endif + ]])], + [_EXT_CHECK=yes], + [_EXT_CHECK=no]) + CFLAGS="$SAVE_CFLAGS" + AC_MSG_CHECKING([if $1 is defined]) + AC_MSG_RESULT([$_EXT_CHECK]) + if test "$_EXT_CHECK" != no; then + REQUIRED_MODULES="$REQUIRED_MODULES $2" + fi +]) + +# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.15' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.15], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.15])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is '.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named 'Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running 'make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "$am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each '.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.65])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2014 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +# +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff --git a/server/xorg/xf86-video-dummy/v0.3.8/compile b/server/xorg/xf86-video-dummy/v0.3.8/compile new file mode 100755 index 000000000..a85b723c7 --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/compile @@ -0,0 +1,347 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2012-10-14.11; # UTC + +# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/server/xorg/xf86-video-dummy/v0.3.8/config.guess b/server/xorg/xf86-video-dummy/v0.3.8/config.guess new file mode 100755 index 000000000..b79252d6b --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/config.guess @@ -0,0 +1,1558 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2013 Free Software Foundation, Inc. + +timestamp='2013-06-10' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches with a ChangeLog entry to config-patches@gnu.org. + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2013 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + else + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + cris:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + crisv32:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + frv:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-${LIBC} + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + ;; + or1k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-${LIBC} + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-${LIBC} + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-${LIBC} + exit ;; + x86_64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; +esac + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/server/xorg/xf86-video-dummy/v0.3.8/config.h.in b/server/xorg/xf86-video-dummy/v0.3.8/config.h.in new file mode 100644 index 000000000..5f4ad8e4c --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/config.h.in @@ -0,0 +1,75 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +#include "xorg-server.h" + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#undef LT_OBJDIR + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Major version of this package */ +#undef PACKAGE_VERSION_MAJOR + +/* Minor version of this package */ +#undef PACKAGE_VERSION_MINOR + +/* Patch version of this package */ +#undef PACKAGE_VERSION_PATCHLEVEL + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Support DGA extension */ +#undef USE_DGA + +/* Version number of package */ +#undef VERSION diff --git a/server/xorg/xf86-video-dummy/v0.3.8/config.sub b/server/xorg/xf86-video-dummy/v0.3.8/config.sub new file mode 100755 index 000000000..9633db704 --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/config.sub @@ -0,0 +1,1791 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2013 Free Software Foundation, Inc. + +timestamp='2013-08-10' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches with a ChangeLog entry to config-patches@gnu.org. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2013 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze*) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ + | bfin \ + | c4x | c8051 | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | epiphany \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ + | ns16k | ns32k \ + | open8 \ + | or1k | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pyramid \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | we32k \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pyramid-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze*) + basic_machine=microblaze-xilinx + ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; + mingw32) + basic_machine=i686-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i686-pc + os=-msys + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or1k-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/server/xorg/xf86-video-dummy/v0.3.8/configure b/server/xorg/xf86-video-dummy/v0.3.8/configure new file mode 100755 index 000000000..b6375fe32 --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/configure @@ -0,0 +1,20923 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69 for xf86-video-dummy 0.3.8. +# +# Report bugs to . +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg +$0: about your system, including any error possibly output +$0: before this message. Then install a modern shell, or +$0: manually run the script under such a shell if you do +$0: have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + +SHELL=${CONFIG_SHELL-/bin/sh} + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='xf86-video-dummy' +PACKAGE_TARNAME='xf86-video-dummy' +PACKAGE_VERSION='0.3.8' +PACKAGE_STRING='xf86-video-dummy 0.3.8' +PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg' +PACKAGE_URL='' + +ac_unique_file="Makefile.am" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +DRIVER_NAME +XORG_LIBS +XORG_CFLAGS +DGA_FALSE +DGA_TRUE +DGA +moduledir +LT_SYS_LIBRARY_PATH +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +RANLIB +ac_ct_AR +AR +DLLTOOL +OBJDUMP +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +LIBTOOL +MAN_SUBSTS +XORG_MAN_PAGE +ADMIN_MAN_DIR +DRIVER_MAN_DIR +MISC_MAN_DIR +FILE_MAN_DIR +LIB_MAN_DIR +APP_MAN_DIR +ADMIN_MAN_SUFFIX +DRIVER_MAN_SUFFIX +MISC_MAN_SUFFIX +FILE_MAN_SUFFIX +LIB_MAN_SUFFIX +APP_MAN_SUFFIX +SED +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +INSTALL_CMD +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +CHANGELOG_CMD +STRICT_CFLAGS +CWARNFLAGS +BASE_CFLAGS +EGREP +GREP +CPP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_dependency_tracking +enable_selective_werror +enable_strict_compilation +enable_static +enable_shared +with_pic +enable_fast_install +with_aix_soname +with_gnu_ld +with_sysroot +enable_libtool_lock +enable_dga +with_xorg_module_dir +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +LT_SYS_LIBRARY_PATH +XORG_CFLAGS +XORG_LIBS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures xf86-video-dummy 0.3.8 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root + [DATAROOTDIR/doc/xf86-video-dummy] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of xf86-video-dummy 0.3.8:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --disable-selective-werror + Turn off selective compiler errors. (default: + enabled) + --enable-strict-compilation + Enable all warnings from compiler and make them + errors (default: disabled) + --enable-static[=PKGS] build static libraries [default=no] + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --disable-dga Build DGA extension (default: yes) + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] + --with-aix-soname=aix|svr4|both + shared library versioning (aka "SONAME") variant to + provide on AIX, [default=aix]. + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot[=DIR] Search for dependent libraries within DIR (or the + compiler's sysroot if not specified). + --with-xorg-module-dir=DIR + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + LT_SYS_LIBRARY_PATH + User-defined run-time library search path. + XORG_CFLAGS C compiler flags for XORG, overriding pkg-config + XORG_LIBS linker flags for XORG, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +xf86-video-dummy configure 0.3.8 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by xf86-video-dummy $as_me 0.3.8, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +ac_config_headers="$ac_config_headers config.h" + +ac_aux_dir= +for ac_dir in . "$srcdir"/.; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in . \"$srcdir\"/." "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + + +# Initialize Automake +am__api_version='1.15' + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='xf86-video-dummy' + VERSION='0.3.8' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + + +# Require xorg-macros: XORG_DEFAULT_OPTIONS + + + + + + + + + + + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 +$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +if ${ac_cv_prog_cc_c99+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +#include + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str; + int number; + float fnumber; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} + +int +main () +{ + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c99" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c99" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c99" != xno; then : + +fi + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + +ac_fn_c_check_decl "$LINENO" "__clang__" "ac_cv_have_decl___clang__" "$ac_includes_default" +if test "x$ac_cv_have_decl___clang__" = xyes; then : + CLANGCC="yes" +else + CLANGCC="no" +fi + +ac_fn_c_check_decl "$LINENO" "__INTEL_COMPILER" "ac_cv_have_decl___INTEL_COMPILER" "$ac_includes_default" +if test "x$ac_cv_have_decl___INTEL_COMPILER" = xyes; then : + INTELCC="yes" +else + INTELCC="no" +fi + +ac_fn_c_check_decl "$LINENO" "__SUNPRO_C" "ac_cv_have_decl___SUNPRO_C" "$ac_includes_default" +if test "x$ac_cv_have_decl___SUNPRO_C" = xyes; then : + SUNCC="yes" +else + SUNCC="no" +fi + + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + + + + + + +# Check whether --enable-selective-werror was given. +if test "${enable_selective_werror+set}" = set; then : + enableval=$enable_selective_werror; SELECTIVE_WERROR=$enableval +else + SELECTIVE_WERROR=yes +fi + + + + + +# -v is too short to test reliably with XORG_TESTSET_CFLAG +if test "x$SUNCC" = "xyes"; then + BASE_CFLAGS="-v" +else + BASE_CFLAGS="" +fi + +# This chunk of warnings were those that existed in the legacy CWARNFLAGS + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wall" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wall" >&5 +$as_echo_n "checking if $CC supports -Wall... " >&6; } + cacheid=xorg_cv_cc_flag__Wall + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wall" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wpointer-arith" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wpointer-arith" >&5 +$as_echo_n "checking if $CC supports -Wpointer-arith... " >&6; } + cacheid=xorg_cv_cc_flag__Wpointer_arith + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wpointer-arith" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wmissing-declarations" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmissing-declarations" >&5 +$as_echo_n "checking if $CC supports -Wmissing-declarations... " >&6; } + cacheid=xorg_cv_cc_flag__Wmissing_declarations + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wmissing-declarations" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wformat=2" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wformat=2" >&5 +$as_echo_n "checking if $CC supports -Wformat=2... " >&6; } + cacheid=xorg_cv_cc_flag__Wformat_2 + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wformat=2" + found="yes" + fi + fi + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wformat" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wformat" >&5 +$as_echo_n "checking if $CC supports -Wformat... " >&6; } + cacheid=xorg_cv_cc_flag__Wformat + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wformat" + found="yes" + fi + fi + + + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wstrict-prototypes" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wstrict-prototypes" >&5 +$as_echo_n "checking if $CC supports -Wstrict-prototypes... " >&6; } + cacheid=xorg_cv_cc_flag__Wstrict_prototypes + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wstrict-prototypes" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wmissing-prototypes" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmissing-prototypes" >&5 +$as_echo_n "checking if $CC supports -Wmissing-prototypes... " >&6; } + cacheid=xorg_cv_cc_flag__Wmissing_prototypes + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wmissing-prototypes" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wnested-externs" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wnested-externs" >&5 +$as_echo_n "checking if $CC supports -Wnested-externs... " >&6; } + cacheid=xorg_cv_cc_flag__Wnested_externs + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wnested-externs" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wbad-function-cast" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wbad-function-cast" >&5 +$as_echo_n "checking if $CC supports -Wbad-function-cast... " >&6; } + cacheid=xorg_cv_cc_flag__Wbad_function_cast + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wbad-function-cast" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wold-style-definition" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wold-style-definition" >&5 +$as_echo_n "checking if $CC supports -Wold-style-definition... " >&6; } + cacheid=xorg_cv_cc_flag__Wold_style_definition + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wold-style-definition" + found="yes" + fi + fi + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -fd" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -fd" >&5 +$as_echo_n "checking if $CC supports -fd... " >&6; } + cacheid=xorg_cv_cc_flag__fd + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -fd" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wdeclaration-after-statement" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wdeclaration-after-statement" >&5 +$as_echo_n "checking if $CC supports -Wdeclaration-after-statement... " >&6; } + cacheid=xorg_cv_cc_flag__Wdeclaration_after_statement + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wdeclaration-after-statement" + found="yes" + fi + fi + + + + + +# This chunk adds additional warnings that could catch undesired effects. + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wunused" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wunused" >&5 +$as_echo_n "checking if $CC supports -Wunused... " >&6; } + cacheid=xorg_cv_cc_flag__Wunused + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wunused" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wuninitialized" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wuninitialized" >&5 +$as_echo_n "checking if $CC supports -Wuninitialized... " >&6; } + cacheid=xorg_cv_cc_flag__Wuninitialized + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wuninitialized" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wshadow" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wshadow" >&5 +$as_echo_n "checking if $CC supports -Wshadow... " >&6; } + cacheid=xorg_cv_cc_flag__Wshadow + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wshadow" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wmissing-noreturn" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmissing-noreturn" >&5 +$as_echo_n "checking if $CC supports -Wmissing-noreturn... " >&6; } + cacheid=xorg_cv_cc_flag__Wmissing_noreturn + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wmissing-noreturn" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wmissing-format-attribute" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmissing-format-attribute" >&5 +$as_echo_n "checking if $CC supports -Wmissing-format-attribute... " >&6; } + cacheid=xorg_cv_cc_flag__Wmissing_format_attribute + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wmissing-format-attribute" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wredundant-decls" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wredundant-decls" >&5 +$as_echo_n "checking if $CC supports -Wredundant-decls... " >&6; } + cacheid=xorg_cv_cc_flag__Wredundant_decls + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wredundant-decls" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wlogical-op" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wlogical-op" >&5 +$as_echo_n "checking if $CC supports -Wlogical-op... " >&6; } + cacheid=xorg_cv_cc_flag__Wlogical_op + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wlogical-op" + found="yes" + fi + fi + + + +# These are currently disabled because they are noisy. They will be enabled +# in the future once the codebase is sufficiently modernized to silence +# them. For now, I don't want them to drown out the other warnings. +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) + +# Turn some warnings into errors, so we don't accidently get successful builds +# when there are problems that should be fixed. + +if test "x$SELECTIVE_WERROR" = "xyes" ; then + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror=implicit" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=implicit" >&5 +$as_echo_n "checking if $CC supports -Werror=implicit... " >&6; } + cacheid=xorg_cv_cc_flag__Werror_implicit + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Werror=implicit" + found="yes" + fi + fi + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED" >&5 +$as_echo_n "checking if $CC supports -errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED... " >&6; } + cacheid=xorg_cv_cc_flag__errwarn_E_NO_EXPLICIT_TYPE_GIVEN__errwarn_E_NO_IMPLICIT_DECL_ALLOWED + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror=nonnull" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=nonnull" >&5 +$as_echo_n "checking if $CC supports -Werror=nonnull... " >&6; } + cacheid=xorg_cv_cc_flag__Werror_nonnull + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Werror=nonnull" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror=init-self" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=init-self" >&5 +$as_echo_n "checking if $CC supports -Werror=init-self... " >&6; } + cacheid=xorg_cv_cc_flag__Werror_init_self + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Werror=init-self" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror=main" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=main" >&5 +$as_echo_n "checking if $CC supports -Werror=main... " >&6; } + cacheid=xorg_cv_cc_flag__Werror_main + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Werror=main" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror=missing-braces" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=missing-braces" >&5 +$as_echo_n "checking if $CC supports -Werror=missing-braces... " >&6; } + cacheid=xorg_cv_cc_flag__Werror_missing_braces + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Werror=missing-braces" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror=sequence-point" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=sequence-point" >&5 +$as_echo_n "checking if $CC supports -Werror=sequence-point... " >&6; } + cacheid=xorg_cv_cc_flag__Werror_sequence_point + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Werror=sequence-point" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror=return-type" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=return-type" >&5 +$as_echo_n "checking if $CC supports -Werror=return-type... " >&6; } + cacheid=xorg_cv_cc_flag__Werror_return_type + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Werror=return-type" + found="yes" + fi + fi + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -errwarn=E_FUNC_HAS_NO_RETURN_STMT" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -errwarn=E_FUNC_HAS_NO_RETURN_STMT" >&5 +$as_echo_n "checking if $CC supports -errwarn=E_FUNC_HAS_NO_RETURN_STMT... " >&6; } + cacheid=xorg_cv_cc_flag__errwarn_E_FUNC_HAS_NO_RETURN_STMT + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -errwarn=E_FUNC_HAS_NO_RETURN_STMT" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror=trigraphs" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=trigraphs" >&5 +$as_echo_n "checking if $CC supports -Werror=trigraphs... " >&6; } + cacheid=xorg_cv_cc_flag__Werror_trigraphs + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Werror=trigraphs" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror=array-bounds" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=array-bounds" >&5 +$as_echo_n "checking if $CC supports -Werror=array-bounds... " >&6; } + cacheid=xorg_cv_cc_flag__Werror_array_bounds + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Werror=array-bounds" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror=write-strings" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=write-strings" >&5 +$as_echo_n "checking if $CC supports -Werror=write-strings... " >&6; } + cacheid=xorg_cv_cc_flag__Werror_write_strings + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Werror=write-strings" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror=address" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=address" >&5 +$as_echo_n "checking if $CC supports -Werror=address... " >&6; } + cacheid=xorg_cv_cc_flag__Werror_address + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Werror=address" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror=int-to-pointer-cast" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=int-to-pointer-cast" >&5 +$as_echo_n "checking if $CC supports -Werror=int-to-pointer-cast... " >&6; } + cacheid=xorg_cv_cc_flag__Werror_int_to_pointer_cast + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Werror=int-to-pointer-cast" + found="yes" + fi + fi + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -errwarn=E_BAD_PTR_INT_COMBINATION" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -errwarn=E_BAD_PTR_INT_COMBINATION" >&5 +$as_echo_n "checking if $CC supports -errwarn=E_BAD_PTR_INT_COMBINATION... " >&6; } + cacheid=xorg_cv_cc_flag__errwarn_E_BAD_PTR_INT_COMBINATION + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -errwarn=E_BAD_PTR_INT_COMBINATION" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror=pointer-to-int-cast" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=pointer-to-int-cast" >&5 +$as_echo_n "checking if $CC supports -Werror=pointer-to-int-cast... " >&6; } + cacheid=xorg_cv_cc_flag__Werror_pointer_to_int_cast + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Werror=pointer-to-int-cast" + found="yes" + fi + fi + + # Also -errwarn=E_BAD_PTR_INT_COMBINATION +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You have chosen not to turn some select compiler warnings into errors. This should not be necessary. Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT" >&5 +$as_echo "$as_me: WARNING: You have chosen not to turn some select compiler warnings into errors. This should not be necessary. Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT" >&2;} + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wimplicit" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wimplicit" >&5 +$as_echo_n "checking if $CC supports -Wimplicit... " >&6; } + cacheid=xorg_cv_cc_flag__Wimplicit + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wimplicit" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wnonnull" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wnonnull" >&5 +$as_echo_n "checking if $CC supports -Wnonnull... " >&6; } + cacheid=xorg_cv_cc_flag__Wnonnull + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wnonnull" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Winit-self" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Winit-self" >&5 +$as_echo_n "checking if $CC supports -Winit-self... " >&6; } + cacheid=xorg_cv_cc_flag__Winit_self + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Winit-self" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wmain" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmain" >&5 +$as_echo_n "checking if $CC supports -Wmain... " >&6; } + cacheid=xorg_cv_cc_flag__Wmain + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wmain" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wmissing-braces" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wmissing-braces" >&5 +$as_echo_n "checking if $CC supports -Wmissing-braces... " >&6; } + cacheid=xorg_cv_cc_flag__Wmissing_braces + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wmissing-braces" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wsequence-point" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wsequence-point" >&5 +$as_echo_n "checking if $CC supports -Wsequence-point... " >&6; } + cacheid=xorg_cv_cc_flag__Wsequence_point + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wsequence-point" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wreturn-type" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wreturn-type" >&5 +$as_echo_n "checking if $CC supports -Wreturn-type... " >&6; } + cacheid=xorg_cv_cc_flag__Wreturn_type + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wreturn-type" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wtrigraphs" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wtrigraphs" >&5 +$as_echo_n "checking if $CC supports -Wtrigraphs... " >&6; } + cacheid=xorg_cv_cc_flag__Wtrigraphs + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wtrigraphs" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Warray-bounds" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Warray-bounds" >&5 +$as_echo_n "checking if $CC supports -Warray-bounds... " >&6; } + cacheid=xorg_cv_cc_flag__Warray_bounds + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Warray-bounds" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wwrite-strings" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wwrite-strings" >&5 +$as_echo_n "checking if $CC supports -Wwrite-strings... " >&6; } + cacheid=xorg_cv_cc_flag__Wwrite_strings + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wwrite-strings" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Waddress" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Waddress" >&5 +$as_echo_n "checking if $CC supports -Waddress... " >&6; } + cacheid=xorg_cv_cc_flag__Waddress + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Waddress" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wint-to-pointer-cast" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wint-to-pointer-cast" >&5 +$as_echo_n "checking if $CC supports -Wint-to-pointer-cast... " >&6; } + cacheid=xorg_cv_cc_flag__Wint_to_pointer_cast + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wint-to-pointer-cast" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Wpointer-to-int-cast" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Wpointer-to-int-cast" >&5 +$as_echo_n "checking if $CC supports -Wpointer-to-int-cast... " >&6; } + cacheid=xorg_cv_cc_flag__Wpointer_to_int_cast + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + BASE_CFLAGS="$BASE_CFLAGS -Wpointer-to-int-cast" + found="yes" + fi + fi + + +fi + + + + + + + + CWARNFLAGS="$BASE_CFLAGS" + if test "x$GCC" = xyes ; then + CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing" + fi + + + + + + + + +# Check whether --enable-strict-compilation was given. +if test "${enable_strict_compilation+set}" = set; then : + enableval=$enable_strict_compilation; STRICT_COMPILE=$enableval +else + STRICT_COMPILE=no +fi + + + + + + +STRICT_CFLAGS="" + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -pedantic" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -pedantic" >&5 +$as_echo_n "checking if $CC supports -pedantic... " >&6; } + cacheid=xorg_cv_cc_flag__pedantic + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + STRICT_CFLAGS="$STRICT_CFLAGS -pedantic" + found="yes" + fi + fi + + + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror" >&5 +$as_echo_n "checking if $CC supports -Werror... " >&6; } + cacheid=xorg_cv_cc_flag__Werror + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + STRICT_CFLAGS="$STRICT_CFLAGS -Werror" + found="yes" + fi + fi + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -errwarn" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -errwarn" >&5 +$as_echo_n "checking if $CC supports -errwarn... " >&6; } + cacheid=xorg_cv_cc_flag__errwarn + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + STRICT_CFLAGS="$STRICT_CFLAGS -errwarn" + found="yes" + fi + fi + + + +# Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not +# activate it with -Werror, so we add it here explicitly. + + + + + + + + + + + + + +xorg_testset_save_CFLAGS="$CFLAGS" + +if test "x$xorg_testset_cc_unknown_warning_option" = "x" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unknown-warning-option" >&5 +$as_echo_n "checking if $CC supports -Werror=unknown-warning-option... " >&6; } +if ${xorg_cv_cc_flag_unknown_warning_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unknown_warning_option=yes +else + xorg_cv_cc_flag_unknown_warning_option=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unknown_warning_option" >&5 +$as_echo "$xorg_cv_cc_flag_unknown_warning_option" >&6; } + xorg_testset_cc_unknown_warning_option=$xorg_cv_cc_flag_unknown_warning_option + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +if test "x$xorg_testset_cc_unused_command_line_argument" = "x" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=unused-command-line-argument" >&5 +$as_echo_n "checking if $CC supports -Werror=unused-command-line-argument... " >&6; } +if ${xorg_cv_cc_flag_unused_command_line_argument+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + xorg_cv_cc_flag_unused_command_line_argument=yes +else + xorg_cv_cc_flag_unused_command_line_argument=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xorg_cv_cc_flag_unused_command_line_argument" >&5 +$as_echo "$xorg_cv_cc_flag_unused_command_line_argument" >&6; } + xorg_testset_cc_unused_command_line_argument=$xorg_cv_cc_flag_unused_command_line_argument + CFLAGS="$xorg_testset_save_CFLAGS" +fi + +found="no" + + if test $found = "no" ; then + if test "x$xorg_testset_cc_unknown_warning_option" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unknown-warning-option" + fi + + if test "x$xorg_testset_cc_unused_command_line_argument" = "xyes" ; then + CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + fi + + CFLAGS="$CFLAGS -Werror=attributes" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -Werror=attributes" >&5 +$as_echo_n "checking if $CC supports -Werror=attributes... " >&6; } + cacheid=xorg_cv_cc_flag__Werror_attributes + if eval \${$cacheid+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int i; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval $cacheid=yes +else + eval $cacheid=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + + + CFLAGS="$xorg_testset_save_CFLAGS" + + eval supported=\$$cacheid + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $supported" >&5 +$as_echo "$supported" >&6; } + if test "$supported" = "yes" ; then + STRICT_CFLAGS="$STRICT_CFLAGS -Werror=attributes" + found="yes" + fi + fi + + + +if test "x$STRICT_COMPILE" = "xyes"; then + BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS" + CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS" +fi + + + + + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION_MAJOR `echo $PACKAGE_VERSION | cut -d . -f 1` +_ACEOF + + PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1` + if test "x$PVM" = "x"; then + PVM="0" + fi + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION_MINOR $PVM +_ACEOF + + PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1` + if test "x$PVP" = "x"; then + PVP="0" + fi + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION_PATCHLEVEL $PVP +_ACEOF + + + +CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \ +mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \ +|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \ +echo 'git directory not found: installing possibly empty changelog.' >&2)" + + + + +macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros` +INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \ +mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \ +|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \ +echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)" + + + + + + +if test x$APP_MAN_SUFFIX = x ; then + APP_MAN_SUFFIX=1 +fi +if test x$APP_MAN_DIR = x ; then + APP_MAN_DIR='$(mandir)/man$(APP_MAN_SUFFIX)' +fi + +if test x$LIB_MAN_SUFFIX = x ; then + LIB_MAN_SUFFIX=3 +fi +if test x$LIB_MAN_DIR = x ; then + LIB_MAN_DIR='$(mandir)/man$(LIB_MAN_SUFFIX)' +fi + +if test x$FILE_MAN_SUFFIX = x ; then + case $host_os in + solaris*) FILE_MAN_SUFFIX=4 ;; + *) FILE_MAN_SUFFIX=5 ;; + esac +fi +if test x$FILE_MAN_DIR = x ; then + FILE_MAN_DIR='$(mandir)/man$(FILE_MAN_SUFFIX)' +fi + +if test x$MISC_MAN_SUFFIX = x ; then + case $host_os in + solaris*) MISC_MAN_SUFFIX=5 ;; + *) MISC_MAN_SUFFIX=7 ;; + esac +fi +if test x$MISC_MAN_DIR = x ; then + MISC_MAN_DIR='$(mandir)/man$(MISC_MAN_SUFFIX)' +fi + +if test x$DRIVER_MAN_SUFFIX = x ; then + case $host_os in + solaris*) DRIVER_MAN_SUFFIX=7 ;; + *) DRIVER_MAN_SUFFIX=4 ;; + esac +fi +if test x$DRIVER_MAN_DIR = x ; then + DRIVER_MAN_DIR='$(mandir)/man$(DRIVER_MAN_SUFFIX)' +fi + +if test x$ADMIN_MAN_SUFFIX = x ; then + case $host_os in + solaris*) ADMIN_MAN_SUFFIX=1m ;; + *) ADMIN_MAN_SUFFIX=8 ;; + esac +fi +if test x$ADMIN_MAN_DIR = x ; then + ADMIN_MAN_DIR='$(mandir)/man$(ADMIN_MAN_SUFFIX)' +fi + + + + + + + + + + + + + + + +XORG_MAN_PAGE="X Version 11" + +MAN_SUBSTS="\ + -e 's|__vendorversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \ + -e 's|__xorgversion__|\"\$(PACKAGE_STRING)\" \"\$(XORG_MAN_PAGE)\"|' \ + -e 's|__xservername__|Xorg|g' \ + -e 's|__xconfigfile__|xorg.conf|g' \ + -e 's|__projectroot__|\$(prefix)|g' \ + -e 's|__apploaddir__|\$(appdefaultdir)|g' \ + -e 's|__appmansuffix__|\$(APP_MAN_SUFFIX)|g' \ + -e 's|__drivermansuffix__|\$(DRIVER_MAN_SUFFIX)|g' \ + -e 's|__adminmansuffix__|\$(ADMIN_MAN_SUFFIX)|g' \ + -e 's|__libmansuffix__|\$(LIB_MAN_SUFFIX)|g' \ + -e 's|__miscmansuffix__|\$(MISC_MAN_SUFFIX)|g' \ + -e 's|__filemansuffix__|\$(FILE_MAN_SUFFIX)|g'" + + + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=0;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + + + +# Initialize libtool +# Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else + enable_static=no +fi + + + + + + + + + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4.6' +macro_revision='2.4.6' + + + + + + + + + + + + + +ltmain=$ac_aux_dir/ltmain.sh + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case $ECHO in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_FGREP" || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM +else + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring=ABCD + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n "$lt_cv_sys_max_cmd_len"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test yes != "$GCC"; then + reload_cmds=false + fi + ;; + darwin*) + if test yes = "$GCC"; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test no = "$lt_cv_ar_at_file"; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + bitrig* | openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if ${lt_cv_sys_global_symbol_pipe+:} false; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test ia64 = "$host_cpu"; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS=conftstm.$ac_objext + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test yes = "$pipe_works"; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 +$as_echo "$with_sysroot" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 +$as_echo_n "checking for a working dd... " >&6; } +if ${ac_cv_path_lt_DD+:} false; then : + $as_echo_n "(cached) " >&6 +else + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +if test -z "$lt_DD"; then + ac_path_lt_DD_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in dd; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_lt_DD" || continue +if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi + $ac_path_lt_DD_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_lt_DD"; then + : + fi +else + ac_cv_path_lt_DD=$lt_DD +fi + +rm -f conftest.i conftest2.i conftest.out +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 +$as_echo "$ac_cv_path_lt_DD" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 +$as_echo_n "checking how to truncate binary pipes... " >&6; } +if ${lt_cv_truncate_bin+:} false; then : + $as_echo_n "(cached) " >&6 +else + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 +$as_echo "$lt_cv_truncate_bin" >&6; } + + + + + + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test no = "$enable_libtool_lock" || enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE=32 + ;; + *ELF-64*) + HPUX_IA64_MODE=64 + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test yes = "$lt_cv_prog_gnu_ld"; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + emul=elf + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*|x86_64-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD=${LD-ld}_sol2 + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks=$enable_libtool_lock + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: +fi + + + + + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "$LT_MULTI_MODULE"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.[012][,.]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + fi + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else + pic_mode=default +fi + + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[5-9]*,yes) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 +$as_echo_n "checking which variant of shared library versioning to provide... " >&6; } + +# Check whether --with-aix-soname was given. +if test "${with_aix_soname+set}" = set; then : + withval=$with_aix_soname; case $withval in + aix|svr4|both) + ;; + *) + as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname +else + if ${lt_cv_with_aix_soname+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_with_aix_soname=aix +fi + + with_aix_soname=$lt_cv_with_aix_soname +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 +$as_echo "$with_aix_soname" >&6; } + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS=$ltmain + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld=$lt_cv_prog_gnu_ld + +old_CC=$CC +old_CFLAGS=$CFLAGS + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +func_cc_basename $compiler +cc_basename=$func_cc_basename_result + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/${ac_tool_prefix}file"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac +fi + +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/file"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac +fi + +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC=$CC +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test yes = "$GCC"; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test yes = "$GCC"; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + lt_prog_compiler_pic='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='$wl-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + # old Intel for x86_64, which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if ${lt_cv_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test yes = "$lt_cv_prog_compiler_pic_works"; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test yes = "$lt_cv_prog_compiler_static_works"; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links=nottested +if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test no = "$hard_links"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + with_gnu_ld=no + ;; + linux* | k*bsd*-gnu | gnu*) + link_all_deplibs=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test yes = "$with_gnu_ld"; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test yes = "$lt_use_gnu_ld_interface"; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='$wl' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + export_dynamic_flag_spec='$wl--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test ia64 != "$host_cpu"; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='$wl--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + export_dynamic_flag_spec='-rdynamic' + ;; + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test no = "$ld_shlibs"; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct=no + hardcode_direct_absolute=no + ;; + esac + + if test yes = "$GCC"; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + export_dynamic_flag_spec='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' $wl-bernotok' + allow_undefined_flag=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test yes = "$lt_cv_ld_force_load"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test yes = "$GCC"; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='$wl-E' + ;; + + hpux10*) + if test yes,no = "$GCC,$with_gnu_ld"; then + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='$wl-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test yes,no = "$GCC,$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test yes = "$lt_cv_prog_compiler__b"; then + archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='$wl-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test yes = "$GCC"; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test yes = "$lt_cv_irix_exported_symbol"; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + link_all_deplibs=no + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + ld_shlibs=yes + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + netbsd* | netbsdelf*-gnu) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' + else + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + ;; + + osf3*) + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test yes = "$GCC"; then + wlarc='$wl' + archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='$wl' + archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. GCC discards it without '$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test yes = "$GCC"; then + whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test sequent = "$host_vendor"; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='$wl-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='$wl-z,text' + allow_undefined_flag='$wl-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='$wl-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test sni = "$host_vendor"; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='$wl-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test no = "$ld_shlibs" && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test yes = "$GCC"; then + case $host_os in + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary... + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo = "/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's|/\([A-Za-z]:\)|\1|g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + + + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test yes = "$hardcode_automatic"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && + test no != "$hardcode_minus_L"; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test relink = "$hardcode_action" || + test yes = "$inherit_rpath"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test yes != "$enable_dlopen"; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen=load_add_on + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen=LoadLibrary + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl +else + + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes; then : + lt_cv_dlopen=shl_load +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes; then : + lt_cv_dlopen=dlopen +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if ${ac_cv_lib_svld_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if ${ac_cv_lib_dld_dld_link+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : + lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS=$LDFLAGS + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS=$LIBS + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test yes = "$cross_compiling"; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self_static+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test yes = "$cross_compiling"; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP"; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report what library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC=$lt_save_CC + + + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + + + +# Define a configure option for an alternate module directory +# Check whether --enable-dga was given. +if test "${enable_dga+set}" = set; then : + enableval=$enable_dga; DGA=$enableval +else + DGA=yes +fi + + +# Check whether --with-xorg-module-dir was given. +if test "${with_xorg_module_dir+set}" = set; then : + withval=$with_xorg_module_dir; moduledir="$withval" +else + moduledir="$libdir/xorg/modules" +fi + + + + +# Store the list of server defined optional extensions in REQUIRED_MODULES + + + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I`$PKG_CONFIG --variable=sdkdir xorg-server`" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include "xorg-server.h" +#if !defined RANDR +#error RANDR not defined +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + _EXT_CHECK=yes +else + _EXT_CHECK=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$SAVE_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if RANDR is defined" >&5 +$as_echo_n "checking if RANDR is defined... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_EXT_CHECK" >&5 +$as_echo "$_EXT_CHECK" >&6; } + if test "$_EXT_CHECK" != no; then + REQUIRED_MODULES="$REQUIRED_MODULES randrproto" + fi + + + + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I`$PKG_CONFIG --variable=sdkdir xorg-server`" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include "xorg-server.h" +#if !defined RENDER +#error RENDER not defined +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + _EXT_CHECK=yes +else + _EXT_CHECK=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$SAVE_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if RENDER is defined" >&5 +$as_echo_n "checking if RENDER is defined... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_EXT_CHECK" >&5 +$as_echo "$_EXT_CHECK" >&6; } + if test "$_EXT_CHECK" != no; then + REQUIRED_MODULES="$REQUIRED_MODULES renderproto" + fi + + + + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I`$PKG_CONFIG --variable=sdkdir xorg-server`" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include "xorg-server.h" +#if !defined XV +#error XV not defined +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + _EXT_CHECK=yes +else + _EXT_CHECK=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$SAVE_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if XV is defined" >&5 +$as_echo_n "checking if XV is defined... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_EXT_CHECK" >&5 +$as_echo "$_EXT_CHECK" >&6; } + if test "$_EXT_CHECK" != no; then + REQUIRED_MODULES="$REQUIRED_MODULES videoproto" + fi + + +if test "x$DGA" = xyes; then + + + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -I`$PKG_CONFIG --variable=sdkdir xorg-server`" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include "xorg-server.h" +#if !defined XFreeXDGA +#error XFreeXDGA not defined +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + _EXT_CHECK=yes +else + _EXT_CHECK=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$SAVE_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if XFreeXDGA is defined" >&5 +$as_echo_n "checking if XFreeXDGA is defined... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_EXT_CHECK" >&5 +$as_echo "$_EXT_CHECK" >&6; } + if test "$_EXT_CHECK" != no; then + REQUIRED_MODULES="$REQUIRED_MODULES xf86dgaproto" + fi + + +$as_echo "#define USE_DGA 1" >>confdefs.h + +fi + + if test "x$DGA" = xyes; then + DGA_TRUE= + DGA_FALSE='#' +else + DGA_TRUE='#' + DGA_FALSE= +fi + + +# Obtain compiler/linker options for the driver dependencies + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XORG" >&5 +$as_echo_n "checking for XORG... " >&6; } + +if test -n "$XORG_CFLAGS"; then + pkg_cv_XORG_CFLAGS="$XORG_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xorg-server >= 1.4.99.901 xproto fontsproto \$REQUIRED_MODULES\""; } >&5 + ($PKG_CONFIG --exists --print-errors "xorg-server >= 1.4.99.901 xproto fontsproto $REQUIRED_MODULES") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_XORG_CFLAGS=`$PKG_CONFIG --cflags "xorg-server >= 1.4.99.901 xproto fontsproto $REQUIRED_MODULES" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$XORG_LIBS"; then + pkg_cv_XORG_LIBS="$XORG_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"xorg-server >= 1.4.99.901 xproto fontsproto \$REQUIRED_MODULES\""; } >&5 + ($PKG_CONFIG --exists --print-errors "xorg-server >= 1.4.99.901 xproto fontsproto $REQUIRED_MODULES") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_XORG_LIBS=`$PKG_CONFIG --libs "xorg-server >= 1.4.99.901 xproto fontsproto $REQUIRED_MODULES" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + XORG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "xorg-server >= 1.4.99.901 xproto fontsproto $REQUIRED_MODULES" 2>&1` + else + XORG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "xorg-server >= 1.4.99.901 xproto fontsproto $REQUIRED_MODULES" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$XORG_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (xorg-server >= 1.4.99.901 xproto fontsproto $REQUIRED_MODULES) were not met: + +$XORG_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables XORG_CFLAGS +and XORG_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables XORG_CFLAGS +and XORG_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + XORG_CFLAGS=$pkg_cv_XORG_CFLAGS + XORG_LIBS=$pkg_cv_XORG_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +# Checks for libraries. + + +DRIVER_NAME=dummy + + +ac_config_files="$ac_config_files Makefile src/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${DGA_TRUE}" && test -z "${DGA_FALSE}"; then + as_fn_error $? "conditional \"DGA\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by xf86-video-dummy $as_me 0.3.8, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +xf86-video-dummy config.status 0.3.8 +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' +configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ +AR \ +AR_FLAGS \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_import \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +lt_cv_nm_interface \ +nm_file_list_spec \ +lt_cv_truncate_bin \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +configure_time_dlsearch_path \ +configure_time_lt_sys_library_path; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' + +# See if we are running on zsh, and set the options that allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + RM='$RM' + ofile='$ofile' + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named 'Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running 'make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "$am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options that allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST + fi + + cfgfile=${ofile}T + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL +# Generated automatically by $as_me ($PACKAGE) $VERSION +# NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +# Copyright (C) 2014 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +# The names of the tagged configurations supported by this script. +available_tags='' + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shared archive member basename,for filename based shared library versioning on AIX. +shared_archive_member_spec=$shared_archive_member_spec + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive. +AR_FLAGS=$lt_AR_FLAGS + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm into a list of symbols to manually relocate. +global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# The name lister interface. +nm_interface=$lt_lt_cv_nm_interface + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and where our libraries should be installed. +lt_sysroot=$lt_sysroot + +# Command to truncate a binary pipe. +lt_truncate_bin=$lt_lt_cv_truncate_bin + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Detected run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path + +# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. +configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain=$ac_aux_dir/ltmain.sh + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/server/xorg/xf86-video-dummy/v0.3.8/configure.ac b/server/xorg/xf86-video-dummy/v0.3.8/configure.ac new file mode 100644 index 000000000..4eb7faecb --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/configure.ac @@ -0,0 +1,81 @@ +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Process this file with autoconf to produce a configure script + +# Initialize Autoconf +AC_PREREQ([2.60]) +AC_INIT([xf86-video-dummy], + [0.3.8], + [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], + [xf86-video-dummy]) +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_AUX_DIR(.) + +# Initialize Automake +AM_INIT_AUTOMAKE([foreign dist-bzip2]) + +# Require xorg-macros: XORG_DEFAULT_OPTIONS +m4_ifndef([XORG_MACROS_VERSION], + [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])]) +XORG_MACROS_VERSION(1.3) +XORG_DEFAULT_OPTIONS + +# Initialize libtool +AC_DISABLE_STATIC +AC_PROG_LIBTOOL + +AH_TOP([#include "xorg-server.h"]) + +# Define a configure option for an alternate module directory +AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: yes)]), [DGA=$enableval], [DGA=yes]) +AC_ARG_WITH(xorg-module-dir, [ --with-xorg-module-dir=DIR ], + [ moduledir="$withval" ], + [ moduledir="$libdir/xorg/modules" ]) +AC_SUBST(moduledir) + + +# Store the list of server defined optional extensions in REQUIRED_MODULES +XORG_DRIVER_CHECK_EXT(RANDR, randrproto) +XORG_DRIVER_CHECK_EXT(RENDER, renderproto) +XORG_DRIVER_CHECK_EXT(XV, videoproto) + +if test "x$DGA" = xyes; then + XORG_DRIVER_CHECK_EXT(XFreeXDGA, xf86dgaproto) + AC_DEFINE(USE_DGA, 1, [Support DGA extension]) +fi +AC_SUBST([DGA]) +AM_CONDITIONAL([DGA], [test "x$DGA" = xyes]) + +# Obtain compiler/linker options for the driver dependencies +PKG_CHECK_MODULES(XORG, [xorg-server >= 1.4.99.901] xproto fontsproto $REQUIRED_MODULES) + +# Checks for libraries. + + +DRIVER_NAME=dummy +AC_SUBST([DRIVER_NAME]) + +AC_CONFIG_FILES([ + Makefile + src/Makefile +]) +AC_OUTPUT diff --git a/server/xorg/xf86-video-dummy/v0.3.8/depcomp b/server/xorg/xf86-video-dummy/v0.3.8/depcomp new file mode 100755 index 000000000..4ebd5b3a2 --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/depcomp @@ -0,0 +1,791 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2013-05-30.07; # UTC + +# Copyright (C) 1999-2013 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by 'PROGRAMS ARGS'. + object Object file output by 'PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputting dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +# Get the directory component of the given path, and save it in the +# global variables '$dir'. Note that this directory component will +# be either empty or ending with a '/' character. This is deliberate. +set_dir_from () +{ + case $1 in + */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; + *) dir=;; + esac +} + +# Get the suffix-stripped basename of the given path, and save it the +# global variable '$base'. +set_base_from () +{ + base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` +} + +# If no dependency file was actually created by the compiler invocation, +# we still have to create a dummy depfile, to avoid errors with the +# Makefile "include basename.Plo" scheme. +make_dummy_depfile () +{ + echo "#dummy" > "$depfile" +} + +# Factor out some common post-processing of the generated depfile. +# Requires the auxiliary global variable '$tmpdepfile' to be set. +aix_post_process_depfile () +{ + # If the compiler actually managed to produce a dependency file, + # post-process it. + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependency.h'. + # Do two passes, one to just change these to + # $object: dependency.h + # and one to simply output + # dependency.h: + # which is needed to avoid the deleted-header problem. + { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" + } > "$depfile" + rm -f "$tmpdepfile" + else + make_dummy_depfile + fi +} + +# A tabulation character. +tab=' ' +# A newline character. +nl=' +' +# Character ranges might be problematic outside the C locale. +# These definitions help. +upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ +lower=abcdefghijklmnopqrstuvwxyz +digits=0123456789 +alpha=${upper}${lower} + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Avoid interferences from the environment. +gccflag= dashmflag= + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp +fi + +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + +if test "$depmode" = xlc; then + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. + gccflag=-qmakedep=gcc,-MF + depmode=gcc +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. +## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. +## (see the conditional assignment to $gccflag above). +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). Also, it might not be +## supported by the other compilers which use the 'gcc' depmode. +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The second -e expression handles DOS-style file names with drive + # letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the "deleted header file" problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. +## Some versions of gcc put a space before the ':'. On the theory +## that the space means something, we add a space to the output as +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like '#:fec' to the end of the + # dependency line. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ + | tr "$nl" ' ' >> "$depfile" + echo >> "$depfile" + # The second pass generates a dummy entry for each header file. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" + ;; + +xlc) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts '$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + aix_post_process_depfile + ;; + +tcc) + # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 + # FIXME: That version still under development at the moment of writing. + # Make that this statement remains true also for stable, released + # versions. + # It will wrap lines (doesn't matter whether long or short) with a + # trailing '\', as in: + # + # foo.o : \ + # foo.c \ + # foo.h \ + # + # It will put a trailing '\' even on the last line, and will use leading + # spaces rather than leading tabs (at least since its commit 0394caf7 + # "Emit spaces for -MD"). + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. + # We have to change lines of the first kind to '$object: \'. + sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" + # And for each line of the second kind, we have to emit a 'dep.h:' + # dummy dependency, to avoid the deleted-header problem. + sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +## The order of this option in the case statement is important, since the +## shell code in configure will try each of these formats in the order +## listed in this file. A plain '-MD' option would be understood by many +## compilers, so we must ensure this comes after the gcc and icc options. +pgcc) + # Portland's C compiler understands '-MD'. + # Will always output deps to 'file.d' where file is the root name of the + # source file under compilation, even if file resides in a subdirectory. + # The object file name does not affect the name of the '.d' file. + # pgcc 10.2 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using '\' : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + set_dir_from "$object" + # Use the source, not the object, to determine the base name, since + # that's sadly what pgcc will do too. + set_base_from "$source" + tmpdepfile=$base.d + + # For projects that build the same source file twice into different object + # files, the pgcc approach of using the *source* file root name can cause + # problems in parallel builds. Use a locking strategy to avoid stomping on + # the same $tmpdepfile. + lockdir=$base.d-lock + trap " + echo '$0: caught signal, cleaning up...' >&2 + rmdir '$lockdir' + exit 1 + " 1 2 13 15 + numtries=100 + i=$numtries + while test $i -gt 0; do + # mkdir is a portable test-and-set. + if mkdir "$lockdir" 2>/dev/null; then + # This process acquired the lock. + "$@" -MD + stat=$? + # Release the lock. + rmdir "$lockdir" + break + else + # If the lock is being held by a different process, wait + # until the winning process is done or we timeout. + while test -d "$lockdir" && test $i -gt 0; do + sleep 1 + i=`expr $i - 1` + done + fi + i=`expr $i - 1` + done + trap - 1 2 13 15 + if test $i -le 0; then + echo "$0: failed to acquire lock after $numtries attempts" >&2 + echo "$0: check lockdir '$lockdir'" >&2 + exit 1 + fi + + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" + # Add 'dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in 'foo.d' instead, so we check for that too. + # Subdirectories are respected. + set_dir_from "$object" + set_base_from "$object" + + if test "$libtool" = yes; then + # Libtool generates 2 separate objects for the 2 libraries. These + # two compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir$base.o.d # libtool 1.5 + tmpdepfile2=$dir.libs/$base.o.d # Likewise. + tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + # Same post-processing that is required for AIX mode. + aix_post_process_depfile + ;; + +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/'"$tab"'\1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/'"$tab"'/ + G + p +}' >> "$depfile" + echo >> "$depfile" # make sure the fragment doesn't end with a backslash + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for ':' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. + "$@" $dashmflag | + sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this sed invocation + # correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process the last invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed '1,2d' "$tmpdepfile" \ + | tr ' ' "$nl" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E \ + | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + | sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" + echo "$tab" >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/server/xorg/xf86-video-dummy/v0.3.8/install-sh b/server/xorg/xf86-video-dummy/v0.3.8/install-sh new file mode 100755 index 000000000..377bb8687 --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/install-sh @@ -0,0 +1,527 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2011-11-20.07; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/server/xorg/xf86-video-dummy/v0.3.8/ltmain.sh b/server/xorg/xf86-video-dummy/v0.3.8/ltmain.sh new file mode 100644 index 000000000..a736cf994 --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/ltmain.sh @@ -0,0 +1,11156 @@ +#! /bin/sh +## DO NOT EDIT - This file generated from ./build-aux/ltmain.in +## by inline-source v2014-01-03.01 + +# libtool (GNU libtool) 2.4.6 +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996-2015 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +PROGRAM=libtool +PACKAGE=libtool +VERSION="2.4.6 Debian-2.4.6-2" +package_revision=2.4.6 + + +## ------ ## +## Usage. ## +## ------ ## + +# Run './libtool --help' for help with using this script from the +# command line. + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# After configure completes, it has a better idea of some of the +# shell tools we need than the defaults used by the functions shared +# with bootstrap, so set those here where they can still be over- +# ridden by the user, but otherwise take precedence. + +: ${AUTOCONF="autoconf"} +: ${AUTOMAKE="automake"} + + +## -------------------------- ## +## Source external libraries. ## +## -------------------------- ## + +# Much of our low-level functionality needs to be sourced from external +# libraries, which are installed to $pkgauxdir. + +# Set a version string for this script. +scriptversion=2015-01-20.17; # UTC + +# General shell script boiler plate, and helper functions. +# Written by Gary V. Vaughan, 2004 + +# Copyright (C) 2004-2015 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# As a special exception to the GNU General Public License, if you distribute +# this file as part of a program or library that is built using GNU Libtool, +# you may include this file under the same distribution terms that you use +# for the rest of that program. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please report bugs or propose patches to gary@gnu.org. + + +## ------ ## +## Usage. ## +## ------ ## + +# Evaluate this file near the top of your script to gain access to +# the functions and variables defined here: +# +# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh +# +# If you need to override any of the default environment variable +# settings, do that before evaluating this file. + + +## -------------------- ## +## Shell normalisation. ## +## -------------------- ## + +# Some shells need a little help to be as Bourne compatible as possible. +# Before doing anything else, make sure all that help has been provided! + +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac +fi + +# NLS nuisances: We save the old values in case they are required later. +_G_user_locale= +_G_safe_locale= +for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test set = \"\${$_G_var+set}\"; then + save_$_G_var=\$$_G_var + $_G_var=C + export $_G_var + _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" + _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" + fi" +done + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Make sure IFS has a sensible default +sp=' ' +nl=' +' +IFS="$sp $nl" + +# There are apparently some retarded systems that use ';' as a PATH separator! +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + + +## ------------------------- ## +## Locate command utilities. ## +## ------------------------- ## + + +# func_executable_p FILE +# ---------------------- +# Check that FILE is an executable regular file. +func_executable_p () +{ + test -f "$1" && test -x "$1" +} + + +# func_path_progs PROGS_LIST CHECK_FUNC [PATH] +# -------------------------------------------- +# Search for either a program that responds to --version with output +# containing "GNU", or else returned by CHECK_FUNC otherwise, by +# trying all the directories in PATH with each of the elements of +# PROGS_LIST. +# +# CHECK_FUNC should accept the path to a candidate program, and +# set $func_check_prog_result if it truncates its output less than +# $_G_path_prog_max characters. +func_path_progs () +{ + _G_progs_list=$1 + _G_check_func=$2 + _G_PATH=${3-"$PATH"} + + _G_path_prog_max=0 + _G_path_prog_found=false + _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} + for _G_dir in $_G_PATH; do + IFS=$_G_save_IFS + test -z "$_G_dir" && _G_dir=. + for _G_prog_name in $_G_progs_list; do + for _exeext in '' .EXE; do + _G_path_prog=$_G_dir/$_G_prog_name$_exeext + func_executable_p "$_G_path_prog" || continue + case `"$_G_path_prog" --version 2>&1` in + *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; + *) $_G_check_func $_G_path_prog + func_path_progs_result=$func_check_prog_result + ;; + esac + $_G_path_prog_found && break 3 + done + done + done + IFS=$_G_save_IFS + test -z "$func_path_progs_result" && { + echo "no acceptable sed could be found in \$PATH" >&2 + exit 1 + } +} + + +# We want to be able to use the functions in this file before configure +# has figured out where the best binaries are kept, which means we have +# to search for them ourselves - except when the results are already set +# where we skip the searches. + +# Unless the user overrides by setting SED, search the path for either GNU +# sed, or the sed that truncates its output the least. +test -z "$SED" && { + _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for _G_i in 1 2 3 4 5 6 7; do + _G_sed_script=$_G_sed_script$nl$_G_sed_script + done + echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed + _G_sed_script= + + func_check_prog_sed () + { + _G_path_prog=$1 + + _G_count=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo '' >> conftest.nl + "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin + rm -f conftest.sed + SED=$func_path_progs_result +} + + +# Unless the user overrides by setting GREP, search the path for either GNU +# grep, or the grep that truncates its output the least. +test -z "$GREP" && { + func_check_prog_grep () + { + _G_path_prog=$1 + + _G_count=0 + _G_path_prog_max=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo 'GREP' >> conftest.nl + "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin + GREP=$func_path_progs_result +} + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# All uppercase variable names are used for environment variables. These +# variables can be overridden by the user before calling a script that +# uses them if a suitable command of that name is not already available +# in the command search PATH. + +: ${CP="cp -f"} +: ${ECHO="printf %s\n"} +: ${EGREP="$GREP -E"} +: ${FGREP="$GREP -F"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} + + +## -------------------- ## +## Useful sed snippets. ## +## -------------------- ## + +sed_dirname='s|/[^/]*$||' +sed_basename='s|^.*/||' + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s|\([`"$\\]\)|\\\1|g' + +# Same as above, but do not quote variable references. +sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' + +# Sed substitution that converts a w32 file name or path +# that contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-'\' parameter expansions in output of sed_double_quote_subst that +# were '\'-ed in input to the same. If an odd number of '\' preceded a +# '$' in input to sed_double_quote_subst, that '$' was protected from +# expansion. Since each input '\' is now two '\'s, look for any number +# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. +_G_bs='\\' +_G_bs2='\\\\' +_G_bs4='\\\\\\\\' +_G_dollar='\$' +sed_double_backslash="\ + s/$_G_bs4/&\\ +/g + s/^$_G_bs2$_G_dollar/$_G_bs&/ + s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g + s/\n//g" + + +## ----------------- ## +## Global variables. ## +## ----------------- ## + +# Except for the global variables explicitly listed below, the following +# functions in the '^func_' namespace, and the '^require_' namespace +# variables initialised in the 'Resource management' section, sourcing +# this file will not pollute your global namespace with anything +# else. There's no portable way to scope variables in Bourne shell +# though, so actually running these functions will sometimes place +# results into a variable named after the function, and often use +# temporary variables in the '^_G_' namespace. If you are careful to +# avoid using those namespaces casually in your sourcing script, things +# should continue to work as you expect. And, of course, you can freely +# overwrite any of the functions or variables defined here before +# calling anything to customize them. + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +# Allow overriding, eg assuming that you follow the convention of +# putting '$debug_cmd' at the start of all your functions, you can get +# bash to show function call trace with: +# +# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name +debug_cmd=${debug_cmd-":"} +exit_cmd=: + +# By convention, finish your script with: +# +# exit $exit_status +# +# so that you can set exit_status to non-zero if you want to indicate +# something went wrong during execution without actually bailing out at +# the point of failure. +exit_status=$EXIT_SUCCESS + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath=$0 + +# The name of this program. +progname=`$ECHO "$progpath" |$SED "$sed_basename"` + +# Make sure we have an absolute progpath for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` + progdir=`cd "$progdir" && pwd` + progpath=$progdir/$progname + ;; + *) + _G_IFS=$IFS + IFS=${PATH_SEPARATOR-:} + for progdir in $PATH; do + IFS=$_G_IFS + test -x "$progdir/$progname" && break + done + IFS=$_G_IFS + test -n "$progdir" || progdir=`pwd` + progpath=$progdir/$progname + ;; +esac + + +## ----------------- ## +## Standard options. ## +## ----------------- ## + +# The following options affect the operation of the functions defined +# below, and should be set appropriately depending on run-time para- +# meters passed on the command line. + +opt_dry_run=false +opt_quiet=false +opt_verbose=false + +# Categories 'all' and 'none' are always available. Append any others +# you will pass as the first argument to func_warning from your own +# code. +warning_categories= + +# By default, display warnings according to 'opt_warning_types'. Set +# 'warning_func' to ':' to elide all warnings, or func_fatal_error to +# treat the next displayed warning as a fatal error. +warning_func=func_warn_and_continue + +# Set to 'all' to display all warnings, 'none' to suppress all +# warnings, or a space delimited list of some subset of +# 'warning_categories' to display only the listed warnings. +opt_warning_types=all + + +## -------------------- ## +## Resource management. ## +## -------------------- ## + +# This section contains definitions for functions that each ensure a +# particular resource (a file, or a non-empty configuration variable for +# example) is available, and if appropriate to extract default values +# from pertinent package files. Call them using their associated +# 'require_*' variable to ensure that they are executed, at most, once. +# +# It's entirely deliberate that calling these functions can set +# variables that don't obey the namespace limitations obeyed by the rest +# of this file, in order that that they be as useful as possible to +# callers. + + +# require_term_colors +# ------------------- +# Allow display of bold text on terminals that support it. +require_term_colors=func_require_term_colors +func_require_term_colors () +{ + $debug_cmd + + test -t 1 && { + # COLORTERM and USE_ANSI_COLORS environment variables take + # precedence, because most terminfo databases neglect to describe + # whether color sequences are supported. + test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} + + if test 1 = "$USE_ANSI_COLORS"; then + # Standard ANSI escape sequences + tc_reset='' + tc_bold=''; tc_standout='' + tc_red=''; tc_green='' + tc_blue=''; tc_cyan='' + else + # Otherwise trust the terminfo database after all. + test -n "`tput sgr0 2>/dev/null`" && { + tc_reset=`tput sgr0` + test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` + tc_standout=$tc_bold + test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` + test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` + test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` + test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` + test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` + } + fi + } + + require_term_colors=: +} + + +## ----------------- ## +## Function library. ## +## ----------------- ## + +# This section contains a variety of useful functions to call in your +# scripts. Take note of the portable wrappers for features provided by +# some modern shells, which will fall back to slower equivalents on +# less featureful shells. + + +# func_append VAR VALUE +# --------------------- +# Append VALUE onto the existing contents of VAR. + + # We should try to minimise forks, especially on Windows where they are + # unreasonably slow, so skip the feature probes when bash or zsh are + # being used: + if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then + : ${_G_HAVE_ARITH_OP="yes"} + : ${_G_HAVE_XSI_OPS="yes"} + # The += operator was introduced in bash 3.1 + case $BASH_VERSION in + [12].* | 3.0 | 3.0*) ;; + *) + : ${_G_HAVE_PLUSEQ_OP="yes"} + ;; + esac + fi + + # _G_HAVE_PLUSEQ_OP + # Can be empty, in which case the shell is probed, "yes" if += is + # useable or anything else if it does not work. + test -z "$_G_HAVE_PLUSEQ_OP" \ + && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ + && _G_HAVE_PLUSEQ_OP=yes + +if test yes = "$_G_HAVE_PLUSEQ_OP" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_append () + { + $debug_cmd + + eval "$1+=\$2" + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_append () + { + $debug_cmd + + eval "$1=\$$1\$2" + } +fi + + +# func_append_quoted VAR VALUE +# ---------------------------- +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +if test yes = "$_G_HAVE_PLUSEQ_OP"; then + eval 'func_append_quoted () + { + $debug_cmd + + func_quote_for_eval "$2" + eval "$1+=\\ \$func_quote_for_eval_result" + }' +else + func_append_quoted () + { + $debug_cmd + + func_quote_for_eval "$2" + eval "$1=\$$1\\ \$func_quote_for_eval_result" + } +fi + + +# func_append_uniq VAR VALUE +# -------------------------- +# Append unique VALUE onto the existing contents of VAR, assuming +# entries are delimited by the first character of VALUE. For example: +# +# func_append_uniq options " --another-option option-argument" +# +# will only append to $options if " --another-option option-argument " +# is not already present somewhere in $options already (note spaces at +# each end implied by leading space in second argument). +func_append_uniq () +{ + $debug_cmd + + eval _G_current_value='`$ECHO $'$1'`' + _G_delim=`expr "$2" : '\(.\)'` + + case $_G_delim$_G_current_value$_G_delim in + *"$2$_G_delim"*) ;; + *) func_append "$@" ;; + esac +} + + +# func_arith TERM... +# ------------------ +# Set func_arith_result to the result of evaluating TERMs. + test -z "$_G_HAVE_ARITH_OP" \ + && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ + && _G_HAVE_ARITH_OP=yes + +if test yes = "$_G_HAVE_ARITH_OP"; then + eval 'func_arith () + { + $debug_cmd + + func_arith_result=$(( $* )) + }' +else + func_arith () + { + $debug_cmd + + func_arith_result=`expr "$@"` + } +fi + + +# func_basename FILE +# ------------------ +# Set func_basename_result to FILE with everything up to and including +# the last / stripped. +if test yes = "$_G_HAVE_XSI_OPS"; then + # If this shell supports suffix pattern removal, then use it to avoid + # forking. Hide the definitions single quotes in case the shell chokes + # on unsupported syntax... + _b='func_basename_result=${1##*/}' + _d='case $1 in + */*) func_dirname_result=${1%/*}$2 ;; + * ) func_dirname_result=$3 ;; + esac' + +else + # ...otherwise fall back to using sed. + _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' + _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` + if test "X$func_dirname_result" = "X$1"; then + func_dirname_result=$3 + else + func_append func_dirname_result "$2" + fi' +fi + +eval 'func_basename () +{ + $debug_cmd + + '"$_b"' +}' + + +# func_dirname FILE APPEND NONDIR_REPLACEMENT +# ------------------------------------------- +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +eval 'func_dirname () +{ + $debug_cmd + + '"$_d"' +}' + + +# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT +# -------------------------------------------------------- +# Perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# For efficiency, we do not delegate to the functions above but instead +# duplicate the functionality here. +eval 'func_dirname_and_basename () +{ + $debug_cmd + + '"$_b"' + '"$_d"' +}' + + +# func_echo ARG... +# ---------------- +# Echo program name prefixed message. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_echo_all ARG... +# -------------------- +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + + +# func_echo_infix_1 INFIX ARG... +# ------------------------------ +# Echo program name, followed by INFIX on the first line, with any +# additional lines not showing INFIX. +func_echo_infix_1 () +{ + $debug_cmd + + $require_term_colors + + _G_infix=$1; shift + _G_indent=$_G_infix + _G_prefix="$progname: $_G_infix: " + _G_message=$* + + # Strip color escape sequences before counting printable length + for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" + do + test -n "$_G_tc" && { + _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` + _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` + } + done + _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes + + func_echo_infix_1_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_infix_1_IFS + $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 + _G_prefix=$_G_indent + done + IFS=$func_echo_infix_1_IFS +} + + +# func_error ARG... +# ----------------- +# Echo program name prefixed message to standard error. +func_error () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 +} + + +# func_fatal_error ARG... +# ----------------------- +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + $debug_cmd + + func_error "$*" + exit $EXIT_FAILURE +} + + +# func_grep EXPRESSION FILENAME +# ----------------------------- +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $debug_cmd + + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_len STRING +# --------------- +# Set func_len_result to the length of STRING. STRING may not +# start with a hyphen. + test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_len () + { + $debug_cmd + + func_len_result=${#1} + }' +else + func_len () + { + $debug_cmd + + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` + } +fi + + +# func_mkdir_p DIRECTORY-PATH +# --------------------------- +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + $debug_cmd + + _G_directory_path=$1 + _G_dir_list= + + if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then + + # Protect directory names starting with '-' + case $_G_directory_path in + -*) _G_directory_path=./$_G_directory_path ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$_G_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + _G_dir_list=$_G_directory_path:$_G_dir_list + + # If the last portion added has no slash in it, the list is done + case $_G_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` + done + _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` + + func_mkdir_p_IFS=$IFS; IFS=: + for _G_dir in $_G_dir_list; do + IFS=$func_mkdir_p_IFS + # mkdir can fail with a 'File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$_G_dir" 2>/dev/null || : + done + IFS=$func_mkdir_p_IFS + + # Bail out if we (or some other process) failed to create a directory. + test -d "$_G_directory_path" || \ + func_fatal_error "Failed to create '$1'" + fi +} + + +# func_mktempdir [BASENAME] +# ------------------------- +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, BASENAME is the basename for that directory. +func_mktempdir () +{ + $debug_cmd + + _G_template=${TMPDIR-/tmp}/${1-$progname} + + if test : = "$opt_dry_run"; then + # Return a directory name, but don't create it in dry-run mode + _G_tmpdir=$_G_template-$$ + else + + # If mktemp works, use that first and foremost + _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` + + if test ! -d "$_G_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + _G_tmpdir=$_G_template-${RANDOM-0}$$ + + func_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$_G_tmpdir" + umask $func_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$_G_tmpdir" || \ + func_fatal_error "cannot create temporary directory '$_G_tmpdir'" + fi + + $ECHO "$_G_tmpdir" +} + + +# func_normal_abspath PATH +# ------------------------ +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +func_normal_abspath () +{ + $debug_cmd + + # These SED scripts presuppose an absolute path with a trailing slash. + _G_pathcar='s|^/\([^/]*\).*$|\1|' + _G_pathcdr='s|^/[^/]*||' + _G_removedotparts=':dotsl + s|/\./|/|g + t dotsl + s|/\.$|/|' + _G_collapseslashes='s|/\{1,\}|/|g' + _G_finalslash='s|/*$|/|' + + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` + while :; do + # Processed it all yet? + if test / = "$func_normal_abspath_tpath"; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result"; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + + +# func_notquiet ARG... +# -------------------- +# Echo program name prefixed message only when not in quiet mode. +func_notquiet () +{ + $debug_cmd + + $opt_quiet || func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + + +# func_relative_path SRCDIR DSTDIR +# -------------------------------- +# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. +func_relative_path () +{ + $debug_cmd + + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=$func_dirname_result + if test -z "$func_relative_path_tlibdir"; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test -n "$func_stripname_result"; then + func_append func_relative_path_result "/$func_stripname_result" + fi + + # Normalisation. If bindir is libdir, return '.' else relative path. + if test -n "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + fi + + test -n "$func_relative_path_result" || func_relative_path_result=. + + : +} + + +# func_quote_for_eval ARG... +# -------------------------- +# Aesthetically quote ARGs to be evaled later. +# This function returns two values: +# i) func_quote_for_eval_result +# double-quoted, suitable for a subsequent eval +# ii) func_quote_for_eval_unquoted_result +# has all characters that are still active within double +# quotes backslashified. +func_quote_for_eval () +{ + $debug_cmd + + func_quote_for_eval_unquoted_result= + func_quote_for_eval_result= + while test 0 -lt $#; do + case $1 in + *[\\\`\"\$]*) + _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; + *) + _G_unquoted_arg=$1 ;; + esac + if test -n "$func_quote_for_eval_unquoted_result"; then + func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" + else + func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" + fi + + case $_G_unquoted_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and variable expansion + # for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_quoted_arg=\"$_G_unquoted_arg\" + ;; + *) + _G_quoted_arg=$_G_unquoted_arg + ;; + esac + + if test -n "$func_quote_for_eval_result"; then + func_append func_quote_for_eval_result " $_G_quoted_arg" + else + func_append func_quote_for_eval_result "$_G_quoted_arg" + fi + shift + done +} + + +# func_quote_for_expand ARG +# ------------------------- +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + $debug_cmd + + case $1 in + *[\\\`\"]*) + _G_arg=`$ECHO "$1" | $SED \ + -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; + *) + _G_arg=$1 ;; + esac + + case $_G_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_arg=\"$_G_arg\" + ;; + esac + + func_quote_for_expand_result=$_G_arg +} + + +# func_stripname PREFIX SUFFIX NAME +# --------------------------------- +# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_stripname () + { + $debug_cmd + + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary variable first. + func_stripname_result=$3 + func_stripname_result=${func_stripname_result#"$1"} + func_stripname_result=${func_stripname_result%"$2"} + }' +else + func_stripname () + { + $debug_cmd + + case $2 in + .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; + *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; + esac + } +fi + + +# func_show_eval CMD [FAIL_EXP] +# ----------------------------- +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + func_quote_for_expand "$_G_cmd" + eval "func_notquiet $func_quote_for_expand_result" + + $opt_dry_run || { + eval "$_G_cmd" + _G_status=$? + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_show_eval_locale CMD [FAIL_EXP] +# ------------------------------------ +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + $opt_quiet || { + func_quote_for_expand "$_G_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + $opt_dry_run || { + eval "$_G_user_locale + $_G_cmd" + _G_status=$? + eval "$_G_safe_locale" + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_tr_sh +# ---------- +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + $debug_cmd + + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_verbose ARG... +# ------------------- +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $debug_cmd + + $opt_verbose && func_echo "$*" + + : +} + + +# func_warn_and_continue ARG... +# ----------------------------- +# Echo program name prefixed warning message to standard error. +func_warn_and_continue () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 +} + + +# func_warning CATEGORY ARG... +# ---------------------------- +# Echo program name prefixed warning message to standard error. Warning +# messages can be filtered according to CATEGORY, where this function +# elides messages where CATEGORY is not listed in the global variable +# 'opt_warning_types'. +func_warning () +{ + $debug_cmd + + # CATEGORY must be in the warning_categories list! + case " $warning_categories " in + *" $1 "*) ;; + *) func_internal_error "invalid warning category '$1'" ;; + esac + + _G_category=$1 + shift + + case " $opt_warning_types " in + *" $_G_category "*) $warning_func ${1+"$@"} ;; + esac +} + + +# func_sort_ver VER1 VER2 +# ----------------------- +# 'sort -V' is not generally available. +# Note this deviates from the version comparison in automake +# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a +# but this should suffice as we won't be specifying old +# version formats or redundant trailing .0 in bootstrap.conf. +# If we did want full compatibility then we should probably +# use m4_version_compare from autoconf. +func_sort_ver () +{ + $debug_cmd + + printf '%s\n%s\n' "$1" "$2" \ + | 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 +} + +# func_lt_ver PREV CURR +# --------------------- +# Return true if PREV and CURR are in the correct order according to +# func_sort_ver, otherwise false. Use it like this: +# +# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." +func_lt_ver () +{ + $debug_cmd + + test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: +#! /bin/sh + +# Set a version string for this script. +scriptversion=2014-01-07.03; # UTC + +# A portable, pluggable option parser for Bourne shell. +# Written by Gary V. Vaughan, 2010 + +# Copyright (C) 2010-2015 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Please report bugs or propose patches to gary@gnu.org. + + +## ------ ## +## Usage. ## +## ------ ## + +# This file is a library for parsing options in your shell scripts along +# with assorted other useful supporting features that you can make use +# of too. +# +# For the simplest scripts you might need only: +# +# #!/bin/sh +# . relative/path/to/funclib.sh +# . relative/path/to/options-parser +# scriptversion=1.0 +# func_options ${1+"$@"} +# eval set dummy "$func_options_result"; shift +# ...rest of your script... +# +# In order for the '--version' option to work, you will need to have a +# suitably formatted comment like the one at the top of this file +# starting with '# Written by ' and ending with '# warranty; '. +# +# For '-h' and '--help' to work, you will also need a one line +# description of your script's purpose in a comment directly above the +# '# Written by ' line, like the one at the top of this file. +# +# The default options also support '--debug', which will turn on shell +# execution tracing (see the comment above debug_cmd below for another +# use), and '--verbose' and the func_verbose function to allow your script +# to display verbose messages only when your user has specified +# '--verbose'. +# +# After sourcing this file, you can plug processing for additional +# options by amending the variables from the 'Configuration' section +# below, and following the instructions in the 'Option parsing' +# section further down. + +## -------------- ## +## Configuration. ## +## -------------- ## + +# You should override these variables in your script after sourcing this +# file so that they reflect the customisations you have added to the +# option parser. + +# The usage line for option parsing errors and the start of '-h' and +# '--help' output messages. You can embed shell variables for delayed +# expansion at the time the message is displayed, but you will need to +# quote other shell meta-characters carefully to prevent them being +# expanded when the contents are evaled. +usage='$progpath [OPTION]...' + +# Short help message in response to '-h' and '--help'. Add to this or +# override it after sourcing this library to reflect the full set of +# options your script accepts. +usage_message="\ + --debug enable verbose shell tracing + -W, --warnings=CATEGORY + report the warnings falling in CATEGORY [all] + -v, --verbose verbosely report processing + --version print version information and exit + -h, --help print short or long help message and exit +" + +# Additional text appended to 'usage_message' in response to '--help'. +long_help_message=" +Warning categories include: + 'all' show all warnings + 'none' turn off all the warnings + 'error' warnings are treated as fatal errors" + +# Help message printed before fatal option parsing errors. +fatal_help="Try '\$progname --help' for more information." + + + +## ------------------------- ## +## Hook function management. ## +## ------------------------- ## + +# This section contains functions for adding, removing, and running hooks +# to the main code. A hook is just a named list of of function, that can +# be run in order later on. + +# func_hookable FUNC_NAME +# ----------------------- +# Declare that FUNC_NAME will run hooks added with +# 'func_add_hook FUNC_NAME ...'. +func_hookable () +{ + $debug_cmd + + func_append hookable_fns " $1" +} + + +# func_add_hook FUNC_NAME HOOK_FUNC +# --------------------------------- +# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must +# first have been declared "hookable" by a call to 'func_hookable'. +func_add_hook () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not accept hook functions." ;; + esac + + eval func_append ${1}_hooks '" $2"' +} + + +# func_remove_hook FUNC_NAME HOOK_FUNC +# ------------------------------------ +# Remove HOOK_FUNC from the list of functions called by FUNC_NAME. +func_remove_hook () +{ + $debug_cmd + + eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' +} + + +# func_run_hooks FUNC_NAME [ARG]... +# --------------------------------- +# Run all hook functions registered to FUNC_NAME. +# It is assumed that the list of hook functions contains nothing more +# than a whitespace-delimited list of legal shell function names, and +# no effort is wasted trying to catch shell meta-characters or preserve +# whitespace. +func_run_hooks () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not support hook funcions.n" ;; + esac + + eval _G_hook_fns=\$$1_hooks; shift + + for _G_hook in $_G_hook_fns; do + eval $_G_hook '"$@"' + + # store returned options list back into positional + # parameters for next 'cmd' execution. + eval _G_hook_result=\$${_G_hook}_result + eval set dummy "$_G_hook_result"; shift + done + + func_quote_for_eval ${1+"$@"} + func_run_hooks_result=$func_quote_for_eval_result +} + + + +## --------------- ## +## Option parsing. ## +## --------------- ## + +# In order to add your own option parsing hooks, you must accept the +# full positional parameter list in your hook function, remove any +# options that you action, and then pass back the remaining unprocessed +# options in '_result', escaped suitably for +# 'eval'. Like this: +# +# my_options_prep () +# { +# $debug_cmd +# +# # Extend the existing usage message. +# usage_message=$usage_message' +# -s, --silent don'\''t print informational messages +# ' +# +# func_quote_for_eval ${1+"$@"} +# my_options_prep_result=$func_quote_for_eval_result +# } +# func_add_hook func_options_prep my_options_prep +# +# +# my_silent_option () +# { +# $debug_cmd +# +# # Note that for efficiency, we parse as many options as we can +# # recognise in a loop before passing the remainder back to the +# # caller on the first unrecognised argument we encounter. +# while test $# -gt 0; do +# opt=$1; shift +# case $opt in +# --silent|-s) opt_silent=: ;; +# # Separate non-argument short options: +# -s*) func_split_short_opt "$_G_opt" +# set dummy "$func_split_short_opt_name" \ +# "-$func_split_short_opt_arg" ${1+"$@"} +# shift +# ;; +# *) set dummy "$_G_opt" "$*"; shift; break ;; +# esac +# done +# +# func_quote_for_eval ${1+"$@"} +# my_silent_option_result=$func_quote_for_eval_result +# } +# func_add_hook func_parse_options my_silent_option +# +# +# my_option_validation () +# { +# $debug_cmd +# +# $opt_silent && $opt_verbose && func_fatal_help "\ +# '--silent' and '--verbose' options are mutually exclusive." +# +# func_quote_for_eval ${1+"$@"} +# my_option_validation_result=$func_quote_for_eval_result +# } +# func_add_hook func_validate_options my_option_validation +# +# You'll alse need to manually amend $usage_message to reflect the extra +# options you parse. It's preferable to append if you can, so that +# multiple option parsing hooks can be added safely. + + +# func_options [ARG]... +# --------------------- +# All the functions called inside func_options are hookable. See the +# individual implementations for details. +func_hookable func_options +func_options () +{ + $debug_cmd + + func_options_prep ${1+"$@"} + eval func_parse_options \ + ${func_options_prep_result+"$func_options_prep_result"} + eval func_validate_options \ + ${func_parse_options_result+"$func_parse_options_result"} + + eval func_run_hooks func_options \ + ${func_validate_options_result+"$func_validate_options_result"} + + # save modified positional parameters for caller + func_options_result=$func_run_hooks_result +} + + +# func_options_prep [ARG]... +# -------------------------- +# All initialisations required before starting the option parse loop. +# Note that when calling hook functions, we pass through the list of +# positional parameters. If a hook function modifies that list, and +# needs to propogate that back to rest of this script, then the complete +# modified list must be put in 'func_run_hooks_result' before +# returning. +func_hookable func_options_prep +func_options_prep () +{ + $debug_cmd + + # Option defaults: + opt_verbose=false + opt_warning_types= + + func_run_hooks func_options_prep ${1+"$@"} + + # save modified positional parameters for caller + func_options_prep_result=$func_run_hooks_result +} + + +# func_parse_options [ARG]... +# --------------------------- +# The main option parsing loop. +func_hookable func_parse_options +func_parse_options () +{ + $debug_cmd + + func_parse_options_result= + + # this just eases exit handling + while test $# -gt 0; do + # Defer to hook functions for initial option parsing, so they + # get priority in the event of reusing an option name. + func_run_hooks func_parse_options ${1+"$@"} + + # Adjust func_parse_options positional parameters to match + eval set dummy "$func_run_hooks_result"; shift + + # Break out of the loop if we already parsed every option. + test $# -gt 0 || break + + _G_opt=$1 + shift + case $_G_opt in + --debug|-x) debug_cmd='set -x' + func_echo "enabling shell trace mode" + $debug_cmd + ;; + + --no-warnings|--no-warning|--no-warn) + set dummy --warnings none ${1+"$@"} + shift + ;; + + --warnings|--warning|-W) + test $# = 0 && func_missing_arg $_G_opt && break + case " $warning_categories $1" in + *" $1 "*) + # trailing space prevents matching last $1 above + func_append_uniq opt_warning_types " $1" + ;; + *all) + opt_warning_types=$warning_categories + ;; + *none) + opt_warning_types=none + warning_func=: + ;; + *error) + opt_warning_types=$warning_categories + warning_func=func_fatal_error + ;; + *) + func_fatal_error \ + "unsupported warning category: '$1'" + ;; + esac + shift + ;; + + --verbose|-v) opt_verbose=: ;; + --version) func_version ;; + -\?|-h) func_usage ;; + --help) func_help ;; + + # Separate optargs to long options (plugins may need this): + --*=*) func_split_equals "$_G_opt" + set dummy "$func_split_equals_lhs" \ + "$func_split_equals_rhs" ${1+"$@"} + shift + ;; + + # Separate optargs to short options: + -W*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-v*|-x*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done + + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + func_parse_options_result=$func_quote_for_eval_result +} + + +# func_validate_options [ARG]... +# ------------------------------ +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +func_hookable func_validate_options +func_validate_options () +{ + $debug_cmd + + # Display all warnings if -W was not given. + test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" + + func_run_hooks func_validate_options ${1+"$@"} + + # Bail if the options were screwed! + $exit_cmd $EXIT_FAILURE + + # save modified positional parameters for caller + func_validate_options_result=$func_run_hooks_result +} + + + +## ----------------- ## +## Helper functions. ## +## ----------------- ## + +# This section contains the helper functions used by the rest of the +# hookable option parser framework in ascii-betical order. + + +# func_fatal_help ARG... +# ---------------------- +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + eval \$ECHO \""$fatal_help"\" + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + + +# func_help +# --------- +# Echo long help message to standard output and exit. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message" + exit 0 +} + + +# func_missing_arg ARGNAME +# ------------------------ +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $debug_cmd + + func_error "Missing argument for '$1'." + exit_cmd=exit +} + + +# func_split_equals STRING +# ------------------------ +# Set func_split_equals_lhs and func_split_equals_rhs shell variables after +# splitting STRING at the '=' sign. +test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=${1%%=*} + func_split_equals_rhs=${1#*=} + test "x$func_split_equals_lhs" = "x$1" \ + && func_split_equals_rhs= + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` + func_split_equals_rhs= + test "x$func_split_equals_lhs" = "x$1" \ + || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` + } +fi #func_split_equals + + +# func_split_short_opt SHORTOPT +# ----------------------------- +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"} + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` + func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` + } +fi #func_split_short_opt + + +# func_usage +# ---------- +# Echo short help message to standard output and exit. +func_usage () +{ + $debug_cmd + + func_usage_message + $ECHO "Run '$progname --help |${PAGER-more}' for full usage" + exit 0 +} + + +# func_usage_message +# ------------------ +# Echo short help message to standard output. +func_usage_message () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + echo + $SED -n 's|^# || + /^Written by/{ + x;p;x + } + h + /^Written by/q' < "$progpath" + echo + eval \$ECHO \""$usage_message"\" +} + + +# func_version +# ------------ +# Echo version message to standard output and exit. +func_version () +{ + $debug_cmd + + printf '%s\n' "$progname $scriptversion" + $SED -n ' + /(C)/!b go + :more + /\./!{ + N + s|\n# | | + b more + } + :go + /^# Written by /,/# warranty; / { + s|^# || + s|^# *$|| + s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| + p + } + /^# Written by / { + s|^# || + p + } + /^warranty; /q' < "$progpath" + + exit $? +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: + +# Set a version string. +scriptversion='(GNU libtool) 2.4.6' + + +# func_echo ARG... +# ---------------- +# Libtool also displays the current mode in messages, so override +# funclib.sh func_echo with this custom definition. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_warning ARG... +# ------------------- +# Libtool warnings are not categorized, so override funclib.sh +# func_warning with this simpler definition. +func_warning () +{ + $debug_cmd + + $warning_func ${1+"$@"} +} + + +## ---------------- ## +## Options parsing. ## +## ---------------- ## + +# Hook in the functions to make sure our own options are parsed during +# the option parsing loop. + +usage='$progpath [OPTION]... [MODE-ARG]...' + +# Short help message in response to '-h'. +usage_message="Options: + --config show all configuration variables + --debug enable verbose shell tracing + -n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --mode=MODE use operation mode MODE + --no-warnings equivalent to '-Wnone' + --preserve-dup-deps don't remove duplicate dependency libraries + --quiet, --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + -v, --verbose print more informational messages than default + --version print version information + -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] + -h, --help, --help-all print short, long, or detailed help message +" + +# Additional text appended to 'usage_message' in response to '--help'. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. When passed as first option, +'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. +Try '$progname --help --mode=MODE' for a more detailed description of MODE. + +When reporting a bug, please describe a test case to reproduce it and +include the following information: + + host-triplet: $host + shell: $SHELL + compiler: $LTCC + compiler flags: $LTCFLAGS + linker: $LD (gnu? $with_gnu_ld) + version: $progname $scriptversion Debian-2.4.6-2 + automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` + autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` + +Report bugs to . +GNU libtool home page: . +General help using GNU software: ." + exit 0 +} + + +# func_lo2o OBJECT-NAME +# --------------------- +# Transform OBJECT-NAME from a '.lo' suffix to the platform specific +# object suffix. + +lo2o=s/\\.lo\$/.$objext/ +o2lo=s/\\.$objext\$/.lo/ + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_lo2o () + { + case $1 in + *.lo) func_lo2o_result=${1%.lo}.$objext ;; + * ) func_lo2o_result=$1 ;; + esac + }' + + # func_xform LIBOBJ-OR-SOURCE + # --------------------------- + # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) + # suffix to a '.lo' libtool-object suffix. + eval 'func_xform () + { + func_xform_result=${1%.*}.lo + }' +else + # ...otherwise fall back to using sed. + func_lo2o () + { + func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` + } + + func_xform () + { + func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` + } +fi + + +# func_fatal_configuration ARG... +# ------------------------------- +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func__fatal_error ${1+"$@"} \ + "See the $PACKAGE documentation for more information." \ + "Fatal configuration error." +} + + +# func_config +# ----------- +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + + +# func_features +# ------------- +# Display the features supported by this script. +func_features () +{ + echo "host: $host" + if test yes = "$build_libtool_libs"; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test yes = "$build_old_libs"; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + + exit $? +} + + +# func_enable_tag TAGNAME +# ----------------------- +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname=$1 + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf=/$re_begincf/,/$re_endcf/p + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + + +# func_check_version_match +# ------------------------ +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# libtool_options_prep [ARG]... +# ----------------------------- +# Preparation for options parsed by libtool. +libtool_options_prep () +{ + $debug_mode + + # Option defaults: + opt_config=false + opt_dlopen= + opt_dry_run=false + opt_help=false + opt_mode= + opt_preserve_dup_deps=false + opt_quiet=false + + nonopt= + preserve_args= + + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + esac + + # Pass back the list of options. + func_quote_for_eval ${1+"$@"} + libtool_options_prep_result=$func_quote_for_eval_result +} +func_add_hook func_options_prep libtool_options_prep + + +# libtool_parse_options [ARG]... +# --------------------------------- +# Provide handling for libtool specific options. +libtool_parse_options () +{ + $debug_cmd + + # Perform our own loop to consume as many options as possible in + # each iteration. + while test $# -gt 0; do + _G_opt=$1 + shift + case $_G_opt in + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + + --config) func_config ;; + + --dlopen|-dlopen) + opt_dlopen="${opt_dlopen+$opt_dlopen +}$1" + shift + ;; + + --preserve-dup-deps) + opt_preserve_dup_deps=: ;; + + --features) func_features ;; + + --finish) set dummy --mode finish ${1+"$@"}; shift ;; + + --help) opt_help=: ;; + + --help-all) opt_help=': help-all' ;; + + --mode) test $# = 0 && func_missing_arg $_G_opt && break + opt_mode=$1 + case $1 in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $_G_opt" + exit_cmd=exit + break + ;; + esac + shift + ;; + + --no-silent|--no-quiet) + opt_quiet=false + func_append preserve_args " $_G_opt" + ;; + + --no-warnings|--no-warning|--no-warn) + opt_warning=false + func_append preserve_args " $_G_opt" + ;; + + --no-verbose) + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --silent|--quiet) + opt_quiet=: + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --tag) test $# = 0 && func_missing_arg $_G_opt && break + opt_tag=$1 + func_append preserve_args " $_G_opt $1" + func_enable_tag "$1" + shift + ;; + + --verbose|-v) opt_quiet=false + opt_verbose=: + func_append preserve_args " $_G_opt" + ;; + + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done + + + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + libtool_parse_options_result=$func_quote_for_eval_result +} +func_add_hook func_parse_options libtool_parse_options + + + +# libtool_validate_options [ARG]... +# --------------------------------- +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +libtool_validate_options () +{ + # save first non-option argument + if test 0 -lt $#; then + nonopt=$1 + shift + fi + + # preserve --debug + test : = "$debug_cmd" || func_append preserve_args " --debug" + + case $host in + # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 + # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 + *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + test yes != "$build_libtool_libs" \ + && test yes != "$build_old_libs" \ + && func_fatal_configuration "not configured to build any kind of library" + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test execute != "$opt_mode"; then + func_error "unrecognized option '-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help=$help + help="Try '$progname --help --mode=$opt_mode' for more information." + } + + # Pass back the unparsed argument list + func_quote_for_eval ${1+"$@"} + libtool_validate_options_result=$func_quote_for_eval_result +} +func_add_hook func_validate_options libtool_validate_options + + +# Process options as early as possible so that --help and --version +# can return quickly. +func_options ${1+"$@"} +eval set dummy "$func_options_result"; shift + + + +## ----------- ## +## Main. ## +## ----------- ## + +magic='%%%MAGIC variable%%%' +magic_exe='%%%MAGIC EXE variable%%%' + +# Global variables. +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# func_generated_by_libtool +# True iff stdin has been generated by Libtool. This function is only +# a basic sanity check; it will hardly flush out determined imposters. +func_generated_by_libtool_p () +{ + $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_p file +# True iff FILE is a libtool '.la' library or '.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool '.la' library or '.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if 'file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case $lalib_p_line in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test yes = "$lalib_p" +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + test -f "$1" && + $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $debug_cmd + + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# 'FILE.' does not work on cygwin managed mounts. +func_source () +{ + $debug_cmd + + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case $lt_sysroot:$1 in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result='='$func_stripname_result + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $debug_cmd + + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with '--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=$1 + if test yes = "$build_libtool_libs"; then + write_lobj=\'$2\' + else + write_lobj=none + fi + + if test yes = "$build_old_libs"; then + write_oldobj=\'$3\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $debug_cmd + + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result= + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result"; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $debug_cmd + + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $debug_cmd + + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $debug_cmd + + if test -z "$2" && test -n "$1"; then + func_error "Could not determine host file name corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result=$1 + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $debug_cmd + + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " '$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result=$3 + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $debug_cmd + + case $4 in + $1 ) func_to_host_path_result=$3$func_to_host_path_result + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via '$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $debug_cmd + + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $debug_cmd + + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result=$1 +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result=$func_convert_core_msys_to_w32_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result=$func_convert_core_file_wine_to_w32_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result=$func_cygpath_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result=$func_cygpath_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via '$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $debug_cmd + + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd=func_convert_path_$func_stripname_result + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $debug_cmd + + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result=$1 +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result=$func_convert_core_msys_to_w32_result + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result=$func_convert_core_path_wine_to_w32_result + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result=$func_cygpath_result + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result=$func_cygpath_result + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_dll_def_p FILE +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with _LT_DLL_DEF_P in libtool.m4 +func_dll_def_p () +{ + $debug_cmd + + func_dll_def_p_tmp=`$SED -n \ + -e 's/^[ ]*//' \ + -e '/^\(;.*\)*$/d' \ + -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ + -e q \ + "$1"` + test DEF = "$func_dll_def_p_tmp" +} + + +# func_mode_compile arg... +func_mode_compile () +{ + $debug_cmd + + # Get the compilation command and the source file. + base_compile= + srcfile=$nonopt # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg=$arg + arg_mode=normal + ;; + + target ) + libobj=$arg + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify '-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs=$IFS; IFS=, + for arg in $args; do + IFS=$save_ifs + func_append_quoted lastarg "$arg" + done + IFS=$save_ifs + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg=$srcfile + srcfile=$arg + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with '-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj=$func_basename_result + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from '$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test yes = "$build_libtool_libs" \ + || func_fatal_configuration "cannot build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name '$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname=$func_basename_result + xdir=$func_dirname_result + lobj=$xdir$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test yes = "$build_old_libs"; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test no = "$compiler_c_o"; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext + lockfile=$output_obj.lock + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test yes = "$need_locks"; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test warn = "$need_locks"; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test yes = "$build_libtool_libs"; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test no != "$pic_mode"; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test warn = "$need_locks" && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test yes = "$suppress_opt"; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test yes = "$build_old_libs"; then + if test yes != "$pic_mode"; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test yes = "$compiler_c_o"; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test warn = "$need_locks" && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test no != "$need_locks"; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test compile = "$opt_mode" && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a '.o' file suitable for static linking + -static only build a '.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler + +COMPILE-COMMAND is a command to be used in creating a 'standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix '.c' with the +library object suffix, '.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to '-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the '--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the 'install' or 'cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE use a list of object files found in FILE to specify objects + -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +All other options (arguments beginning with '-') are ignored. + +Every other argument is treated as a filename. Files ending in '.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in '.la', then a libtool library is created, +only library objects ('.lo' files) may be specified, and '-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created +using 'ar' and 'ranlib', or on Windows using 'lib'. + +If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode '$opt_mode'" + ;; + esac + + echo + $ECHO "Try '$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test : = "$opt_help"; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | $SED -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + $SED '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $debug_cmd + + # The first argument is the command name. + cmd=$nonopt + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "'$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "'$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "'$file' was not linked with '-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir=$func_dirname_result + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir=$func_dirname_result + ;; + + *) + func_warning "'-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir=$absdir + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic=$magic + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file=$progdir/$program + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file=$progdir/$program + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if $opt_dry_run; then + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + else + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd=\$cmd$args + fi +} + +test execute = "$opt_mode" && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $debug_cmd + + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "'$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument '$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and '=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_quiet && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the '-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the '$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the '$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the '$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test finish = "$opt_mode" && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $debug_cmd + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac + then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=false + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=: ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test X-m = "X$prev" && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the '$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=: + if $isdir; then + destdir=$dest + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir=$func_dirname_result + destname=$func_basename_result + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "'$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "'$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic=$magic + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "'$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir=$func_dirname_result + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking '$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname=$1 + shift + + srcname=$realname + test -n "$relink_command" && srcname=${realname}T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme=$stripme + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme= + ;; + esac + ;; + os2*) + case $realname in + *_dll.a) + tstripme= + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try 'ln -sf' first, because the 'ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib=$destdir/$realname + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name=$func_basename_result + instname=$dir/${name}i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append staticlibs " $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile=$destdir/$destname + else + func_basename "$file" + destfile=$func_basename_result + destfile=$destdir/$destfile + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest=$destfile + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to '$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test yes = "$build_old_libs"; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile=$destdir/$destname + else + func_basename "$file" + destfile=$func_basename_result + destfile=$destdir/$destfile + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext= + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=.exe + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script '$wrapper'" + + finalize=: + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "'$lib' has not been installed in '$libdir'" + finalize=false + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test no = "$fast_install" && test -n "$relink_command"; then + $opt_dry_run || { + if $finalize; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file=$func_basename_result + outputname=$tmpdir/$file + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_quiet || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink '$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file=$outputname + else + func_warning "cannot relink '$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name=$func_basename_result + + # Set up the ranlib parameters. + oldlib=$destdir/$name + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $tool_oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run '$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test install = "$opt_mode" && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $debug_cmd + + my_outputname=$1 + my_originator=$2 + my_pic_p=${3-false} + my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms=${my_outputname}S.c + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist=$output_objdir/$my_outputname.nm + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* External symbol declarations for the compiler. */\ +" + + if test yes = "$dlself"; then + func_verbose "generating symbol list for '$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from '$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols=$output_objdir/$outputname.exp + $opt_dry_run || { + $RM $export_symbols + eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from '$dlprefile'" + func_basename "$dlprefile" + name=$func_basename_result + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename= + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname"; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename=$func_basename_result + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename"; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + func_show_eval '$RM "${nlist}I"' + if test -n "$global_symbol_to_import"; then + eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[];\ +" + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ +static void lt_syminit(void) +{ + LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; + for (; symbol->name; ++symbol) + {" + $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" + echo >> "$output_objdir/$my_dlsyms" "\ + } +}" + fi + echo >> "$output_objdir/$my_dlsyms" "\ +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{ {\"$my_originator\", (void *) 0}," + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ + {\"@INIT@\", (void *) <_syminit}," + fi + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + $my_pic_p && pic_flag_for_symtable=" $pic_flag" + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' + + # Transform the symbol file into the correct name. + symfileobj=$output_objdir/${my_outputname}S.$objext + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for '$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + 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)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $debug_cmd + + win32_libid_type=unknown + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + case $nm_interface in + "MS dumpbin") + if func_cygming_ms_implib_p "$1" || + func_cygming_gnu_implib_p "$1" + then + win32_nmres=import + else + win32_nmres= + fi + ;; + *) + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s|.*|import| + p + q + } + }'` + ;; + esac + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $debug_cmd + + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $debug_cmd + + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive that possess that section. Heuristic: eliminate + # all those that have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $debug_cmd + + if func_cygming_gnu_implib_p "$1"; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1"; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result= + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $debug_cmd + + f_ex_an_ar_dir=$1; shift + f_ex_an_ar_oldlib=$1 + if test yes = "$lock_old_archive_extraction"; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test yes = "$lock_old_archive_extraction"; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $debug_cmd + + my_gentop=$1; shift + my_oldlibs=${1+"$@"} + my_oldobjs= + my_xlib= + my_xabs= + my_xdir= + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib=$func_basename_result + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir=$my_gentop/$my_xlib_u + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + func_basename "$darwin_archive" + darwin_base_archive=$func_basename_result + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches; do + func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" + $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" + cd "unfat-$$/$darwin_base_archive-$darwin_arch" + func_extract_an_archive "`pwd`" "$darwin_base_archive" + cd "$darwin_curdir" + $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result=$my_oldobjs +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory where it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ that is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options that match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case \" \$* \" in + *\\ --lt-*) + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done ;; + esac + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test yes = "$fast_install"; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + \$ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* declarations of non-ANSI functions */ +#if defined __MINGW32__ +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined __CYGWIN__ +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined other_platform || defined ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined _MSC_VER +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +#elif defined __MINGW32__ +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined __CYGWIN__ +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined other platforms ... */ +#endif + +#if defined PATH_MAX +# define LT_PATHMAX PATH_MAX +#elif defined MAXPATHLEN +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ + defined __OS2__ +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free (stale); stale = 0; } \ +} while (0) + +#if defined LT_DEBUGWRAPPER +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + size_t tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined HAVE_DOS_BASED_FILE_SYSTEM + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined HAVE_DOS_BASED_FILE_SYSTEM + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = (size_t) (q - p); + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (STREQ (str, pat)) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + size_t len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + size_t orig_value_len = strlen (orig_value); + size_t add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + size_t len = strlen (new_value); + while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[--len] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#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" +#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" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -n -e ' +s/^\(.\{79\}\)\(..*\)/\1\ +\2/ +h +s/\([\\"]\)/\\\1/g +s/$/\\n/ +s/\([^\n]*\).*/ fputs ("\1", f);/p +g +D' + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $debug_cmd + + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_suncc_cstd_abi +# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! +# Several compiler flags select an ABI that is incompatible with the +# Cstd library. Avoid specifying it if any are in CXXFLAGS. +func_suncc_cstd_abi () +{ + $debug_cmd + + case " $compile_command " in + *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) + suncc_use_cstd_abi=no + ;; + *) + suncc_use_cstd_abi=yes + ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $debug_cmd + + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # what system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll that has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + os2dllname= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=false + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module=$wl-single_module + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test yes != "$build_libtool_libs" \ + && func_fatal_configuration "cannot build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg=$1 + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir=$arg + prev= + continue + ;; + dlfiles|dlprefiles) + $preload || { + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=: + } + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test no = "$dlself"; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test dlprefiles = "$prev"; then + dlself=yes + elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test dlfiles = "$prev"; then + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols=$arg + test -f "$arg" \ + || func_fatal_error "symbol file '$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex=$arg + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir=$arg + prev= + continue + ;; + mllvm) + # Clang does not use LLVM to link, so we can simply discard any + # '-mllvm $arg' options when doing the link step. + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + if test none != "$pic_object"; then + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + fi + + # Non-PIC object. + if test none != "$non_pic_object"; then + # Prepend the subdirectory the object is found in. + non_pic_object=$xdir$non_pic_object + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object=$pic_object + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "'$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file '$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + os2dllname) + os2dllname=$arg + prev= + continue + ;; + precious_regex) + precious_files_regex=$arg + prev= + continue + ;; + release) + release=-$arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test rpath = "$prev"; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds=$arg + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg=$arg + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "'-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test X-export-symbols = "X$arg"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between '-L' and '$1'" + else + func_fatal_error "need path for '-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of '$dir'" + dir=$absdir + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test X-lc = "X$arg" || test X-lm = "X$arg"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test X-lc = "X$arg" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) + # Do not include libc due to us having libc/libc_r. + test X-lc = "X$arg" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test X-lc = "X$arg" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test X-lc = "X$arg" && continue + ;; + esac + elif test X-lc_r = "X$arg"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -mllvm) + prev=mllvm + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + continue + ;; + + -multi_module) + single_module=$wl-multi_module + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "'-no-install' is ignored for $host" + func_warning "assuming '-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -os2dllname) + prev=os2dllname + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs=$IFS; IFS=, + for flag in $args; do + IFS=$save_ifs + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" + done + IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs=$IFS; IFS=, + for flag in $args; do + IFS=$save_ifs + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" + done + IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # -fstack-protector* stack protector flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -specs=* GCC specs files + # -stdlib=* select c++ std lib with clang + # -fsanitize=* Clang/GCC memory and address sanitizer + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ + -specs=*|-fsanitize=*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + -Z*) + if test os2 = "`expr $host : '.*\(os2\)'`"; then + # OS/2 uses -Zxxx to specify OS/2-specific options + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case $arg in + -Zlinker | -Zstack) + prev=xcompiler + ;; + esac + continue + else + # Otherwise treat like 'Some other compiler flag' below + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + fi + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + test none = "$pic_object" || { + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + } + + # Non-PIC object. + if test none != "$non_pic_object"; then + # Prepend the subdirectory the object is found in. + non_pic_object=$xdir$non_pic_object + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object=$pic_object + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "'$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test dlfiles = "$prev"; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test dlprefiles = "$prev"; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the '$prevarg' option requires an argument" + + if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname=$func_basename_result + libobjs_save=$libobjs + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + # Definition is injected by LT_CONFIG during libtool generation. + func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" + + func_dirname "$output" "/" "" + output_objdir=$func_dirname_result$objdir + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test lib = "$linkmode"; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=false + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test lib,link = "$linkmode,$pass"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs=$tmp_deplibs + fi + + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass"; then + libs=$deplibs + deplibs= + fi + if test prog = "$linkmode"; then + case $pass in + dlopen) libs=$dlfiles ;; + dlpreopen) libs=$dlprefiles ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; + esac + fi + if test lib,dlpreopen = "$linkmode,$pass"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs=$dlprefiles + fi + if test dlopen = "$pass"; then + # Collect dlpreopened libraries + save_deplibs=$deplibs + deplibs= + fi + + for deplib in $libs; do + lib= + found=false + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test lib != "$linkmode" && test prog != "$linkmode"; then + func_warning "'-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test lib = "$linkmode"; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib=$searchdir/lib$name$search_ext + if test -f "$lib"; then + if test .la = "$search_ext"; then + found=: + else + found=false + fi + break 2 + fi + done + done + if $found; then + # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll=$l + done + if test "X$ll" = "X$old_library"; then # only static version available + found=false + func_dirname "$lib" "" "." + ladir=$func_dirname_result + lib=$ladir/$old_library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + else + # deplib doesn't seem to be a libtool library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + *.ltframework) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test conv = "$pass" && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + if test scan = "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "'-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test link = "$pass"; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=false + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=: + fi + ;; + pass_all) + valid_a_lib=: + ;; + esac + if $valid_a_lib; then + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + else + echo + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + fi + ;; + esac + continue + ;; + prog) + if test link != "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + elif test prog = "$linkmode"; then + if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=: + continue + ;; + esac # case $deplib + + $found || test -f "$lib" \ + || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "'$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir=$func_dirname_result + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass" || + { test prog != "$linkmode" && test lib != "$linkmode"; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test conv = "$pass"; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for '$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + elif test prog != "$linkmode" && test lib != "$linkmode"; then + func_fatal_error "'$lib' is not a convenience library" + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test yes = "$prefer_static_libs" || + test built,no = "$prefer_static_libs,$installed"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib=$l + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for '$lib'" + fi + + # This library was specified with -dlopen. + if test dlopen = "$pass"; then + test -z "$libdir" \ + && func_fatal_error "cannot -dlopen a convenience library: '$lib'" + if test -z "$dlname" || + test yes != "$dlopen_support" || + test no = "$build_libtool_libs" + then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of '$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir=$ladir + fi + ;; + esac + func_basename "$lib" + laname=$func_basename_result + + # Find the relevant object directory and library name. + if test yes = "$installed"; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library '$lib' was moved." + dir=$ladir + absdir=$abs_ladir + libdir=$abs_ladir + else + dir=$lt_sysroot$libdir + absdir=$lt_sysroot$libdir + fi + test yes = "$hardcode_automatic" && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir=$ladir + absdir=$abs_ladir + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir=$ladir/$objdir + absdir=$abs_ladir/$objdir + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test dlpreopen = "$pass"; then + if test -z "$libdir" && test prog = "$linkmode"; then + func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" + fi + case $host in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test lib = "$linkmode"; then + deplibs="$dir/$old_library $deplibs" + elif test prog,link = "$linkmode,$pass"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test prog = "$linkmode" && test link != "$pass"; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=false + if test no != "$link_all_deplibs" || test -z "$library_names" || + test no = "$build_libtool_libs"; then + linkalldeplibs=: + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if $linkalldeplibs; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test prog,link = "$linkmode,$pass"; then + if test -n "$library_names" && + { { test no = "$prefer_static_libs" || + test built,yes = "$prefer_static_libs,$installed"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then + # Make sure the rpath contains only unique directories. + case $temp_rpath: in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if $alldeplibs && + { test pass_all = "$deplibs_check_method" || + { test yes = "$build_libtool_libs" && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test built = "$use_static_libs" && test yes = "$installed"; then + use_static_libs=no + fi + if test -n "$library_names" && + { test no = "$use_static_libs" || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc* | *os2*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test no = "$installed"; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule= + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule=$dlpremoduletest + break + fi + done + if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then + echo + if test prog = "$linkmode"; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test lib = "$linkmode" && + test yes = "$hardcode_into_libs"; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname=$1 + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname=$dlname + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc* | *os2*) + func_arith $current - $age + major=$func_arith_result + versuffix=-$major + ;; + esac + eval soname=\"$soname_spec\" + else + soname=$realname + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot=$soname + func_basename "$soroot" + soname=$func_basename_result + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from '$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for '$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test prog = "$linkmode" || test relink != "$opt_mode"; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test no = "$hardcode_direct"; then + add=$dir/$linklib + case $host in + *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; + *-*-sysv4*uw2*) add_dir=-L$dir ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir=-L$dir ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we cannot + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library"; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add=$dir/$old_library + fi + elif test -n "$old_library"; then + add=$dir/$old_library + fi + fi + esac + elif test no = "$hardcode_minus_L"; then + case $host in + *-*-sunos*) add_shlibpath=$dir ;; + esac + add_dir=-L$dir + add=-l$name + elif test no = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + relink) + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$dir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$absdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test yes != "$lib_linked"; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test prog = "$linkmode"; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test yes != "$hardcode_direct" && + test yes != "$hardcode_minus_L" && + test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test prog = "$linkmode" || test relink = "$opt_mode"; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$libdir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$libdir + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add=-l$name + elif test yes = "$hardcode_automatic"; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib"; then + add=$inst_prefix_dir$libdir/$linklib + else + add=$libdir/$linklib + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir=-L$libdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add=-l$name + fi + + if test prog = "$linkmode"; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test prog = "$linkmode"; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test unsupported != "$hardcode_direct"; then + test -n "$old_library" && linklib=$old_library + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test yes = "$build_libtool_libs"; then + # Not a shared library + if test pass_all != "$deplibs_check_method"; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system cannot link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test yes = "$module"; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** 'nm' from GNU binutils and a full rebuild may help." + fi + if test no = "$build_old_libs"; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test lib = "$linkmode"; then + if test -n "$dependency_libs" && + { test yes != "$hardcode_into_libs" || + test yes = "$build_old_libs" || + test yes = "$link_static"; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs=$temp_deplibs + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test no != "$link_all_deplibs"; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path=$deplib ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of '$dir'" + absdir=$dir + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names"; then + for tmp in $deplibrary_names; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl"; then + depdepl=$absdir/$objdir/$depdepl + darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" + func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" + path= + fi + fi + ;; + *) + path=-L$absdir/$objdir + ;; + esac + else + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "'$deplib' seems to be moved" + + path=-L$absdir + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test link = "$pass"; then + if test prog = "$linkmode"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs=$newdependency_libs + if test dlpreopen = "$pass"; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test dlopen != "$pass"; then + test conv = "$pass" || { + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + } + + if test prog,link = "$linkmode,$pass"; then + vars="compile_deplibs finalize_deplibs" + else + vars=deplibs + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + + # Add Sun CC postdeps if required: + test CXX = "$tagname" && { + case $host_os in + linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C++ 5.9 + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + + solaris*) + func_cc_basename "$CC" + case $func_cc_basename_result in + CC* | sunCC*) + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + esac + } + + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i= + ;; + esac + if test -n "$i"; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test prog = "$linkmode"; then + dlfiles=$newdlfiles + fi + if test prog = "$linkmode" || test lib = "$linkmode"; then + dlprefiles=$newdlprefiles + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "'-l' and '-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "'-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "'-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "'-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "'-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "'-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs=$output + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form 'libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test no = "$module" \ + && func_fatal_help "libtool library '$output' must begin with 'lib'" + + if test no != "$need_lib_prefix"; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test pass_all != "$deplibs_check_method"; then + func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test no = "$dlself" \ + || func_warning "'-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test 1 -lt "$#" \ + && func_warning "ignoring multiple '-rpath's for a libtool library" + + install_libdir=$1 + + oldlibs= + if test -z "$rpath"; then + if test yes = "$build_libtool_libs"; then + # Building a libtool convenience library. + # Some compilers have problems with a '.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "'-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "'-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs=$IFS; IFS=: + set dummy $vinfo 0 0 0 + shift + IFS=$save_ifs + + test -n "$7" && \ + func_fatal_help "too many parameters to '-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major=$1 + number_minor=$2 + number_revision=$3 + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # that has an extra 1 added just for fun + # + case $version_type in + # correct linux to gnu/linux during the next big refactor + darwin|freebsd-elf|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_revision + ;; + freebsd-aout|qnx|sunos) + current=$number_major + revision=$number_minor + age=0 + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_minor + lt_irix_increment=no + ;; + *) + func_fatal_configuration "$modename: unknown library version type '$version_type'" + ;; + esac + ;; + no) + current=$1 + revision=$2 + age=$3 + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 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]) ;; + *) + func_error "CURRENT '$current' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + case $revision in + 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]) ;; + *) + func_error "REVISION '$revision' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + case $age in + 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]) ;; + *) + func_error "AGE '$age' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE '$age' is greater than the current interface number '$current'" + func_fatal_error "'$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + # On Darwin other compilers + case $CC in + nagfor*) + verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + ;; + *) + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + esac + ;; + + freebsd-aout) + major=.$current + versuffix=.$current.$revision + ;; + + freebsd-elf) + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + irix | nonstopux) + if test no = "$lt_irix_increment"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring=$verstring_prefix$major.$revision + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test 0 -ne "$loop"; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring=$verstring_prefix$major.$iface:$verstring + done + + # Before this point, $major must not contain '.'. + major=.$major + versuffix=$major.$revision + ;; + + linux) # correct to gnu/linux during the next big refactor + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=.$current.$age.$revision + verstring=$current.$age.$revision + + # Add in all the interfaces that we are compatible with. + loop=$age + while test 0 -ne "$loop"; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring=$verstring:$iface.0 + done + + # Make executables depend on our current version. + func_append verstring ":$current.0" + ;; + + qnx) + major=.$current + versuffix=.$current + ;; + + sco) + major=.$current + versuffix=.$current + ;; + + sunos) + major=.$current + versuffix=.$current.$revision + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 file systems. + func_arith $current - $age + major=$func_arith_result + versuffix=-$major + ;; + + *) + func_fatal_configuration "unknown library version type '$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring=0.0 + ;; + esac + if test no = "$need_version"; then + versuffix= + else + versuffix=.0.0 + fi + fi + + # Remove version info from name if versioning should be avoided + if test yes,no = "$avoid_version,$need_version"; then + major= + versuffix= + verstring= + fi + + # Check to see if the archive will have undefined symbols. + if test yes = "$allow_undefined"; then + if test unsupported = "$allow_undefined_flag"; then + if test yes = "$build_old_libs"; then + func_warning "undefined symbols not allowed in $host shared libraries; building static only" + build_libtool_libs=no + else + func_fatal_error "can't build $host shared library unless -no-undefined is specified" + fi + fi + else + # Don't allow undefined symbols. + allow_undefined_flag=$no_undefined_flag + fi + + fi + + func_generate_dlsyms "$libname" "$libname" : + func_append libobjs " $symfileobj" + test " " = "$libobjs" && libobjs= + + if test relink != "$opt_mode"; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) + if test -n "$precious_files_regex"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles=$dlfiles + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles=$dlprefiles + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test yes = "$build_libtool_libs"; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test yes = "$build_libtool_need_lc"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release= + versuffix= + major= + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib=$potent_lib + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | $SED 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; + *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib= + ;; + esac + fi + if test -n "$a_deplib"; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib=$potent_lib # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs= + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + for i in $predeps $postdeps; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + echo + if test none = "$deplibs_check_method"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + if test yes = "$droppeddeps"; then + if test yes = "$module"; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** 'nm' from GNU binutils and a full rebuild may help." + fi + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test no = "$allow_undefined"; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs=$new_libs + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test yes = "$build_libtool_libs"; then + # Remove $wl instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac + if test yes = "$hardcode_into_libs"; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath=$finalize_rpath + test relink = "$opt_mode" || rpath=$compile_rpath$rpath + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath=$finalize_shlibpath + test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname=$1 + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname=$realname + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib=$output_objdir/$realname + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols=$output_objdir/$libname.uexp + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + func_dll_def_p "$export_symbols" || { + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols=$export_symbols + export_symbols= + always_export_symbols=yes + } + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs=$IFS; IFS='~' + for cmd1 in $cmds; do + IFS=$save_ifs + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test yes = "$try_normal_branch" \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=$output_objdir/$output_la.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS=$save_ifs + if test -n "$export_symbols_regex" && test : != "$skipped_export"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test : != "$skipped_export" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands, which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs=$tmp_deplibs + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test yes = "$compiler_needs_object" && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test relink = "$opt_mode"; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test yes = "$module" && test -n "$module_cmds"; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test : != "$skipped_export" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then + output=$output_objdir/$output_la.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then + output=$output_objdir/$output_la.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test yes = "$compiler_needs_object"; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-$k.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test -z "$objlist" || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test 1 -eq "$k"; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-$k.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-$k.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + ${skipped_export-false} && { + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + } + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs=$IFS; IFS='~' + for cmd in $concat_cmds; do + IFS=$save_ifs + $opt_quiet || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS=$save_ifs + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + ${skipped_export-false} && { + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands, which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + } + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test yes = "$module" && test -n "$module_cmds"; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs=$IFS; IFS='~' + for cmd in $cmds; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + $opt_quiet || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS=$save_ifs + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test yes = "$module" || test yes = "$export_dynamic"; then + # On all known operating systems, these are identical. + dlname=$soname + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "'-l' and '-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "'-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "'-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "'-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "'-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object '$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj=$output + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # if reload_cmds runs $LD directly, get rid of -Wl from + # whole_archive_flag_spec and hope we can get by with turning comma + # into space. + case $reload_cmds in + *\$LD[\ \$]*) wl= ;; + esac + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags + else + gentop=$output_objdir/${obj}x + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test yes = "$build_libtool_libs" || libobjs=$non_pic_objects + + # Create the old-style object. + reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs + + output=$obj + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + test yes = "$build_libtool_libs" || { + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + } + + if test -n "$pic_flag" || test default != "$pic_mode"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output=$libobj + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "'-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "'-release' is ignored for programs" + + $preload \ + && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ + && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test CXX = "$tagname"; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " $wl-bind_at_load" + func_append finalize_command " $wl-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs=$new_libs + + + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath=$rpath + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append finalize_perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath=$rpath + + if test -n "$libobjs" && test yes = "$build_old_libs"; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" false + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=: + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=false + ;; + *cygwin* | *mingw* ) + test yes = "$build_libtool_libs" || wrappers_required=false + ;; + *) + if test no = "$need_relink" || test yes != "$build_libtool_libs"; then + wrappers_required=false + fi + ;; + esac + $wrappers_required || { + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command=$compile_command$compile_rpath + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.$objext"; then + func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' + fi + + exit $exit_status + } + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test yes = "$no_install"; then + # We don't need to create a wrapper script. + link_command=$compile_var$compile_command$compile_rpath + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + fi + + case $hardcode_action,$fast_install in + relink,*) + # Fast installation is not supported + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "'$output' will be relinked during installation" + ;; + *,yes) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + ;; + *,no) + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + ;; + *,needless) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command= + ;; + esac + + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + 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'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource=$output_path/$objdir/lt-$output_name.c + cwrapper=$output_path/$output_name.exe + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host"; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + case $build_libtool_libs in + convenience) + oldobjs="$libobjs_save $symfileobj" + addlibs=$convenience + build_libtool_libs=no + ;; + module) + oldobjs=$libobjs_save + addlibs=$old_convenience + build_libtool_libs=no + ;; + *) + oldobjs="$old_deplibs $non_pic_objects" + $preload && test -f "$symfileobj" \ + && func_append oldobjs " $symfileobj" + addlibs=$old_convenience + ;; + esac + + if test -n "$addlibs"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase=$func_basename_result + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj"; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test -z "$oldobjs"; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test yes = "$build_old_libs" && old_library=$libname.$libext + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + if test yes = "$hardcode_automatic"; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test yes = "$installed"; then + if test -z "$install_libdir"; then + break + fi + output=$output_objdir/${outputname}i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name=$func_basename_result + func_resolve_sysroot "$deplib" + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs=$newdependency_libs + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "'$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles=$newdlfiles + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "'$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles=$newdlprefiles + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles=$newdlfiles + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles=$newdlprefiles + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test -n "$bindir"; then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result/$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that cannot go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test no,yes = "$installed,$need_relink"; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +if test link = "$opt_mode" || test relink = "$opt_mode"; then + func_mode_link ${1+"$@"} +fi + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $debug_cmd + + RM=$nonopt + files= + rmforce=false + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic=$magic + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=: ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir=$func_dirname_result + if test . = "$dir"; then + odir=$objdir + else + odir=$dir/$objdir + fi + func_basename "$file" + name=$func_basename_result + test uninstall = "$opt_mode" && odir=$dir + + # Remember odir for removal later, being careful to avoid duplicates + if test clean = "$opt_mode"; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif $rmforce; then + continue + fi + + rmfiles=$file + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case $opt_mode in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && test none != "$pic_object"; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && test none != "$non_pic_object"; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test clean = "$opt_mode"; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.$objext" + if test yes = "$fast_install" && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name"; then + func_append rmfiles " $odir/lt-$noexename.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the $objdir's in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then + func_mode_uninstall ${1+"$@"} +fi + +test -z "$opt_mode" && { + help=$generic_help + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode '$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# where we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/server/xorg/xf86-video-dummy/v0.3.8/missing b/server/xorg/xf86-video-dummy/v0.3.8/missing new file mode 100755 index 000000000..cdea51493 --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/missing @@ -0,0 +1,215 @@ +#! /bin/sh +# Common wrapper for a few potentially missing GNU programs. + +scriptversion=2012-06-26.16; # UTC + +# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Originally written by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try '$0 --help' for more information" + exit 1 +fi + +case $1 in + + --is-lightweight) + # Used by our autoconf macros to check whether the available missing + # script is modern enough. + exit 0 + ;; + + --run) + # Back-compat with the calling convention used by older automake. + shift + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due +to PROGRAM being missing or too old. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal autoconf autoheader autom4te automake makeinfo + bison yacc flex lex help2man + +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and +'g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: unknown '$1' option" + echo 1>&2 "Try '$0 --help' for more information" + exit 1 + ;; + +esac + +# Run the given program, remember its exit status. +"$@"; st=$? + +# If it succeeded, we are done. +test $st -eq 0 && exit 0 + +# Also exit now if we it failed (or wasn't found), and '--version' was +# passed; such an option is passed most likely to detect whether the +# program is present and works. +case $2 in --version|--help) exit $st;; esac + +# Exit code 63 means version mismatch. This often happens when the user +# tries to use an ancient version of a tool on a file that requires a +# minimum version. +if test $st -eq 63; then + msg="probably too old" +elif test $st -eq 127; then + # Program was missing. + msg="missing on your system" +else + # Program was found and executed, but failed. Give up. + exit $st +fi + +perl_URL=http://www.perl.org/ +flex_URL=http://flex.sourceforge.net/ +gnu_software_URL=http://www.gnu.org/software + +program_details () +{ + case $1 in + aclocal|automake) + echo "The '$1' program is part of the GNU Automake package:" + echo "<$gnu_software_URL/automake>" + echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/autoconf>" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + autoconf|autom4te|autoheader) + echo "The '$1' program is part of the GNU Autoconf package:" + echo "<$gnu_software_URL/autoconf/>" + echo "It also requires GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + esac +} + +give_advice () +{ + # Normalize program name to check for. + normalized_program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + + printf '%s\n' "'$1' is $msg." + + configure_deps="'configure.ac' or m4 files included by 'configure.ac'" + case $normalized_program in + autoconf*) + echo "You should only need it if you modified 'configure.ac'," + echo "or m4 files included by it." + program_details 'autoconf' + ;; + autoheader*) + echo "You should only need it if you modified 'acconfig.h' or" + echo "$configure_deps." + program_details 'autoheader' + ;; + automake*) + echo "You should only need it if you modified 'Makefile.am' or" + echo "$configure_deps." + program_details 'automake' + ;; + aclocal*) + echo "You should only need it if you modified 'acinclude.m4' or" + echo "$configure_deps." + program_details 'aclocal' + ;; + autom4te*) + echo "You might have modified some maintainer files that require" + echo "the 'automa4te' program to be rebuilt." + program_details 'autom4te' + ;; + bison*|yacc*) + echo "You should only need it if you modified a '.y' file." + echo "You may want to install the GNU Bison package:" + echo "<$gnu_software_URL/bison/>" + ;; + lex*|flex*) + echo "You should only need it if you modified a '.l' file." + echo "You may want to install the Fast Lexical Analyzer package:" + echo "<$flex_URL>" + ;; + help2man*) + echo "You should only need it if you modified a dependency" \ + "of a man page." + echo "You may want to install the GNU Help2man package:" + echo "<$gnu_software_URL/help2man/>" + ;; + makeinfo*) + echo "You should only need it if you modified a '.texi' file, or" + echo "any other file indirectly affecting the aspect of the manual." + echo "You might want to install the Texinfo package:" + echo "<$gnu_software_URL/texinfo/>" + echo "The spurious makeinfo call might also be the consequence of" + echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" + echo "want to install GNU make:" + echo "<$gnu_software_URL/make/>" + ;; + *) + echo "You might have modified some files without having the proper" + echo "tools for further handling them. Check the 'README' file, it" + echo "often tells you about the needed prerequisites for installing" + echo "this package. You may also peek at any GNU archive site, in" + echo "case some other package contains this missing '$1' program." + ;; + esac +} + +give_advice "$1" | sed -e '1s/^/WARNING: /' \ + -e '2,$s/^/ /' >&2 + +# Propagate the correct exit status (expected to be 127 for a program +# not found, 63 for a program that failed due to version mismatch). +exit $st + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/server/xorg/xf86-video-dummy/v0.3.8/src/Makefile.am b/server/xorg/xf86-video-dummy/v0.3.8/src/Makefile.am new file mode 100644 index 000000000..da1dd9a9a --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/src/Makefile.am @@ -0,0 +1,44 @@ +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +# this is obnoxious: +# -module lets us name the module exactly how we want +# -avoid-version prevents gratuitous .0.0.0 version numbers on the end +# _ladir passes a dummy rpath to libtool so the thing will actually link +# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. + +AM_CFLAGS = $(XORG_CFLAGS) $(PCIACCESS_CFLAGS) + +dummy_drv_la_LTLIBRARIES = dummy_drv.la +dummy_drv_la_LDFLAGS = -module -avoid-version +dummy_drv_la_LIBADD = $(XORG_LIBS) +dummy_drv_ladir = @moduledir@/drivers + +dummy_drv_la_SOURCES = \ + compat-api.h \ + dummy_cursor.c \ + dummy_driver.c \ + dummy.h + +if DGA +dummy_drv_la_SOURCES += \ + dummy_dga.c +endif diff --git a/server/xorg/xf86-video-dummy/v0.3.8/src/Makefile.in b/server/xorg/xf86-video-dummy/v0.3.8/src/Makefile.in new file mode 100644 index 000000000..4562a081a --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/src/Makefile.in @@ -0,0 +1,707 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# this is obnoxious: +# -module lets us name the module exactly how we want +# -avoid-version prevents gratuitous .0.0.0 version numbers on the end +# _ladir passes a dummy rpath to libtool so the thing will actually link +# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@DGA_TRUE@am__append_1 = \ +@DGA_TRUE@ dummy_dga.c + +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(dummy_drv_ladir)" +LTLIBRARIES = $(dummy_drv_la_LTLIBRARIES) +am__DEPENDENCIES_1 = +dummy_drv_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am__dummy_drv_la_SOURCES_DIST = compat-api.h dummy_cursor.c \ + dummy_driver.c dummy.h dummy_dga.c +@DGA_TRUE@am__objects_1 = dummy_dga.lo +am_dummy_drv_la_OBJECTS = dummy_cursor.lo dummy_driver.lo \ + $(am__objects_1) +dummy_drv_la_OBJECTS = $(am_dummy_drv_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +dummy_drv_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(dummy_drv_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(dummy_drv_la_SOURCES) +DIST_SOURCES = $(am__dummy_drv_la_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_CFLAGS = @BASE_CFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA = @DGA@ +DLLTOOL = @DLLTOOL@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRIVER_NAME = @DRIVER_NAME@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_CMD = @INSTALL_CMD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MAN_SUBSTS = @MAN_SUBSTS@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRICT_CFLAGS = @STRICT_CFLAGS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_LIBS = @XORG_LIBS@ +XORG_MAN_PAGE = @XORG_MAN_PAGE@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CFLAGS = $(XORG_CFLAGS) $(PCIACCESS_CFLAGS) +dummy_drv_la_LTLIBRARIES = dummy_drv.la +dummy_drv_la_LDFLAGS = -module -avoid-version +dummy_drv_la_LIBADD = $(XORG_LIBS) +dummy_drv_ladir = @moduledir@/drivers +dummy_drv_la_SOURCES = compat-api.h dummy_cursor.c dummy_driver.c \ + dummy.h $(am__append_1) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +install-dummy_drv_laLTLIBRARIES: $(dummy_drv_la_LTLIBRARIES) + @$(NORMAL_INSTALL) + @list='$(dummy_drv_la_LTLIBRARIES)'; test -n "$(dummy_drv_ladir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(dummy_drv_ladir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(dummy_drv_ladir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(dummy_drv_ladir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(dummy_drv_ladir)"; \ + } + +uninstall-dummy_drv_laLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(dummy_drv_la_LTLIBRARIES)'; test -n "$(dummy_drv_ladir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(dummy_drv_ladir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(dummy_drv_ladir)/$$f"; \ + done + +clean-dummy_drv_laLTLIBRARIES: + -test -z "$(dummy_drv_la_LTLIBRARIES)" || rm -f $(dummy_drv_la_LTLIBRARIES) + @list='$(dummy_drv_la_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +dummy_drv.la: $(dummy_drv_la_OBJECTS) $(dummy_drv_la_DEPENDENCIES) $(EXTRA_dummy_drv_la_DEPENDENCIES) + $(AM_V_CCLD)$(dummy_drv_la_LINK) -rpath $(dummy_drv_ladir) $(dummy_drv_la_OBJECTS) $(dummy_drv_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy_cursor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy_dga.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy_driver.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(dummy_drv_ladir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-dummy_drv_laLTLIBRARIES clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-dummy_drv_laLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-dummy_drv_laLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-dummy_drv_laLTLIBRARIES clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dummy_drv_laLTLIBRARIES \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-dummy_drv_laLTLIBRARIES + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/server/xorg/xf86-video-dummy/v0.3.8/src/compat-api.h b/server/xorg/xf86-video-dummy/v0.3.8/src/compat-api.h new file mode 100644 index 000000000..b74a58260 --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/src/compat-api.h @@ -0,0 +1,101 @@ +/* + * Copyright 2012 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: Dave Airlie + */ + +/* this file provides API compat between server post 1.13 and pre it, + it should be reused inside as many drivers as possible */ +#ifndef COMPAT_API_H +#define COMPAT_API_H + +#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR +#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum] +#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p +#endif + +#ifndef XF86_HAS_SCRN_CONV +#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum] +#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex] +#endif + +#ifndef XF86_SCRN_INTERFACE + +#define SCRN_ARG_TYPE int +#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)] + +#define SCREEN_ARG_TYPE int +#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)] + +#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv + +#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask +#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask + +#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen +#define CLOSE_SCREEN_ARGS scrnIndex, pScreen + +#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags +#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0 + +#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags +#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0 + +#define FREE_SCREEN_ARGS_DECL int arg, int flags +#define FREE_SCREEN_ARGS(x) (x)->scrnIndex, 0 + +#define VT_FUNC_ARGS_DECL int arg, int flags +#define VT_FUNC_ARGS(flags) pScrn->scrnIndex, (flags) + +#define XF86_ENABLEDISABLEFB_ARG(x) ((x)->scrnIndex) +#else +#define SCRN_ARG_TYPE ScrnInfoPtr +#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1) + +#define SCREEN_ARG_TYPE ScreenPtr +#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1) + +#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv + +#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask +#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask + +#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen +#define CLOSE_SCREEN_ARGS pScreen + +#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y +#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y + +#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode +#define SWITCH_MODE_ARGS(arg, m) arg, m + +#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg +#define FREE_SCREEN_ARGS(x) (x) + +#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg +#define VT_FUNC_ARGS(flags) pScrn + +#define XF86_ENABLEDISABLEFB_ARG(x) (x) + +#endif + +#endif diff --git a/server/xorg/xf86-video-dummy/v0.3.8/src/dummy.h b/server/xorg/xf86-video-dummy/v0.3.8/src/dummy.h new file mode 100644 index 000000000..c3fdd6efd --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/src/dummy.h @@ -0,0 +1,79 @@ + +/* All drivers should typically include these */ +#include "xf86.h" +#include "xf86_OSproc.h" + +#include "xf86Cursor.h" + +#ifdef XvExtension +#include "xf86xv.h" +#include +#endif +#include + +#include "compat-api.h" + +/* Supported chipsets */ +typedef enum { + DUMMY_CHIP +} DUMMYType; + +/* function prototypes */ + +extern Bool DUMMYSwitchMode(SWITCH_MODE_ARGS_DECL); +extern void DUMMYAdjustFrame(ADJUST_FRAME_ARGS_DECL); + +/* in dummy_cursor.c */ +extern Bool DUMMYCursorInit(ScreenPtr pScrn); +extern void DUMMYShowCursor(ScrnInfoPtr pScrn); +extern void DUMMYHideCursor(ScrnInfoPtr pScrn); + +/* in dummy_dga.c */ +Bool DUMMYDGAInit(ScreenPtr pScreen); + +/* in dummy_video.c */ +extern void DUMMYInitVideo(ScreenPtr pScreen); + +/* globals */ +typedef struct _color +{ + int red; + int green; + int blue; +} dummy_colors; + +typedef struct dummyRec +{ + DGAModePtr DGAModes; + int numDGAModes; + Bool DGAactive; + int DGAViewportStatus; + /* options */ + OptionInfoPtr Options; + Bool swCursor; + /* proc pointer */ + CloseScreenProcPtr CloseScreen; + xf86CursorInfoPtr CursorInfo; + + Bool DummyHWCursorShown; + int cursorX, cursorY; + int cursorFG, cursorBG; + + Bool screenSaver; + Bool video; +#ifdef XvExtension + XF86VideoAdaptorPtr overlayAdaptor; +#endif + int overlay; + int overlay_offset; + int videoKey; + int interlace; + dummy_colors colors[256]; + pointer* FBBase; + Bool (*CreateWindow)() ; /* wrapped CreateWindow */ + Bool prop; +} DUMMYRec, *DUMMYPtr; + +/* The privates of the DUMMY driver */ +#define DUMMYPTR(p) ((DUMMYPtr)((p)->driverPrivate)) + diff --git a/server/xorg/xf86-video-dummy/v0.3.8/src/dummy_cursor.c b/server/xorg/xf86-video-dummy/v0.3.8/src/dummy_cursor.c new file mode 100644 index 000000000..07a89bf20 --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/src/dummy_cursor.c @@ -0,0 +1,104 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* All drivers should typically include these */ +#include "xf86.h" +#include "xf86_OSproc.h" + +#include "xf86Cursor.h" +#include "cursorstr.h" +/* Driver specific headers */ +#include "dummy.h" + +static void +dummyShowCursor(ScrnInfoPtr pScrn) +{ + DUMMYPtr dPtr = DUMMYPTR(pScrn); + + /* turn cursor on */ + dPtr->DummyHWCursorShown = TRUE; +} + +static void +dummyHideCursor(ScrnInfoPtr pScrn) +{ + DUMMYPtr dPtr = DUMMYPTR(pScrn); + + /* + * turn cursor off + * + */ + dPtr->DummyHWCursorShown = FALSE; +} + +#define MAX_CURS 64 + +static void +dummySetCursorPosition(ScrnInfoPtr pScrn, int x, int y) +{ + DUMMYPtr dPtr = DUMMYPTR(pScrn); + +/* unsigned char *_dest = ((unsigned char *)dPtr->FBBase + */ +/* pScrn->videoRam * 1024 - 1024); */ + dPtr->cursorX = x; + dPtr->cursorY = y; +} + +static void +dummySetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) +{ + DUMMYPtr dPtr = DUMMYPTR(pScrn); + + dPtr->cursorFG = fg; + dPtr->cursorBG = bg; +} + +static void +dummyLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) +{ +} + +static Bool +dummyUseHWCursor(ScreenPtr pScr, CursorPtr pCurs) +{ + DUMMYPtr dPtr = DUMMYPTR(xf86ScreenToScrn(pScr)); + return(!dPtr->swCursor); +} + +#if 0 +static unsigned char* +dummyRealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) +{ + return NULL; +} +#endif + +Bool +DUMMYCursorInit(ScreenPtr pScreen) +{ + DUMMYPtr dPtr = DUMMYPTR(xf86ScreenToScrn(pScreen)); + + xf86CursorInfoPtr infoPtr; + infoPtr = xf86CreateCursorInfoRec(); + if(!infoPtr) return FALSE; + + dPtr->CursorInfo = infoPtr; + + infoPtr->MaxHeight = 64; + infoPtr->MaxWidth = 64; + infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; + + infoPtr->SetCursorColors = dummySetCursorColors; + infoPtr->SetCursorPosition = dummySetCursorPosition; + infoPtr->LoadCursorImage = dummyLoadCursorImage; + infoPtr->HideCursor = dummyHideCursor; + infoPtr->ShowCursor = dummyShowCursor; + infoPtr->UseHWCursor = dummyUseHWCursor; +/* infoPtr->RealizeCursor = dummyRealizeCursor; */ + + return(xf86InitCursor(pScreen, infoPtr)); +} + + + diff --git a/server/xorg/xf86-video-dummy/v0.3.8/src/dummy_dga.c b/server/xorg/xf86-video-dummy/v0.3.8/src/dummy_dga.c new file mode 100644 index 000000000..d16d09f1b --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/src/dummy_dga.c @@ -0,0 +1,175 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "dgaproc.h" +#include "dummy.h" + +static Bool DUMMY_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, + int *, int *, int *); +static Bool DUMMY_SetMode(ScrnInfoPtr, DGAModePtr); +static int DUMMY_GetViewport(ScrnInfoPtr); +static void DUMMY_SetViewport(ScrnInfoPtr, int, int, int); + +static +DGAFunctionRec DUMMYDGAFuncs = { + DUMMY_OpenFramebuffer, + NULL, + DUMMY_SetMode, + DUMMY_SetViewport, + DUMMY_GetViewport, + NULL, + NULL, + NULL, +#if 0 + DUMMY_BlitTransRect +#else + NULL +#endif +}; + +Bool +DUMMYDGAInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); + DUMMYPtr pDUMMY = DUMMYPTR(pScrn); + DGAModePtr modes = NULL, newmodes = NULL, currentMode; + DisplayModePtr pMode, firstMode; + int Bpp = pScrn->bitsPerPixel >> 3; + int num = 0, imlines, pixlines; + + imlines = (pScrn->videoRam * 1024) / + (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)); + + pixlines = imlines; + + pMode = firstMode = pScrn->modes; + + while(pMode) { + + newmodes = realloc(modes, (num + 1) * sizeof(DGAModeRec)); + + if(!newmodes) { + free(modes); + return FALSE; + } + modes = newmodes; + + currentMode = modes + num; + num++; + + currentMode->mode = pMode; + currentMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; + if(pMode->Flags & V_DBLSCAN) + currentMode->flags |= DGA_DOUBLESCAN; + if(pMode->Flags & V_INTERLACE) + currentMode->flags |= DGA_INTERLACED; + currentMode->byteOrder = pScrn->imageByteOrder; + currentMode->depth = pScrn->depth; + currentMode->bitsPerPixel = pScrn->bitsPerPixel; + currentMode->red_mask = pScrn->mask.red; + currentMode->green_mask = pScrn->mask.green; + currentMode->blue_mask = pScrn->mask.blue; + currentMode->visualClass = (Bpp == 1) ? PseudoColor : TrueColor; + currentMode->viewportWidth = pMode->HDisplay; + currentMode->viewportHeight = pMode->VDisplay; + currentMode->xViewportStep = 1; + currentMode->yViewportStep = 1; + currentMode->viewportFlags = DGA_FLIP_RETRACE; + currentMode->offset = 0; + currentMode->address = (unsigned char *)pDUMMY->FBBase; + + currentMode->bytesPerScanline = + ((pScrn->displayWidth * Bpp) + 3) & ~3L; + currentMode->imageWidth = pScrn->displayWidth; + currentMode->imageHeight = imlines; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = pixlines; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; + + pMode = pMode->next; + if(pMode == firstMode) + break; + } + + pDUMMY->numDGAModes = num; + pDUMMY->DGAModes = modes; + + return DGAInit(pScreen, &DUMMYDGAFuncs, modes, num); +} + +static DisplayModePtr DUMMYSavedDGAModes[MAXSCREENS]; + +static Bool +DUMMY_SetMode( + ScrnInfoPtr pScrn, + DGAModePtr pMode +){ + int index = pScrn->pScreen->myNum; + DUMMYPtr pDUMMY = DUMMYPTR(pScrn); + + if(!pMode) { /* restore the original mode */ + if(pDUMMY->DGAactive) { + pScrn->currentMode = DUMMYSavedDGAModes[index]; + DUMMYSwitchMode(SWITCH_MODE_ARGS(pScrn, pScrn->currentMode)); + DUMMYAdjustFrame(ADJUST_FRAME_ARGS(pScrn, 0, 0)); + pDUMMY->DGAactive = FALSE; + } + } else { + if(!pDUMMY->DGAactive) { /* save the old parameters */ + DUMMYSavedDGAModes[index] = pScrn->currentMode; + pDUMMY->DGAactive = TRUE; + } + + DUMMYSwitchMode(SWITCH_MODE_ARGS(pScrn, pMode->mode)); + } + + return TRUE; +} + +static int +DUMMY_GetViewport( + ScrnInfoPtr pScrn +){ + DUMMYPtr pDUMMY = DUMMYPTR(pScrn); + + return pDUMMY->DGAViewportStatus; +} + +static void +DUMMY_SetViewport( + ScrnInfoPtr pScrn, + int x, int y, + int flags +){ + DUMMYPtr pDUMMY = DUMMYPTR(pScrn); + + DUMMYAdjustFrame(ADJUST_FRAME_ARGS(pScrn, x, y)); + pDUMMY->DGAViewportStatus = 0; +} + + +static Bool +DUMMY_OpenFramebuffer( + ScrnInfoPtr pScrn, + char **name, + unsigned char **mem, + int *size, + int *offset, + int *flags +){ + DUMMYPtr pDUMMY = DUMMYPTR(pScrn); + + *name = NULL; /* no special device */ + *mem = (unsigned char*)pDUMMY->FBBase; + *size = pScrn->videoRam * 1024; + *offset = 0; + *flags = DGA_NEED_ROOT; + + return TRUE; +} diff --git a/server/xorg/xf86-video-dummy/v0.3.8/src/dummy_driver.c b/server/xorg/xf86-video-dummy/v0.3.8/src/dummy_driver.c new file mode 100644 index 000000000..265660280 --- /dev/null +++ b/server/xorg/xf86-video-dummy/v0.3.8/src/dummy_driver.c @@ -0,0 +1,761 @@ + +/* + * Copyright 2002, SuSE Linux AG, Author: Egbert Eich + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* All drivers should typically include these */ +#include "xf86.h" +#include "xf86_OSproc.h" + +/* All drivers initialising the SW cursor need this */ +#include "mipointer.h" + +/* All drivers using the mi colormap manipulation need this */ +#include "micmap.h" + +/* identifying atom needed by magnifiers */ +#include +#include "property.h" + +#include "xf86cmap.h" + +#include "xf86fbman.h" + +#include "fb.h" + +#include "picturestr.h" + +#ifdef XvExtension +#include "xf86xv.h" +#include +#endif + +/* + * Driver data structures. + */ +#include "dummy.h" + +/* These need to be checked */ +#include +#include +#include "scrnintstr.h" +#include "servermd.h" +#ifdef USE_DGA +#define _XF86DGA_SERVER_ +#include +#endif + +/* Mandatory functions */ +static const OptionInfoRec * DUMMYAvailableOptions(int chipid, int busid); +static void DUMMYIdentify(int flags); +static Bool DUMMYProbe(DriverPtr drv, int flags); +static Bool DUMMYPreInit(ScrnInfoPtr pScrn, int flags); +static Bool DUMMYScreenInit(SCREEN_INIT_ARGS_DECL); +static Bool DUMMYEnterVT(VT_FUNC_ARGS_DECL); +static void DUMMYLeaveVT(VT_FUNC_ARGS_DECL); +static Bool DUMMYCloseScreen(CLOSE_SCREEN_ARGS_DECL); +static Bool DUMMYCreateWindow(WindowPtr pWin); +static void DUMMYFreeScreen(FREE_SCREEN_ARGS_DECL); +static ModeStatus DUMMYValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, + Bool verbose, int flags); +static Bool DUMMYSaveScreen(ScreenPtr pScreen, int mode); + +/* Internally used functions */ +static Bool dummyDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, + pointer ptr); + + +/* static void DUMMYDisplayPowerManagementSet(ScrnInfoPtr pScrn, */ +/* int PowerManagementMode, int flags); */ + +#define DUMMY_VERSION 4000 +#define DUMMY_NAME "DUMMY" +#define DUMMY_DRIVER_NAME "dummy" + +#define DUMMY_MAJOR_VERSION PACKAGE_VERSION_MAJOR +#define DUMMY_MINOR_VERSION PACKAGE_VERSION_MINOR +#define DUMMY_PATCHLEVEL PACKAGE_VERSION_PATCHLEVEL + +#define DUMMY_MAX_WIDTH 32767 +#define DUMMY_MAX_HEIGHT 32767 + +/* + * This is intentionally screen-independent. It indicates the binding + * choice made in the first PreInit. + */ +static int pix24bpp = 0; + + +/* + * This contains the functions needed by the server after loading the driver + * module. It must be supplied, and gets passed back by the SetupProc + * function in the dynamic case. In the static case, a reference to this + * is compiled in, and this requires that the name of this DriverRec be + * an upper-case version of the driver name. + */ + +_X_EXPORT DriverRec DUMMY = { + DUMMY_VERSION, + DUMMY_DRIVER_NAME, + DUMMYIdentify, + DUMMYProbe, + DUMMYAvailableOptions, + NULL, + 0, + dummyDriverFunc +}; + +static SymTabRec DUMMYChipsets[] = { + { DUMMY_CHIP, "dummy" }, + { -1, NULL } +}; + +typedef enum { + OPTION_SW_CURSOR +} DUMMYOpts; + +static const OptionInfoRec DUMMYOptions[] = { + { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } +}; + +#ifdef XFree86LOADER + +static MODULESETUPPROTO(dummySetup); + +static XF86ModuleVersionInfo dummyVersRec = +{ + "dummy", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + DUMMY_MAJOR_VERSION, DUMMY_MINOR_VERSION, DUMMY_PATCHLEVEL, + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + {0,0,0,0} +}; + +/* + * This is the module init data. + * Its name has to be the driver name followed by ModuleData + */ +_X_EXPORT XF86ModuleData dummyModuleData = { &dummyVersRec, dummySetup, NULL }; + +static pointer +dummySetup(pointer module, pointer opts, int *errmaj, int *errmin) +{ + static Bool setupDone = FALSE; + + if (!setupDone) { + setupDone = TRUE; + xf86AddDriver(&DUMMY, module, HaveDriverFuncs); + + /* + * Modules that this driver always requires can be loaded here + * by calling LoadSubModule(). + */ + + /* + * The return value must be non-NULL on success even though there + * is no TearDownProc. + */ + return (pointer)1; + } else { + if (errmaj) *errmaj = LDR_ONCEONLY; + return NULL; + } +} + +#endif /* XFree86LOADER */ + +static Bool +DUMMYGetRec(ScrnInfoPtr pScrn) +{ + /* + * Allocate a DUMMYRec, and hook it into pScrn->driverPrivate. + * pScrn->driverPrivate is initialised to NULL, so we can check if + * the allocation has already been done. + */ + if (pScrn->driverPrivate != NULL) + return TRUE; + + pScrn->driverPrivate = xnfcalloc(sizeof(DUMMYRec), 1); + + if (pScrn->driverPrivate == NULL) + return FALSE; + return TRUE; +} + +static void +DUMMYFreeRec(ScrnInfoPtr pScrn) +{ + if (pScrn->driverPrivate == NULL) + return; + free(pScrn->driverPrivate); + pScrn->driverPrivate = NULL; +} + +static const OptionInfoRec * +DUMMYAvailableOptions(int chipid, int busid) +{ + return DUMMYOptions; +} + +/* Mandatory */ +static void +DUMMYIdentify(int flags) +{ + xf86PrintChipsets(DUMMY_NAME, "Driver for Dummy chipsets", + DUMMYChipsets); +} + +/* Mandatory */ +static Bool +DUMMYProbe(DriverPtr drv, int flags) +{ + Bool foundScreen = FALSE; + int numDevSections, numUsed; + GDevPtr *devSections; + int i; + + if (flags & PROBE_DETECT) + return FALSE; + /* + * Find the config file Device sections that match this + * driver, and return if there are none. + */ + if ((numDevSections = xf86MatchDevice(DUMMY_DRIVER_NAME, + &devSections)) <= 0) { + return FALSE; + } + + numUsed = numDevSections; + + if (numUsed > 0) { + + for (i = 0; i < numUsed; i++) { + ScrnInfoPtr pScrn = NULL; + int entityIndex = + xf86ClaimNoSlot(drv,DUMMY_CHIP,devSections[i],TRUE); + /* Allocate a ScrnInfoRec and claim the slot */ + if ((pScrn = xf86AllocateScreen(drv,0 ))) { + xf86AddEntityToScreen(pScrn,entityIndex); + pScrn->driverVersion = DUMMY_VERSION; + pScrn->driverName = DUMMY_DRIVER_NAME; + pScrn->name = DUMMY_NAME; + pScrn->Probe = DUMMYProbe; + pScrn->PreInit = DUMMYPreInit; + pScrn->ScreenInit = DUMMYScreenInit; + pScrn->SwitchMode = DUMMYSwitchMode; + pScrn->AdjustFrame = DUMMYAdjustFrame; + pScrn->EnterVT = DUMMYEnterVT; + pScrn->LeaveVT = DUMMYLeaveVT; + pScrn->FreeScreen = DUMMYFreeScreen; + pScrn->ValidMode = DUMMYValidMode; + + foundScreen = TRUE; + } + } + } + return foundScreen; +} + +# define RETURN \ + { DUMMYFreeRec(pScrn);\ + return FALSE;\ + } + +/* Mandatory */ +Bool +DUMMYPreInit(ScrnInfoPtr pScrn, int flags) +{ + ClockRangePtr clockRanges; + int i; + DUMMYPtr dPtr; + int maxClock = 300000; + GDevPtr device = xf86GetEntityInfo(pScrn->entityList[0])->device; + + if (flags & PROBE_DETECT) + return TRUE; + + /* Allocate the DummyRec driverPrivate */ + if (!DUMMYGetRec(pScrn)) { + return FALSE; + } + + dPtr = DUMMYPTR(pScrn); + + pScrn->chipset = (char *)xf86TokenToString(DUMMYChipsets, + DUMMY_CHIP); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Chipset is a DUMMY\n"); + + pScrn->monitor = pScrn->confScreen->monitor; + + if (!xf86SetDepthBpp(pScrn, 0, 0, 0, Support24bppFb | Support32bppFb)) + return FALSE; + else { + /* Check that the returned depth is one we support */ + switch (pScrn->depth) { + case 8: + case 15: + case 16: + case 24: + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given depth (%d) is not supported by this driver\n", + pScrn->depth); + return FALSE; + } + } + + xf86PrintDepthBpp(pScrn); + if (pScrn->depth == 8) + pScrn->rgbBits = 8; + + /* Get the depth24 pixmap format */ + if (pScrn->depth == 24 && pix24bpp == 0) + pix24bpp = xf86GetBppFromDepth(pScrn, 24); + + /* + * This must happen after pScrn->display has been set because + * xf86SetWeight references it. + */ + if (pScrn->depth > 8) { + /* The defaults are OK for us */ + rgb zeros = {0, 0, 0}; + + if (!xf86SetWeight(pScrn, zeros, zeros)) { + return FALSE; + } else { + /* XXX check that weight returned is supported */ + ; + } + } + + if (!xf86SetDefaultVisual(pScrn, -1)) + return FALSE; + + if (pScrn->depth > 1) { + Gamma zeros = {0.0, 0.0, 0.0}; + + if (!xf86SetGamma(pScrn, zeros)) + return FALSE; + } + + xf86CollectOptions(pScrn, device->options); + /* Process the options */ + if (!(dPtr->Options = malloc(sizeof(DUMMYOptions)))) + return FALSE; + memcpy(dPtr->Options, DUMMYOptions, sizeof(DUMMYOptions)); + + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, dPtr->Options); + + xf86GetOptValBool(dPtr->Options, OPTION_SW_CURSOR,&dPtr->swCursor); + + if (device->videoRam != 0) { + pScrn->videoRam = device->videoRam; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "VideoRAM: %d kByte\n", + pScrn->videoRam); + } else { + pScrn->videoRam = 4096; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VideoRAM: %d kByte\n", + pScrn->videoRam); + } + + if (device->dacSpeeds[0] != 0) { + maxClock = device->dacSpeeds[0]; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Max Clock: %d kHz\n", + maxClock); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Max Clock: %d kHz\n", + maxClock); + } + + pScrn->progClock = TRUE; + /* + * Setup the ClockRanges, which describe what clock ranges are available, + * and what sort of modes they can be used for. + */ + clockRanges = (ClockRangePtr)xnfcalloc(sizeof(ClockRange), 1); + clockRanges->next = NULL; + clockRanges->ClockMulFactor = 1; + clockRanges->minClock = 11000; /* guessed §§§ */ + clockRanges->maxClock = maxClock; + clockRanges->clockIndex = -1; /* programmable */ + clockRanges->interlaceAllowed = TRUE; + clockRanges->doubleScanAllowed = TRUE; + + /* Subtract memory for HW cursor */ + + + { + int apertureSize = (pScrn->videoRam * 1024); + i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, + pScrn->display->modes, clockRanges, + NULL, 256, DUMMY_MAX_WIDTH, + (8 * pScrn->bitsPerPixel), + 128, DUMMY_MAX_HEIGHT, pScrn->display->virtualX, + pScrn->display->virtualY, apertureSize, + LOOKUP_BEST_REFRESH); + + if (i == -1) + RETURN; + } + + /* Prune the modes marked as invalid */ + xf86PruneDriverModes(pScrn); + + if (i == 0 || pScrn->modes == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); + RETURN; + } + + /* + * Set the CRTC parameters for all of the modes based on the type + * of mode, and the chipset's interlace requirements. + * + * Calling this is required if the mode->Crtc* values are used by the + * driver and if the driver doesn't provide code to set them. They + * are not pre-initialised at all. + */ + xf86SetCrtcForModes(pScrn, 0); + + /* Set the current mode to the first in the list */ + pScrn->currentMode = pScrn->modes; + + /* Print the list of modes being used */ + xf86PrintModes(pScrn); + + /* If monitor resolution is set on the command line, use it */ + xf86SetDpi(pScrn, 0, 0); + + if (xf86LoadSubModule(pScrn, "fb") == NULL) { + RETURN; + } + + if (!dPtr->swCursor) { + if (!xf86LoadSubModule(pScrn, "ramdac")) + RETURN; + } + + /* We have no contiguous physical fb in physical memory */ + pScrn->memPhysBase = 0; + pScrn->fbOffset = 0; + + return TRUE; +} +#undef RETURN + +/* Mandatory */ +static Bool +DUMMYEnterVT(VT_FUNC_ARGS_DECL) +{ + return TRUE; +} + +/* Mandatory */ +static void +DUMMYLeaveVT(VT_FUNC_ARGS_DECL) +{ +} + +static void +DUMMYLoadPalette( + ScrnInfoPtr pScrn, + int numColors, + int *indices, + LOCO *colors, + VisualPtr pVisual +){ + int i, index, shift, Gshift; + DUMMYPtr dPtr = DUMMYPTR(pScrn); + + switch(pScrn->depth) { + case 15: + shift = Gshift = 1; + break; + case 16: + shift = 0; + Gshift = 0; + break; + default: + shift = Gshift = 0; + break; + } + + for(i = 0; i < numColors; i++) { + index = indices[i]; + dPtr->colors[index].red = colors[index].red << shift; + dPtr->colors[index].green = colors[index].green << Gshift; + dPtr->colors[index].blue = colors[index].blue << shift; + } + +} + +static ScrnInfoPtr DUMMYScrn; /* static-globalize it */ + +/* Mandatory */ +static Bool +DUMMYScreenInit(SCREEN_INIT_ARGS_DECL) +{ + ScrnInfoPtr pScrn; + DUMMYPtr dPtr; + int ret; + VisualPtr visual; + + /* + * we need to get the ScrnInfoRec for this screen, so let's allocate + * one first thing + */ + pScrn = xf86ScreenToScrn(pScreen); + dPtr = DUMMYPTR(pScrn); + DUMMYScrn = pScrn; + + + if (!(dPtr->FBBase = malloc(pScrn->videoRam * 1024))) + return FALSE; + + /* + * Reset visual list. + */ + miClearVisualTypes(); + + /* Setup the visuals we support. */ + + if (!miSetVisualTypes(pScrn->depth, + miGetDefaultVisualMask(pScrn->depth), + pScrn->rgbBits, pScrn->defaultVisual)) + return FALSE; + + if (!miSetPixmapDepths ()) return FALSE; + + /* + * Call the framebuffer layer's ScreenInit function, and fill in other + * pScreen fields. + */ + ret = fbScreenInit(pScreen, dPtr->FBBase, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, pScrn->bitsPerPixel); + if (!ret) + return FALSE; + + if (pScrn->depth > 8) { + /* Fixup RGB ordering */ + visual = pScreen->visuals + pScreen->numVisuals; + while (--visual >= pScreen->visuals) { + if ((visual->class | DynamicClass) == DirectColor) { + visual->offsetRed = pScrn->offset.red; + visual->offsetGreen = pScrn->offset.green; + visual->offsetBlue = pScrn->offset.blue; + visual->redMask = pScrn->mask.red; + visual->greenMask = pScrn->mask.green; + visual->blueMask = pScrn->mask.blue; + } + } + } + + /* must be after RGB ordering fixed */ + fbPictureInit(pScreen, 0, 0); + + xf86SetBlackWhitePixels(pScreen); + +#ifdef USE_DGA + DUMMYDGAInit(pScreen); +#endif + + if (dPtr->swCursor) + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using Software Cursor.\n"); + + { + + + BoxRec AvailFBArea; + int lines = pScrn->videoRam * 1024 / + (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3)); + AvailFBArea.x1 = 0; + AvailFBArea.y1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + AvailFBArea.y2 = lines; + xf86InitFBManager(pScreen, &AvailFBArea); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %i scanlines of offscreen memory \n" + , lines - pScrn->virtualY); + } + + xf86SetBackingStore(pScreen); + xf86SetSilkenMouse(pScreen); + + /* Initialise cursor functions */ + miDCInitialize (pScreen, xf86GetPointerScreenFuncs()); + + + if (!dPtr->swCursor) { + /* HW cursor functions */ + if (!DUMMYCursorInit(pScreen)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Hardware cursor initialization failed\n"); + return FALSE; + } + } + + /* Initialise default colourmap */ + if(!miCreateDefColormap(pScreen)) + return FALSE; + + if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, + DUMMYLoadPalette, NULL, + CMAP_PALETTED_TRUECOLOR + | CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; + +/* DUMMYInitVideo(pScreen); */ + + pScreen->SaveScreen = DUMMYSaveScreen; + + + /* Wrap the current CloseScreen function */ + dPtr->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = DUMMYCloseScreen; + + /* Wrap the current CreateWindow function */ + dPtr->CreateWindow = pScreen->CreateWindow; + pScreen->CreateWindow = DUMMYCreateWindow; + + /* Report any unused options (only for the first generation) */ + if (serverGeneration == 1) { + xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); + } + + return TRUE; +} + +/* Mandatory */ +Bool +DUMMYSwitchMode(SWITCH_MODE_ARGS_DECL) +{ + return TRUE; +} + +/* Mandatory */ +void +DUMMYAdjustFrame(ADJUST_FRAME_ARGS_DECL) +{ +} + +/* Mandatory */ +static Bool +DUMMYCloseScreen(CLOSE_SCREEN_ARGS_DECL) +{ + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); + DUMMYPtr dPtr = DUMMYPTR(pScrn); + + if(pScrn->vtSema){ + free(dPtr->FBBase); + } + + if (dPtr->CursorInfo) + xf86DestroyCursorInfoRec(dPtr->CursorInfo); + + pScrn->vtSema = FALSE; + pScreen->CloseScreen = dPtr->CloseScreen; + return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS); +} + +/* Optional */ +static void +DUMMYFreeScreen(FREE_SCREEN_ARGS_DECL) +{ + SCRN_INFO_PTR(arg); + DUMMYFreeRec(pScrn); +} + +static Bool +DUMMYSaveScreen(ScreenPtr pScreen, int mode) +{ + ScrnInfoPtr pScrn = NULL; + DUMMYPtr dPtr; + + if (pScreen != NULL) { + pScrn = xf86ScreenToScrn(pScreen); + dPtr = DUMMYPTR(pScrn); + + dPtr->screenSaver = xf86IsUnblank(mode); + } + return TRUE; +} + +/* Optional */ +static ModeStatus +DUMMYValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags) +{ + return(MODE_OK); +} + +Atom VFB_PROP = 0; +#define VFB_PROP_NAME "VFB_IDENT" + +static Bool +DUMMYCreateWindow(WindowPtr pWin) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + DUMMYPtr dPtr = DUMMYPTR(DUMMYScrn); + WindowPtr pWinRoot; + int ret; + + pScreen->CreateWindow = dPtr->CreateWindow; + ret = pScreen->CreateWindow(pWin); + dPtr->CreateWindow = pScreen->CreateWindow; + pScreen->CreateWindow = DUMMYCreateWindow; + + if(ret != TRUE) + return(ret); + + if(dPtr->prop == FALSE) { +#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 8 + pWinRoot = WindowTable[DUMMYScrn->pScreen->myNum]; +#else + pWinRoot = DUMMYScrn->pScreen->root; +#endif + if (! ValidAtom(VFB_PROP)) + VFB_PROP = MakeAtom(VFB_PROP_NAME, strlen(VFB_PROP_NAME), 1); + + ret = dixChangeWindowProperty(serverClient, pWinRoot, VFB_PROP, + XA_STRING, 8, PropModeReplace, + (int)4, (pointer)"TRUE", FALSE); + if( ret != Success) + ErrorF("Could not set VFB root window property"); + dPtr->prop = TRUE; + + return TRUE; + } + return TRUE; +} + +#ifndef HW_SKIP_CONSOLE +#define HW_SKIP_CONSOLE 4 +#endif + +static Bool +dummyDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr) +{ + CARD32 *flag; + + switch (op) { + case GET_REQUIRED_HW_INTERFACES: + flag = (CARD32*)ptr; + (*flag) = HW_SKIP_CONSOLE; + return TRUE; + default: + return FALSE; + } +}