2 # Process this file with autoconf to produce a configure script.
5 # Copyright 2016-2018 Nest Labs Inc. All Rights Reserved.
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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.
22 # This file is the GNU autoconf input source file for
23 # @PACKAGE_DESCRIPTION@.
27 # Declare autoconf version requirements
32 # Initialize autoconf for the package
34 AC_INIT([@PACKAGE_SHORT_LOWER@],
35 m4_esyscmd([@NLBUILD_AUTOTOOLS_STEM@/scripts/mkversion -b `cat .default-version` .]),
37 [@PACKAGE_SHORT_LOWER@],
40 # Tell the rest of the build system the absolute path where the
41 # nlbuild-autotools repository is rooted at.
43 AC_SUBST(nlbuild_autotools_stem,[@NLBUILD_AUTOTOOLS_STEM@])
44 AC_SUBST(abs_top_nlbuild_autotools_dir,[\${abs_top_srcdir}/\${nlbuild_autotools_stem}])
47 # @PACKAGE_SHORT_UPPER@ interface current, revision, and age versions.
49 # Maintainters: Please manage these fields as follows:
51 # Interfaces removed: CURRENT++, AGE = 0, REVISION = 0
52 # Interfaces added: CURRENT++, AGE++, REVISION = 0
53 # No interfaces changed: REVISION++
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}])
62 # Check the sanity of the source directory by checking for the
63 # presence of a key watch file
65 AC_CONFIG_SRCDIR([include/@PACKAGE_SHORT_LOWER@.h])
68 # Tell autoconf where to find auxilliary build tools (e.g. config.guess,
69 # install-sh, missing, etc.)
71 AC_CONFIG_AUX_DIR([@NLBUILD_AUTOTOOLS_STEM@/third_party/autoconf])
74 # Tell autoconf where to find auxilliary M4 macros
76 AC_CONFIG_MACRO_DIRS([@NLBUILD_AUTOTOOLS_STEM@/third_party/autoconf/m4 @NLBUILD_AUTOTOOLS_STEM@/autoconf/m4])
79 # Tell autoconf what file the package is using to aggregate C preprocessor
82 AC_CONFIG_HEADERS([include/@PACKAGE_SHORT_LOWER@-config.h])
85 # Figure out what the canonical build, host and target tuples are.
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
97 NL_FILTERED_CANONICAL_BUILD
98 NL_FILTERED_CANONICAL_HOST
99 NL_FILTERED_CANONICAL_TARGET
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.
107 # Disable silent build rules by either passing --disable-silent-rules to
108 # configure or passing V=1 to make
110 AM_INIT_AUTOMAKE([1.14 foreign silent-rules subdir-objects tar-pax])
113 # Silent build rules requires at least automake-1.11. Employ
114 # techniques for not breaking earlier versions of automake.
116 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
117 AM_SILENT_RULES([yes])
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".
124 # Use the included 'bootstrap' script instead when necessary.
129 # Checks for build host programs
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).
138 AC_MSG_CHECKING([whether to disable executable checking])
139 if test "$cross_compiling" = yes; then
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).
150 # If -Werror has been passed transform it into -Wno-error. We'll
151 # transform it back later with NL_RESTORE_WERROR.
155 # Check for compilers.
157 # These should be checked BEFORE we check for and, implicitly,
158 # initialize libtool such that libtool knows what languages it has to
172 # Check for other compiler toolchain tools.
174 AC_CHECK_TOOL(AR, ar)
175 AC_CHECK_TOOL(RANLIB, ranlib)
176 AC_CHECK_TOOL(OBJCOPY, objcopy)
177 AC_CHECK_TOOL(STRIP, strip)
179 # Check for other host tools.
184 AC_PATH_PROG(CMP, cmp)
185 AC_PATH_PROG(PERL, perl)
188 # Checks for specific compiler characteristics
192 # Common compiler flags we would like to have.
197 PROSPECTIVE_CFLAGS="-Wall"
198 PROSPECTIVE_CXXFLAGS=""
200 AX_CHECK_COMPILER_OPTIONS([C], ${PROSPECTIVE_CFLAGS})
201 AX_CHECK_COMPILER_OPTIONS([C++], ${PROSPECTIVE_CFLAGS} ${PROSPECTIVE_CXXFLAGS})
203 # Check for and initialize libtool
210 AC_MSG_NOTICE([checking whether to build debug instances])
214 NL_ENABLE_DEBUG([no])
216 AM_CONDITIONAL([@PACKAGE_SHORT_UPPER@_BUILD_DEBUG], [test "${nl_cv_build_debug}" = "yes"])
219 # Code coverage and compiler optimization
224 NL_ENABLE_COVERAGE([no])
226 AM_CONDITIONAL([@PACKAGE_SHORT_UPPER@_BUILD_COVERAGE], [test "${nl_cv_build_coverage}" = "yes"])
228 NL_ENABLE_COVERAGE_REPORTS([auto])
230 AM_CONDITIONAL([@PACKAGE_SHORT_UPPER@_BUILD_COVERAGE_REPORTS], [test "${nl_cv_build_coverage_reports}" = "yes"])
234 NL_ENABLE_OPTIMIZATION([yes])
236 AM_CONDITIONAL([@PACKAGE_SHORT_UPPER@_BUILD_OPTIMIZED], [test "${nl_cv_build_optimized}" = "yes"])
241 AC_MSG_NOTICE([checking whether to build tests])
245 NL_ENABLE_TESTS([yes])
247 AM_CONDITIONAL([@PACKAGE_SHORT_UPPER@_BUILD_TESTS], [test "${nl_cv_build_tests}" = "yes"])
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.
257 NL_ENABLE_DOCS([auto],[NO])
259 AM_CONDITIONAL(@PACKAGE_SHORT_UPPER@_BUILD_DOCS, [test "${nl_cv_build_docs}" = "yes"])
262 # Checks for libraries and packages.
264 # At minimum, the following packages are optional, depending on
269 AC_MSG_NOTICE([checking required package dependencies])
271 # Check if the build host has pkg-config
273 AC_PATH_PROG([PKG_CONFIG],[pkg-config])
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
284 # if test "${nl_cv_build_tests}" = "yes"; then
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.
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"
301 # # Check for required nlunit-test headers.
303 # AC_CHECK_HEADERS([nlunit-test.h],
306 # AC_MSG_ERROR(The nlunit-test header "$ac_header" is required but cannot be found.)
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.
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}"
320 # AC_MSG_NOTICE([attempting to create internal ${nlunit_test_dirstem}])
322 # ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${nlunit_test_dirstem}
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'])
328 # maybe_nlunit_test_dirstem=""
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"])
340 AC_CHECK_HEADERS([stdint.h])
341 AC_CHECK_HEADERS([string.h])
344 # Check for types and structures
356 # Checks for library functions
359 if test "${ac_no_link}" != "yes"; then
360 AC_CHECK_FUNCS([memcpy])
363 # Here is an example with nlunit-test. Uncomment and adapt or delete
366 # # Add any nlunit-test CPPFLAGS, LDFLAGS, and LIBS
368 # CPPFLAGS="${CPPFLAGS} ${NLUNIT_TEST_CPPFLAGS}"
369 # LDFLAGS="${LDFLAGS} ${NLUNIT_TEST_LDFLAGS}"
370 # LIBS="${LIBS} ${NLUNIT_TEST_LIBS}"
372 # Add any code coverage CPPFLAGS and LIBS
374 CPPFLAGS="${CPPFLAGS} ${NL_COVERAGE_CPPFLAGS}"
375 LIBS="${LIBS} ${NL_COVERAGE_LIBS}"
376 LDFLAGS="${LDFLAGS} ${NL_COVERAGE_LDFLAGS}"
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.
384 # Here is an example with nlunit-test. Uncomment and adapt or delete
387 # # Configure any autotools-based subdirectories
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"])
395 # Identify the various makefiles and auto-generated files for the package
406 # Generate the auto-generated files for the package
411 # Summarize the package configuration
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}
434 Genhtml : ${GENHTML:--}
435 Build tests : ${nl_cv_build_tests}
437 Shadow directory program : ${LNDIR}
438 Documentation support : ${nl_cv_build_docs}
439 Doxygen : ${DOXYGEN:--}
440 GraphViz dot : ${DOT:--}
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}
449 C++ Preprocessor : ${CXXCPP}
450 C++ Compiler : ${CXX}
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}