configure 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/sh
  2. set -e
  3. echo '---------------------------------------------------------------------'
  4. echo 'SoftEther VPN for Unix'
  5. echo
  6. echo 'Copyright (c) all contributors on SoftEther VPN project in GitHub.'
  7. echo 'Copyright (c) Daiyuu Nobori, SoftEther Project at University of Tsukuba, and SoftEther Corporation.'
  8. echo
  9. echo 'Licensed under the Apache License, Version 2.0 (the License).'
  10. echo
  11. echo 'Read and understand README, LICENSE and WARNING before use.'
  12. echo '---------------------------------------------------------------------'
  13. echo
  14. echo 'Welcome to the corner-cutting configure script !'
  15. echo
  16. if [ ! -d "build" ]; then
  17. mkdir build
  18. fi
  19. if [ ! -z ${CMAKE_FLAGS+x} ]; then
  20. CMAKE_FLAGS="${CMAKE_FLAGS}"
  21. fi
  22. if [ ! -z ${CMAKE_INSTALL_PREFIX+x} ]; then
  23. CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ${CMAKE_FLAGS}"
  24. fi
  25. if [ -z ${OPENSSL_ROOT_DIR} ]; then
  26. unameOut="$(uname -s)"
  27. if [ "$unameOut" = "Darwin" ]; then
  28. echo "Environment variable OPENSSL_ROOT_DIR not set, using default Homebrew path: /usr/local/opt/openssl/"
  29. export OPENSSL_ROOT_DIR="/usr/local/opt/openssl/"
  30. fi
  31. fi
  32. if [ ! -z ${CPACK_GENERATOR+x} ]; then
  33. echo "CPACK_GENERATOR is set, CPack will generate ${CPACK_GENERATOR} packages."
  34. CMAKE_FLAGS="-DCPACK_GENERATOR=${CPACK_GENERATOR} ${CMAKE_FLAGS}"
  35. elif [ -x "$(command -v rpm)" ]; then
  36. echo "'rpm' executable found, CPack will generate RPM packages."
  37. CMAKE_FLAGS="-DCPACK_GENERATOR='RPM' ${CMAKE_FLAGS}"
  38. else
  39. echo "'rpm' executable not found, CPack will generate DEB packages."
  40. CMAKE_FLAGS="-DCPACK_GENERATOR='DEB' ${CMAKE_FLAGS}"
  41. fi
  42. echo ""
  43. (cd build && cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ${CMAKE_FLAGS} .. || exit 1)
  44. echo ""
  45. echo "The Makefile is generated. Run 'make -C build' to build SoftEther VPN."