Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / nlio / repo / third_party / nlbuild-autotools / repo / examples / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 #
5 #    Copyright 2016-2018 Nest Labs Inc. All Rights Reserved.
6 #
7 #    Licensed under the Apache License, Version 2.0 (the "License");
8 #    you may not use this file except in compliance with the License.
9 #    You may obtain a copy of the License at
10 #
11 #    http://www.apache.org/licenses/LICENSE-2.0
12 #
13 #    Unless required by applicable law or agreed to in writing, software
14 #    distributed under the License is distributed on an "AS IS" BASIS,
15 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 #    See the License for the specific language governing permissions and
17 #    limitations under the License.
18 #
19
20 #
21 #    Description:
22 #      This file is the GNU autoconf input source file for
23 #      @PACKAGE_DESCRIPTION@.
24 #
25
26 #
27 # Declare autoconf version requirements
28 #
29 AC_PREREQ([2.68])
30
31 #
32 # Initialize autoconf for the package
33 #
34 AC_INIT([@PACKAGE_SHORT_LOWER@],
35         m4_esyscmd([@NLBUILD_AUTOTOOLS_STEM@/scripts/mkversion -b `cat .default-version` .]),
36         [@PACKAGE_EMAIL@],
37         [@PACKAGE_SHORT_LOWER@],
38         [@PACKAGE_URL@])
39
40 # Tell the rest of the build system the absolute path where the
41 # nlbuild-autotools repository is rooted at.
42
43 AC_SUBST(nlbuild_autotools_stem,[@NLBUILD_AUTOTOOLS_STEM@])
44 AC_SUBST(abs_top_nlbuild_autotools_dir,[\${abs_top_srcdir}/\${nlbuild_autotools_stem}])
45
46 #
47 # @PACKAGE_SHORT_UPPER@ interface current, revision, and age versions.
48 #
49 # Maintainters: Please manage these fields as follows:
50 #
51 #   Interfaces removed:    CURRENT++, AGE = 0, REVISION = 0
52 #   Interfaces added:      CURRENT++, AGE++,   REVISION = 0
53 #   No interfaces changed:                     REVISION++
54 #
55 #
56 AC_SUBST(LIB@PACKAGE_SHORT_UPPER@_VERSION_CURRENT,  [1])
57 AC_SUBST(LIB@PACKAGE_SHORT_UPPER@_VERSION_AGE,      [0])
58 AC_SUBST(LIB@PACKAGE_SHORT_UPPER@_VERSION_REVISION, [0])
59 AC_SUBST(LIB@PACKAGE_SHORT_UPPER@_VERSION_INFO,     [${LIB@PACKAGE_SHORT_UPPER@_VERSION_CURRENT}:${LIB@PACKAGE_SHORT_UPPER@_VERSION_REVISION}:${LIB@PACKAGE_SHORT_UPPER@_VERSION_AGE}])
60
61 #
62 # Check the sanity of the source directory by checking for the
63 # presence of a key watch file
64 #
65 AC_CONFIG_SRCDIR([include/@PACKAGE_SHORT_LOWER@.h])
66
67 #
68 # Tell autoconf where to find auxilliary build tools (e.g. config.guess,
69 # install-sh, missing, etc.)
70 #
71 AC_CONFIG_AUX_DIR([@NLBUILD_AUTOTOOLS_STEM@/third_party/autoconf])
72
73 #
74 # Tell autoconf where to find auxilliary M4 macros
75 #
76 AC_CONFIG_MACRO_DIRS([@NLBUILD_AUTOTOOLS_STEM@/third_party/autoconf/m4 @NLBUILD_AUTOTOOLS_STEM@/autoconf/m4])
77
78 #
79 # Tell autoconf what file the package is using to aggregate C preprocessor
80 # defines.
81 #
82 AC_CONFIG_HEADERS([include/@PACKAGE_SHORT_LOWER@-config.h])
83
84 #
85 # Figure out what the canonical build, host and target tuples are.
86 #
87 AC_CANONICAL_BUILD
88 AC_CANONICAL_HOST
89 AC_CANONICAL_TARGET
90
91 #
92 # Mac OS X / Darwin ends up putting some versioning cruft on the end of its
93 # tuple that we don't care about in this script. Create "clean" variables
94 # devoid of it.
95 #
96
97 NL_FILTERED_CANONICAL_BUILD
98 NL_FILTERED_CANONICAL_HOST
99 NL_FILTERED_CANONICAL_TARGET
100
101 #
102 # Configure automake with the desired options, indicating that this is not
103 # a native GNU package, that we want "silent" build rules, and that we want
104 # objects built in the same subdirectory as their source rather than collapsed
105 # together at the top-level directory.
106 #
107 # Disable silent build rules by either passing --disable-silent-rules to
108 # configure or passing V=1 to make
109 #
110 AM_INIT_AUTOMAKE([1.14 foreign silent-rules subdir-objects tar-pax])
111
112 #
113 # Silent build rules requires at least automake-1.11. Employ
114 # techniques for not breaking earlier versions of automake.
115 #
116 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
117 AM_SILENT_RULES([yes])
118
119 #
120 # Enable maintainer mode to prevent the package from constantly trying
121 # to rebuild configure, Makefile.in, etc. Rebuilding such files rarely,
122 # if ever, needs to be done "in the field".
123 #
124 # Use the included 'bootstrap' script instead when necessary.
125 #
126 AM_MAINTAINER_MODE
127
128 #
129 # Checks for build host programs
130 #
131
132 # If we are cross-compiling and we are on an embedded target that
133 # doesn't support independent, standalone executables, then all
134 # compiler tests that attempt to create an executable will fail. In
135 # such circumstances, set AC_NO_EXECUTABLES (see http://sourceware.org/
136 # ml/newlib/2006/msg00353.html).
137
138 AC_MSG_CHECKING([whether to disable executable checking])
139 if test "$cross_compiling" = yes; then
140     AC_NO_EXECUTABLES
141     AC_MSG_RESULT([yes])
142 else
143     AC_MSG_RESULT([no])
144 fi
145
146 # Passing -Werror to GCC-based or -compatible compilers breaks some
147 # autoconf tests (see
148 # http://lists.gnu.org/archive/html/autoconf-patches/2008-09/msg00014.html).
149 #
150 # If -Werror has been passed transform it into -Wno-error. We'll
151 # transform it back later with NL_RESTORE_WERROR.
152
153 NL_SAVE_WERROR
154
155 # Check for compilers.
156 #
157 # These should be checked BEFORE we check for and, implicitly,
158 # initialize libtool such that libtool knows what languages it has to
159 # work with.
160
161 AC_PROG_CPP
162 AC_PROG_CPP_WERROR
163
164 AC_PROG_CC
165 AC_PROG_CC_C_O
166
167 AC_PROG_CXXCPP
168
169 AC_PROG_CXX
170 AC_PROG_CXX_C_O
171
172 # Check for other compiler toolchain tools.
173
174 AC_CHECK_TOOL(AR, ar)
175 AC_CHECK_TOOL(RANLIB, ranlib)
176 AC_CHECK_TOOL(OBJCOPY, objcopy)
177 AC_CHECK_TOOL(STRIP, strip)
178
179 # Check for other host tools.
180
181 AC_PROG_INSTALL
182 AC_PROG_LN_S
183
184 AC_PATH_PROG(CMP, cmp)
185 AC_PATH_PROG(PERL, perl)
186
187 #
188 # Checks for specific compiler characteristics
189 #
190
191 #
192 # Common compiler flags we would like to have.
193 #
194 #   -Wall                        CC, CXX
195 #
196
197 PROSPECTIVE_CFLAGS="-Wall"
198 PROSPECTIVE_CXXFLAGS=""
199
200 AX_CHECK_COMPILER_OPTIONS([C],   ${PROSPECTIVE_CFLAGS})
201 AX_CHECK_COMPILER_OPTIONS([C++], ${PROSPECTIVE_CFLAGS} ${PROSPECTIVE_CXXFLAGS})
202
203 # Check for and initialize libtool
204
205 LT_INIT
206
207 #
208 # Debug instances
209 #
210 AC_MSG_NOTICE([checking whether to build debug instances])
211
212 # Debug
213
214 NL_ENABLE_DEBUG([no])
215
216 AM_CONDITIONAL([@PACKAGE_SHORT_UPPER@_BUILD_DEBUG], [test "${nl_cv_build_debug}" = "yes"])
217
218 #
219 # Code coverage and compiler optimization
220 #
221
222 # Coverage
223
224 NL_ENABLE_COVERAGE([no])
225
226 AM_CONDITIONAL([@PACKAGE_SHORT_UPPER@_BUILD_COVERAGE], [test "${nl_cv_build_coverage}" = "yes"])
227
228 NL_ENABLE_COVERAGE_REPORTS([auto])
229
230 AM_CONDITIONAL([@PACKAGE_SHORT_UPPER@_BUILD_COVERAGE_REPORTS], [test "${nl_cv_build_coverage_reports}" = "yes"])
231
232 # Optimization
233
234 NL_ENABLE_OPTIMIZATION([yes])
235
236 AM_CONDITIONAL([@PACKAGE_SHORT_UPPER@_BUILD_OPTIMIZED], [test "${nl_cv_build_optimized}" = "yes"])
237
238 #
239 # Tests
240 #
241 AC_MSG_NOTICE([checking whether to build tests])
242
243 # Tests
244
245 NL_ENABLE_TESTS([yes])
246
247 AM_CONDITIONAL([@PACKAGE_SHORT_UPPER@_BUILD_TESTS], [test "${nl_cv_build_tests}" = "yes"])
248
249 #
250 # Documentation
251 #
252
253 # Determine whether or not documentation (via Doxygen) should be built
254 # or not, with 'auto' as the default and establish a default support
255 # value for GraphViz 'dot' support.
256
257 NL_ENABLE_DOCS([auto],[NO])
258
259 AM_CONDITIONAL(@PACKAGE_SHORT_UPPER@_BUILD_DOCS, [test "${nl_cv_build_docs}" = "yes"])
260
261 #
262 # Checks for libraries and packages.
263 #
264 # At minimum, the following packages are optional, depending on
265 # configuration:
266 #
267 #   * TBD
268 #
269 AC_MSG_NOTICE([checking required package dependencies])
270
271 # Check if the build host has pkg-config
272
273 AC_PATH_PROG([PKG_CONFIG],[pkg-config])
274
275 # Here is a package example with nlunit-test. Uncomment and adapt or delete
276 # this, as needed. If you choose to use this, please also take a look at
277 # Makefile.am and third_party/Makefile.am and uncomment the appropriate
278 # sections there.
279
280 # #
281 # # Nlunit-test
282 # #
283 #
284 # if test "${nl_cv_build_tests}" = "yes"; then
285 #     NL_WITH_PACKAGE(
286 #         [Nlunit-test],
287 #         [NLUNIT_TEST],
288 #         [nlunit_test],
289 #         [-lnlunit-test],
290 #         [
291 #           # At this point, the internal Nlunit-test package will be neither
292 #           # configured nor built, so the normal checks we undertake for an
293 #           # external package cannot be run here. Simply set the appropriate
294 #           # variables and trust all will be well.
295 #
296 #             NLUNIT_TEST_CPPFLAGS="-I\${abs_top_srcdir}/third_party/nlunit-test/repo/src"
297 #             NLUNIT_TEST_LDFLAGS="-L${ac_pwd}/third_party/nlunit-test/repo/src"
298 #             NLUNIT_TEST_LIBS="-lnlunit-test"
299 #         ],
300 #         [
301 #             # Check for required nlunit-test headers.
302 #
303 #             AC_CHECK_HEADERS([nlunit-test.h],
304 #             [],
305 #             [
306 #                 AC_MSG_ERROR(The nlunit-test header "$ac_header" is required but cannot be found.)
307 #             ])
308 #         ])
309 # fi
310 #
311 # # Depending on whether nlunit-test has been configured for an internal
312 # # location, its directory stem within this package needs to be set
313 # # accordingly. In addition, if the location is internal, then we need
314 # # to attempt to pull it down using the bootstrap makefile.
315 #
316 # if test "${nl_with_nlunit_test}" = "internal"; then
317 #     maybe_nlunit_test_dirstem="nlunit-test/repo"
318 #     nlunit_test_dirstem="third_party/${maybe_nlunit_test_dirstem}"
319 #
320 #     AC_MSG_NOTICE([attempting to create internal ${nlunit_test_dirstem}])
321 #
322 #     ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${nlunit_test_dirstem}
323 #
324 #     if test $? -ne 0; then
325 #         AC_MSG_ERROR([failed to create ${nlunit_test_dirstem}. Please check your network connection or the correctness of 'repos.conf'])
326 #     fi
327 # else
328 #     maybe_nlunit_test_dirstem=""
329 # fi
330 #
331 # AC_SUBST(NLUNIT_TEST_SUBDIRS, [${maybe_nlunit_test_dirstem}])
332 # AM_CONDITIONAL([@PACKAGE_SHORT_UPPER@_WITH_NLUNIT_TEST_INTERNAL], [test "${nl_with_nlunit_test}" = "internal"])
333
334 #
335 # Check for headers
336 #
337 AC_HEADER_STDBOOL
338 AC_HEADER_STDC
339
340 AC_CHECK_HEADERS([stdint.h])
341 AC_CHECK_HEADERS([string.h])
342
343 #
344 # Check for types and structures
345 #
346 AC_TYPE_INT8_T
347 AC_TYPE_INT16_T
348 AC_TYPE_INT32_T
349 AC_TYPE_INT64_T
350 AC_TYPE_UINT8_T
351 AC_TYPE_UINT16_T
352 AC_TYPE_UINT32_T
353 AC_TYPE_UINT64_T
354
355 #
356 # Checks for library functions
357 #
358
359 if test "${ac_no_link}" != "yes"; then
360     AC_CHECK_FUNCS([memcpy])
361 fi
362
363 # Here is an example with nlunit-test. Uncomment and adapt or delete
364 # this, as needed.
365
366 # # Add any nlunit-test CPPFLAGS, LDFLAGS, and LIBS
367 #
368 # CPPFLAGS="${CPPFLAGS} ${NLUNIT_TEST_CPPFLAGS}"
369 # LDFLAGS="${LDFLAGS} ${NLUNIT_TEST_LDFLAGS}"
370 # LIBS="${LIBS} ${NLUNIT_TEST_LIBS}"
371
372 # Add any code coverage CPPFLAGS and LIBS
373
374 CPPFLAGS="${CPPFLAGS} ${NL_COVERAGE_CPPFLAGS}"
375 LIBS="${LIBS} ${NL_COVERAGE_LIBS}"
376 LDFLAGS="${LDFLAGS} ${NL_COVERAGE_LDFLAGS}"
377
378 # At this point, we can restore the compiler flags to whatever the
379 # user passed in, now that we're clear of any -Werror issues by
380 # transforming -Wno-error back to -Werror.
381
382 NL_RESTORE_WERROR
383
384 # Here is an example with nlunit-test. Uncomment and adapt or delete
385 # this, as needed.
386
387 # # Configure any autotools-based subdirectories
388 #
389 # if test "${nl_with_nlunit_test}" = "internal"; then
390 #     AC_CONFIG_SUBDIRS([third_party/nlunit-test/repo])
391 #     AC_SUBST(NLUNIT_TEST_FOREIGN_SUBDIR_DEPENDENCY,["${ac_pwd}/third_party/nlunit-test/repo/src"])
392 # fi
393
394 #
395 # Identify the various makefiles and auto-generated files for the package
396 #
397 AC_CONFIG_FILES([
398 Makefile
399 third_party/Makefile
400 src/Makefile
401 tests/Makefile
402 doc/Makefile
403 ])
404
405 #
406 # Generate the auto-generated files for the package
407 #
408 AC_OUTPUT
409
410 #
411 # Summarize the package configuration
412 #
413
414 AC_MSG_NOTICE([
415
416   Configuration Summary
417   ---------------------
418   Package                                     : ${PACKAGE_NAME}
419   Version                                     : ${PACKAGE_VERSION}
420   Interface                                   : ${LIB@PACKAGE_SHORT_UPPER@_VERSION_INFO//:/.}
421   Build system                                : ${build}
422   Host system                                 : ${host}
423   Target system                               : ${target}
424   Target architecture                         : ${target_cpu}
425   Target OS                                   : ${target_os}
426   Cross compiling                             : ${cross_compiling}
427   Build shared libraries                      : ${enable_shared}
428   Build static libraries                      : ${enable_static}
429   Build debug libraries                       : ${nl_cv_build_debug}
430   Build optimized libraries                   : ${nl_cv_build_optimized}
431   Build coverage libraries                    : ${nl_cv_build_coverage}
432   Build coverage reports                      : ${nl_cv_build_coverage_reports}
433   Lcov                                        : ${LCOV:--}
434   Genhtml                                     : ${GENHTML:--}
435   Build tests                                 : ${nl_cv_build_tests}
436   Prefix                                      : ${prefix}
437   Shadow directory program                    : ${LNDIR}
438   Documentation support                       : ${nl_cv_build_docs}
439   Doxygen                                     : ${DOXYGEN:--}
440   GraphViz dot                                : ${DOT:--}
441   PERL                                        : ${PERL:--}
442   Nlunit-test source                          : ${nl_with_nlunit_test:--}
443   Nlunit-test compile flags                   : ${NLUNIT_TEST_CPPFLAGS:--}
444   Nlunit-test link flags                      : ${NLUNIT_TEST_LDFLAGS:--}
445   Nlunit-test link libraries                  : ${NLUNIT_TEST_LIBS:--}
446   Nlunit-test foreign subdirectory dependency : ${NLUNIT_TEST_FOREIGN_SUBDIR_DEPENDENCY:--}
447   C Preprocessor                              : ${CPP}
448   C Compiler                                  : ${CC}
449   C++ Preprocessor                            : ${CXXCPP}
450   C++ Compiler                                : ${CXX}
451   Archiver                                    : ${AR}
452   Archive Indexer                             : ${RANLIB}
453   Symbol Stripper                             : ${STRIP}
454   Object Copier                               : ${OBJCOPY}
455   C Preprocessor flags                        : ${CPPFLAGS:--}
456   C Compile flags                             : ${CFLAGS:--}
457   C++ Compile flags                           : ${CXXFLAGS:--}
458   Link flags                                  : ${LDFLAGS:--}
459   Link libraries                              : ${LIBS}
460
461 ])