-
Notifications
You must be signed in to change notification settings - Fork 2
/
aclocal.m4
2477 lines (2219 loc) · 90.8 KB
/
aclocal.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# generated automatically by aclocal 1.16.3 -*- Autoconf -*-
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.69.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 12 (pkg-config-0.29.2)
dnl Copyright © 2004 Scott James Remnant <[email protected]>.
dnl Copyright © 2012-2015 Dan Nicholson <[email protected]>
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
dnl 02111-1307, USA.
dnl
dnl As a special exception to the GNU General Public License, if you
dnl distribute this file as part of a program that contains a
dnl configuration script generated by Autoconf, you may include it under
dnl the same distribution terms that you use for the rest of that
dnl program.
dnl PKG_PREREQ(MIN-VERSION)
dnl -----------------------
dnl Since: 0.29
dnl
dnl Verify that the version of the pkg-config macros are at least
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
dnl installed version of pkg-config, this checks the developer's version
dnl of pkg.m4 when generating configure.
dnl
dnl To ensure that this macro is defined, also add:
dnl m4_ifndef([PKG_PREREQ],
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
dnl ----------------------------------
dnl Since: 0.16
dnl
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
dnl first found in the path. Checks that the version of pkg-config found
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
dnl used since that's the first version where most current features of
dnl pkg-config existed.
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])dnl PKG_PROG_PKG_CONFIG
dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------------------------------
dnl Since: 0.18
dnl
dnl Check to see whether a particular set of modules exists. Similar to
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
dnl
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
dnl only at the first occurence in configure.ac, so if the first place
dnl it's called might be skipped (such as if it is within an "if", you
dnl have to call PKG_CHECK_EXISTS manually
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
dnl ---------------------------------------------
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
dnl pkg_failed based on the result.
m4_define([_PKG_CONFIG],
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])dnl _PKG_CONFIG
dnl _PKG_SHORT_ERRORS_SUPPORTED
dnl ---------------------------
dnl Internal check to see if pkg-config supports short errors.
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi[]dnl
])dnl _PKG_SHORT_ERRORS_SUPPORTED
dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
dnl [ACTION-IF-NOT-FOUND])
dnl --------------------------------------------------------------
dnl Since: 0.4.0
dnl
dnl Note that if there is a possibility the first call to
dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
_PKG_TEXT
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
$3
fi[]dnl
])dnl PKG_CHECK_MODULES
dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
dnl [ACTION-IF-NOT-FOUND])
dnl ---------------------------------------------------------------------
dnl Since: 0.29
dnl
dnl Checks for existence of MODULES and gathers its build flags with
dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
dnl and VARIABLE-PREFIX_LIBS from --libs.
dnl
dnl Note that if there is a possibility the first call to
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
dnl configure.ac.
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
_save_PKG_CONFIG=$PKG_CONFIG
PKG_CONFIG="$PKG_CONFIG --static"
PKG_CHECK_MODULES($@)
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
])dnl PKG_CHECK_MODULES_STATIC
dnl PKG_INSTALLDIR([DIRECTORY])
dnl -------------------------
dnl Since: 0.27
dnl
dnl Substitutes the variable pkgconfigdir as the location where a module
dnl should install pkg-config .pc files. By default the directory is
dnl $libdir/pkgconfig, but the default can be changed by passing
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
dnl parameter.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
[with_pkgconfigdir=]pkg_default)
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
])dnl PKG_INSTALLDIR
dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
dnl --------------------------------
dnl Since: 0.27
dnl
dnl Substitutes the variable noarch_pkgconfigdir as the location where a
dnl module should install arch-independent pkg-config .pc files. By
dnl default the directory is $datadir/pkgconfig, but the default can be
dnl changed by passing DIRECTORY. The user can override through the
dnl --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([noarch-pkgconfigdir],
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
[with_noarch_pkgconfigdir=]pkg_default)
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
])dnl PKG_NOARCH_INSTALLDIR
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------
dnl Since: 0.28
dnl
dnl Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
dnl ---------------------------------------------------------------------------
dnl Author: wxWidgets development team,
dnl Francesco Montorsi,
dnl Bob McCown (Mac-testing)
dnl Creation date: 24/11/2001
dnl ---------------------------------------------------------------------------
dnl ===========================================================================
dnl Table of Contents of this macro file:
dnl -------------------------------------
dnl
dnl SECTION A: wxWidgets main macros
dnl - WX_CONFIG_OPTIONS
dnl - WX_CONFIG_CHECK
dnl - WXRC_CHECK
dnl - WX_STANDARD_OPTIONS
dnl - WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
dnl - WX_DETECT_STANDARD_OPTION_VALUES
dnl
dnl SECTION B: wxWidgets-related utilities
dnl - WX_LIKE_LIBNAME
dnl - WX_ARG_ENABLE_YESNOAUTO
dnl - WX_ARG_WITH_YESNOAUTO
dnl
dnl SECTION C: messages to the user
dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG
dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG_BEGIN
dnl - WX_STANDARD_OPTIONS_SUMMARY_MSG_END
dnl - WX_BOOLOPT_SUMMARY
dnl
dnl The special "WX_DEBUG_CONFIGURE" variable can be set to 1 to enable extra
dnl debug output on stdout from these macros.
dnl ===========================================================================
dnl ---------------------------------------------------------------------------
dnl Macros for wxWidgets detection. Typically used in configure.in as:
dnl
dnl AC_ARG_ENABLE(...)
dnl AC_ARG_WITH(...)
dnl ...
dnl WX_CONFIG_OPTIONS
dnl ...
dnl ...
dnl WX_CONFIG_CHECK([2.6.0], [wxWin=1])
dnl if test "$wxWin" != 1; then
dnl AC_MSG_ERROR([
dnl wxWidgets must be installed on your system
dnl but wx-config script couldn't be found.
dnl
dnl Please check that wx-config is in path, the directory
dnl where wxWidgets libraries are installed (returned by
dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
dnl equivalent variable and wxWidgets version is 2.3.4 or above.
dnl ])
dnl fi
dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
dnl
dnl LIBS="$LIBS $WX_LIBS"
dnl
dnl If you want to support standard --enable-debug/unicode/shared options, you
dnl may do the following:
dnl
dnl ...
dnl AC_CANONICAL_SYSTEM
dnl
dnl # define configure options
dnl WX_CONFIG_OPTIONS
dnl WX_STANDARD_OPTIONS([debug,unicode,shared,toolkit,wxshared])
dnl
dnl # basic configure checks
dnl ...
dnl
dnl # we want to always have DEBUG==WX_DEBUG and UNICODE==WX_UNICODE
dnl WX_DEBUG=$DEBUG
dnl WX_UNICODE=$UNICODE
dnl
dnl WX_CONVERT_STANDARD_OPTIONS_TO_WXCONFIG_FLAGS
dnl WX_CONFIG_CHECK([2.8.0], [wxWin=1],,[html,core,net,base],[$WXCONFIG_FLAGS])
dnl WX_DETECT_STANDARD_OPTION_VALUES
dnl
dnl # write the output files
dnl AC_CONFIG_FILES([Makefile ...])
dnl AC_OUTPUT
dnl
dnl # optional: just to show a message to the user
dnl WX_STANDARD_OPTIONS_SUMMARY_MSG
dnl
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl WX_CONFIG_OPTIONS
dnl
dnl adds support for --wx-prefix, --wx-exec-prefix, --with-wxdir and
dnl --wx-config command line options
dnl ---------------------------------------------------------------------------
AC_DEFUN([WX_CONFIG_OPTIONS],
[
AC_ARG_WITH(wxdir,
[ --with-wxdir=PATH Use uninstalled version of wxWidgets in PATH],
[ wx_config_name="$withval/wx-config"
wx_config_args="--inplace"])
AC_ARG_WITH(wx-config,
[ --with-wx-config=CONFIG wx-config script to use (optional)],
wx_config_name="$withval" )
AC_ARG_WITH(wx-prefix,
[ --with-wx-prefix=PREFIX Prefix where wxWidgets is installed (optional)],
wx_config_prefix="$withval", wx_config_prefix="")
AC_ARG_WITH(wx-exec-prefix,
[ --with-wx-exec-prefix=PREFIX
Exec prefix where wxWidgets is installed (optional)],
wx_config_exec_prefix="$withval", wx_config_exec_prefix="")
])
dnl Helper macro for checking if wx version is at least $1.$2.$3, set's
dnl wx_ver_ok=yes if it is:
AC_DEFUN([_WX_PRIVATE_CHECK_VERSION],
[
wx_ver_ok=""
if test "x$WX_VERSION" != x ; then
if test $wx_config_major_version -gt $1; then
wx_ver_ok=yes
else
if test $wx_config_major_version -eq $1; then
if test $wx_config_minor_version -gt $2; then
wx_ver_ok=yes
else
if test $wx_config_minor_version -eq $2; then
if test $wx_config_micro_version -ge $3; then
wx_ver_ok=yes
fi
fi
fi
fi
fi
fi
])
dnl ---------------------------------------------------------------------------
dnl WX_CONFIG_CHECK(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND
dnl [, WX-LIBS [, ADDITIONAL-WX-CONFIG-FLAGS]]]])
dnl
dnl Test for wxWidgets, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC
dnl (the latter is for static linking against wxWidgets). Set WX_CONFIG_NAME
dnl environment variable to override the default name of the wx-config script
dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this
dnl case the macro won't even waste time on tests for its existence.
dnl
dnl Optional WX-LIBS argument contains comma- or space-separated list of
dnl wxWidgets libraries to link against. If it is not specified then WX_LIBS
dnl and WX_LIBS_STATIC will contain flags to link with all of the core
dnl wxWidgets libraries.
dnl
dnl Optional ADDITIONAL-WX-CONFIG-FLAGS argument is appended to wx-config
dnl invocation command in present. It can be used to fine-tune lookup of
dnl best wxWidgets build available.
dnl
dnl Example use:
dnl WX_CONFIG_CHECK([2.6.0], [wxWin=1], [wxWin=0], [html,core,net]
dnl [--unicode --debug])
dnl ---------------------------------------------------------------------------
dnl
dnl Get the cflags and libraries from the wx-config script
dnl
AC_DEFUN([WX_CONFIG_CHECK],
[
dnl do we have wx-config name: it can be wx-config or wxd-config or ...
if test x${WX_CONFIG_NAME+set} != xset ; then
WX_CONFIG_NAME=wx-config
fi
if test "x$wx_config_name" != x ; then
WX_CONFIG_NAME="$wx_config_name"
fi
dnl deal with optional prefixes
if test x$wx_config_exec_prefix != x ; then
wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix"
WX_LOOKUP_PATH="$wx_config_exec_prefix/bin"
fi
if test x$wx_config_prefix != x ; then
wx_config_args="$wx_config_args --prefix=$wx_config_prefix"
WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin"
fi
if test "$cross_compiling" = "yes"; then
wx_config_args="$wx_config_args --host=$host_alias"
fi
dnl don't search the PATH if WX_CONFIG_NAME is absolute filename
if test -x "$WX_CONFIG_NAME" ; then
AC_MSG_CHECKING(for wx-config)
WX_CONFIG_PATH="$WX_CONFIG_NAME"
AC_MSG_RESULT($WX_CONFIG_PATH)
else
AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH")
fi
if test "$WX_CONFIG_PATH" != "no" ; then
WX_VERSION=""
min_wx_version=ifelse([$1], ,2.2.1,$1)
if test -z "$5" ; then
AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version])
else
AC_MSG_CHECKING([for wxWidgets version >= $min_wx_version ($5)])
fi
dnl don't add the libraries ($4) to this variable as this would result in
dnl an error when it's used with --version below
WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args $5"
WX_VERSION=`$WX_CONFIG_WITH_ARGS --version 2>/dev/null`
wx_config_major_version=`echo $WX_VERSION | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
wx_config_minor_version=`echo $WX_VERSION | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
wx_config_micro_version=`echo $WX_VERSION | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
wx_requested_major_version=`echo $min_wx_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
wx_requested_minor_version=`echo $min_wx_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
wx_requested_micro_version=`echo $min_wx_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
_WX_PRIVATE_CHECK_VERSION([$wx_requested_major_version],
[$wx_requested_minor_version],
[$wx_requested_micro_version])
if test -n "$wx_ver_ok"; then
AC_MSG_RESULT(yes (version $WX_VERSION))
WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs $4`
dnl is this even still appropriate? --static is a real option now
dnl and WX_CONFIG_WITH_ARGS is likely to contain it if that is
dnl what the user actually wants, making this redundant at best.
dnl For now keep it in case anyone actually used it in the past.
AC_MSG_CHECKING([for wxWidgets static library])
WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs $4 2>/dev/null`
if test "x$WX_LIBS_STATIC" = "x"; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
dnl starting with version 2.2.6 wx-config has --cppflags argument
wx_has_cppflags=""
if test $wx_config_major_version -gt 2; then
wx_has_cppflags=yes
else
if test $wx_config_major_version -eq 2; then
if test $wx_config_minor_version -gt 2; then
wx_has_cppflags=yes
else
if test $wx_config_minor_version -eq 2; then
if test $wx_config_micro_version -ge 6; then
wx_has_cppflags=yes
fi
fi
fi
fi
fi
dnl starting with version 2.7.0 wx-config has --rescomp option
wx_has_rescomp=""
if test $wx_config_major_version -gt 2; then
wx_has_rescomp=yes
else
if test $wx_config_major_version -eq 2; then
if test $wx_config_minor_version -ge 7; then
wx_has_rescomp=yes
fi
fi
fi
if test "x$wx_has_rescomp" = x ; then
dnl cannot give any useful info for resource compiler
WX_RESCOMP=
else
WX_RESCOMP=`$WX_CONFIG_WITH_ARGS --rescomp`
fi
if test "x$wx_has_cppflags" = x ; then
dnl no choice but to define all flags like CFLAGS
WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags $4`
WX_CPPFLAGS=$WX_CFLAGS
WX_CXXFLAGS=$WX_CFLAGS
WX_CFLAGS_ONLY=$WX_CFLAGS
WX_CXXFLAGS_ONLY=$WX_CFLAGS
else
dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS
WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags $4`
WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags $4`
WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags $4`
WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"`
WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"`
fi
ifelse([$2], , :, [$2])
else
if test "x$WX_VERSION" = x; then
dnl no wx-config at all
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(no (version $WX_VERSION is not new enough))
fi
WX_CFLAGS=""
WX_CPPFLAGS=""
WX_CXXFLAGS=""
WX_LIBS=""
WX_LIBS_STATIC=""
WX_RESCOMP=""
if test ! -z "$5"; then
wx_error_message="
The configuration you asked for $PACKAGE_NAME requires a wxWidgets
build with the following settings:
$5
but such build is not available.
To see the wxWidgets builds available on this system, please use
'wx-config --list' command. To use the default build, returned by
'wx-config --selected-config', use the options with their 'auto'
default values."
fi
wx_error_message="
The requested wxWidgets build couldn't be found.
$wx_error_message
If you still get this error, then check that 'wx-config' is
in path, the directory where wxWidgets libraries are installed
(returned by 'wx-config --libs' command) is in LD_LIBRARY_PATH
or equivalent variable and wxWidgets version is $1 or above."
ifelse([$3], , AC_MSG_ERROR([$wx_error_message]), [$3])
fi
else
WX_CFLAGS=""
WX_CPPFLAGS=""
WX_CXXFLAGS=""
WX_LIBS=""
WX_LIBS_STATIC=""
WX_RESCOMP=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(WX_CPPFLAGS)
AC_SUBST(WX_CFLAGS)
AC_SUBST(WX_CXXFLAGS)
AC_SUBST(WX_CFLAGS_ONLY)
AC_SUBST(WX_CXXFLAGS_ONLY)
AC_SUBST(WX_LIBS)
AC_SUBST(WX_LIBS_STATIC)
AC_SUBST(WX_VERSION)
AC_SUBST(WX_RESCOMP)
dnl need to export also WX_VERSION_MINOR and WX_VERSION_MAJOR symbols
dnl to support wxpresets bakefiles (we export also WX_VERSION_MICRO for completeness):
WX_VERSION_MAJOR="$wx_config_major_version"
WX_VERSION_MINOR="$wx_config_minor_version"
WX_VERSION_MICRO="$wx_config_micro_version"
AC_SUBST(WX_VERSION_MAJOR)
AC_SUBST(WX_VERSION_MINOR)
AC_SUBST(WX_VERSION_MICRO)
])
dnl ---------------------------------------------------------------------------
dnl Get information on the wxrc program for making C++, Python and xrs
dnl resource files.
dnl
dnl AC_ARG_ENABLE(...)
dnl AC_ARG_WITH(...)
dnl ...
dnl WX_CONFIG_OPTIONS
dnl ...
dnl WX_CONFIG_CHECK(2.6.0, wxWin=1)
dnl if test "$wxWin" != 1; then
dnl AC_MSG_ERROR([
dnl wxWidgets must be installed on your system
dnl but wx-config script couldn't be found.
dnl
dnl Please check that wx-config is in path, the directory
dnl where wxWidgets libraries are installed (returned by
dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
dnl equivalent variable and wxWidgets version is 2.6.0 or above.
dnl ])
dnl fi
dnl
dnl WXRC_CHECK([HAVE_WXRC=1], [HAVE_WXRC=0])
dnl if test "x$HAVE_WXRC" != x1; then
dnl AC_MSG_ERROR([
dnl The wxrc program was not installed or not found.
dnl
dnl Please check the wxWidgets installation.
dnl ])
dnl fi
dnl
dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
dnl
dnl LDFLAGS="$LDFLAGS $WX_LIBS"
dnl ---------------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl WXRC_CHECK([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl
dnl Test for wxWidgets' wxrc program for creating either C++, Python or XRS
dnl resources. The variable WXRC will be set and substituted in the configure
dnl script and Makefiles.
dnl
dnl Example use:
dnl WXRC_CHECK([wxrc=1], [wxrc=0])
dnl ---------------------------------------------------------------------------
dnl
dnl wxrc program from the wx-config script
dnl
AC_DEFUN([WXRC_CHECK],
[
AC_ARG_VAR([WXRC], [Path to wxWidget's wxrc resource compiler])
if test "x$WX_CONFIG_NAME" = x; then
AC_MSG_ERROR([The wxrc tests must run after wxWidgets test.])
else
AC_MSG_CHECKING([for wxrc])
if test "x$WXRC" = x ; then
dnl wx-config --utility is a new addition to wxWidgets:
_WX_PRIVATE_CHECK_VERSION(2,5,3)
if test -n "$wx_ver_ok"; then
WXRC=`$WX_CONFIG_WITH_ARGS --utility=wxrc`
fi
fi
if test "x$WXRC" = x ; then
AC_MSG_RESULT([not found])
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT([$WXRC])
ifelse([$1], , :, [$1])
fi
AC_SUBST(WXRC)
fi
])
dnl ---------------------------------------------------------------------------
dnl WX_LIKE_LIBNAME([output-var] [prefix], [name])
dnl
dnl Sets the "output-var" variable to the name of a library named with same
dnl wxWidgets rule.
dnl E.g. for output-var=='lib', name=='test', prefix='mine', sets
dnl the $lib variable to:
dnl 'mine_gtk2ud_test-2.8'
dnl if WX_PORT=gtk2, WX_UNICODE=1, WX_DEBUG=1 and WX_RELEASE=28
dnl ---------------------------------------------------------------------------
AC_DEFUN([WX_LIKE_LIBNAME],
[
wx_temp="$2""_""$WX_PORT"
dnl add the [u][d] string
if test "$WX_UNICODE" = "1"; then
wx_temp="$wx_temp""u"
fi
if test "$WX_DEBUG" = "1"; then
wx_temp="$wx_temp""d"
fi
dnl complete the name of the lib
wx_temp="$wx_temp""_""$3""-$WX_VERSION_MAJOR.$WX_VERSION_MINOR"
dnl save it in the user's variable
$1=$wx_temp
])
dnl ---------------------------------------------------------------------------
dnl WX_ARG_ENABLE_YESNOAUTO/WX_ARG_WITH_YESNOAUTO
dnl
dnl Two little custom macros which define the ENABLE/WITH configure arguments.
dnl Macro arguments:
dnl $1 = the name of the --enable / --with feature
dnl $2 = the name of the variable associated
dnl $3 = the description of that feature
dnl $4 = the default value for that feature
dnl $5 = additional action to do in case option is given with "yes" value
dnl ---------------------------------------------------------------------------
AC_DEFUN([WX_ARG_ENABLE_YESNOAUTO],
[AC_ARG_ENABLE($1,
AC_HELP_STRING([--enable-$1], [$3 (default is $4)]),
[], [enableval="$4"])
dnl Show a message to the user about this option
AC_MSG_CHECKING([for the --enable-$1 option])
if test "$enableval" = "yes" ; then
AC_MSG_RESULT([yes])
$2=1
$5
elif test "$enableval" = "no" ; then
AC_MSG_RESULT([no])
$2=0
elif test "$enableval" = "auto" ; then
AC_MSG_RESULT([will be automatically detected])
$2="auto"
else
AC_MSG_ERROR([
Unrecognized option value (allowed values: yes, no, auto)
])
fi
])
AC_DEFUN([WX_ARG_WITH_YESNOAUTO],
[AC_ARG_WITH($1,
AC_HELP_STRING([--with-$1], [$3 (default is $4)]),
[], [withval="$4"])
dnl Show a message to the user about this option
AC_MSG_CHECKING([for the --with-$1 option])
if test "$withval" = "yes" ; then
AC_MSG_RESULT([yes])
$2=1
$5
dnl NB: by default we don't allow --with-$1=no option
dnl since it does not make much sense !
elif test "$6" = "1" -a "$withval" = "no" ; then
AC_MSG_RESULT([no])
$2=0
elif test "$withval" = "auto" ; then
AC_MSG_RESULT([will be automatically detected])
$2="auto"
else
AC_MSG_ERROR([
Unrecognized option value (allowed values: yes, auto)
])
fi
])
dnl ---------------------------------------------------------------------------
dnl WX_STANDARD_OPTIONS([options-to-add])
dnl
dnl Adds to the configure script one or more of the following options:
dnl --enable-[debug|unicode|shared|wxshared|wxdebug]
dnl --with-[gtk|msw|motif|x11|mac|dfb]
dnl --with-wxversion
dnl Then checks for their presence and eventually set the DEBUG, UNICODE, SHARED,
dnl PORT, WX_SHARED, WX_DEBUG, variables to one of the "yes", "no", "auto" values.
dnl
dnl Note that e.g. UNICODE != WX_UNICODE; the first is the value of the
dnl --enable-unicode option (in boolean format) while the second indicates
dnl if wxWidgets was built in Unicode mode (and still is in boolean format).
dnl ---------------------------------------------------------------------------
AC_DEFUN([WX_STANDARD_OPTIONS],
[
dnl the following lines will expand to WX_ARG_ENABLE_YESNOAUTO calls if and only if
dnl the $1 argument contains respectively the debug,unicode or shared options.
dnl be careful here not to set debug flag if only "wxdebug" was specified
ifelse(regexp([$1], [\bdebug]), [-1],,
[WX_ARG_ENABLE_YESNOAUTO([debug], [DEBUG], [Build in debug mode], [auto])])
ifelse(index([$1], [unicode]), [-1],,
[WX_ARG_ENABLE_YESNOAUTO([unicode], [UNICODE], [Build in Unicode mode], [auto])])
ifelse(regexp([$1], [\bshared]), [-1],,
[WX_ARG_ENABLE_YESNOAUTO([shared], [SHARED], [Build as shared library], [auto])])
dnl WX_ARG_WITH_YESNOAUTO cannot be used for --with-toolkit since it's an option
dnl which must be able to accept the auto|gtk1|gtk2|msw|... values
ifelse(index([$1], [toolkit]), [-1],,
[
AC_ARG_WITH([toolkit],
AC_HELP_STRING([--with-toolkit],
[Build against a specific wxWidgets toolkit (default is auto)]),
[], [withval="auto"])
dnl Show a message to the user about this option
AC_MSG_CHECKING([for the --with-toolkit option])
if test "$withval" = "auto" ; then
AC_MSG_RESULT([will be automatically detected])
TOOLKIT="auto"
else
TOOLKIT="$withval"
dnl PORT must be one of the allowed values
if test "$TOOLKIT" != "gtk1" -a "$TOOLKIT" != "gtk2" -a \
"$TOOLKIT" != "msw" -a "$TOOLKIT" != "motif" -a \
"$TOOLKIT" != "osx_carbon" -a "$TOOLKIT" != "osx_cocoa" -a \
"$TOOLKIT" != "dfb" -a "$TOOLKIT" != "x11"; then
AC_MSG_ERROR([
Unrecognized option value (allowed values: auto, gtk1, gtk2, msw, motif, osx_carbon, osx_cocoa, dfb, x11)
])
fi
AC_MSG_RESULT([$TOOLKIT])
fi
])
dnl ****** IMPORTANT *******
dnl Unlike for the UNICODE setting, you can build your program in
dnl shared mode against a static build of wxWidgets. Thus we have the
dnl following option which allows these mixtures. E.g.
dnl
dnl ./configure --disable-shared --with-wxshared
dnl
dnl will build your library in static mode against the first available
dnl shared build of wxWidgets.
dnl
dnl Note that's not possible to do the viceversa:
dnl
dnl ./configure --enable-shared --without-wxshared
dnl
dnl Doing so you would try to build your library in shared mode against a static
dnl build of wxWidgets. This is not possible (you would mix PIC and non PIC code) !
dnl A check for this combination of options is in WX_DETECT_STANDARD_OPTION_VALUES
dnl (where we know what 'auto' should be expanded to).
dnl
dnl If you try to build something in ANSI mode against a UNICODE build
dnl of wxWidgets or in RELEASE mode against a DEBUG build of wxWidgets,
dnl then at best you'll get ton of linking errors !
dnl ************************
ifelse(index([$1], [wxshared]), [-1],,
[
WX_ARG_WITH_YESNOAUTO(
[wxshared], [WX_SHARED],
[Force building against a shared build of wxWidgets, even if --disable-shared is given],
[auto], [], [1])
])
dnl Just like for SHARED and WX_SHARED it may happen that some adventurous
dnl peoples will want to mix a wxWidgets release build with a debug build of
dnl his app/lib. So, we have both DEBUG and WX_DEBUG variables.
ifelse(index([$1], [wxdebug]), [-1],,
[
WX_ARG_WITH_YESNOAUTO(
[wxdebug], [WX_DEBUG],
[Force building against a debug build of wxWidgets, even if --disable-debug is given],
[auto], [], [1])
])
dnl WX_ARG_WITH_YESNOAUTO cannot be used for --with-wxversion since it's an option
dnl which accepts the "auto|2.6|2.7|2.8|2.9|3.0" etc etc values
ifelse(index([$1], [wxversion]), [-1],,
[
AC_ARG_WITH([wxversion],
AC_HELP_STRING([--with-wxversion],
[Build against a specific version of wxWidgets (default is auto)]),
[], [withval="auto"])
dnl Show a message to the user about this option
AC_MSG_CHECKING([for the --with-wxversion option])
if test "$withval" = "auto" ; then
AC_MSG_RESULT([will be automatically detected])
WX_RELEASE="auto"
else
wx_requested_major_version=`echo $withval | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).*/\1/'`
wx_requested_minor_version=`echo $withval | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).*/\2/'`
dnl both vars above must be exactly 1 digit
if test "${#wx_requested_major_version}" != "1" -o \
"${#wx_requested_minor_version}" != "1" ; then
AC_MSG_ERROR([
Unrecognized option value (allowed values: auto, 2.6, 2.7, 2.8, 2.9, 3.0)
])
fi
WX_RELEASE="$wx_requested_major_version"".""$wx_requested_minor_version"
AC_MSG_RESULT([$WX_RELEASE])
fi
])
if test "$WX_DEBUG_CONFIGURE" = "1"; then
echo "[[dbg]] DEBUG: $DEBUG, WX_DEBUG: $WX_DEBUG"
echo "[[dbg]] UNICODE: $UNICODE, WX_UNICODE: $WX_UNICODE"
echo "[[dbg]] SHARED: $SHARED, WX_SHARED: $WX_SHARED"
echo "[[dbg]] TOOLKIT: $TOOLKIT, WX_TOOLKIT: $WX_TOOLKIT"
echo "[[dbg]] VERSION: $VERSION, WX_RELEASE: $WX_RELEASE"
fi
])