configure.ac 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. # Copyright (c) 2014 Intel Corporation. All Rights Reserved.
  2. #
  3. # Redistribution and use in source and binary forms, with or without
  4. # modification, are permitted provided that the following conditions
  5. # are met:
  6. #
  7. # * Redistributions of source code must retain the above copyright
  8. # notice, this list of conditions and the following disclaimer.
  9. # * Redistributions in binary form must reproduce the above copyright
  10. # notice, this list of conditions and the following disclaimer in the
  11. # documentation and/or other materials provided with the distribution.
  12. # * Neither the name of Intel Corporation nor the names of its
  13. # contributors may be used to endorse or promote products derived
  14. # from this software without specific prior written permission.
  15. #
  16. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  17. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  18. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  19. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  20. # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  21. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  22. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  26. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. # Process this file with autoconf to produce a configure script, like so:
  28. # aclocal -I .. -I ../config && autoconf && automake
  29. AC_PREREQ([2.64])
  30. AC_INIT([MIC Offload Runtime Library], [1.0], ,[liboffloadmic])
  31. AC_CANONICAL_SYSTEM
  32. target_alias=${target_alias-$host_alias}
  33. AC_SUBST(target_alias)
  34. AM_INIT_AUTOMAKE(foreign no-dist)
  35. AM_MAINTAINER_MODE
  36. AC_PROG_CC
  37. AC_PROG_CXX
  38. AC_CONFIG_FILES([Makefile liboffloadmic_host.spec liboffloadmic_target.spec])
  39. AM_ENABLE_MULTILIB(, ..)
  40. AC_CONFIG_SUBDIRS(plugin)
  41. AC_FUNC_ALLOCA
  42. AC_CHECK_HEADERS([mm_malloc.h], [], [AC_MSG_ERROR(["Couldn't find mm_malloc.h"])])
  43. AC_CHECK_FUNCS([__secure_getenv secure_getenv])
  44. # Get target configure.
  45. . ${srcdir}/configure.tgt
  46. if test -n "$UNSUPPORTED"; then
  47. AC_MSG_ERROR([Configuration ${target} is unsupported])
  48. fi
  49. if test "${multilib}" = "yes"; then
  50. multilib_arg="--enable-multilib"
  51. else
  52. multilib_arg=
  53. fi
  54. AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
  55. AC_ARG_ENABLE([version-specific-runtime-libs],
  56. AC_HELP_STRING([--enable-version-specific-runtime-libs],
  57. [Specify that runtime libraries should be installed in a compiler-specific directory]),
  58. [case "$enableval" in
  59. yes) enable_version_specific_runtime_libs=yes ;;
  60. no) enable_version_specific_runtime_libs=no ;;
  61. *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
  62. esac],
  63. [enable_version_specific_runtime_libs=no])
  64. AC_MSG_RESULT($enable_version_specific_runtime_libs)
  65. # Make sure liboffloadmic is enabled
  66. case "$enable_liboffloadmic" in
  67. host | target)
  68. ;;
  69. *)
  70. AC_MSG_ERROR([Liboffloadmic is disabled]) ;;
  71. esac
  72. AM_CONDITIONAL(LIBOFFLOADMIC_HOST, [test x"$enable_liboffloadmic" = xhost])
  73. # Calculate toolexeclibdir.
  74. # Also toolexecdir, though it's only used in toolexeclibdir.
  75. case ${enable_version_specific_runtime_libs} in
  76. yes)
  77. # Need the gcc compiler version to know where to install libraries
  78. # and header files if --enable-version-specific-runtime-libs option
  79. # is selected.
  80. toolexecdir='$(libdir)/gcc/$(target_alias)'
  81. toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
  82. ;;
  83. no)
  84. if test -n "$with_cross_host" &&
  85. test x"$with_cross_host" != x"no"; then
  86. # Install a library built with a cross compiler in tooldir, not libdir.
  87. toolexecdir='$(exec_prefix)/$(target_alias)'
  88. toolexeclibdir='$(toolexecdir)/lib'
  89. else
  90. toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
  91. toolexeclibdir='$(libdir)'
  92. fi
  93. multi_os_directory=`$CC -print-multi-os-directory`
  94. case $multi_os_directory in
  95. .) ;; # Avoid trailing /.
  96. *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
  97. esac
  98. ;;
  99. esac
  100. AC_LIBTOOL_DLOPEN
  101. AM_PROG_LIBTOOL
  102. # Forbid libtool to hardcode RPATH, because we want to be able to specify
  103. # library search directory using LD_LIBRARY_PATH
  104. hardcode_into_libs=no
  105. AC_SUBST(toolexecdir)
  106. AC_SUBST(toolexeclibdir)
  107. AC_SUBST(lt_cv_dlopen_libs)
  108. if test $enable_shared = yes; then
  109. link_offloadmic_host="-loffloadmic_host %{static: $LIBS}"
  110. link_offloadmic_target="-loffloadmic_target %{static: $LIBS}"
  111. else
  112. link_offloadmic_host="-loffloadmic_host $LIBS"
  113. link_offloadmic_target="-loffloadmic_target $LIBS"
  114. fi
  115. AC_SUBST(link_offloadmic_host)
  116. AC_SUBST(link_offloadmic_target)
  117. # Must be last
  118. AC_OUTPUT