with_database_dir.m4 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #
  2. # Copyright (C) 1994-2018 Altair Engineering, Inc.
  3. # For more information, contact Altair at www.altair.com.
  4. #
  5. # This file is part of the PBS Professional ("PBS Pro") software.
  6. #
  7. # Open Source License Information:
  8. #
  9. # PBS Pro is free software. You can redistribute it and/or modify it under the
  10. # terms of the GNU Affero General Public License as published by the Free
  11. # Software Foundation, either version 3 of the License, or (at your option) any
  12. # later version.
  13. #
  14. # PBS Pro is distributed in the hope that it will be useful, but WITHOUT ANY
  15. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16. # FOR A PARTICULAR PURPOSE.
  17. # See the GNU Affero General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU Affero General Public License
  20. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. #
  22. # Commercial License Information:
  23. #
  24. # For a copy of the commercial license terms and conditions,
  25. # go to: (http://www.pbspro.com/UserArea/agreement.html)
  26. # or contact the Altair Legal Department.
  27. #
  28. # Altair’s dual-license business model allows companies, individuals, and
  29. # organizations to create proprietary derivative works of PBS Pro and
  30. # distribute them - whether embedded or bundled with other software -
  31. # under a commercial license agreement.
  32. #
  33. # Use of Altair’s trademarks, including but not limited to "PBS™",
  34. # "PBS Professional®", and "PBS Pro™" and Altair’s logos is subject to Altair's
  35. # trademark licensing policies.
  36. #
  37. AC_DEFUN([PBS_AC_WITH_DATABASE_DIR],
  38. [
  39. AC_MSG_CHECKING([for PBS database directory])
  40. AC_ARG_WITH([database-dir],
  41. AS_HELP_STRING([--with-database-dir=DIR],
  42. [Specify the directory where the PBS database is installed.]
  43. )
  44. )
  45. AS_IF([test "x$with_database_dir" != "x"],
  46. [database_dir="$with_database_dir"],
  47. [database_dir="/usr"]
  48. )
  49. AS_IF([test -r "$database_dir/include/libpq-fe.h"],
  50. AS_IF([test "$database_dir" != "/usr"],
  51. [database_inc="-I$database_dir/include"]),
  52. AS_IF([test -r "$database_dir/include/pgsql/libpq-fe.h"],
  53. [database_inc="-I$database_dir/include/pgsql"],
  54. AS_IF([test -r "$database_dir/include/postgresql/libpq-fe.h"],
  55. [database_inc="-I$database_dir/include/postgresql"],
  56. AC_MSG_ERROR([Database headers not found.]))))
  57. AS_IF([test "$database_dir" = "/usr"],
  58. # Using system installed PostgreSQL
  59. AS_IF([test -r "/usr/lib64/libpq.so" -o -r "/usr/lib/libpq.so" -o -r "/usr/lib/x86_64-linux-gnu/libpq.so"],
  60. [database_lib="-lpq"],
  61. AC_MSG_ERROR([PBS database shared object library not found.])),
  62. # Using developer installed PostgreSQL
  63. AS_IF([test -r "$database_dir/lib64/libpq.a"],
  64. [database_lib="$database_dir/lib64/libpq.a"],
  65. AS_IF([test -r "$database_dir/lib/libpq.a"],
  66. [database_lib="$database_dir/lib/libpq.a"],
  67. AC_MSG_ERROR([PBS database library not found.])
  68. )
  69. )
  70. )
  71. AC_MSG_RESULT([$database_dir])
  72. AC_SUBST([database_dir])
  73. AC_SUBST([database_inc])
  74. AC_SUBST([database_lib])
  75. AC_SUBST([database_ldflags])
  76. AC_DEFINE([DATABASE], [], [Defined when PBS database is available])
  77. ])