1# CODYlib  -*- mode:autoconf -*-
2# Copyright (C) 2020 Nathan Sidwell, nathan@acm.org
3# License: Apache v2.0
4
5AC_INIT([codylib],[0.0],[github.com/urnathan/libcody])
6AC_CONFIG_SRCDIR(cody.hh)
7m4_include(config.m4)
8
9AC_CONFIG_AUX_DIR(..)
10AC_SUBST(PACKAGE_VERSION)
11
12AC_CANONICAL_HOST
13
14NMS_MAINTAINER_MODE
15NMS_CXX_COMPILER
16AC_LANG(C++)
17AC_PROG_CXX
18NMS_CXX_11
19NMS_LINK_OPT([-Wl,--no-undefined])
20
21# Enable expensive internal checks
22is_release=
23if test -d $srcdir/../gcc \
24   && test -f $srcdir/../gcc/DEV-PHASE \
25   && test x"`cat $srcdir/../gcc/DEV-PHASE`" != xexperimental; then
26  is_release=yes
27fi
28
29dnl NMS_ENABLE_CHECKING
30dnl cloned from ../libcpp/configure.ac
31AC_ARG_ENABLE(checking,
32[AS_HELP_STRING([[--enable-checking[=LIST]]],
33		[enable expensive run-time checks.  With LIST,
34		 enable only specific categories of checks.
35		 Categories are: yes,no,all,none,release.
36		 Flags are: misc,valgrind or other strings])],
37[ac_checking_flags="${enableval}"],[
38# Determine the default checks.
39if test x$is_release = x ; then
40  ac_checking_flags=yes
41else
42  ac_checking_flags=release
43fi])
44IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS="$IFS,"
45for check in release $ac_checking_flags
46do
47	case $check in
48	yes|all|misc) ac_checking=1 ;;
49	no|none|release) ac_checking= ;;
50	# accept
51	*) ;;
52	esac
53done
54IFS="$ac_save_IFS"
55                
56if test x$ac_checking != x ; then
57  AC_DEFINE(NMS_CHECKING, 1,
58[Define to 1 if you want more run-time sanity checks.])
59else
60  AC_DEFINE(NMS_CHECKING, 0)
61fi
62
63# Enable --enable-host-shared.
64AC_ARG_ENABLE(host-shared,
65[AS_HELP_STRING([--enable-host-shared],
66		[build host code as shared libraries])],
67[PICFLAG=-fPIC], [PICFLAG=])
68AC_SUBST(PICFLAG)
69
70NMS_ENABLE_EXCEPTIONS
71
72AC_PROG_RANLIB
73AC_CHECK_TOOL([AR],[ar])
74AH_VERBATIM([_GNU_SOURCE],[#define _GNU_SOURCE 1])
75AH_VERBATIM([_FORTIFY_SOURCE],[#undef _FORTIFY_SOURCE])
76AC_CONFIG_HEADERS([config.h])
77
78AC_CONFIG_FILES([Makefile])
79AC_SUBST(configure_args,[$ac_configure_args])
80
81AC_OUTPUT
82