]> git.ipfire.org Git - thirdparty/pdns.git/blob - m4/pdns_pie.m4
Update h2o to 2.2.6, fixing CVE-2019-9512, CVE-2019-9514 and CVE-2019-9515
[thirdparty/pdns.git] / m4 / pdns_pie.m4
1 dnl
2 dnl Check for support for position independent executables
3 dnl
4 dnl Copyright (C) 2013 Red Hat, Inc.
5 dnl
6 dnl This library is free software; you can redistribute it and/or
7 dnl modify it under the terms of the GNU Lesser General Public
8 dnl License as published by the Free Software Foundation; either
9 dnl version 2.1 of the License, or (at your option) any later version.
10 dnl
11 dnl This library is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 dnl Lesser General Public License for more details.
15 dnl
16 dnl You should have received a copy of the GNU Lesser General Public
17 dnl License along with this library. If not, see
18 dnl <http://www.gnu.org/licenses/>.
19 dnl
20
21 AC_DEFUN([AC_CC_PIE],[
22 AC_REQUIRE([gl_UNKNOWN_WARNINGS_ARE_ERRORS])
23 PIE_CFLAGS=
24 PIE_LDFLAGS=
25 OLD_CXXFLAGS=$CXXFLAGS
26 case "$host" in
27 *-*-mingw* | *-*-msvc* | *-*-cygwin* )
28 ;; dnl All code is position independent on Win32 target
29 *)
30 CXXFLAGS="-fPIE -DPIE"
31 gl_COMPILER_OPTION_IF([-pie], [
32 PIE_CFLAGS="-fPIE -DPIE"
33 PIE_LDFLAGS="-pie"
34 ], [
35 dnl some versions of clang require -Wl,-pie instead of -pie
36 gl_COMPILER_OPTION_IF([[-Wl,-pie]], [
37 PIE_CFLAGS="-fPIE -DPIE"
38 PIE_LDFLAGS="-Wl,-pie"
39 ], [],
40 [AC_LANG_PROGRAM([[
41 #include <pthread.h>
42 __thread unsigned int t_id;
43 ]], [[t_id = 1;]])]
44 )
45 ],
46 [AC_LANG_PROGRAM([[
47 #include <pthread.h>
48 __thread unsigned int t_id;
49 ]], [[t_id = 1;]])]
50 )
51 esac
52 CXXFLAGS=$OLD_CXXFLAGS
53 AC_SUBST([PIE_CFLAGS])
54 AC_SUBST([PIE_LDFLAGS])
55 ])