File: configure.ac

package info (click to toggle)
wmaker 0.95.7-8
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,876 kB
  • ctags: 10,510
  • sloc: ansic: 97,511; sh: 13,970; perl: 3,582; makefile: 1,476; lisp: 219; python: 34
file content (985 lines) | stat: -rw-r--r-- 32,680 bytes parent folder | download
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
dnl ============================================================================
dnl
dnl Window Maker autoconf input
dnl
AC_COPYRIGHT([Copyright (c) 2001-2015 The Window Maker Team])
dnl
dnl ============================================================================
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,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License along
dnl with this program; see the file COPYING.
dnl
dnl ============================================================================
dnl
dnl Process with: ./autogen.sh


dnl Due to a bug in Autoconf 2.68 (apparently a regression), we need at least
dnl version 2.68b which includes this patch:
dnl   http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commit;h=2b0d95faef68d7ed7c08b0edb9ff1c38728376fa
dnl
dnl Because the 2.69 was released only a few month later, let's just ask for it
AC_PREREQ([2.69])


dnl Configuration for Autoconf and Automake
dnl =======================================
AC_INIT([WindowMaker],[0.95.7],[wmaker-dev@lists.windowmaker.org],[WindowMaker],[http://www.windowmaker.org/])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])

dnl We need the EXTRA_xxx_DEPENDENCIES keyword in Makefiles which have been
dnl introduced in the version 1.11.3; because the 1.12 was realeased shortly
dnl after, we just ask for it
AM_INIT_AUTOMAKE([1.12 silent-rules])

dnl Reference file used by 'configure' to make sure the path to sources is valid
AC_CONFIG_SRCDIR([src/WindowMaker.h])

dnl Include at the end of 'config.h', this file is generated by top-level Makefile
AH_BOTTOM([@%:@include "config-paths.h"])


dnl libtool library versioning
dnl ==========================
dnl
dnl current
dnl revision
dnl age
dnl
dnl 1. Start with version information of ‘0:0:0’ for each libtool library.
dnl 2. Update the version information only immediately before a public
dnl release of your software. More frequent updates are unnecessary, and
dnl only guarantee that the current interface number gets larger faster.
dnl 3. If the library source code has changed at all since the last
dnl update, then increment revision (‘c:r:a’ becomes ‘c:r+1:a’).
dnl 4. If any interfaces have been added, removed, or changed since the
dnl last update, increment current, and set revision to 0.
dnl 5. If any interfaces have been added since the last public release,
dnl then increment age.
dnl 6. If any interfaces have been removed or changed since the last
dnl public release, then set age to 0.
dnl
dnl libwraster
WRASTER_CURRENT=5
WRASTER_REVISION=0
WRASTER_AGE=0
WRASTER_VERSION=$WRASTER_CURRENT:$WRASTER_REVISION:$WRASTER_AGE
AC_SUBST(WRASTER_VERSION)
dnl After next soname bump drop this and use WRASTER_VERSION as argument
dnl for generate-mapfile-from-header.sh
dnl http://bugs.debian.org/811304
WRASTER_SYMBOL_VERSION=3
AC_SUBST([WRASTER_SYMBOL_VERSION])
dnl
dnl libWINGs
WINGS_CURRENT=4
WINGS_REVISION=0
WINGS_AGE=1
WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
AC_SUBST(WINGS_VERSION)
dnl
dnl libWUtil
WUTIL_CURRENT=5
WUTIL_REVISION=0
WUTIL_AGE=0
WUTIL_VERSION=$WUTIL_CURRENT:$WUTIL_REVISION:$WUTIL_AGE
AC_SUBST(WUTIL_VERSION)


dnl Checks for programs
dnl ===================
AC_PROG_CC
WM_PROG_CC_C11
AC_PROG_LN_S
AC_PROG_GCC_TRADITIONAL
LT_INIT


dnl Debugging Options
dnl =================
AC_ARG_ENABLE([debug],
    [AS_HELP_STRING([--enable-debug], [enable debugging options, @<:@default=no@:>@])],
    [AS_CASE(["$enableval"],
        [yes], [debug=yes],
        [no],  [debug=no],
        [AC_MSG_ERROR([bad value $enableval for --enable-debug])] )],
    [debug=no])
AS_IF([test "x$debug" = "xyes"],
    [dnl This flag should have already been detected and added, but if user
     dnl provided an explicit CFLAGS it may not be the case
     AS_IF([echo " $CFLAGS " | grep " -g " 2>&1 > /dev/null],
           [@%:@ Debug symbol already activated],
           [AX_CFLAGS_GCC_OPTION([-g])])
     dnl
     dnl This flag generally makes debugging nightmarish, remove it if present
     CFLAGS="`echo "$CFLAGS" | sed -e 's/-fomit-frame-pointer *//' `"
     dnl
     dnl Enable internal debug code
     CPPFLAGS="$CPPFLAGS -DDEBUG"
],  [dnl
     dnl When debug is not enabled, the user probably does not wants to keep
     dnl assertions in the final program
     CPPFLAGS="$CPPFLAGS -DNDEBUG"
])


AX_CFLAGS_GCC_OPTION([-Wall])
AX_CFLAGS_GCC_OPTION([-Wextra -Wno-sign-compare])
dnl
dnl The use of trampolines cause code that can crash on some secured OS, it is
dnl also known to be a source of crash if not used properly, in a more general
dnl way it tends to generate binary code that may not be optimal, and it is
dnl not compatible with the 'nested-func-to-macro' workaround
WM_CFLAGS_CHECK_FIRST([-Wtrampolines],
         [-Werror=trampolines  dnl try to generate an error if possible
          -Wtrampolines        dnl if not, try to fall back to a simple warning
         ])
dnl
AS_IF([test "x$debug" = "xyes"],
    [dnl When debug is enabled, we try to activate more checks from
     dnl the compiler. They are on independant check because the
     dnl macro checks all the options at once, but we may have cases
     dnl where some options are not supported and we don't want to
     dnl loose all of them.
     dnl
     dnl clang, suggest parenthesis on bit operations that could be
     dnl misunderstood due to C operator precedence
     AX_CFLAGS_GCC_OPTION([-Wbitwise-op-parentheses])
     dnl
     dnl Points at code that gcc thinks is so complicated that gcc
     dnl gives up trying to optimize, which probably also means it is
     dnl too complicated to maintain
     AX_CFLAGS_GCC_OPTION([-Wdisabled-optimization])
     dnl
     dnl Because of C's type promotion, the compiler has to generate
     dnl less optimal code when a double constant is used in a
     dnl float expression
     AX_CFLAGS_GCC_OPTION([-Wdouble-promotion])
     dnl
     dnl Floating-point comparison is not a good idea
     AX_CFLAGS_GCC_OPTION([-Wfloat-equal])
     dnl
     dnl clang warns about constants that may have portability issues due
     dnl to the endianness of the host
     AX_CFLAGS_GCC_OPTION([-Wfour-char-constants])
     dnl
     dnl clang warns about constant that may be too big to be portable
     AX_CFLAGS_GCC_OPTION([-Wliteral-range])
     dnl
     dnl Try to report misuses of '&' versus '&&' and similar
     AX_CFLAGS_GCC_OPTION([-Wlogical-op])
     dnl
     dnl clang, reports cases where the code assumes everyone is an
     dnl expert in C operator precedence... which is unlikely!
     AX_CFLAGS_GCC_OPTION([-Wlogical-op-parentheses])
     dnl
     dnl Reports declaration of global things that are done inside
     dnl a local environment, instead of using the appropriate
     dnl header
     AX_CFLAGS_GCC_OPTION([-Wnested-externs])
     dnl
     dnl Warn about constant strings that could pose portability issues
     AX_CFLAGS_GCC_OPTION([-Woverlength-strings])
     dnl
     dnl Use of 'sizeof()' on inappropriate pointer types
     AX_CFLAGS_GCC_OPTION([-Wpointer-arith])
     dnl
     dnl Having more than 1 prototype for a function makes code updates
     dnl more difficult, so try to avoid it
     AX_CFLAGS_GCC_OPTION([-Wredundant-decls])
     dnl
     dnl clang, detect some misuses of sizeof. We also count in our code
     dnl on the use of the macro 'wlength' which contains a check if the
     dnl compiler support C11's static_assert
     AX_CFLAGS_GCC_OPTION([-Wsizeof-array-argument])
     dnl
     dnl Prototype of function must be explicit, no deprecated K&R syntax
     dnl and no empty argument list which prevents compiler from doing
     dnl type checking when using the function
     WM_CFLAGS_GCC_OPTION_STRICTPROTO
     dnl
     dnl Proper attributes helps the compiler to produce better code
     WM_CFLAGS_CHECK_FIRST([format attribute suggest],
         [-Wsuggest-attribute=format  dnl new gcc syntax
          -Wmissing-format-attribute  dnl old gcc syntax, clang
         ])
     WM_CFLAGS_CHECK_FIRST([no-return attribute suggest],
         [-Wsuggest-attribute=noreturn  dnl gcc syntax
          -Wmissing-noreturn            dnl clang syntax
         ])
     dnl
     dnl GCC provides a couple of checks to detect incorrect macro uses
     AX_CFLAGS_GCC_OPTION([-Wundef])
     WM_CFLAGS_GCC_OPTION_UNUSEDMACROS
     dnl
     dnl clang reports stuff marked unused but which is actually used
     AX_CFLAGS_GCC_OPTION([-Wused-but-marked-unused])
], [dnl
     dnl When debug not enabled, we try to avoid some non-necessary
     dnl messages from the compiler
     dnl
     dnl To support legacy X servers, we have sometime to use
     dnl functions marked as deprecated. We do not wish our users
     dnl to be worried about it
     AX_CFLAGS_GCC_OPTION([-Wno-deprecated])
     AX_CFLAGS_GCC_OPTION([-Wno-deprecated-declarations])
])


dnl Support for Nested Functions by the compiler
dnl ============================================
WM_PROG_CC_NESTEDFUNC


dnl Posix thread
dnl ============
dnl they are used by util/wmiv
AX_PTHREAD


dnl Tracking on what is detected for final status
dnl =============================================
unsupported=""
supported_core=""
supported_xext=""
supported_gfx=""


dnl Platform-specific Makefile setup
dnl ================================
AS_CASE(["$host"],
    [*-*-linux*|*-*-cygwin*|*-gnu*], [WM_OSDEP="linux" ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"],
    [*-*-freebsd*|*-k*bsd-gnu*],     [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600 -DFREEBSD"],
    [*-*-netbsd*],                   [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DNETBSD"],
    [*-*-openbsd*],                  [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DOPENBSD"],
    [*-*-dragonfly*],                [WM_OSDEP="bsd"   ; CPPFLAGS="$CPPFLAGS -DDRAGONFLYBSD"],
    [*-apple-darwin*],               [WM_OSDEP="darwin"],
    [*-*-solaris*],                  [WM_OSDEP="stub"],  dnl  solaris.c when done
    [WM_OSDEP="stub"])
AM_CONDITIONAL([WM_OSDEP_LINUX],   [test "x$WM_OSDEP" = "xlinux"])
AM_CONDITIONAL([WM_OSDEP_BSD],     [test "x$WM_OSDEP" = "xbsd"])
AM_CONDITIONAL([WM_OSDEP_DARWIN],  [test "x$WM_OSDEP" = "xdarwin"])
AM_CONDITIONAL([WM_OSDEP_GENERIC], [test "x$WM_OSDEP" = "xstub"])


dnl the prefix
dnl ==========
dnl
dnl move this earlier in the script... anyone know why this is handled
dnl in such a bizarre way?

test "x$prefix" = xNONE && prefix=$ac_default_prefix
dnl Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'


_bindir=`eval echo $bindir`
_bindir=`eval echo $_bindir`
_libdir=`eval echo $libdir`
_libdir=`eval echo $_libdir`

lib_search_path='-L${libdir}'

inc_search_path='-I${includedir}'

dnl ===============================================
dnl Specify paths to look for libraries and headers
dnl ===============================================
AC_ARG_WITH(libs-from, AS_HELP_STRING([--with-libs-from], [pass compiler flags to look for libraries]),
	[lib_search_path="$withval $lib_search_path"])

AC_ARG_WITH(incs-from, AS_HELP_STRING([--with-incs-from], [pass compiler flags to look for header files]),
	[inc_search_path="$withval $inc_search_path"])


dnl Features Configuration
dnl ======================
AC_ARG_ENABLE([animations],
    [AS_HELP_STRING([--disable-animations], [disable permanently animations @<:@default=enabled@:>@])],
    [AS_CASE(["$enableval"],
        [yes|no], [],
        [AC_MSG_ERROR([bad value $enableval for --enable-animations])])],
    [enable_animations="yes"])
AS_IF([test "x$enable_animations" = "xno"],
    [unsupported="$unsupported Animations"],
    [AC_DEFINE([USE_ANIMATIONS], [1], [Defined when user did not request to disable animations])
     supported_core="$supported_core Animations"])


AC_ARG_ENABLE([mwm-hints],
    [AS_HELP_STRING([--disable-mwm-hints], [disable support for Motif WM hints @<:@default=enabled@:>@])],
    [AS_CASE(["$enableval"],
        [yes|no], [],
        [AC_MSG_ERROR([bad value $enableval for --enable-mwm-hints])])],
    [enable_mwm_hints="yes"])
AS_IF([test "x$enable_mwm_hints" = "xno"],
    [unsupported="$unsupported MWMHints"],
    [AC_DEFINE([USE_MWM_HINTS], [1], [Defined when used did not request to disable Motif WM hints])
     supported_core="$supported_core MWMHints"])
AM_CONDITIONAL([USE_MWM_HINTS], [test "x$enable_mwm_hints" != "xno"])


dnl Boehm GC
dnl ========
AC_ARG_ENABLE([boehm-gc],
    [AS_HELP_STRING([--enable-boehm-gc], [use Boehm GC instead of the default libc malloc() [default=no]])],
    [AS_CASE(["$enableval"],
        [yes], [with_boehm_gc=yes],
        [no],  [with_boehm_gc=no],
        [AC_MSG_ERROR([bad value $enableval for --enable-boehm-gc])] )],
    [with_boehm_gc=no])
AS_IF([test "x$with_boehm_gc" = "xyes"],
    AC_SEARCH_LIBS([GC_malloc], [gc],
        [AC_DEFINE(USE_BOEHM_GC, 1, [Define if Boehm GC is to be used])],
        [AC_MSG_FAILURE([--enable-boehm-gc specified but test for libgc failed])]))


dnl LCOV
dnl ====
AC_ARG_ENABLE([lcov],
    [AS_HELP_STRING([--enable-lcov[=output-directory]], [enable coverage data generation using LCOV (GCC only) [default=no]])],
    [],
    [enable_lcov=no])

AS_IF([test "x$enable_lcov" != "xno"],
    [AX_CFLAGS_GCC_OPTION(-fprofile-arcs -ftest-coverage)
    AS_IF([test "x$enable_lcov" = "xyes"],
        [lcov_output_directory="coverage-report"],
        [lcov_output_directory="${enable_lcov}/coverage-report"])
    AC_SUBST(lcov_output_directory)])

AM_CONDITIONAL([USE_LCOV], [test "x$enable_lcov" != "xno"])


dnl ============================
dnl Checks for library functions
dnl ============================
AC_FUNC_MEMCMP
AC_FUNC_VPRINTF
WM_FUNC_SECURE_GETENV
AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
	       setsid mallinfo mkstemp sysconf)
AC_SEARCH_LIBS([strerror], [cposix])

dnl nanosleep is generally available in standard libc, although not always the
dnl case. One known example is Solaris which needs -lrt
AC_SEARCH_LIBS([nanosleep], [rt], [],
    [AC_MSG_ERROR([function 'nanosleep' not found, please report to wmaker-dev@lists.windowmaker.org])])

dnl the flag 'O_NOFOLLOW' for 'open' is used in WINGs
WM_FUNC_OPEN_NOFOLLOW


dnl Check for strlcat/strlcpy
dnl =========================
AC_ARG_WITH([libbsd],
  [AS_HELP_STRING([--without-libbsd], [do not use libbsd for strlcat and strlcpy [default=check]])],
  [AS_IF([test "x$with_libbsd" != "xno"],
    [with_libbsd=bsd]
    [with_libbsd=]
  )],
  [with_libbsd=bsd])

tmp_libs=$LIBS
AC_SEARCH_LIBS([strlcat],[$with_libbsd],
  [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available])],
  [],
  []
)
AC_SEARCH_LIBS([strlcpy],[$with_libbsd],
  [AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcpy is available])],
  [],
  []
)
LIBS=$tmp_libs

LIBBSD=
AS_IF([test "x$ac_cv_search_strlcat" = "x-lbsd" -o "x$ac_cv_search_strlcpy" = "x-lbsd"],
  [LIBBSD=-lbsd
   AC_CHECK_HEADERS([bsd/string.h])]
)
AC_SUBST(LIBBSD)


dnl Check for OpenBSD kernel memory interface - kvm(3)
dnl ==================================================
AS_IF([test "x$WM_OSDEP" = "xbsd"],
  AC_SEARCH_LIBS([kvm_openfiles], [kvm]) )


dnl Check for inotify
dnl =================
dnl It is used by WindowMaker to reload automatically the configuration when the
dnl user changed it using WPref or wdwrite
AC_CHECK_HEADERS([sys/inotify.h],
    [AC_DEFINE([HAVE_INOTIFY], [1], [Check for inotify])])


dnl Check for syslog 
dnl ================
dnl It is used by WUtil to log the wwarning, werror and wfatal
AC_CHECK_HEADERS([syslog.h], [AC_DEFINE([HAVE_SYSLOG], [1], [Check for syslog])])


dnl Checks for header files
dnl =======================
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h libintl.h poll.h malloc.h ctype.h \
		 string.h strings.h)


