Mercurial > hg > CbC > CbC_gcc
annotate libssp/configure.ac @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 1830386684a0 |
children |
rev | line source |
---|---|
0 | 1 # Process this file with autoconf to produce a configure script, like so: |
2 # | |
3 # aclocal -I .. -I ../config && autoconf && autoheader && automake | |
4 | |
5 AC_INIT(libssp, 1.0) | |
6 AC_CONFIG_SRCDIR(ssp.c) | |
7 AC_CANONICAL_SYSTEM | |
8 ACX_NONCANONICAL_TARGET | |
9 | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
10 AM_INIT_AUTOMAKE([no-dist]) |
0 | 11 |
12 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) | |
13 AC_ARG_ENABLE(version-specific-runtime-libs, | |
14 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ], | |
15 [case "$enableval" in | |
16 yes) version_specific_libs=yes ;; | |
17 no) version_specific_libs=no ;; | |
18 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; | |
19 esac], | |
20 [version_specific_libs=no]) | |
21 AC_MSG_RESULT($version_specific_libs) | |
22 | |
23 AM_MAINTAINER_MODE | |
24 | |
25 GCC_NO_EXECUTABLES | |
26 | |
27 AM_ENABLE_MULTILIB(, ..) | |
28 | |
29 target_alias=${target_alias-$host_alias} | |
30 AC_SUBST(target_alias) | |
31 | |
32 AC_CONFIG_HEADERS(config.h) | |
33 | |
34 AC_LANG_C | |
35 # The same as in boehm-gc and libstdc++. Have to borrow it from there. | |
36 # We must force CC to /not/ be precious variables; otherwise | |
37 # the wrong, non-multilib-adjusted value will be used in multilibs. | |
38 # As a side effect, we have to subst CFLAGS ourselves. | |
39 | |
40 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) | |
41 m4_define([_AC_ARG_VAR_PRECIOUS],[]) | |
42 AC_PROG_CC | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
43 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) |
0 | 44 |
45 AC_SUBST(CFLAGS) | |
46 | |
47 if test "x$GCC" != "xyes"; then | |
48 AC_MSG_ERROR([libssp must be built with GCC]) | |
49 fi | |
50 AC_PROG_CPP | |
51 | |
52 AC_MSG_CHECKING([whether -fstack-protector works]) | |
53 save_CFLAGS="$CFLAGS" | |
54 CFLAGS="$CFLAGS -fstack-protector -Werror" | |
55 AC_TRY_COMPILE([ | |
56 void __attribute__((noinline)) bar (char *x) | |
57 { | |
58 __builtin_memset (x, 0, 64); | |
59 }],[char buf[64]; bar (buf);], | |
60 [AC_MSG_RESULT(yes)], | |
61 [AC_MSG_RESULT(no)]) | |
62 CFLAGS="$save_CFLAGS" | |
63 | |
131 | 64 # Add CET specific flags if CET is enabled |
65 GCC_CET_FLAGS(CET_FLAGS) | |
66 XCFLAGS="$XCFLAGS $CET_FLAGS" | |
67 AC_SUBST(XCFLAGS) | |
68 | |
0 | 69 AC_MSG_CHECKING([whether hidden visibility is supported]) |
70 AC_TRY_COMPILE([ | |
71 void __attribute__((visibility ("hidden"))) bar (void) {}],, | |
72 [ssp_hidden=yes],[ssp_hidden=no]) | |
73 AC_MSG_RESULT($ssp_hidden) | |
74 if test x$ssp_hidden = xyes; then | |
75 AC_DEFINE([HAVE_HIDDEN_VISIBILITY],[1],[__attribute__((visibility ("hidden"))) supported]) | |
76 fi | |
77 | |
78 AC_MSG_CHECKING([whether symbol versioning is supported]) | |
111 | 79 AC_ARG_ENABLE(symvers, |
80 AS_HELP_STRING([--disable-symvers], | |
81 [disable symbol versioning for libssp]), | |
82 ssp_use_symver=$enableval, | |
83 ssp_use_symver=yes) | |
84 if test "x$ssp_use_symver" != xno; then | |
85 if test x$gcc_no_link = xyes; then | |
86 # If we cannot link, we cannot build shared libraries, so do not use | |
87 # symbol versioning. | |
88 ssp_use_symver=no | |
89 else | |
90 save_LDFLAGS="$LDFLAGS" | |
91 LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map" | |
92 cat > conftest.map <<EOF | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
93 FOO_1.0 { |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
94 global: *foo*; bar; local: *; |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
95 }; |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
96 EOF |
111 | 97 AC_TRY_LINK([int foo;],[],[ssp_use_symver=gnu],[ssp_use_symver=no]) |
98 if test x$ssp_use_symver = xno; then | |
99 case "$target_os" in | |
100 solaris2*) | |
101 LDFLAGS="$save_LDFLAGS" | |
102 LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map" | |
103 # Sun ld cannot handle wildcards and treats all entries as undefined. | |
104 cat > conftest.map <<EOF | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
105 FOO_1.0 { |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
106 global: foo; local: *; |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
107 }; |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
108 EOF |
111 | 109 AC_TRY_LINK([int foo;],[],[ssp_use_symver=sun],[ssp_use_symver=no]) |
110 ;; | |
111 esac | |
112 fi | |
113 LDFLAGS="$save_LDFLAGS" | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
114 fi |
0 | 115 fi |
116 AC_MSG_RESULT($ssp_use_symver) | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
117 AM_CONDITIONAL(LIBSSP_USE_SYMVER, [test "x$ssp_use_symver" != xno]) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
118 AM_CONDITIONAL(LIBSSP_USE_SYMVER_GNU, [test "x$ssp_use_symver" = xgnu]) |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
119 AM_CONDITIONAL(LIBSSP_USE_SYMVER_SUN, [test "x$ssp_use_symver" = xsun]) |
0 | 120 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
121 AC_CHECK_HEADERS(alloca.h malloc.h paths.h syslog.h string.h unistd.h fcntl.h stdio.h limits.h) |
0 | 122 |
123 if test x$gcc_no_link = xyes; then | |
124 # Presume the ISO C functions are available; add target-specific | |
125 # configuration here if required. | |
126 AC_DEFINE(HAVE_STRNCPY) | |
127 AC_DEFINE(HAVE_STRNCAT) | |
128 else | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
129 AC_CHECK_FUNCS(memmove mempcpy strncpy strncat) |
0 | 130 fi |
131 | |
132 AC_MSG_CHECKING([whether vsnprintf is usable]) | |
145 | 133 AC_RUN_IFELSE([AC_LANG_PROGRAM([ |
0 | 134 #include <stdarg.h> |
135 #include <string.h> | |
136 #include <stdio.h> | |
137 int foo (char *buf, size_t n, const char *fmt, ...) | |
138 { | |
139 va_list ap; | |
140 int ret; | |
141 va_start (ap, fmt); | |
142 ret = vsnprintf (buf, n, fmt, ap); | |
143 va_end (ap); | |
144 return ret; | |
145 }], | |
146 [char buf@<:@8@:>@; memset (buf, 'A', sizeof (buf)); | |
147 if (foo (buf, 4, ".%s.", "CDEFG") != 7) | |
148 return 1; | |
145 | 149 return memcmp (buf, ".CD\0AAAA", sizeof (buf)) != 0;])], |
0 | 150 [ssp_have_usable_vsnprintf=define], |
151 [ssp_have_usable_vsnprintf=undef], | |
152 [ssp_have_usable_vsnprintf=undef]) | |
153 if test "x$ssp_have_usable_vsnprintf" = xdefine; then | |
154 AC_MSG_RESULT(yes) | |
155 AC_DEFINE([HAVE_USABLE_VSNPRINTF],[1],[vsnprintf is present and works]) | |
156 else | |
157 AC_MSG_RESULT(no) | |
158 fi | |
159 AC_SUBST(ssp_have_usable_vsnprintf) | |
160 | |
161 AM_PROG_LIBTOOL | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
63
diff
changeset
|
162 ACX_LT_HOST_FLAGS |
0 | 163 AC_SUBST(enable_shared) |
164 AC_SUBST(enable_static) | |
165 | |
145 | 166 GCC_WITH_TOOLEXECLIBDIR |
167 | |
0 | 168 # Calculate toolexeclibdir |
169 # Also toolexecdir, though it's only used in toolexeclibdir | |
170 case ${version_specific_libs} in | |
171 yes) | |
172 # Need the gcc compiler version to know where to install libraries | |
173 # and header files if --enable-version-specific-runtime-libs option | |
174 # is selected. | |
175 toolexecdir='$(libdir)/gcc/$(target_alias)' | |
176 toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)' | |
177 ;; | |
178 no) | |
179 if test -n "$with_cross_host" && | |
180 test x"$with_cross_host" != x"no"; then | |
181 # Install a library built with a cross compiler in tooldir, not libdir. | |
182 toolexecdir='$(exec_prefix)/$(target_alias)' | |
145 | 183 case ${with_toolexeclibdir} in |
184 no) | |
185 toolexeclibdir='$(toolexecdir)/lib' | |
186 ;; | |
187 *) | |
188 toolexeclibdir=${with_toolexeclibdir} | |
189 ;; | |
190 esac | |
0 | 191 else |
192 toolexecdir='$(libdir)/gcc-lib/$(target_alias)' | |
193 toolexeclibdir='$(libdir)' | |
194 fi | |
195 multi_os_directory=`$CC -print-multi-os-directory` | |
196 case $multi_os_directory in | |
197 .) ;; # Avoid trailing /. | |
198 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; | |
199 esac | |
200 ;; | |
201 esac | |
202 AC_SUBST(toolexecdir) | |
203 AC_SUBST(toolexeclibdir) | |
204 | |
205 if test ${multilib} = yes; then | |
206 multilib_arg="--enable-multilib" | |
207 else | |
208 multilib_arg= | |
209 fi | |
210 | |
111 | 211 # Determine what GCC version number to use in filesystem paths. |
212 GCC_BASE_VER | |
213 | |
0 | 214 AC_CONFIG_FILES([Makefile ssp/ssp.h]) |
215 AC_OUTPUT |