configure.ac 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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_INIT([MIC Offload Runtime Library], [1.0], ,[liboffloadmic])
  30. AC_CANONICAL_SYSTEM
  31. target_alias=${target_alias-$host_alias}
  32. AC_SUBST(target_alias)
  33. AM_INIT_AUTOMAKE(foreign no-dist)
  34. AM_MAINTAINER_MODE
  35. AC_PROG_CC
  36. AC_PROG_CXX
  37. AC_CONFIG_FILES([Makefile liboffloadmic_host.spec liboffloadmic_target.spec])
  38. AM_ENABLE_MULTILIB(, ..)
  39. AC_CONFIG_SUBDIRS(plugin)
  40. AC_FUNC_ALLOCA
  41. AC_CHECK_HEADERS([mm_malloc.h], [], [AC_MSG_ERROR(["Couldn't find mm_malloc.h"])])
  42. AC_CHECK_FUNCS([__secure_getenv secure_getenv])
  43. # Get target configure.
  44. . ${srcdir}/configure.tgt
  45. if test -n "$UNSUPPORTED"; then
  46. AC_MSG_ERROR([Configuration ${target} is unsupported])
  47. fi
  48. if test "${multilib}" = "yes"; then
  49. multilib_arg="--enable-multilib"
  50. else
  51. multilib_arg=
  52. fi
  53. AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
  54. AC_ARG_ENABLE([version-specific-runtime-libs],
  55. AC_HELP_STRING([--enable-version-specific-runtime-libs],
  56. [Specify that runtime libraries should be installed in a compiler-specific directory]),
  57. [case "$enableval" in
  58. yes) enable_version_specific_runtime_libs=yes ;;
  59. no) enable_version_specific_runtime_libs=no ;;
  60. *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
  61. esac],
  62. [enable_version_specific_runtime_libs=no])
  63. AC_MSG_RESULT($enable_version_specific_runtime_libs)
  64. # Make sure liboffloadmic is enabled
  65. case "$enable_liboffloadmic" in
  66. host | target)
  67. ;;
  68. *)
  69. AC_MSG_ERROR([Liboffloadmic is disabled]) ;;
  70. esac
  71. AM_CONDITIONAL(LIBOFFLOADMIC_HOST, [test x"$enable_liboffloadmic" = xhost])
  72. GCC_WITH_TOOLEXECLIBDIR
  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. case ${with_toolexeclibdir} in
  89. no)
  90. toolexeclibdir='$(toolexecdir)/lib'
  91. ;;
  92. *)
  93. toolexeclibdir=${with_toolexeclibdir}
  94. ;;
  95. esac
  96. else
  97. toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
  98. toolexeclibdir='$(libdir)'
  99. fi
  100. multi_os_directory=`$CC -print-multi-os-directory`
  101. case $multi_os_directory in
  102. .) ;; # Avoid trailing /.
  103. *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
  104. esac
  105. ;;
  106. esac
  107. AC_LIBTOOL_DLOPEN
  108. AM_PROG_LIBTOOL
  109. # Forbid libtool to hardcode RPATH, because we want to be able to specify
  110. # library search directory using LD_LIBRARY_PATH
  111. hardcode_into_libs=no
  112. AC_SUBST(toolexecdir)
  113. AC_SUBST(toolexeclibdir)
  114. AC_SUBST(lt_cv_dlopen_libs)
  115. if test $enable_shared = yes; then
  116. link_offloadmic_host="-loffloadmic_host %{static: $LIBS}"
  117. link_offloadmic_target="-loffloadmic_target %{static: $LIBS}"
  118. else
  119. link_offloadmic_host="-loffloadmic_host $LIBS"
  120. link_offloadmic_target="-loffloadmic_target $LIBS"
  121. fi
  122. AC_SUBST(link_offloadmic_host)
  123. AC_SUBST(link_offloadmic_target)
  124. # Determine what GCC version number to use in filesystem paths.
  125. GCC_BASE_VER
  126. # Must be last
  127. AC_OUTPUT