dnl Checks for typedefs, structures, and compiler characteristics
dnl =============================================================
AC_C_CONST
AC_C_INLINE
WM_C_NORETURN
AC_TYPE_SIZE_T
AC_TYPE_PID_T
WM_TYPE_SIGNAL


dnl pkg-config
dnl ==========
AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config])



dnl Internationalization
dnl ====================
dnl Detect the language for translations to be installed and check
dnl that the gettext environment works
WM_I18N_LANGUAGES
WM_I18N_XGETTEXT
WM_I18N_MENUTEXTDOMAIN

dnl 2014/12/29: The option is deprecated, we should keep this message for at
dnl least 2 years to ensure users see it and update their build scripts
AC_ARG_WITH([nlsdir], [],
    [AC_MSG_ERROR([option '--with-nlsdir' is deprecated, please use autoconf's standard '--localedir' instead])])


dnl ===========================================
dnl 		Stuff that uses X
dnl ===========================================

AC_PATH_XTRA

AS_IF([test "x$no_x" = "xyes"],
    [AC_MSG_ERROR([The path for the X11 files not found!
Make sure you have X and it's headers and libraries (the -devel packages
in Linux) installed.])])

X_LIBRARY_PATH=$x_libraries
XCFLAGS="$X_CFLAGS"
XLFLAGS="$X_LIBS"
XLIBS="-lX11 $X_EXTRA_LIBS"

lib_search_path="$lib_search_path $XLFLAGS"
inc_search_path="$inc_search_path $XCFLAGS"

AC_SUBST(X_LIBRARY_PATH)


dnl Decide which locale function to use, setlocale() or _Xsetlocale()
dnl by MANOME Tomonori 
dnl ===========================================
WM_I18N_XLOCALE



dnl Check whether XInternAtoms() exist
dnl ==================================
AC_CHECK_LIB([X11], [XInternAtoms],
    [AC_DEFINE([HAVE_XINTERNATOMS], [1],
        [define if your X server has XInternAtoms() (set by configure)])],
    [], [$XLFLAGS $XLIBS])


dnl Check whether XConvertCase() exist
dnl ==================================
AC_CHECK_LIB([X11], [XConvertCase],
    [AC_DEFINE([HAVE_XCONVERTCASE], [1],
        [define if your X server has XConvertCase() (set by configure)])],
    [], [$XLFLAGS $XLIBS])


dnl XKB keyboard language status
dnl ============================
AC_ARG_ENABLE([modelock],
    [AS_HELP_STRING([--enable-modelock], [XKB keyboard language status support])],
    [AS_CASE([$enableval],
        [yes|no], [],
        [AC_MSG_ERROR([bad value '$enableval' for --enable-modelock])])],
    [enable_modelock=no])
AS_IF([test "x$enable_modelock" = "xyes"],
    [AC_DEFINE([XKB_MODELOCK], [1], [whether XKB language MODELOCK should be enabled]) ])


dnl XDND Drag-nd-Drop support
dnl =========================
AC_ARG_ENABLE([xdnd],
    [AS_HELP_STRING([--disable-xdnd], [disable support for Drag-and-Drop on the dock @<:@default=enabled@:>@])],
    [AS_CASE(["$enableval"],
        [yes|no], [],
        [AC_MSG_ERROR([bad value $enableval for --disable-xdnd]) ]) ],
    [enable_xdnd=yes])
AS_IF([test "x$enable_xdnd" = "xyes"],
    [supported_core="$supported_core XDnD"
     AC_DEFINE([USE_DOCK_XDND], [1], [whether Drag-and-Drop on the dock should be enabled])],
    [unsupported="$unsupported XDnd"])
AM_CONDITIONAL([USE_DOCK_XDND], [test "x$enable_xdnd" != "xno"])


dnl Support for ICCCM 2.0 Window Manager replacement
dnl ================================================
AC_ARG_ENABLE([wmreplace],
    [AS_HELP_STRING([--enable-wmreplace], [support for ICCCM window manager replacement])],
    [AS_CASE([$enableval],
        [yes|no], [],
        [AC_MSG_ERROR([bad value '$enableval' for --enable-wmreplace])])],
    [enable_wmreplace=no])
AS_IF([test "x$enable_wmreplace" = "xyes"],
    [AC_DEFINE([USE_ICCCM_WMREPLACE], [1],
       [define to support ICCCM protocol for window manager replacement])
     supported_xext="$supported_xext WMReplace"])


dnl XShape support
dnl ==============
AC_ARG_ENABLE([shape],
    [AS_HELP_STRING([--disable-shape], [disable shaped window extension support])],
    [AS_CASE(["$enableval"],
        [yes|no], [],
        [AC_MSG_ERROR([bad value $enableval for --enable-shape]) ]) ],
    [enable_shape=auto])
WM_XEXT_CHECK_XSHAPE


dnl MIT-SHM support
dnl ===============
AC_ARG_ENABLE([shm],
    [AS_HELP_STRING([--disable-shm], [disable usage of MIT-SHM extension])],
    [AS_CASE(["$enableval"],
        [yes|no], [],
        [AC_MSG_ERROR([bad value $enableval for --enable-shm]) ]) ],
    [enable_shm=auto])
WM_XEXT_CHECK_XSHM


dnl X Misceleanous Utility
dnl ======================
dnl the libXmu is used in WRaster
WM_EXT_CHECK_XMU


dnl XINERAMA support
dnl ================
AC_ARG_ENABLE([xinerama],
    [AS_HELP_STRING([--enable-xinerama], [enable Xinerama extension support])],
    [AS_CASE(["$enableval"],
        [yes|no], [],
        [AC_MSG_ERROR([bad value $enableval for --enable-xinerama]) ]) ],
    [enable_xinerama=auto])
WM_XEXT_CHECK_XINERAMA


dnl RandR support
dnl =============
AC_ARG_ENABLE([randr],
    [AS_HELP_STRING([--enable-randr], [enable RandR extension support (NOT recommended, buggy)])],
    [AS_CASE(["$enableval"],
        [yes|no], [],
        [AC_MSG_ERROR([bad value $enableval for --enable-randr]) ]) ],
    [enable_randr=no])
WM_XEXT_CHECK_XRANDR


dnl Math library
dnl ============
dnl libWINGS uses math functions, check whether usage requires linking
dnl against libm
WM_CHECK_LIBM


dnl FontConfig
dnl ==========
dnl libWINGS uses FcPatternDel from libfontconfig
AC_MSG_CHECKING([for fontconfig library])
FCLIBS=`$PKGCONFIG fontconfig --libs`
if test "x$FCLIBS" = "x" ; then
        AC_MSG_RESULT([not found])
else
        AC_MSG_RESULT([found])
fi
AC_SUBST(FCLIBS)


dnl Xft2 antialiased font support
dnl =============================

xft=yes
XFTLIBS=""

if test "x$PKGCONFIG" != x -a "`$PKGCONFIG xft; echo $?`" = 0; then
        XFTCONFIG="$PKGCONFIG xft"
        pkgconfig_xft=yes
else
        AC_CHECK_PROG(XFTCONFIG, xft-config, xft-config)
fi

AC_MSG_CHECKING([for the Xft2 library])

if test "x$XFTCONFIG" != x; then
        XFTLIBS=`$XFTCONFIG --libs`
        XFTFLAGS=`$XFTCONFIG --cflags`
        AC_MSG_RESULT([found])
else
        AC_MSG_RESULT([not found])
        echo
        echo "ERROR!!! libXft2 is not installed or could not be found."
        echo "         Xft2 is a requirement for building Window Maker."
        echo "         Please install it (along with fontconfig) before continuing."
        echo
        exit 1
fi

minXFT="2.1.0"
goodxft="no"

dnl
dnl The macro below will use $XFTFLAGS (defined above) to find Xft.h
dnl
WM_CHECK_XFT_VERSION($minXFT, goodxft=yes, goodxft=no)

if test "$goodxft" = no; then
        echo
        echo "ERROR!!! libXft on this system is an old version."
        echo "         Please consider upgrading to at least version ${minXFT}."
        echo
        exit 1
fi

AC_SUBST(XFTFLAGS)
AC_SUBST(XFTLIBS)

dnl PANGO support
dnl =============
pango=no
AC_ARG_ENABLE(pango, AS_HELP_STRING([--enable-pango], [enable Pango text layout support]),
                pango=$enableval, pango=no)

PANGOFLAGS=
PANGOLIBS=
if test "$pango" = yes; then
	PANGOLIBS=`$PKGCONFIG pangoxft --libs`
	PANGOFLAGS=`$PKGCONFIG pangoxft --cflags`
	if test "x$PANGOLIBS" = "x" ; then
	        AC_MSG_RESULT([not found])
	else
		AC_DEFINE(USE_PANGO, 1, [Define if Pango is to be used])
		AC_MSG_RESULT([found])
	fi
fi
inc_search_path="$inc_search_path $PANGOFLAGS"
AC_SUBST(PANGOLIBS)

dnl ==============================================
dnl         Graphic Format Libraries
dnl ==============================================

dnl XPM Support
dnl ===========
AC_ARG_ENABLE([xpm],
    [AS_HELP_STRING([--disable-xpm], [disable use of XPM pixmaps through libXpm])],
    [AS_CASE(["$enableval"],
        [yes|no], [],
        [AC_MSG_ERROR([bad value $enableval for --enable-xpm])] )],
    [enable_xpm=auto])
WM_IMGFMT_CHECK_XPM


# for wmlib
AC_SUBST(XCFLAGS)
# for test
AC_SUBST(XLFLAGS)
AC_SUBST(XLIBS)
AC_SUBST(X_EXTRA_LIBS)

dnl ===============================================
dnl 		End of stuff that uses X
dnl ===============================================

dnl EXIF Support
dnl ============
WM_CHECK_LIBEXIF
AS_IF([test "x$LIBEXIF" != "x"],
        [AC_DEFINE(HAVE_EXIF, 1, [Define if EXIF can be used])])


dnl PNG Support
dnl ===========
AC_ARG_ENABLE([png],
    [AS_HELP_STRING([--disable-png], [disable PNG support through libpng])],
    [AS_CASE(["$enableval"],
        [yes|no], [],
        [AC_MSG_ERROR([bad value $enableval for --enable-png])] )],
    [enable_png=auto])
WM_IMGFMT_CHECK_PNG


dnl JPEG Support
dnl ============
AC_ARG_ENABLE([jpeg],
    [AS_HELP_STRING([--disable-jpeg], [disable JPEG support through libjpeg])],
    [AS_CASE(["$enableval"],
        [yes|no], [],
        [AC_MSG_ERROR([bad value $enableval for --enable-jpeg])] )],
    [enable_jpeg=auto])
WM_IMGFMT_CHECK_JPEG


dnl GIF Support
dnl ============
AC_ARG_ENABLE(gif,
    [AS_HELP_STRING([--disable-gif], [disable GIF support through libgif or libungif])],
    [AS_CASE(["$enableval"],
        [yes|no], [],
        [AC_MSG_ERROR([bad value $enableval for --enable-gif])] )],
    [enable_gif=auto])
WM_IMGFMT_CHECK_GIF


dnl TIFF Support
dnl ============
AC_ARG_ENABLE([tiff],
    [AS_HELP_STRING([--disable-tiff], [disable use of TIFF images through libtiff])],
    [AS_CASE(["$enableval"],
        [yes|no], [],
        [AC_MSG_ERROR([bad value $enableval for --enable-tiff])] )],
    [enable_tiff=auto])
WM_IMGFMT_CHECK_TIFF


dnl WEBP Support
dnl ============
AC_ARG_ENABLE([webp],
    [AS_HELP_STRING([--disable-webp], [disable WEBP support through libwebp])],
    [AS_CASE(["$enableval"],
        [yes|no], [],
        [AC_MSG_ERROR([bad value $enableval for --enable-webp])] )],
    [enable_webp=auto])
WM_IMGFMT_CHECK_WEBP


dnl MagicK Support
dnl ==============
AC_ARG_ENABLE([magick],
    [AS_HELP_STRING([--disable-magick], [disable MAGICK support through libMagickWand])],
    [AS_CASE(["$enableval"],
        [yes|no], [],
        [AC_MSG_ERROR([bad value $enableval for --enable-magick])] )],
    [enable_magick=auto])
WM_IMGFMT_CHECK_MAGICK


dnl PPM Support
dnl ===========
# The PPM format is always enabled because we have built-in support for the format
# We are not using any external library like libppm
supported_gfx="$supported_gfx builtin-PPM"


# Choice of the default format for icons
AS_IF([test "x$enable_tiff" != "xno"],
    [ICONEXT="tiff"],
    [ICONEXT="xpm"])


LIBRARY_SEARCH_PATH="$lib_search_path"
HEADER_SEARCH_PATH="$inc_search_path"

AC_SUBST(LIBRARY_SEARCH_PATH)
AC_SUBST(HEADER_SEARCH_PATH)


AC_SUBST(GFXLIBS)
AC_SUBST(ICONEXT)
AM_CONDITIONAL([ICON_EXT_XPM],  [test "x$ICONEXT" = "xxpm"])
AM_CONDITIONAL([ICON_EXT_TIFF], [test "x$ICONEXT" = "xtiff"])


dnl ==============================================
dnl         End of Graphic Format Libraries
dnl ==============================================


dnl
dnl stdlib.h is checked here, because of conflict in jpeglib.h
AC_CHECK_HEADERS(stdlib.h)


dnl Support for PIXMAPDIR option
dnl ============================
AC_ARG_WITH([pixmapdir],
    [AS_HELP_STRING([--with-pixmapdir=PATH], [specify where pixmaps are located [DATADIR/pixmaps]])],
    [AS_CASE([$withval],
        [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-pixmapdir, expected a path]) ],
        [/*],  [], dnl Absolute path, ok
        [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
        [AC_MSG_ERROR([bad path '$withval' for pixmapdir, expecting an absolute path])])],
    [with_pixmapdir=""])

AS_IF([test "x$with_pixmapdir" != "x"],
    [pixmapdir="$with_pixmapdir"],
    [pixmapdir='${datadir}/pixmaps'])
AC_SUBST([pixmapdir])dnl


dnl Support for GNUSTEP_LOCAL_ROOT, for WPrefs.app
dnl ==============================================
AC_ARG_WITH([gnustepdir],
    [AS_HELP_STRING([--with-gnustepdir=PATH], [specify the directory for GNUstep applications])],
    [AS_CASE([$withval],
        [yes|no], [AC_MSG_ERROR([bad value '$withval' for --with-gnustepdir, expected a path]) ],
        [/*],  [], dnl Absolute path, ok
        [\$*], [], dnl Assumes it starts with a reference to $prefix or a similar variable, ok
        [AC_MSG_ERROR([bad path '$withval' for gnustepdir, expecting an absolute path])])],
    [dnl If no command-line option was given, we use $GNUSTEP_LOCAL_ROOT if it was set
     with_gnustepdir="$GNUSTEP_LOCAL_ROOT"])

AS_IF([test "x$with_gnustepdir" = "x"],
    [dnl No path specified, use default
     wprefs_base_dir=${prefix}
     wprefs_datadir="${datadir}/WPrefs"
     wprefs_bindir="${bindir}"],
    [dnl User specified base path
     wprefs_base_dir="$with_gnustepdir/Applications"
     wprefs_datadir="$wprefs_base_dir/WPrefs.app"
     wprefs_bindir="$wprefs_base_dir/WPrefs.app"])
AC_SUBST([wprefs_datadir])dnl
AC_SUBST([wprefs_bindir])dnl


dnl Enable User Defined Menu thing
dnl ==============================
AC_ARG_ENABLE([usermenu],
    [AS_HELP_STRING([--enable-usermenu], [user defined menus for applications])],
    [AS_CASE([$enableval],
        [yes|no], [],
        [AC_MSG_ERROR([bad value '$enableval' for --enable-usermenu])])],
    [enable_usermenu=no])
AS_IF([test "x$enable_usermenu" = "xyes"],
    [AC_DEFINE([USER_MENU], [1],
        [define if you want user defined menus for applications])])


dnl Support for removing non-public symbols from a library
dnl ======================================================
gl_LD_VERSION_SCRIPT


dnl Add the post-poned compilation options
dnl ======================================
WM_CFLAGS_GCC_OPTION_POSTPONED


AC_SUBST(lib_search_path)
AC_SUBST(inc_search_path)


dnl Spit out the configuration
dnl ==========================
AC_CONFIG_FILES(
    Makefile

    dnl WRaster Library
    wrlib/Makefile
    wrlib/tests/Makefile

    dnl WINGs toolkit
    WINGs/Makefile WINGs/WINGs/Makefile WINGs/po/Makefile
    WINGs/Documentation/Makefile WINGs/Resources/Makefile WINGs/Extras/Makefile
    WINGs/Examples/Makefile WINGs/Tests/Makefile

    dnl Window Maker's core
    src/Makefile src/wconfig.h po/Makefile
    doc/Makefile doc/build/Makefile
    doc/sk/Makefile doc/cs/Makefile doc/ru/Makefile
    WindowMaker/Makefile WindowMaker/Backgrounds/Makefile
    WindowMaker/Defaults/Makefile WindowMaker/IconSets/Makefile
    WindowMaker/Icons/Makefile WindowMaker/Pixmaps/Makefile
    WindowMaker/Styles/Makefile WindowMaker/Themes/Makefile

    dnl Preference GUI
    WPrefs.app/Makefile WPrefs.app/po/Makefile
    WPrefs.app/tiff/Makefile WPrefs.app/xpm/Makefile

    dnl Command-line utilities
    util/Makefile util/po/Makefile

    dnl Misceleanous stuff
    wmlib/Makefile
    test/Makefile
)

AC_OUTPUT


dnl Provide a summary of the config
dnl ===============================
echo
echo "Window Maker was configured as follows:"
echo
echo "Installation path prefix            : $prefix"
echo "Installation path for binaries      : $_bindir"
echo "Installation path for libraries     : $_libdir"
echo "Installation path for WPrefs.app    : $wprefs_base_dir" | sed -e 's|\${prefix}|'"$prefix|"
echo "Supported core features:            :$supported_core"
echo "Supported X extensions:             :$supported_xext"
echo "Supported graphic format libraries  :$supported_gfx"
echo "Unsupported features                :$unsupported"
echo "Antialiased text support in WINGs   : $xft"
echo "Pango text layout support in WINGs  : $pango"
echo "Translated languages to support     :$supported_locales"
AS_IF([test "x$debug" = "xyes"],
    [AS_ECHO(["Debug enabled: CFLAGS = $CFLAGS"]) ])
echo

AS_IF([test "x$wm_cv_prog_cc_nestedfunc" != "xyes"],
    [AC_MSG_WARN([[Your compiler does not support Nested Function, work-around enabled]])])

AS_IF([test "x$supported_locales" = "x"],
    [AC_MSG_WARN([[No language from \$LINGUAS are supported]])])

AS_IF([test "x$enable_jpeg" = xno], [dnl
    AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])
    AS_ECHO([])
    AS_ECHO(["JPEG support will not be included because the JPEG library is"])
    AS_ECHO(["not installed correctly or was not found. Background images"])
    AS_ECHO(["from themes will not display as they usually are JPEG files."])
    AS_ECHO([])
    AS_ECHO(["To fix, download and install the jpeg library and/or make sure you"])
    AS_ECHO(["installed all jpeg related packages, SPECIALLY the development packages"])
    AS_ECHO(["like jpeg-dev (if you use some prepackaged version of libjpeg)."])
    AS_ECHO([])
    AS_ECHO(["WARNING   WARNING   WARNING   WARNING   WARNING   WARNING   WARNING"])dnl
])


dnl This is for Emacs.  I'm lazy, I know... (nicolai)
dnl ================================================
dnl Local Variables:
dnl compile-command: "autoconf"
dnl End: