64 lines
2.1 KiB
Bash
Executable File
64 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Helper script to find libssh installation on your system
|
|
|
|
echo "Looking for libssh installation..."
|
|
echo
|
|
|
|
# Check pkg-config path
|
|
if command -v pkg-config &> /dev/null; then
|
|
echo "Checking pkg-config for libssh:"
|
|
if pkg-config --exists libssh; then
|
|
echo " - Found libssh with pkg-config"
|
|
echo " - Version: $(pkg-config --modversion libssh)"
|
|
echo " - Include path: $(pkg-config --variable=includedir libssh)"
|
|
echo " - Library path: $(pkg-config --variable=libdir libssh)"
|
|
echo
|
|
echo "To use this in cmake:"
|
|
echo " cmake -DCMAKE_PREFIX_PATH=$(pkg-config --variable=prefix libssh) .."
|
|
echo
|
|
else
|
|
echo " - libssh not found with pkg-config"
|
|
echo
|
|
fi
|
|
else
|
|
echo "pkg-config not found on your system"
|
|
echo
|
|
fi
|
|
|
|
# Check common include paths
|
|
for DIR in /usr/include /usr/local/include /opt/local/include; do
|
|
if [ -d "$DIR" ] && [ -f "$DIR/libssh/libssh.h" ]; then
|
|
echo "Found libssh headers at: $DIR/libssh/libssh.h"
|
|
fi
|
|
done
|
|
|
|
# Check common library paths
|
|
LIB_PATHS=()
|
|
for DIR in /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu /usr/local/lib64 /opt/local/lib; do
|
|
if [ -d "$DIR" ]; then
|
|
LIBS=$(find "$DIR" -name "libssh.so*" -o -name "libssh.dylib" -o -name "libssh.a" 2>/dev/null)
|
|
if [ -n "$LIBS" ]; then
|
|
echo "Found libssh libraries in $DIR:"
|
|
echo "$LIBS" | sed 's/^/ - /'
|
|
LIB_DIR="$DIR"
|
|
LIB_PATHS+=("$DIR")
|
|
fi
|
|
fi
|
|
done
|
|
|
|
echo
|
|
if [ ${#LIB_PATHS[@]} -gt 0 ]; then
|
|
echo "To build with the detected libssh installation, you can use:"
|
|
echo " cmake -DLIBSSH_LIBRARY=${LIB_PATHS[0]}/libssh.so -DLIBSSH_INCLUDE_DIR=/usr/include .."
|
|
echo
|
|
echo "Or set environment variables:"
|
|
echo " export LIBSSH_LIBRARY=${LIB_PATHS[0]}/libssh.so"
|
|
echo " export LIBSSH_INCLUDE_DIR=/usr/include"
|
|
echo " cmake .."
|
|
else
|
|
echo "Could not find libssh on your system."
|
|
echo "Please install it with your package manager:"
|
|
echo " - Ubuntu/Debian: sudo apt install libssh-dev"
|
|
echo " - CentOS/RHEL: sudo yum install libssh-devel"
|
|
echo " - macOS: brew install libssh"
|
|
fi |