Mercurial > dwindows
comparison acinclude.m4 @ 2970:83c17a84bc27
Update the configure scripts with the latest autotools.
configure.in is now configure.ac.
AC_DEFINE() now requires additional parameters.
Use AX_CXX_COMPILE_STDCXX to determine the C++11 options.
AX_CXX_COMPILE_STDCXX requires the autoconf-archive package.
autoreconf created a new install-sh script.
Remove the old install.sh script, which is now ancient.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 20 Mar 2023 22:49:06 +0000 |
parents | 67a643a734d9 |
children |
comparison
equal
deleted
inserted
replaced
2969:8a2079224bc4 | 2970:83c17a84bc27 |
---|---|
1 dnl aclocal.m4 generated automatically by aclocal 1.4a | 1 # generated automatically by aclocal 1.16.5 -*- Autoconf -*- |
2 | 2 |
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. | 3 # Copyright (C) 1996-2021 Free Software Foundation, Inc. |
4 dnl This file is free software; the Free Software Foundation | 4 |
5 dnl gives unlimited permission to copy and/or distribute it, | 5 # This file is free software; the Free Software Foundation |
6 dnl with or without modifications, as long as this notice is preserved. | 6 # gives unlimited permission to copy and/or distribute it, |
7 | 7 # with or without modifications, as long as this notice is preserved. |
8 dnl This program is distributed in the hope that it will be useful, | 8 |
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without | 9 # This program is distributed in the hope that it will be useful, |
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A | 10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without |
11 dnl PARTICULAR PURPOSE. | 11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
12 | 12 # PARTICULAR PURPOSE. |
13 # Configure paths for GLIB | 13 |
14 # Owen Taylor 97-11-3 | 14 m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) |
15 | 15 # =========================================================================== |
16 dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) | 16 # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html |
17 dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or | 17 # =========================================================================== |
18 dnl gthread is specified in MODULES, pass to glib-config | 18 # |
19 dnl | 19 # SYNOPSIS |
20 AC_DEFUN(AM_PATH_GLIB, | 20 # |
21 [dnl | 21 # AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) |
22 dnl Get the cflags and libraries from the glib-config script | 22 # |
23 dnl | 23 # DESCRIPTION |
24 AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is installed (optional)], | 24 # |
25 glib_config_prefix="$withval", glib_config_prefix="") | 25 # Check for baseline language coverage in the compiler for the specified |
26 AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where GLIB is installed (optional)], | 26 # version of the C++ standard. If necessary, add switches to CXX and |
27 glib_config_exec_prefix="$withval", glib_config_exec_prefix="") | 27 # CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for |
28 AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and run a test GLIB program], | 28 # the respective C++ standard version. |
29 , enable_glibtest=yes) | 29 # |
30 | 30 # The second argument, if specified, indicates whether you insist on an |
31 if test x$glib_config_exec_prefix != x ; then | 31 # extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. |
32 glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefix" | 32 # -std=c++11). If neither is specified, you get whatever works, with |
33 if test x${GLIB_CONFIG+set} != xset ; then | 33 # preference for no added switch, and then for an extended mode. |
34 GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config | 34 # |
35 fi | 35 # The third argument, if specified 'mandatory' or if left unspecified, |
36 # indicates that baseline support for the specified C++ standard is | |
37 # required and that the macro should error out if no mode with that | |
38 # support is found. If specified 'optional', then configuration proceeds | |
39 # regardless, after defining HAVE_CXX${VERSION} if and only if a | |
40 # supporting mode is found. | |
41 # | |
42 # LICENSE | |
43 # | |
44 # Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com> | |
45 # Copyright (c) 2012 Zack Weinberg <zackw@panix.com> | |
46 # Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu> | |
47 # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com> | |
48 # Copyright (c) 2015 Paul Norman <penorman@mac.com> | |
49 # Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu> | |
50 # Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com> | |
51 # Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.com> | |
52 # Copyright (c) 2020 Jason Merrill <jason@redhat.com> | |
53 # Copyright (c) 2021 Jörn Heusipp <osmanx@problemloesungsmaschine.de> | |
54 # | |
55 # Copying and distribution of this file, with or without modification, are | |
56 # permitted in any medium without royalty provided the copyright notice | |
57 # and this notice are preserved. This file is offered as-is, without any | |
58 # warranty. | |
59 | |
60 #serial 15 | |
61 | |
62 dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro | |
63 dnl (serial version number 13). | |
64 | |
65 AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl | |
66 m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], | |
67 [$1], [14], [ax_cxx_compile_alternatives="14 1y"], | |
68 [$1], [17], [ax_cxx_compile_alternatives="17 1z"], | |
69 [$1], [20], [ax_cxx_compile_alternatives="20"], | |
70 [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl | |
71 m4_if([$2], [], [], | |
72 [$2], [ext], [], | |
73 [$2], [noext], [], | |
74 [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl | |
75 m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], | |
76 [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], | |
77 [$3], [optional], [ax_cxx_compile_cxx$1_required=false], | |
78 [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) | |
79 AC_LANG_PUSH([C++])dnl | |
80 ac_success=no | |
81 | |
82 m4_if([$2], [], [dnl | |
83 AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, | |
84 ax_cv_cxx_compile_cxx$1, | |
85 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], | |
86 [ax_cv_cxx_compile_cxx$1=yes], | |
87 [ax_cv_cxx_compile_cxx$1=no])]) | |
88 if test x$ax_cv_cxx_compile_cxx$1 = xyes; then | |
89 ac_success=yes | |
90 fi]) | |
91 | |
92 m4_if([$2], [noext], [], [dnl | |
93 if test x$ac_success = xno; then | |
94 for alternative in ${ax_cxx_compile_alternatives}; do | |
95 switch="-std=gnu++${alternative}" | |
96 cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) | |
97 AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, | |
98 $cachevar, | |
99 [ac_save_CXX="$CXX" | |
100 CXX="$CXX $switch" | |
101 AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], | |
102 [eval $cachevar=yes], | |
103 [eval $cachevar=no]) | |
104 CXX="$ac_save_CXX"]) | |
105 if eval test x\$$cachevar = xyes; then | |
106 CXX="$CXX $switch" | |
107 if test -n "$CXXCPP" ; then | |
108 CXXCPP="$CXXCPP $switch" | |
109 fi | |
110 ac_success=yes | |
111 break | |
112 fi | |
113 done | |
114 fi]) | |
115 | |
116 m4_if([$2], [ext], [], [dnl | |
117 if test x$ac_success = xno; then | |
118 dnl HP's aCC needs +std=c++11 according to: | |
119 dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf | |
120 dnl Cray's crayCC needs "-h std=c++11" | |
121 for alternative in ${ax_cxx_compile_alternatives}; do | |
122 for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do | |
123 cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) | |
124 AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, | |
125 $cachevar, | |
126 [ac_save_CXX="$CXX" | |
127 CXX="$CXX $switch" | |
128 AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], | |
129 [eval $cachevar=yes], | |
130 [eval $cachevar=no]) | |
131 CXX="$ac_save_CXX"]) | |
132 if eval test x\$$cachevar = xyes; then | |
133 CXX="$CXX $switch" | |
134 if test -n "$CXXCPP" ; then | |
135 CXXCPP="$CXXCPP $switch" | |
136 fi | |
137 ac_success=yes | |
138 break | |
139 fi | |
140 done | |
141 if test x$ac_success = xyes; then | |
142 break | |
143 fi | |
144 done | |
145 fi]) | |
146 AC_LANG_POP([C++]) | |
147 if test x$ax_cxx_compile_cxx$1_required = xtrue; then | |
148 if test x$ac_success = xno; then | |
149 AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) | |
150 fi | |
36 fi | 151 fi |
37 if test x$glib_config_prefix != x ; then | 152 if test x$ac_success = xno; then |
38 glib_config_args="$glib_config_args --prefix=$glib_config_prefix" | 153 HAVE_CXX$1=0 |
39 if test x${GLIB_CONFIG+set} != xset ; then | 154 AC_MSG_NOTICE([No compiler with C++$1 support was found]) |
40 GLIB_CONFIG=$glib_config_prefix/bin/glib-config | 155 else |
41 fi | 156 HAVE_CXX$1=1 |
157 AC_DEFINE(HAVE_CXX$1,1, | |
158 [define if the compiler supports basic C++$1 syntax]) | |
42 fi | 159 fi |
43 | 160 AC_SUBST(HAVE_CXX$1) |
44 for module in . $4 | 161 ]) |
45 do | 162 |
46 case "$module" in | 163 |
47 gmodule) | 164 dnl Test body for checking C++11 support |
48 glib_config_args="$glib_config_args gmodule" | 165 |
49 ;; | 166 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], |
50 gthread) | 167 _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 |
51 glib_config_args="$glib_config_args gthread" | 168 ) |
52 ;; | 169 |
53 esac | 170 dnl Test body for checking C++14 support |
54 done | 171 |
55 | 172 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], |
56 AC_PATH_PROG(GLIB_CONFIG, glib-config, no) | 173 _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 |
57 min_glib_version=ifelse([$1], ,1.2.0,$1) | 174 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 |
58 AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) | 175 ) |
59 no_glib="" | 176 |
60 if test "$GLIB_CONFIG" = "no" ; then | 177 dnl Test body for checking C++17 support |
61 no_glib=yes | 178 |
62 else | 179 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], |
63 GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags` | 180 _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 |
64 GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs` | 181 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 |
65 glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \ | 182 _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 |
66 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | 183 ) |
67 glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \ | 184 |
68 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | 185 dnl Test body for checking C++20 support |
69 glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \ | 186 |
70 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | 187 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_20], |
71 if test "x$enable_glibtest" = "xyes" ; then | 188 _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 |
72 ac_save_CFLAGS="$CFLAGS" | 189 _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 |
73 ac_save_LIBS="$LIBS" | 190 _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 |
74 CFLAGS="$CFLAGS $GLIB_CFLAGS" | 191 _AX_CXX_COMPILE_STDCXX_testbody_new_in_20 |
75 LIBS="$GLIB_LIBS $LIBS" | 192 ) |
76 dnl | 193 |
77 dnl Now check if the installed GLIB is sufficiently new. (Also sanity | 194 |
78 dnl checks the results of glib-config to some extent | 195 dnl Tests for new features in C++11 |
79 dnl | 196 |
80 rm -f conf.glibtest | 197 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ |
81 AC_TRY_RUN([ | 198 |
82 #include <glib.h> | 199 // If the compiler admits that it is not ready for C++11, why torture it? |
83 #include <stdio.h> | 200 // Hopefully, this will speed up the test. |
84 #include <stdlib.h> | 201 |
85 | 202 #ifndef __cplusplus |
86 int | 203 |
87 main () | 204 #error "This is not a C++ compiler" |
205 | |
206 // MSVC always sets __cplusplus to 199711L in older versions; newer versions | |
207 // only set it correctly if /Zc:__cplusplus is specified as well as a | |
208 // /std:c++NN switch: | |
209 // https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ | |
210 #elif __cplusplus < 201103L && !defined _MSC_VER | |
211 | |
212 #error "This is not a C++11 compiler" | |
213 | |
214 #else | |
215 | |
216 namespace cxx11 | |
88 { | 217 { |
89 int major, minor, micro; | 218 |
90 char *tmp_version; | 219 namespace test_static_assert |
91 | 220 { |
92 system ("touch conf.glibtest"); | 221 |
93 | 222 template <typename T> |
94 /* HP/UX 9 (%@#!) writes to sscanf strings */ | 223 struct check |
95 tmp_version = g_strdup("$min_glib_version"); | 224 { |
96 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | 225 static_assert(sizeof(int) <= sizeof(T), "not big enough"); |
97 printf("%s, bad version string\n", "$min_glib_version"); | 226 }; |
98 exit(1); | 227 |
99 } | 228 } |
100 | 229 |
101 if ((glib_major_version != $glib_config_major_version) || | 230 namespace test_final_override |
102 (glib_minor_version != $glib_config_minor_version) || | 231 { |
103 (glib_micro_version != $glib_config_micro_version)) | 232 |
104 { | 233 struct Base |
105 printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", | 234 { |
106 $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, | 235 virtual ~Base() {} |
107 glib_major_version, glib_minor_version, glib_micro_version); | 236 virtual void f() {} |
108 printf ("*** was found! If glib-config was correct, then it is best\n"); | 237 }; |
109 printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n"); | 238 |
110 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); | 239 struct Derived : public Base |
111 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); | 240 { |
112 printf("*** required on your system.\n"); | 241 virtual ~Derived() override {} |
113 printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n"); | 242 virtual void f() override {} |
114 printf("*** to point to the correct copy of glib-config, and remove the file config.cache\n"); | 243 }; |
115 printf("*** before re-running configure\n"); | 244 |
116 } | 245 } |
117 else if ((glib_major_version != GLIB_MAJOR_VERSION) || | 246 |
118 (glib_minor_version != GLIB_MINOR_VERSION) || | 247 namespace test_double_right_angle_brackets |
119 (glib_micro_version != GLIB_MICRO_VERSION)) | 248 { |
120 { | 249 |
121 printf("*** GLIB header files (version %d.%d.%d) do not match\n", | 250 template < typename T > |
122 GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); | 251 struct check {}; |
123 printf("*** library (version %d.%d.%d)\n", | 252 |
124 glib_major_version, glib_minor_version, glib_micro_version); | 253 typedef check<void> single_type; |
125 } | 254 typedef check<check<void>> double_type; |
126 else | 255 typedef check<check<check<void>>> triple_type; |
127 { | 256 typedef check<check<check<check<void>>>> quadruple_type; |
128 if ((glib_major_version > major) || | 257 |
129 ((glib_major_version == major) && (glib_minor_version > minor)) || | 258 } |
130 ((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro))) | 259 |
131 { | 260 namespace test_decltype |
132 return 0; | 261 { |
133 } | 262 |
134 else | 263 int |
135 { | 264 f() |
136 printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", | 265 { |
137 glib_major_version, glib_minor_version, glib_micro_version); | 266 int a = 1; |
138 printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n", | 267 decltype(a) b = 2; |
139 major, minor, micro); | 268 return a + b; |
140 printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); | 269 } |
141 printf("***\n"); | 270 |
142 printf("*** If you have already installed a sufficiently new version, this error\n"); | 271 } |
143 printf("*** probably means that the wrong copy of the glib-config shell script is\n"); | 272 |
144 printf("*** being found. The easiest way to fix this is to remove the old version\n"); | 273 namespace test_type_deduction |
145 printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n"); | 274 { |
146 printf("*** correct copy of glib-config. (In this case, you will have to\n"); | 275 |
147 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); | 276 template < typename T1, typename T2 > |
148 printf("*** so that the correct libraries are found at run-time))\n"); | 277 struct is_same |
149 } | 278 { |
150 } | 279 static const bool value = false; |
151 return 1; | 280 }; |
152 } | 281 |
153 ],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | 282 template < typename T > |
154 CFLAGS="$ac_save_CFLAGS" | 283 struct is_same<T, T> |
155 LIBS="$ac_save_LIBS" | 284 { |
156 fi | 285 static const bool value = true; |
157 fi | 286 }; |
158 if test "x$no_glib" = x ; then | 287 |
159 AC_MSG_RESULT(yes) | 288 template < typename T1, typename T2 > |
160 ifelse([$2], , :, [$2]) | 289 auto |
161 else | 290 add(T1 a1, T2 a2) -> decltype(a1 + a2) |
162 AC_MSG_RESULT(no) | 291 { |
163 if test "$GLIB_CONFIG" = "no" ; then | 292 return a1 + a2; |
164 echo "*** The glib-config script installed by GLIB could not be found" | 293 } |
165 echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in" | 294 |
166 echo "*** your path, or set the GLIB_CONFIG environment variable to the" | 295 int |
167 echo "*** full path to glib-config." | 296 test(const int c, volatile int v) |
168 else | 297 { |
169 if test -f conf.glibtest ; then | 298 static_assert(is_same<int, decltype(0)>::value == true, ""); |
170 : | 299 static_assert(is_same<int, decltype(c)>::value == false, ""); |
171 else | 300 static_assert(is_same<int, decltype(v)>::value == false, ""); |
172 echo "*** Could not run GLIB test program, checking why..." | 301 auto ac = c; |
173 CFLAGS="$CFLAGS $GLIB_CFLAGS" | 302 auto av = v; |
174 LIBS="$LIBS $GLIB_LIBS" | 303 auto sumi = ac + av + 'x'; |
175 AC_TRY_LINK([ | 304 auto sumf = ac + av + 1.0; |
176 #include <glib.h> | 305 static_assert(is_same<int, decltype(ac)>::value == true, ""); |
177 #include <stdio.h> | 306 static_assert(is_same<int, decltype(av)>::value == true, ""); |
178 ], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ], | 307 static_assert(is_same<int, decltype(sumi)>::value == true, ""); |
179 [ echo "*** The test program compiled, but did not run. This usually means" | 308 static_assert(is_same<int, decltype(sumf)>::value == false, ""); |
180 echo "*** that the run-time linker is not finding GLIB or finding the wrong" | 309 static_assert(is_same<int, decltype(add(c, v))>::value == true, ""); |
181 echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your" | 310 return (sumf > 0.0) ? sumi : add(c, v); |
182 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | 311 } |
183 echo "*** to the installed location Also, make sure you have run ldconfig if that" | 312 |
184 echo "*** is required on your system" | 313 } |
185 echo "***" | 314 |
186 echo "*** If you have an old version installed, it is best to remove it, although" | 315 namespace test_noexcept |
187 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], | 316 { |
188 [ echo "*** The test program failed to compile or link. See the file config.log for the" | 317 |
189 echo "*** exact error that occured. This usually means GLIB was incorrectly installed" | 318 int f() { return 0; } |
190 echo "*** or that you have moved GLIB since it was installed. In the latter case, you" | 319 int g() noexcept { return 0; } |
191 echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ]) | 320 |
192 CFLAGS="$ac_save_CFLAGS" | 321 static_assert(noexcept(f()) == false, ""); |
193 LIBS="$ac_save_LIBS" | 322 static_assert(noexcept(g()) == true, ""); |
194 fi | 323 |
195 fi | 324 } |
196 GLIB_CFLAGS="" | 325 |
197 GLIB_LIBS="" | 326 namespace test_constexpr |
198 ifelse([$3], , :, [$3]) | 327 { |
199 fi | 328 |
200 AC_SUBST(GLIB_CFLAGS) | 329 template < typename CharT > |
201 AC_SUBST(GLIB_LIBS) | 330 unsigned long constexpr |
202 rm -f conf.glibtest | 331 strlen_c_r(const CharT *const s, const unsigned long acc) noexcept |
203 ]) | 332 { |
204 | 333 return *s ? strlen_c_r(s + 1, acc + 1) : acc; |
205 # Configure paths for GTK+ | 334 } |
206 # Owen Taylor 97-11-3 | 335 |
207 | 336 template < typename CharT > |
208 dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) | 337 unsigned long constexpr |
209 dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS | 338 strlen_c(const CharT *const s) noexcept |
210 dnl | 339 { |
211 AC_DEFUN(AM_PATH_GTK, | 340 return strlen_c_r(s, 0UL); |
212 [dnl | 341 } |
213 dnl Get the cflags and libraries from the gtk-config script | 342 |
214 dnl | 343 static_assert(strlen_c("") == 0UL, ""); |
215 AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installed (optional)], | 344 static_assert(strlen_c("1") == 1UL, ""); |
216 gtk_config_prefix="$withval", gtk_config_prefix="") | 345 static_assert(strlen_c("example") == 7UL, ""); |
217 AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)], | 346 static_assert(strlen_c("another\0example") == 7UL, ""); |
218 gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") | 347 |
219 AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and run a test GTK program], | 348 } |
220 , enable_gtktest=yes) | 349 |
221 | 350 namespace test_rvalue_references |
222 for module in . $4 | 351 { |
223 do | 352 |
224 case "$module" in | 353 template < int N > |
225 gthread) | 354 struct answer |
226 gtk_config_args="$gtk_config_args gthread" | 355 { |
227 ;; | 356 static constexpr int value = N; |
228 esac | 357 }; |
229 done | 358 |
230 | 359 answer<1> f(int&) { return answer<1>(); } |
231 if test x$gtk_config_exec_prefix != x ; then | 360 answer<2> f(const int&) { return answer<2>(); } |
232 gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" | 361 answer<3> f(int&&) { return answer<3>(); } |
233 if test x${GTK_CONFIG+set} != xset ; then | 362 |
234 GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config | 363 void |
235 fi | 364 test() |
236 fi | 365 { |
237 if test x$gtk_config_prefix != x ; then | 366 int i = 0; |
238 gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" | 367 const int c = 0; |
239 if test x${GTK_CONFIG+set} != xset ; then | 368 static_assert(decltype(f(i))::value == 1, ""); |
240 GTK_CONFIG=$gtk_config_prefix/bin/gtk-config | 369 static_assert(decltype(f(c))::value == 2, ""); |
241 fi | 370 static_assert(decltype(f(0))::value == 3, ""); |
242 fi | 371 } |
243 | 372 |
244 AC_PATH_PROG(GTK_CONFIG, gtk-config, no) | 373 } |
245 min_gtk_version=ifelse([$1], ,1.2.0,$1) | 374 |
246 AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) | 375 namespace test_uniform_initialization |
247 no_gtk="" | 376 { |
248 if test "$GTK_CONFIG" = "no" ; then | 377 |
249 no_gtk=yes | 378 struct test |
250 else | 379 { |
251 GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` | 380 static const int zero {}; |
252 GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` | 381 static const int one {1}; |
253 gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ | 382 }; |
254 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | 383 |
255 gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ | 384 static_assert(test::zero == 0, ""); |
256 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | 385 static_assert(test::one == 1, ""); |
257 gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ | 386 |
258 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | 387 } |
259 if test "x$enable_gtktest" = "xyes" ; then | 388 |
260 ac_save_CFLAGS="$CFLAGS" | 389 namespace test_lambdas |
261 ac_save_LIBS="$LIBS" | 390 { |
262 CFLAGS="$CFLAGS $GTK_CFLAGS" | 391 |
263 LIBS="$GTK_LIBS $LIBS" | 392 void |
264 dnl | 393 test1() |
265 dnl Now check if the installed GTK is sufficiently new. (Also sanity | 394 { |
266 dnl checks the results of gtk-config to some extent | 395 auto lambda1 = [](){}; |
267 dnl | 396 auto lambda2 = lambda1; |
268 rm -f conf.gtktest | 397 lambda1(); |
269 AC_TRY_RUN([ | 398 lambda2(); |
270 #include <gtk/gtk.h> | 399 } |
271 #include <stdio.h> | 400 |
272 #include <stdlib.h> | 401 int |
273 | 402 test2() |
274 int | 403 { |
275 main () | 404 auto a = [](int i, int j){ return i + j; }(1, 2); |
405 auto b = []() -> int { return '0'; }(); | |
406 auto c = [=](){ return a + b; }(); | |
407 auto d = [&](){ return c; }(); | |
408 auto e = [a, &b](int x) mutable { | |
409 const auto identity = [](int y){ return y; }; | |
410 for (auto i = 0; i < a; ++i) | |
411 a += b--; | |
412 return x + identity(a + b); | |
413 }(0); | |
414 return a + b + c + d + e; | |
415 } | |
416 | |
417 int | |
418 test3() | |
419 { | |
420 const auto nullary = [](){ return 0; }; | |
421 const auto unary = [](int x){ return x; }; | |
422 using nullary_t = decltype(nullary); | |
423 using unary_t = decltype(unary); | |
424 const auto higher1st = [](nullary_t f){ return f(); }; | |
425 const auto higher2nd = [unary](nullary_t f1){ | |
426 return [unary, f1](unary_t f2){ return f2(unary(f1())); }; | |
427 }; | |
428 return higher1st(nullary) + higher2nd(nullary)(unary); | |
429 } | |
430 | |
431 } | |
432 | |
433 namespace test_variadic_templates | |
434 { | |
435 | |
436 template <int...> | |
437 struct sum; | |
438 | |
439 template <int N0, int... N1toN> | |
440 struct sum<N0, N1toN...> | |
441 { | |
442 static constexpr auto value = N0 + sum<N1toN...>::value; | |
443 }; | |
444 | |
445 template <> | |
446 struct sum<> | |
447 { | |
448 static constexpr auto value = 0; | |
449 }; | |
450 | |
451 static_assert(sum<>::value == 0, ""); | |
452 static_assert(sum<1>::value == 1, ""); | |
453 static_assert(sum<23>::value == 23, ""); | |
454 static_assert(sum<1, 2>::value == 3, ""); | |
455 static_assert(sum<5, 5, 11>::value == 21, ""); | |
456 static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); | |
457 | |
458 } | |
459 | |
460 // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae | |
461 // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function | |
462 // because of this. | |
463 namespace test_template_alias_sfinae | |
464 { | |
465 | |
466 struct foo {}; | |
467 | |
468 template<typename T> | |
469 using member = typename T::member_type; | |
470 | |
471 template<typename T> | |
472 void func(...) {} | |
473 | |
474 template<typename T> | |
475 void func(member<T>*) {} | |
476 | |
477 void test(); | |
478 | |
479 void test() { func<foo>(0); } | |
480 | |
481 } | |
482 | |
483 } // namespace cxx11 | |
484 | |
485 #endif // __cplusplus >= 201103L | |
486 | |
487 ]]) | |
488 | |
489 | |
490 dnl Tests for new features in C++14 | |
491 | |
492 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ | |
493 | |
494 // If the compiler admits that it is not ready for C++14, why torture it? | |
495 // Hopefully, this will speed up the test. | |
496 | |
497 #ifndef __cplusplus | |
498 | |
499 #error "This is not a C++ compiler" | |
500 | |
501 #elif __cplusplus < 201402L && !defined _MSC_VER | |
502 | |
503 #error "This is not a C++14 compiler" | |
504 | |
505 #else | |
506 | |
507 namespace cxx14 | |
276 { | 508 { |
277 int major, minor, micro; | 509 |
278 char *tmp_version; | 510 namespace test_polymorphic_lambdas |
279 | 511 { |
280 system ("touch conf.gtktest"); | 512 |
281 | 513 int |
282 /* HP/UX 9 (%@#!) writes to sscanf strings */ | 514 test() |
283 tmp_version = g_strdup("$min_gtk_version"); | 515 { |
284 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | 516 const auto lambda = [](auto&&... args){ |
285 printf("%s, bad version string\n", "$min_gtk_version"); | 517 const auto istiny = [](auto x){ |
286 exit(1); | 518 return (sizeof(x) == 1UL) ? 1 : 0; |
287 } | 519 }; |
288 | 520 const int aretiny[] = { istiny(args)... }; |
289 if ((gtk_major_version != $gtk_config_major_version) || | 521 return aretiny[0]; |
290 (gtk_minor_version != $gtk_config_minor_version) || | 522 }; |
291 (gtk_micro_version != $gtk_config_micro_version)) | 523 return lambda(1, 1L, 1.0f, '1'); |
292 { | 524 } |
293 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", | 525 |
294 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version, | 526 } |
295 gtk_major_version, gtk_minor_version, gtk_micro_version); | 527 |
296 printf ("*** was found! If gtk-config was correct, then it is best\n"); | 528 namespace test_binary_literals |
297 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); | 529 { |
298 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); | 530 |
299 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); | 531 constexpr auto ivii = 0b0000000000101010; |
300 printf("*** required on your system.\n"); | 532 static_assert(ivii == 42, "wrong value"); |
301 printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); | 533 |
302 printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n"); | 534 } |
303 printf("*** before re-running configure\n"); | 535 |
304 } | 536 namespace test_generalized_constexpr |
305 #if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION) | 537 { |
306 else if ((gtk_major_version != GTK_MAJOR_VERSION) || | 538 |
307 (gtk_minor_version != GTK_MINOR_VERSION) || | 539 template < typename CharT > |
308 (gtk_micro_version != GTK_MICRO_VERSION)) | 540 constexpr unsigned long |
309 { | 541 strlen_c(const CharT *const s) noexcept |
310 printf("*** GTK+ header files (version %d.%d.%d) do not match\n", | 542 { |
311 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); | 543 auto length = 0UL; |
312 printf("*** library (version %d.%d.%d)\n", | 544 for (auto p = s; *p; ++p) |
313 gtk_major_version, gtk_minor_version, gtk_micro_version); | 545 ++length; |
314 } | 546 return length; |
315 #endif /* defined (GTK_MAJOR_VERSION) ... */ | 547 } |
316 else | 548 |
317 { | 549 static_assert(strlen_c("") == 0UL, ""); |
318 if ((gtk_major_version > major) || | 550 static_assert(strlen_c("x") == 1UL, ""); |
319 ((gtk_major_version == major) && (gtk_minor_version > minor)) || | 551 static_assert(strlen_c("test") == 4UL, ""); |
320 ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro))) | 552 static_assert(strlen_c("another\0test") == 7UL, ""); |
321 { | 553 |
322 return 0; | 554 } |
323 } | 555 |
324 else | 556 namespace test_lambda_init_capture |
325 { | 557 { |
326 printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", | 558 |
327 gtk_major_version, gtk_minor_version, gtk_micro_version); | 559 int |
328 printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n", | 560 test() |
329 major, minor, micro); | 561 { |
330 printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); | 562 auto x = 0; |
331 printf("***\n"); | 563 const auto lambda1 = [a = x](int b){ return a + b; }; |
332 printf("*** If you have already installed a sufficiently new version, this error\n"); | 564 const auto lambda2 = [a = lambda1(x)](){ return a; }; |
333 printf("*** probably means that the wrong copy of the gtk-config shell script is\n"); | 565 return lambda2(); |
334 printf("*** being found. The easiest way to fix this is to remove the old version\n"); | 566 } |
335 printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); | 567 |
336 printf("*** correct copy of gtk-config. (In this case, you will have to\n"); | 568 } |
337 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); | 569 |
338 printf("*** so that the correct libraries are found at run-time))\n"); | 570 namespace test_digit_separators |
339 } | 571 { |
340 } | 572 |
341 return 1; | 573 constexpr auto ten_million = 100'000'000; |
342 } | 574 static_assert(ten_million == 100000000, ""); |
343 ],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | 575 |
344 CFLAGS="$ac_save_CFLAGS" | 576 } |
345 LIBS="$ac_save_LIBS" | 577 |
346 fi | 578 namespace test_return_type_deduction |
347 fi | 579 { |
348 if test "x$no_gtk" = x ; then | 580 |
349 AC_MSG_RESULT(yes) | 581 auto f(int& x) { return x; } |
350 ifelse([$2], , :, [$2]) | 582 decltype(auto) g(int& x) { return x; } |
351 else | 583 |
352 AC_MSG_RESULT(no) | 584 template < typename T1, typename T2 > |
353 if test "$GTK_CONFIG" = "no" ; then | 585 struct is_same |
354 echo "*** The gtk-config script installed by GTK could not be found" | 586 { |
355 echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" | 587 static constexpr auto value = false; |
356 echo "*** your path, or set the GTK_CONFIG environment variable to the" | 588 }; |
357 echo "*** full path to gtk-config." | 589 |
358 else | 590 template < typename T > |
359 if test -f conf.gtktest ; then | 591 struct is_same<T, T> |
360 : | 592 { |
361 else | 593 static constexpr auto value = true; |
362 echo "*** Could not run GTK test program, checking why..." | 594 }; |
363 CFLAGS="$CFLAGS $GTK_CFLAGS" | 595 |
364 LIBS="$LIBS $GTK_LIBS" | 596 int |
365 AC_TRY_LINK([ | 597 test() |
366 #include <gtk/gtk.h> | 598 { |
367 #include <stdio.h> | 599 auto x = 0; |
368 ], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ], | 600 static_assert(is_same<int, decltype(f(x))>::value, ""); |
369 [ echo "*** The test program compiled, but did not run. This usually means" | 601 static_assert(is_same<int&, decltype(g(x))>::value, ""); |
370 echo "*** that the run-time linker is not finding GTK or finding the wrong" | 602 return x; |
371 echo "*** version of GTK. If it is not finding GTK, you'll need to set your" | 603 } |
372 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | 604 |
373 echo "*** to the installed location Also, make sure you have run ldconfig if that" | 605 } |
374 echo "*** is required on your system" | 606 |
375 echo "***" | 607 } // namespace cxx14 |
376 echo "*** If you have an old version installed, it is best to remove it, although" | 608 |
377 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ], | 609 #endif // __cplusplus >= 201402L |
378 [ echo "*** The test program failed to compile or link. See the file config.log for the" | 610 |
379 echo "*** exact error that occured. This usually means GTK was incorrectly installed" | 611 ]]) |
380 echo "*** or that you have moved GTK since it was installed. In the latter case, you" | 612 |
381 echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) | 613 |
382 CFLAGS="$ac_save_CFLAGS" | 614 dnl Tests for new features in C++17 |
383 LIBS="$ac_save_LIBS" | 615 |
384 fi | 616 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ |
385 fi | 617 |
386 GTK_CFLAGS="" | 618 // If the compiler admits that it is not ready for C++17, why torture it? |
387 GTK_LIBS="" | 619 // Hopefully, this will speed up the test. |
388 ifelse([$3], , :, [$3]) | 620 |
389 fi | 621 #ifndef __cplusplus |
390 AC_SUBST(GTK_CFLAGS) | 622 |
391 AC_SUBST(GTK_LIBS) | 623 #error "This is not a C++ compiler" |
392 rm -f conf.gtktest | 624 |
393 ]) | 625 #elif __cplusplus < 201703L && !defined _MSC_VER |
394 | 626 |
395 # Configure paths for IMLIB | 627 #error "This is not a C++17 compiler" |
396 # David Walluck 99-9-18 | 628 |
397 # Frank Belew 98-8-31 | 629 #else |
398 # stolen from Manish Singh | 630 |
399 # Shamelessly stolen from Owen Taylor | 631 #include <initializer_list> |
400 | 632 #include <utility> |
401 dnl AM_PATH_IMLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) | 633 #include <type_traits> |
402 dnl Test for IMLIB, and define IMLIB_CFLAGS and IMLIB_LIBS | 634 |
403 dnl | 635 namespace cxx17 |
404 AC_DEFUN(AM_PATH_IMLIB, | |
405 [dnl | |
406 dnl Get the cflags and libraries from the imlib-config script | |
407 dnl | |
408 AC_ARG_WITH(imlib-prefix,[ --with-imlib-prefix=PFX Prefix where IMLIB is installed (optional)], | |
409 imlib_prefix="$withval", imlib_prefix="") | |
410 AC_ARG_WITH(imlib-exec-prefix,[ --with-imlib-exec-prefix=PFX Exec prefix where IMLIB is installed (optional)], | |
411 imlib_exec_prefix="$withval", imlib_exec_prefix="") | |
412 AC_ARG_ENABLE(imlibtest, [ --disable-imlibtest Do not try to compile and run a test IMLIB program], | |
413 , enable_imlibtest=yes) | |
414 | |
415 if test x$imlib_exec_prefix != x ; then | |
416 imlib_args="$imlib_args --exec-prefix=$imlib_exec_prefix" | |
417 if test x${IMLIB_CONFIG+set} != xset ; then | |
418 IMLIB_CONFIG=$imlib_exec_prefix/bin/imlib-config | |
419 fi | |
420 fi | |
421 if test x$imlib_prefix != x ; then | |
422 imlib_args="$imlib_args --prefix=$imlib_prefix" | |
423 if test x${IMLIB_CONFIG+set} != xset ; then | |
424 IMLIB_CONFIG=$imlib_prefix/bin/imlib-config | |
425 fi | |
426 fi | |
427 | |
428 AC_PATH_PROG(IMLIB_CONFIG, imlib-config, no) | |
429 min_imlib_version=ifelse([$1], ,1.9.4,$1) | |
430 AC_MSG_CHECKING(for IMLIB - version >= $min_imlib_version) | |
431 no_imlib="" | |
432 if test "$IMLIB_CONFIG" = "no" ; then | |
433 no_imlib=yes | |
434 else | |
435 IMLIB_CFLAGS=`$IMLIB_CONFIG $imlibconf_args --cflags` | |
436 IMLIB_LIBS=`$IMLIB_CONFIG $imlibconf_args --libs` | |
437 | |
438 imlib_major_version=`$IMLIB_CONFIG $imlib_args --version | \ | |
439 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
440 imlib_minor_version=`$IMLIB_CONFIG $imlib_args --version | \ | |
441 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
442 imlib_micro_version=`$IMLIB_CONFIG $imlib_args --version | \ | |
443 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
444 if test "x$enable_imlibtest" = "xyes" ; then | |
445 ac_save_CFLAGS="$CFLAGS" | |
446 ac_save_LIBS="$LIBS" | |
447 CFLAGS="$CFLAGS $IMLIB_CFLAGS" | |
448 LIBS="$LIBS $IMLIB_LIBS" | |
449 dnl | |
450 dnl Now check if the installed IMLIB is sufficiently new. (Also sanity | |
451 dnl checks the results of imlib-config to some extent | |
452 dnl | |
453 rm -f conf.imlibtest | |
454 AC_TRY_RUN([ | |
455 #include <stdio.h> | |
456 #include <stdlib.h> | |
457 #include <Imlib.h> | |
458 | |
459 int main () | |
460 { | 636 { |
461 int major, minor, micro; | 637 |
462 char *tmp_version; | 638 namespace test_constexpr_lambdas |
463 | 639 { |
464 system ("touch conf.imlibtest"); | 640 |
465 | 641 constexpr int foo = [](){return 42;}(); |
466 /* HP/UX 9 (%@#!) writes to sscanf strings */ | 642 |
467 tmp_version = g_strdup("$min_imlib_version"); | 643 } |
468 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | 644 |
469 printf("%s, bad version string\n", "$min_imlib_version"); | 645 namespace test::nested_namespace::definitions |
470 exit(1); | 646 { |
471 } | 647 |
472 | 648 } |
473 if (($imlib_major_version > major) || | 649 |
474 (($imlib_major_version == major) && ($imlib_minor_version > minor)) || | 650 namespace test_fold_expression |
475 (($imlib_major_version == major) && ($imlib_minor_version == minor) && | 651 { |
476 ($imlib_micro_version >= micro))) | 652 |
477 { | 653 template<typename... Args> |
478 return 0; | 654 int multiply(Args... args) |
479 } | 655 { |
480 else | 656 return (args * ... * 1); |
481 { | 657 } |
482 printf("\n*** 'imlib-config --version' returned %d.%d.%d, but the minimum version\n", $imlib_major_version, $imlib_minor_version, $imlib_micro_version); | 658 |
483 printf("*** of IMLIB required is %d.%d.%d. If imlib-config is correct, then it is\n", major, minor, micro); | 659 template<typename... Args> |
484 printf("*** best to upgrade to the required version.\n"); | 660 bool all(Args... args) |
485 printf("*** If imlib-config was wrong, set the environment variable IMLIB_CONFIG\n"); | 661 { |
486 printf("*** to point to the correct copy of imlib-config, and remove the file\n"); | 662 return (args && ...); |
487 printf("*** config.cache before re-running configure\n"); | 663 } |
488 return 1; | 664 |
489 } | 665 } |
490 } | 666 |
491 | 667 namespace test_extended_static_assert |
492 ],, no_imlib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | 668 { |
493 CFLAGS="$ac_save_CFLAGS" | 669 |
494 LIBS="$ac_save_LIBS" | 670 static_assert (true); |
495 fi | 671 |
496 fi | 672 } |
497 if test "x$no_imlib" = x ; then | 673 |
498 AC_MSG_RESULT(yes) | 674 namespace test_auto_brace_init_list |
499 ifelse([$2], , :, [$2]) | 675 { |
500 else | 676 |
501 AC_MSG_RESULT(no) | 677 auto foo = {5}; |
502 if test "$IMLIB_CONFIG" = "no" ; then | 678 auto bar {5}; |
503 echo "*** The imlib-config script installed by IMLIB could not be found" | 679 |
504 echo "*** If IMLIB was installed in PREFIX, make sure PREFIX/bin is in" | 680 static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value); |
505 echo "*** your path, or set the IMLIB_CONFIG environment variable to the" | 681 static_assert(std::is_same<int, decltype(bar)>::value); |
506 echo "*** full path to imlib-config." | 682 } |
507 else | 683 |
508 if test -f conf.imlibtest ; then | 684 namespace test_typename_in_template_template_parameter |
509 : | 685 { |
510 else | 686 |
511 echo "*** Could not run IMLIB test program, checking why..." | 687 template<template<typename> typename X> struct D; |
512 CFLAGS="$CFLAGS $IMLIB_CFLAGS" | 688 |
513 LIBS="$LIBS $IMLIB_LIBS" | 689 } |
514 AC_TRY_LINK([ | 690 |
515 #include <stdio.h> | 691 namespace test_fallthrough_nodiscard_maybe_unused_attributes |
516 #include <Imlib.h> | 692 { |
517 ], [ return 0; ], | 693 |
518 [ echo "*** The test program compiled, but did not run. This usually means" | 694 int f1() |
519 echo "*** that the run-time linker is not finding IMLIB or finding the wrong" | 695 { |
520 echo "*** version of IMLIB. If it is not finding IMLIB, you'll need to set your" | 696 return 42; |
521 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | 697 } |
522 echo "*** to the installed location Also, make sure you have run ldconfig if that" | 698 |
523 echo "*** is required on your system" | 699 [[nodiscard]] int f2() |
524 echo "***" | 700 { |
525 echo "*** If you have an old version installed, it is best to remove it, although" | 701 [[maybe_unused]] auto unused = f1(); |
526 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], | 702 |
527 [ echo "*** The test program failed to compile or link. See the file config.log for the" | 703 switch (f1()) |
528 echo "*** exact error that occured. This usually means IMLIB was incorrectly installed" | 704 { |
529 echo "*** or that you have moved IMLIB since it was installed. In the latter case, you" | 705 case 17: |
530 echo "*** may want to edit the imlib-config script: $IMLIB_CONFIG" ]) | 706 f1(); |
531 CFLAGS="$ac_save_CFLAGS" | 707 [[fallthrough]]; |
532 LIBS="$ac_save_LIBS" | 708 case 42: |
533 fi | 709 f1(); |
534 fi | 710 } |
535 IMLIB_CFLAGS="" | 711 return f1(); |
536 IMLIB_LIBS="" | 712 } |
537 ifelse([$3], , :, [$3]) | 713 |
538 fi | 714 } |
539 AC_SUBST(IMLIB_CFLAGS) | 715 |
540 AC_SUBST(IMLIB_LIBS) | 716 namespace test_extended_aggregate_initialization |
541 rm -f conf.imlibtest | 717 { |
542 ]) | 718 |
543 | 719 struct base1 |
544 # Check for gdk-imlib | 720 { |
545 AC_DEFUN(AM_PATH_GDK_IMLIB, | 721 int b1, b2 = 42; |
546 [dnl | 722 }; |
547 dnl Get the cflags and libraries from the imlib-config script | 723 |
548 dnl | 724 struct base2 |
549 AC_ARG_WITH(imlib-prefix,[ --with-imlib-prefix=PFX Prefix where IMLIB is installed (optional)], | 725 { |
550 imlib_prefix="$withval", imlib_prefix="") | 726 base2() { |
551 AC_ARG_WITH(imlib-exec-prefix,[ --with-imlib-exec-prefix=PFX Exec prefix where IMLIB is installed (optional)], | 727 b3 = 42; |
552 imlib_exec_prefix="$withval", imlib_exec_prefix="") | 728 } |
553 AC_ARG_ENABLE(imlibtest, [ --disable-imlibtest Do not try to compile and run a test IMLIB program], | 729 int b3; |
554 , enable_imlibtest=yes) | 730 }; |
555 | 731 |
556 if test x$imlib_exec_prefix != x ; then | 732 struct derived : base1, base2 |
557 imlib_args="$imlib_args --exec-prefix=$imlib_exec_prefix" | 733 { |
558 if test x${IMLIB_CONFIG+set} != xset ; then | 734 int d; |
559 IMLIB_CONFIG=$imlib_exec_prefix/bin/imlib-config | 735 }; |
560 fi | 736 |
561 fi | 737 derived d1 {{1, 2}, {}, 4}; // full initialization |
562 if test x$imlib_prefix != x ; then | 738 derived d2 {{}, {}, 4}; // value-initialized bases |
563 imlib_args="$imlib_args --prefix=$imlib_prefix" | 739 |
564 if test x${IMLIB_CONFIG+set} != xset ; then | 740 } |
565 IMLIB_CONFIG=$imlib_prefix/bin/imlib-config | 741 |
566 fi | 742 namespace test_general_range_based_for_loop |
567 fi | 743 { |
568 | 744 |
569 AC_PATH_PROG(IMLIB_CONFIG, imlib-config, no) | 745 struct iter |
570 min_imlib_version=ifelse([$1], ,1.9.4,$1) | 746 { |
571 AC_MSG_CHECKING(for IMLIB - version >= $min_imlib_version) | 747 int i; |
572 no_imlib="" | 748 |
573 if test "$IMLIB_CONFIG" = "no" ; then | 749 int& operator* () |
574 no_imlib=yes | 750 { |
575 else | 751 return i; |
576 GDK_IMLIB_CFLAGS=`$IMLIB_CONFIG $imlibconf_args --cflags-gdk` | 752 } |
577 GDK_IMLIB_LIBS=`$IMLIB_CONFIG $imlibconf_args --libs-gdk` | 753 |
578 | 754 const int& operator* () const |
579 imlib_major_version=`$IMLIB_CONFIG $imlib_args --version | \ | 755 { |
580 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | 756 return i; |
581 imlib_minor_version=`$IMLIB_CONFIG $imlib_args --version | \ | 757 } |
582 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | 758 |
583 imlib_micro_version=`$IMLIB_CONFIG $imlib_args --version | \ | 759 iter& operator++() |
584 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | 760 { |
585 if test "x$enable_imlibtest" = "xyes" ; then | 761 ++i; |
586 ac_save_CFLAGS="$CFLAGS" | 762 return *this; |
587 ac_save_LIBS="$LIBS" | 763 } |
588 CFLAGS="$CFLAGS $GDK_IMLIB_CFLAGS" | 764 }; |
589 LIBS="$LIBS $GDK_IMLIB_LIBS" | 765 |
590 dnl | 766 struct sentinel |
591 dnl Now check if the installed IMLIB is sufficiently new. (Also sanity | 767 { |
592 dnl checks the results of imlib-config to some extent | 768 int i; |
593 dnl | 769 }; |
594 rm -f conf.imlibtest | 770 |
595 AC_TRY_RUN([ | 771 bool operator== (const iter& i, const sentinel& s) |
596 #include <stdio.h> | 772 { |
597 #include <stdlib.h> | 773 return i.i == s.i; |
598 #include <gdk_imlib.h> | 774 } |
599 | 775 |
600 int main () | 776 bool operator!= (const iter& i, const sentinel& s) |
777 { | |
778 return !(i == s); | |
779 } | |
780 | |
781 struct range | |
782 { | |
783 iter begin() const | |
784 { | |
785 return {0}; | |
786 } | |
787 | |
788 sentinel end() const | |
789 { | |
790 return {5}; | |
791 } | |
792 }; | |
793 | |
794 void f() | |
795 { | |
796 range r {}; | |
797 | |
798 for (auto i : r) | |
799 { | |
800 [[maybe_unused]] auto v = i; | |
801 } | |
802 } | |
803 | |
804 } | |
805 | |
806 namespace test_lambda_capture_asterisk_this_by_value | |
807 { | |
808 | |
809 struct t | |
810 { | |
811 int i; | |
812 int foo() | |
813 { | |
814 return [*this]() | |
815 { | |
816 return i; | |
817 }(); | |
818 } | |
819 }; | |
820 | |
821 } | |
822 | |
823 namespace test_enum_class_construction | |
824 { | |
825 | |
826 enum class byte : unsigned char | |
827 {}; | |
828 | |
829 byte foo {42}; | |
830 | |
831 } | |
832 | |
833 namespace test_constexpr_if | |
834 { | |
835 | |
836 template <bool cond> | |
837 int f () | |
838 { | |
839 if constexpr(cond) | |
840 { | |
841 return 13; | |
842 } | |
843 else | |
844 { | |
845 return 42; | |
846 } | |
847 } | |
848 | |
849 } | |
850 | |
851 namespace test_selection_statement_with_initializer | |
852 { | |
853 | |
854 int f() | |
855 { | |
856 return 13; | |
857 } | |
858 | |
859 int f2() | |
860 { | |
861 if (auto i = f(); i > 0) | |
862 { | |
863 return 3; | |
864 } | |
865 | |
866 switch (auto i = f(); i + 4) | |
867 { | |
868 case 17: | |
869 return 2; | |
870 | |
871 default: | |
872 return 1; | |
873 } | |
874 } | |
875 | |
876 } | |
877 | |
878 namespace test_template_argument_deduction_for_class_templates | |
879 { | |
880 | |
881 template <typename T1, typename T2> | |
882 struct pair | |
883 { | |
884 pair (T1 p1, T2 p2) | |
885 : m1 {p1}, | |
886 m2 {p2} | |
887 {} | |
888 | |
889 T1 m1; | |
890 T2 m2; | |
891 }; | |
892 | |
893 void f() | |
894 { | |
895 [[maybe_unused]] auto p = pair{13, 42u}; | |
896 } | |
897 | |
898 } | |
899 | |
900 namespace test_non_type_auto_template_parameters | |
901 { | |
902 | |
903 template <auto n> | |
904 struct B | |
905 {}; | |
906 | |
907 B<5> b1; | |
908 B<'a'> b2; | |
909 | |
910 } | |
911 | |
912 namespace test_structured_bindings | |
913 { | |
914 | |
915 int arr[2] = { 1, 2 }; | |
916 std::pair<int, int> pr = { 1, 2 }; | |
917 | |
918 auto f1() -> int(&)[2] | |
919 { | |
920 return arr; | |
921 } | |
922 | |
923 auto f2() -> std::pair<int, int>& | |
924 { | |
925 return pr; | |
926 } | |
927 | |
928 struct S | |
929 { | |
930 int x1 : 2; | |
931 volatile double y1; | |
932 }; | |
933 | |
934 S f3() | |
935 { | |
936 return {}; | |
937 } | |
938 | |
939 auto [ x1, y1 ] = f1(); | |
940 auto& [ xr1, yr1 ] = f1(); | |
941 auto [ x2, y2 ] = f2(); | |
942 auto& [ xr2, yr2 ] = f2(); | |
943 const auto [ x3, y3 ] = f3(); | |
944 | |
945 } | |
946 | |
947 namespace test_exception_spec_type_system | |
948 { | |
949 | |
950 struct Good {}; | |
951 struct Bad {}; | |
952 | |
953 void g1() noexcept; | |
954 void g2(); | |
955 | |
956 template<typename T> | |
957 Bad | |
958 f(T*, T*); | |
959 | |
960 template<typename T1, typename T2> | |
961 Good | |
962 f(T1*, T2*); | |
963 | |
964 static_assert (std::is_same_v<Good, decltype(f(g1, g2))>); | |
965 | |
966 } | |
967 | |
968 namespace test_inline_variables | |
969 { | |
970 | |
971 template<class T> void f(T) | |
972 {} | |
973 | |
974 template<class T> inline T g(T) | |
975 { | |
976 return T{}; | |
977 } | |
978 | |
979 template<> inline void f<>(int) | |
980 {} | |
981 | |
982 template<> int g<>(int) | |
983 { | |
984 return 5; | |
985 } | |
986 | |
987 } | |
988 | |
989 } // namespace cxx17 | |
990 | |
991 #endif // __cplusplus < 201703L && !defined _MSC_VER | |
992 | |
993 ]]) | |
994 | |
995 | |
996 dnl Tests for new features in C++20 | |
997 | |
998 m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_20], [[ | |
999 | |
1000 #ifndef __cplusplus | |
1001 | |
1002 #error "This is not a C++ compiler" | |
1003 | |
1004 #elif __cplusplus < 202002L && !defined _MSC_VER | |
1005 | |
1006 #error "This is not a C++20 compiler" | |
1007 | |
1008 #else | |
1009 | |
1010 #include <version> | |
1011 | |
1012 namespace cxx20 | |
601 { | 1013 { |
602 int major, minor, micro; | 1014 |
603 char *tmp_version; | 1015 // As C++20 supports feature test macros in the standard, there is no |
604 | 1016 // immediate need to actually test for feature availability on the |
605 system ("touch conf.gdkimlibtest"); | 1017 // Autoconf side. |
606 | 1018 |
607 /* HP/UX 9 (%@#!) writes to sscanf strings */ | 1019 } // namespace cxx20 |
608 tmp_version = g_strdup("$min_imlib_version"); | 1020 |
609 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | 1021 #endif // __cplusplus < 202002L && !defined _MSC_VER |
610 printf("%s, bad version string\n", "$min_imlib_version"); | 1022 |
611 exit(1); | 1023 ]]) |
612 } | 1024 |
613 | |
614 if (($imlib_major_version > major) || | |
615 (($imlib_major_version == major) && ($imlib_minor_version > minor)) || | |
616 (($imlib_major_version == major) && ($imlib_minor_version == minor) && | |
617 ($imlib_micro_version >= micro))) | |
618 { | |
619 return 0; | |
620 } | |
621 else | |
622 { | |
623 printf("\n*** 'imlib-config --version' returned %d.%d.%d, but the minimum version\n", $imlib_major_version, $imlib_minor_version, $imlib_micro_version); | |
624 printf("*** of IMLIB required is %d.%d.%d. If imlib-config is correct, then it is\n", major, minor, micro); | |
625 printf("*** best to upgrade to the required version.\n"); | |
626 printf("*** If imlib-config was wrong, set the environment variable IMLIB_CONFIG\n"); | |
627 printf("*** to point to the correct copy of imlib-config, and remove the file\n"); | |
628 printf("*** config.cache before re-running configure\n"); | |
629 return 1; | |
630 } | |
631 } | |
632 | |
633 ],, no_imlib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
634 CFLAGS="$ac_save_CFLAGS" | |
635 LIBS="$ac_save_LIBS" | |
636 fi | |
637 fi | |
638 if test "x$no_imlib" = x ; then | |
639 AC_MSG_RESULT(yes) | |
640 ifelse([$2], , :, [$2]) | |
641 else | |
642 AC_MSG_RESULT(no) | |
643 if test "$IMLIB_CONFIG" = "no" ; then | |
644 echo "*** The imlib-config script installed by IMLIB could not be found" | |
645 echo "*** If IMLIB was installed in PREFIX, make sure PREFIX/bin is in" | |
646 echo "*** your path, or set the IMLIB_CONFIG environment variable to the" | |
647 echo "*** full path to imlib-config." | |
648 else | |
649 if test -f conf.gdkimlibtest ; then | |
650 : | |
651 else | |
652 echo "*** Could not run IMLIB test program, checking why..." | |
653 CFLAGS="$CFLAGS $GDK_IMLIB_CFLAGS" | |
654 LIBS="$LIBS $GDK_IMLIB_LIBS" | |
655 AC_TRY_LINK([ | |
656 #include <stdio.h> | |
657 #include <gdk_imlib.h> | |
658 ], [ return 0; ], | |
659 [ echo "*** The test program compiled, but did not run. This usually means" | |
660 echo "*** that the run-time linker is not finding IMLIB or finding the wrong" | |
661 echo "*** version of IMLIB. If it is not finding IMLIB, you'll need to set your" | |
662 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
663 echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
664 echo "*** is required on your system" | |
665 echo "***" | |
666 echo "*** If you have an old version installed, it is best to remove it, although" | |
667 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], | |
668 [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
669 echo "*** exact error that occured. This usually means IMLIB was incorrectly installed" | |
670 echo "*** or that you have moved IMLIB since it was installed. In the latter case, you" | |
671 echo "*** may want to edit the imlib-config script: $IMLIB_CONFIG" ]) | |
672 CFLAGS="$ac_save_CFLAGS" | |
673 LIBS="$ac_save_LIBS" | |
674 fi | |
675 fi | |
676 GDK_IMLIB_CFLAGS="" | |
677 GDK_IMLIB_LIBS="" | |
678 ifelse([$3], , :, [$3]) | |
679 fi | |
680 AC_SUBST(GDK_IMLIB_CFLAGS) | |
681 AC_SUBST(GDK_IMLIB_LIBS) | |
682 rm -f conf.gdkimlibtest | |
683 ]) | |
684 | |
685 # Configure paths for ESD | |
686 # David Walluck 99-9-20 | |
687 # Manish Singh 98-9-30 | |
688 # stolen back from Frank Belew | |
689 # stolen from Manish Singh | |
690 # Shamelessly stolen from Owen Taylor | |
691 | |
692 dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) | |
693 dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS | |
694 dnl | |
695 AC_DEFUN(AM_PATH_ESD, | |
696 [dnl | |
697 dnl Get the cflags and libraries from the esd-config script | |
698 dnl | |
699 AC_ARG_WITH(esd-prefix,[ --with-esd-prefix=PFX Prefix where ESD is installed (optional)], | |
700 esd_prefix="$withval", esd_prefix="") | |
701 AC_ARG_WITH(esd-exec-prefix,[ --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)], | |
702 esd_exec_prefix="$withval", esd_exec_prefix="") | |
703 AC_ARG_ENABLE(esdtest, [ --disable-esdtest Do not try to compile and run a test ESD program], | |
704 , enable_esdtest=yes) | |
705 | |
706 if test x$esd_exec_prefix != x ; then | |
707 esd_args="$esd_args --exec-prefix=$esd_exec_prefix" | |
708 if test x${ESD_CONFIG+set} != xset ; then | |
709 ESD_CONFIG=$esd_exec_prefix/bin/esd-config | |
710 fi | |
711 fi | |
712 if test x$esd_prefix != x ; then | |
713 esd_args="$esd_args --prefix=$esd_prefix" | |
714 if test x${ESD_CONFIG+set} != xset ; then | |
715 ESD_CONFIG=$esd_prefix/bin/esd-config | |
716 fi | |
717 fi | |
718 | |
719 AC_PATH_PROG(ESD_CONFIG, esd-config, no) | |
720 min_esd_version=ifelse([$1], ,0.2.5,$1) | |
721 AC_MSG_CHECKING(for ESD - version >= $min_esd_version) | |
722 no_esd="" | |
723 if test "$ESD_CONFIG" = "no" ; then | |
724 no_esd=yes | |
725 else | |
726 ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags` | |
727 ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs` | |
728 | |
729 esd_major_version=`$ESD_CONFIG $esd_args --version | \ | |
730 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
731 esd_minor_version=`$ESD_CONFIG $esd_args --version | \ | |
732 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
733 esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \ | |
734 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
735 if test "x$enable_esdtest" = "xyes" ; then | |
736 ac_save_CFLAGS="$CFLAGS" | |
737 ac_save_LIBS="$LIBS" | |
738 CFLAGS="$CFLAGS $ESD_CFLAGS" | |
739 LIBS="$LIBS $ESD_LIBS" | |
740 dnl | |
741 dnl Now check if the installed ESD is sufficiently new. (Also sanity | |
742 dnl checks the results of esd-config to some extent | |
743 dnl | |
744 rm -f conf.esdtest | |
745 AC_TRY_RUN([ | |
746 #include <stdio.h> | |
747 #include <stdlib.h> | |
748 #include <esd.h> | |
749 | |
750 int main () | |
751 { | |
752 int major, minor, micro; | |
753 char *tmp_version; | |
754 | |
755 system ("touch conf.esdtest"); | |
756 | |
757 /* HP/UX 9 (%@#!) writes to sscanf strings */ | |
758 tmp_version = g_strdup("$min_esd_version"); | |
759 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
760 printf("%s, bad version string\n", "$min_esd_version"); | |
761 exit(1); | |
762 } | |
763 | |
764 if (($esd_major_version > major) || | |
765 (($esd_major_version == major) && ($esd_minor_version > minor)) || | |
766 (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro))) | |
767 { | |
768 return 0; | |
769 } | |
770 else | |
771 { | |
772 printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version); | |
773 printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro); | |
774 printf("*** best to upgrade to the required version.\n"); | |
775 printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n"); | |
776 printf("*** to point to the correct copy of esd-config, and remove the file\n"); | |
777 printf("*** config.cache before re-running configure\n"); | |
778 return 1; | |
779 } | |
780 } | |
781 | |
782 ],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
783 CFLAGS="$ac_save_CFLAGS" | |
784 LIBS="$ac_save_LIBS" | |
785 fi | |
786 fi | |
787 if test "x$no_esd" = x ; then | |
788 AC_MSG_RESULT(yes) | |
789 ifelse([$2], , :, [$2]) | |
790 else | |
791 AC_MSG_RESULT(no) | |
792 if test "$ESD_CONFIG" = "no" ; then | |
793 echo "*** The esd-config script installed by ESD could not be found" | |
794 echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in" | |
795 echo "*** your path, or set the ESD_CONFIG environment variable to the" | |
796 echo "*** full path to esd-config." | |
797 else | |
798 if test -f conf.esdtest ; then | |
799 : | |
800 else | |
801 echo "*** Could not run ESD test program, checking why..." | |
802 CFLAGS="$CFLAGS $ESD_CFLAGS" | |
803 LIBS="$LIBS $ESD_LIBS" | |
804 AC_TRY_LINK([ | |
805 #include <stdio.h> | |
806 #include <esd.h> | |
807 ], [ return 0; ], | |
808 [ echo "*** The test program compiled, but did not run. This usually means" | |
809 echo "*** that the run-time linker is not finding ESD or finding the wrong" | |
810 echo "*** version of ESD. If it is not finding ESD, you'll need to set your" | |
811 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
812 echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
813 echo "*** is required on your system" | |
814 echo "***" | |
815 echo "*** If you have an old version installed, it is best to remove it, although" | |
816 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], | |
817 [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
818 echo "*** exact error that occured. This usually means ESD was incorrectly installed" | |
819 echo "*** or that you have moved ESD since it was installed. In the latter case, you" | |
820 echo "*** may want to edit the esd-config script: $ESD_CONFIG" ]) | |
821 CFLAGS="$ac_save_CFLAGS" | |
822 LIBS="$ac_save_LIBS" | |
823 fi | |
824 fi | |
825 ESD_CFLAGS="" | |
826 ESD_LIBS="" | |
827 ifelse([$3], , :, [$3]) | |
828 fi | |
829 AC_SUBST(ESD_CFLAGS) | |
830 AC_SUBST(ESD_LIBS) | |
831 rm -f conf.esdtest | |
832 ]) | |
833 | |
834 # Configure paths for AUDIOFILE | |
835 # Bertrand Guiheneuf 98-10-21 | |
836 # stolen from esd.m4 in esound : | |
837 # Manish Singh 98-9-30 | |
838 # stolen back from Frank Belew | |
839 # stolen from Manish Singh | |
840 # Shamelessly stolen from Owen Taylor | |
841 | |
842 dnl AM_PATH_AUDIOFILE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) | |
843 dnl Test for AUDIOFILE, and define AUDIOFILE_CFLAGS and AUDIOFILE_LIBS | |
844 dnl | |
845 AC_DEFUN(AM_PATH_AUDIOFILE, | |
846 [dnl | |
847 dnl Get the cflags and libraries from the audiofile-config script | |
848 dnl | |
849 AC_ARG_WITH(audiofile-prefix,[ --with-audiofile-prefix=PFX Prefix where AUDIOFILE is installed (optional)], | |
850 audiofile_prefix="$withval", audiofile_prefix="") | |
851 AC_ARG_WITH(audiofile-exec-prefix,[ --with-audiofile-exec-prefix=PFX Exec prefix where AUDIOFILE is installed | |
852 (optional)], | |
853 audiofile_exec_prefix="$withval", audiofile_exec_prefix="") | |
854 AC_ARG_ENABLE(audiofiletest, [ --disable-audiofiletest Do not try to compile and run a test AUDIOFILE program], | |
855 , enable_audiofiletest=yes) | |
856 | |
857 if test x$audiofile_exec_prefix != x ; then | |
858 audiofile_args="$audiofile_args --exec-prefix=$audiofile_exec_prefix" | |
859 if test x${AUDIOFILE_CONFIG+set} != xset ; then | |
860 AUDIOFILE_CONFIG=$audiofile_exec_prefix/bin/audiofile-config | |
861 fi | |
862 fi | |
863 if test x$audiofile_prefix != x ; then | |
864 audiofile_args="$audiofile_args --prefix=$audiofile_prefix" | |
865 if test x${AUDIOFILE_CONFIG+set} != xset ; then | |
866 AUDIOFILE_CONFIG=$audiofile_prefix/bin/audiofile-config | |
867 fi | |
868 fi | |
869 | |
870 AC_PATH_PROG(AUDIOFILE_CONFIG, audiofile-config, no) | |
871 min_audiofile_version=ifelse([$1], ,0.1.5,$1) | |
872 AC_MSG_CHECKING(for AUDIOFILE - version >= $min_audiofile_version) | |
873 no_audiofile="" | |
874 if test "$AUDIOFILE_CONFIG" = "no" ; then | |
875 no_audiofile=yes | |
876 else | |
877 AUDIOFILE_LIBS=`$AUDIOFILE_CONFIG $audiofileconf_args --libs` | |
878 AUDIOFILE_CFLAGS=`$AUDIOFILE_CONFIG $audiofileconf_args --cflags` | |
879 audiofile_major_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \ | |
880 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
881 audiofile_minor_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \ | |
882 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
883 audiofile_micro_version=`$AUDIOFILE_CONFIG $audiofile_config_args --version | \ | |
884 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
885 if test "x$enable_audiofiletest" = "xyes" ; then | |
886 ac_save_CFLAGS="$CFLAGS" | |
887 ac_save_LIBS="$LIBS" | |
888 CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS" | |
889 LIBS="$LIBS $AUDIOFILE_LIBS" | |
890 dnl | |
891 dnl Now check if the installed AUDIOFILE is sufficiently new. (Also sanity | |
892 dnl checks the results of audiofile-config to some extent | |
893 dnl | |
894 rm -f conf.audiofiletest | |
895 AC_TRY_RUN([ | |
896 #include <stdio.h> | |
897 #include <stdlib.h> | |
898 #include <audiofile.h> | |
899 | |
900 int main () | |
901 { | |
902 int major, minor, micro; | |
903 char *tmp_version; | |
904 | |
905 system ("touch conf.audiofiletest"); | |
906 | |
907 /* HP/UX 9 (%@#!) writes to sscanf strings */ | |
908 tmp_version = g_strdup("$min_audiofile_version"); | |
909 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
910 printf("%s, bad version string\n", "$min_audiofile_version"); | |
911 exit(1); | |
912 } | |
913 | |
914 if (($audiofile_major_version > major) || | |
915 (($audiofile_major_version == major) && ($audiofile_minor_version > minor)) || | |
916 (($audiofile_major_version == major) && ($audiofile_minor_version == minor) && ($audiofile_micro_version >= micro))) | |
917 { | |
918 return 0; | |
919 } | |
920 else | |
921 { | |
922 printf("\n*** 'audiofile-config --version' returned %d.%d.%d, but the minimum version\n", $audiofile_major_version, $audiofile_minor_version, $audiofile_micro_version); | |
923 printf("*** of AUDIOFILE required is %d.%d.%d. If audiofile-config is correct, then it is\n", major, minor, micro); | |
924 printf("*** best to upgrade to the required version.\n"); | |
925 printf("*** If audiofile-config was wrong, set the environment variable AUDIOFILE_CONFIG\n"); | |
926 printf("*** to point to the correct copy of audiofile-config, and remove the file\n"); | |
927 printf("*** config.cache before re-running configure\n"); | |
928 return 1; | |
929 } | |
930 } | |
931 | |
932 ],, no_audiofile=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
933 CFLAGS="$ac_save_CFLAGS" | |
934 LIBS="$ac_save_LIBS" | |
935 fi | |
936 fi | |
937 if test "x$no_audiofile" = x ; then | |
938 AC_MSG_RESULT(yes) | |
939 ifelse([$2], , :, [$2]) | |
940 else | |
941 AC_MSG_RESULT(no) | |
942 if test "$AUDIOFILE_CONFIG" = "no" ; then | |
943 echo "*** The audiofile-config script installed by AUDIOFILE could not be found" | |
944 echo "*** If AUDIOFILE was installed in PREFIX, make sure PREFIX/bin is in" | |
945 echo "*** your path, or set the AUDIOFILE_CONFIG environment variable to the" | |
946 echo "*** full path to audiofile-config." | |
947 else | |
948 if test -f conf.audiofiletest ; then | |
949 : | |
950 else | |
951 echo "*** Could not run AUDIOFILE test program, checking why..." | |
952 CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS" | |
953 LIBS="$LIBS $AUDIOFILE_LIBS" | |
954 AC_TRY_LINK([ | |
955 #include <stdio.h> | |
956 #include <audiofile.h> | |
957 ], [ return 0; ], | |
958 [ echo "*** The test program compiled, but did not run. This usually means" | |
959 echo "*** that the run-time linker is not finding AUDIOFILE or finding the wrong" | |
960 echo "*** version of AUDIOFILE. If it is not finding AUDIOFILE, you'll need to set your" | |
961 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
962 echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
963 echo "*** is required on your system" | |
964 echo "***" | |
965 echo "*** If you have an old version installed, it is best to remove it, although" | |
966 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], | |
967 [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
968 echo "*** exact error that occured. This usually means AUDIOFILE was incorrectly installed" | |
969 echo "*** or that you have moved AUDIOFILE since it was installed. In the latter case, you" | |
970 echo "*** may want to edit the audiofile-config script: $AUDIOFILE_CONFIG" ]) | |
971 CFLAGS="$ac_save_CFLAGS" | |
972 LIBS="$ac_save_LIBS" | |
973 fi | |
974 fi | |
975 AUDIOFILE_CFLAGS="" | |
976 AUDIOFILE_LIBS="" | |
977 ifelse([$3], , :, [$3]) | |
978 fi | |
979 AC_SUBST(AUDIOFILE_CFLAGS) | |
980 AC_SUBST(AUDIOFILE_LIBS) | |
981 rm -f conf.audiofiletest | |
982 ]) | |
983 # Configure paths for GNOME | |
984 # David Walluck 99-9-24 | |
985 | |
986 dnl AM_PATH_GNOME([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) | |
987 dnl Test for GNOME, and define GNOME_CFLAGS and GNOME_LIBS | |
988 dnl | |
989 AC_DEFUN(AM_PATH_GNOME, | |
990 [dnl | |
991 dnl Get the cflags and libraries from the gnome-config script | |
992 dnl | |
993 AC_ARG_WITH(gnome-prefix,[ --with-gnome-prefix=PFX Prefix where GNOME is installed (optional)], | |
994 gnome_prefix="$withval", gnome_prefix="") | |
995 AC_ARG_WITH(gnome-exec-prefix,[ --with-gnome-exec-prefix=PFX Exec prefix where GNOME is installed (optional)], | |
996 gnome_exec_prefix="$withval", gnome_exec_prefix="") | |
997 AC_ARG_ENABLE(gnometest, [ --disable-gnometest Do not try to compile and run a test GNOME program], | |
998 , enable_gnometest=yes) | |
999 | |
1000 if test x$gnome_exec_prefix != x ; then | |
1001 gnome_args="$gnome_args --exec-prefix=$gnome_exec_prefix" | |
1002 if test x${GNOME_CONFIG+set} != xset ; then | |
1003 GNOME_CONFIG=$gnome_exec_prefix/bin/gnome-config | |
1004 fi | |
1005 fi | |
1006 if test x$gnome_prefix != x ; then | |
1007 gnome_args="$gnome_args --prefix=$gnome_prefix" | |
1008 if test x${GNOME_CONFIG+set} != xset ; then | |
1009 GNOME_CONFIG=$gnome_prefix/bin/gnome-config | |
1010 fi | |
1011 fi | |
1012 | |
1013 AC_PATH_PROG(GNOME_CONFIG, gnome-config, no) | |
1014 min_gnome_version=ifelse([$1], ,0.2.7,$1) | |
1015 AC_MSG_CHECKING(for GNOME - version >= $min_gnome_version) | |
1016 no_gnome="" | |
1017 if test "$GNOME_CONFIG" = "no" ; then | |
1018 no_gnome=yes | |
1019 else | |
1020 GNOME_CFLAGS=`$GNOME_CONFIG $gnomeconf_args gnome --cflags` | |
1021 GNOME_LIBS=`$GNOME_CONFIG $gnomeconf_args gnome --libs` | |
1022 | |
1023 gnome_major_version=`$GNOME_CONFIG $gnome_args --version | \ | |
1024 sed 's/gnome-libs //' | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
1025 gnome_minor_version=`$GNOME_CONFIG $gnome_args --version | \ | |
1026 sed 's/gnome-libs //' | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
1027 gnome_micro_version=`$GNOME_CONFIG $gnome_config_args --version | \ | |
1028 sed 's/gnome-libs //' | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
1029 if test "x$enable_gnometest" = "xyes" ; then | |
1030 ac_save_CFLAGS="$CFLAGS" | |
1031 ac_save_LIBS="$LIBS" | |
1032 CFLAGS="$CFLAGS $GNOME_CFLAGS" | |
1033 LIBS="$LIBS $GNOME_LIBS" | |
1034 dnl | |
1035 dnl Now check if the installed GNOME is sufficiently new. (Also sanity | |
1036 dnl checks the results of gnome-config to some extent | |
1037 dnl | |
1038 rm -f conf.gnometest | |
1039 AC_TRY_RUN([ | |
1040 #include <stdio.h> | |
1041 #include <stdlib.h> | |
1042 #include <string.h> | |
1043 #include <gnome.h> | |
1044 | |
1045 int main () | |
1046 { | |
1047 int major, minor, micro; | |
1048 char *tmp_version; | |
1049 | |
1050 system ("touch conf.gnometest"); | |
1051 | |
1052 /* HP/UX 9 (%@#!) writes to sscanf strings */ | |
1053 tmp_version = g_strdup("$min_gnome_version"); | |
1054 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
1055 printf("%s, bad version string\n", "$min_gnome_version"); | |
1056 exit(1); | |
1057 } | |
1058 | |
1059 if (($gnome_major_version > major) || | |
1060 (($gnome_major_version == major) && ($gnome_minor_version > minor)) || | |
1061 (($gnome_major_version == major) && ($gnome_minor_version == minor) && ($gnome_micro_version >= micro))) | |
1062 { | |
1063 return 0; | |
1064 } | |
1065 else | |
1066 { | |
1067 printf("\n*** 'gnome-config --version' returned %d.%d.%d, but the minimum version\n", $gnome_major_version, $gnome_minor_version, $gnome_micro_version); | |
1068 printf("*** of GNOME required is %d.%d.%d. If gnome-config is correct, then it is\n", major, minor, micro); | |
1069 printf("*** best to upgrade to the required version.\n"); | |
1070 printf("*** If gnome-config was wrong, set the environment variable GNOME_CONFIG\n"); | |
1071 printf("*** to point to the correct copy of gnome-config, and remove the file\n"); | |
1072 printf("*** config.cache before re-running configure\n"); | |
1073 return 1; | |
1074 } | |
1075 } | |
1076 | |
1077 ],, no_gnome=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
1078 CFLAGS="$ac_save_CFLAGS" | |
1079 LIBS="$ac_save_LIBS" | |
1080 fi | |
1081 fi | |
1082 if test "x$no_gnome" = x ; then | |
1083 AC_MSG_RESULT(yes) | |
1084 ifelse([$2], , :, [$2]) | |
1085 else | |
1086 AC_MSG_RESULT(no) | |
1087 if test "$GNOME_CONFIG" = "no" ; then | |
1088 echo "*** The gnome-config script installed by GNOME could not be found" | |
1089 echo "*** If GNOME was installed in PREFIX, make sure PREFIX/bin is in" | |
1090 echo "*** your path, or set the GNOME_CONFIG environment variable to the" | |
1091 echo "*** full path to gnome-config." | |
1092 else | |
1093 if test -f conf.gnometest ; then | |
1094 : | |
1095 else | |
1096 echo "*** Could not run GNOME test program, checking why..." | |
1097 CFLAGS="$CFLAGS $GNOME_CFLAGS" | |
1098 LIBS="$LIBS $GNOME_LIBS" | |
1099 AC_TRY_LINK([ | |
1100 #include <stdio.h> | |
1101 #include <gnome.h> | |
1102 ], [ return 0; ], | |
1103 [ echo "*** The test program compiled, but did not run. This usually means" | |
1104 echo "*** that the run-time linker is not finding GNOME or finding the wrong" | |
1105 echo "*** version of GNOME. If it is not finding GNOME, you'll need to set your" | |
1106 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" | |
1107 echo "*** to the installed location Also, make sure you have run ldconfig if that" | |
1108 echo "*** is required on your system" | |
1109 echo "***" | |
1110 echo "*** If you have an old version installed, it is best to remove it, although" | |
1111 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], | |
1112 [ echo "*** The test program failed to compile or link. See the file config.log for the" | |
1113 echo "*** exact error that occured. This usually means GNOME was incorrectly installed" | |
1114 echo "*** or that you have moved GNOME since it was installed. In the latter case, you" | |
1115 echo "*** may want to edit the gnome-config script: $GNOME_CONFIG" ]) | |
1116 CFLAGS="$ac_save_CFLAGS" | |
1117 LIBS="$ac_save_LIBS" | |
1118 fi | |
1119 fi | |
1120 GNOME_CFLAGS="" | |
1121 GNOME_LIBS="" | |
1122 ifelse([$3], , :, [$3]) | |
1123 fi | |
1124 AC_SUBST(GNOME_CFLAGS) | |
1125 AC_SUBST(GNOME_LIBS) | |
1126 rm -f conf.gnometest | |
1127 ]) |