]>
Commit | Line | Data |
---|---|---|
5f520819 KY |
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 | ||
28 | # Process this file with autoconf to produce a configure script, like so: | |
29 | # aclocal -I .. -I ../config && autoconf && automake | |
30 | ||
5f520819 KY |
31 | AC_INIT([MIC Offload Runtime Library], [1.0], ,[liboffloadmic]) |
32 | ||
33 | AC_CANONICAL_SYSTEM | |
34 | target_alias=${target_alias-$host_alias} | |
35 | AC_SUBST(target_alias) | |
36 | ||
37 | AM_INIT_AUTOMAKE(foreign no-dist) | |
38 | AM_MAINTAINER_MODE | |
39 | ||
40 | AC_PROG_CC | |
41 | AC_PROG_CXX | |
42 | AC_CONFIG_FILES([Makefile liboffloadmic_host.spec liboffloadmic_target.spec]) | |
43 | AM_ENABLE_MULTILIB(, ..) | |
9d73ec14 | 44 | AC_CONFIG_SUBDIRS(plugin) |
5f520819 KY |
45 | AC_FUNC_ALLOCA |
46 | AC_CHECK_HEADERS([mm_malloc.h], [], [AC_MSG_ERROR(["Couldn't find mm_malloc.h"])]) | |
47 | AC_CHECK_FUNCS([__secure_getenv secure_getenv]) | |
48 | ||
49 | # Get target configure. | |
50 | . ${srcdir}/configure.tgt | |
51 | if test -n "$UNSUPPORTED"; then | |
52 | AC_MSG_ERROR([Configuration ${target} is unsupported]) | |
53 | fi | |
54 | ||
55 | if test "${multilib}" = "yes"; then | |
56 | multilib_arg="--enable-multilib" | |
57 | else | |
58 | multilib_arg= | |
59 | fi | |
60 | ||
61 | AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) | |
62 | AC_ARG_ENABLE([version-specific-runtime-libs], | |
63 | AC_HELP_STRING([--enable-version-specific-runtime-libs], | |
64 | [Specify that runtime libraries should be installed in a compiler-specific directory]), | |
65 | [case "$enableval" in | |
66 | yes) enable_version_specific_runtime_libs=yes ;; | |
67 | no) enable_version_specific_runtime_libs=no ;; | |
68 | *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; | |
69 | esac], | |
70 | [enable_version_specific_runtime_libs=no]) | |
71 | AC_MSG_RESULT($enable_version_specific_runtime_libs) | |
72 | ||
73 | # Make sure liboffloadmic is enabled | |
74 | case "$enable_liboffloadmic" in | |
75 | host | target) | |
76 | ;; | |
77 | *) | |
78 | AC_MSG_ERROR([Liboffloadmic is disabled]) ;; | |
79 | esac | |
80 | AM_CONDITIONAL(LIBOFFLOADMIC_HOST, [test x"$enable_liboffloadmic" = xhost]) | |
81 | ||
82 | # Calculate toolexeclibdir. | |
83 | # Also toolexecdir, though it's only used in toolexeclibdir. | |
84 | case ${enable_version_specific_runtime_libs} in | |
85 | yes) | |
86 | # Need the gcc compiler version to know where to install libraries | |
87 | # and header files if --enable-version-specific-runtime-libs option | |
88 | # is selected. | |
89 | toolexecdir='$(libdir)/gcc/$(target_alias)' | |
90 | toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)' | |
91 | ;; | |
92 | no) | |
93 | if test -n "$with_cross_host" && | |
94 | test x"$with_cross_host" != x"no"; then | |
95 | # Install a library built with a cross compiler in tooldir, not libdir. | |
96 | toolexecdir='$(exec_prefix)/$(target_alias)' | |
97 | toolexeclibdir='$(toolexecdir)/lib' | |
98 | else | |
99 | toolexecdir='$(libdir)/gcc-lib/$(target_alias)' | |
100 | toolexeclibdir='$(libdir)' | |
101 | fi | |
102 | multi_os_directory=`$CC -print-multi-os-directory` | |
103 | case $multi_os_directory in | |
104 | .) ;; # Avoid trailing /. | |
105 | *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; | |
106 | esac | |
107 | ;; | |
108 | esac | |
109 | ||
110 | AC_LIBTOOL_DLOPEN | |
111 | AM_PROG_LIBTOOL | |
112 | # Forbid libtool to hardcode RPATH, because we want to be able to specify | |
113 | # library search directory using LD_LIBRARY_PATH | |
114 | hardcode_into_libs=no | |
115 | AC_SUBST(toolexecdir) | |
116 | AC_SUBST(toolexeclibdir) | |
117 | ||
118 | AC_SUBST(lt_cv_dlopen_libs) | |
119 | ||
120 | if test $enable_shared = yes; then | |
121 | link_offloadmic_host="-loffloadmic_host %{static: $LIBS}" | |
122 | link_offloadmic_target="-loffloadmic_target %{static: $LIBS}" | |
123 | else | |
124 | link_offloadmic_host="-loffloadmic_host $LIBS" | |
125 | link_offloadmic_target="-loffloadmic_target $LIBS" | |
126 | fi | |
127 | AC_SUBST(link_offloadmic_host) | |
128 | AC_SUBST(link_offloadmic_target) | |
129 | ||
3c36aa6b JJ |
130 | # Determine what GCC version number to use in filesystem paths. |
131 | GCC_BASE_VER | |
132 | ||
5f520819 KY |
133 | # Must be last |
134 | AC_OUTPUT |