]> git.ipfire.org Git - thirdparty/gcc.git/blob - libcody/configure.ac
configure: Implement --enable-host-pie
[thirdparty/gcc.git] / libcody / configure.ac
1 # CODYlib -*- mode:autoconf -*-
2 # Copyright (C) 2020 Nathan Sidwell, nathan@acm.org
3 # License: Apache v2.0
4
5 AC_INIT([codylib],[0.0],[github.com/urnathan/libcody])
6 AC_CONFIG_SRCDIR(cody.hh)
7 m4_include(config.m4)
8
9 AC_CONFIG_AUX_DIR(..)
10 AC_SUBST(PACKAGE_VERSION)
11
12 AC_CANONICAL_HOST
13
14 NMS_MAINTAINER_MODE
15 NMS_CXX_COMPILER
16 AC_LANG(C++)
17 AC_PROG_CXX
18 NMS_CXX_11
19 NMS_LINK_OPT([-Wl,--no-undefined])
20
21 # Enable expensive internal checks
22 is_release=
23 if 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
27 fi
28
29 dnl NMS_ENABLE_CHECKING
30 dnl cloned from ../libcpp/configure.ac
31 AC_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.
39 if test x$is_release = x ; then
40 ac_checking_flags=yes
41 else
42 ac_checking_flags=release
43 fi])
44 IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
45 for check in release $ac_checking_flags
46 do
47 case $check in
48 yes|all|misc) ac_checking=1 ;;
49 no|none|release) ac_checking= ;;
50 # accept
51 *) ;;
52 esac
53 done
54 IFS="$ac_save_IFS"
55
56 if test x$ac_checking != x ; then
57 AC_DEFINE(NMS_CHECKING, 1,
58 [Define to 1 if you want more run-time sanity checks.])
59 else
60 AC_DEFINE(NMS_CHECKING, 0)
61 fi
62
63 # Enable --enable-host-shared.
64 AC_ARG_ENABLE(host-shared,
65 [AS_HELP_STRING([--enable-host-shared],
66 [build host code as shared libraries])])
67 AC_SUBST(enable_host_shared)
68
69 # Enable --enable-host-pie.
70 AC_ARG_ENABLE(host-pie,
71 [AS_HELP_STRING([--enable-host-pie],
72 [build host code as PIE])])
73 AC_SUBST(enable_host_pie)
74
75 if test x$enable_host_shared = xyes; then
76 PICFLAG=-fPIC
77 elif test x$enable_host_pie = xyes; then
78 PICFLAG=-fPIE
79 else
80 PICFLAG=
81 fi
82
83 if test x$enable_host_pie = xyes; then
84 LD_PICFLAG=-pie
85 else
86 LD_PICFLAG=
87 fi
88
89 AC_SUBST(PICFLAG)
90 AC_SUBST(LD_PICFLAG)
91
92 NMS_ENABLE_EXCEPTIONS
93
94 AC_PROG_RANLIB
95 AC_CHECK_TOOL([AR],[ar])
96 AH_VERBATIM([_GNU_SOURCE],[#define _GNU_SOURCE 1])
97 AH_VERBATIM([_FORTIFY_SOURCE],[#undef _FORTIFY_SOURCE])
98 AC_CONFIG_HEADERS([config.h])
99
100 AC_CONFIG_FILES([Makefile])
101 AC_SUBST(configure_args,[$ac_configure_args])
102
103 AC_OUTPUT