-
Notifications
You must be signed in to change notification settings - Fork 61
/
configure.ac
5146 lines (4305 loc) · 156 KB
/
configure.ac
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
# configure.in --- xscreensaver, Copyright © 1997-2023 Jamie Zawinski.
#
# Note: upgrading past 2.69_5 breaks the world, mostly the po/ shitshow.
AC_PREREQ([2.69])
# If you accidentally upgraded autoconf, re-install the 2019-08-23 version:
#
# git clone --single-branch https://github.com/macports/macports-ports.git
# cd macports-ports/
# git checkout 1d802b48a7b00b6c154e971119a2a309550c79c2
# cd devel/autoconf
# sudo port install
# port installed autoconf
AC_INIT
AC_CONFIG_SRCDIR([driver/subprocs.c])
AC_CONFIG_HEADERS([config.h])
echo "current directory: `pwd`"
echo "command line was: $0 $@"
if ! test -z "$ac_unrecognized_opts" ; then
echo "" >&2
exit 2
fi
###############################################################################
#
# Autoheader stuff
#
###############################################################################
AH_TOP([
/* xscreensaver, Copyright © 1991-2022 Jamie Zawinski.
* Generate this file by running 'configure' rather than editing it by hand.
*/
])
# Defines in config.h are dumped out alphabetically rather than in any kind
# of sane order, sigh.
#
# OS stuff.
#
AH_TEMPLATE([HAVE_PTHREAD],
[Define this if you have POSIX threads.])
AH_TEMPLATE([HAVE_SIGTIMEDWAIT],
[Define to 1 if you have the `sigtimedwait' function.])
AH_TEMPLATE([HAVE_FORKPTY],
[Define this if you have forkpty.])
AH_TEMPLATE([HAVE_GETTIMEOFDAY],
[Define this if you have gettimeofday.])
AH_TEMPLATE([GETTIMEOFDAY_TWO_ARGS],
[Define this if gettimeofday takes two arguments.])
AH_TEMPLATE([HAVE_ICMP],
[Define this if ping uses struct icmp.icmp_id.])
AH_TEMPLATE([HAVE_ICMPHDR],
[Define this if ping uses struct icmphdr.un.echo.id.])
AH_TEMPLATE([HAVE_GETIFADDRS],
[Define this if you have getifaddrs.])
AH_TEMPLATE([HAVE_LIBCAP],
[Define this if your system has libcap.])
#
# X11 server stuff.
#
AH_TEMPLATE([XPointer],
[Stare into the void.])
AH_TEMPLATE([HAVE_XINPUT],
[Define this if you have the XInput2 extension.])
# This only ever existed in X11R4 and X11R5.
AH_TEMPLATE([HAVE_XIDLE_EXTENSION],
[Define this if you have the X11R5 XIDLE extension.])
# This only ever existed on SGI hardware.
AH_TEMPLATE([HAVE_SGI_SAVER_EXTENSION],
[Define this if you have the SGI SCREEN_SAVER extension.])
# This only ever existed on SGI hardware.
AH_TEMPLATE([HAVE_SGI_VC_EXTENSION],
[Define this if you have the SGI-VIDEO-CONTROL extension.])
AH_TEMPLATE([HAVE_MIT_SAVER_EXTENSION],
[Using the MIT-SCREEN-SAVER extension means that the X server
will crash at random times, and fading and hysteresis won't work.
Don't use this. You'll be sorry. See comment in xscreensaver.c.])
AH_TEMPLATE([HAVE_DPMS_EXTENSION],
[Define this if you have the XDPMS extension.])
AH_TEMPLATE([HAVE_XF86VMODE],
[Define this if you have XF86VidModeGetViewPort, for
virtual desktops.])
AH_TEMPLATE([HAVE_XF86VMODE_GAMMA],
[Define this if you have XF86VidModeSetGamma, for fading.])
AH_TEMPLATE([HAVE_XF86VMODE_GAMMA_RAMP],
[Define this if you have XF86VidModeSetGammaRamp, for fading.])
AH_TEMPLATE([HAVE_XINERAMA],
[Define this if you have the Xinerama extension.])
AH_TEMPLATE([HAVE_XHPDISABLERESET],
[Define this if you have XHPDisableReset, which allows
Ctrl-Sh-Reset to be temporarily disabled.])
AH_TEMPLATE([HAVE_RANDR],
[Define this if you have the Resize and Rotate extension.])
AH_TEMPLATE([HAVE_RANDR_12],
[Define this if the RANDR library is version 1.2 or newer.])
AH_TEMPLATE([HAVE_XSHM_EXTENSION],
[Define this if you have the X Shared Memory Extension.])
AH_TEMPLATE([HAVE_DOUBLE_BUFFER_EXTENSION],
[Define this if you have the X Double Buffer Extension.])
#AH_TEMPLATE([HAVE_XCOMPOSITE_EXTENSION],
# [Define this if you have the X Composite Extension.])
AH_TEMPLATE([HAVE_XKB],
[Define this if you have the X Keyboard Extension.])
AH_TEMPLATE([HAVE_LIBSYSTEMD],
[Define this if you have libsystemd.])
AH_TEMPLATE([HAVE_LIBELOGIND],
[Define this if you have libelogind.])
AH_TEMPLATE([HAVE_PROC_INTERRUPTS],
[Define this if you have a Linux-like /proc/interrupts file which
can be examined to determine when keyboard activity has
occurred, and you use PS/2 input devices instead of USB.])
AH_TEMPLATE([HAVE_PROC_OOM],
[Define this if you have a Linux-like /proc/.../oom_score_adj file
which can be adjusted by root to exempt us from the out-of-memory
killer.])
#
# GUI stuff.
#
AH_TEMPLATE([HAVE_MOTIF],
[Define this if you have Motif.])
AH_TEMPLATE([HAVE_XMCOMBOBOX],
[Define this if you have the XmComboBox Motif 2.0 widget.])
AH_TEMPLATE([HAVE_GTK],
[Define this if you have Gtk 2.x.])
AH_TEMPLATE([HAVE_XML],
[Define this if you have the XML library.])
AH_TEMPLATE([HAVE_GDK_PIXBUF],
[Define this if you have GDK-Pixbuf.])
AH_TEMPLATE([HAVE_GDK_PIXBUF_XLIB],
[Define this if you have GDK-Pixbuf-Xlib.])
AH_TEMPLATE([HAVE_GDK_PIXBUF_APPLY_EMBEDDED_ORIENTATION],
[Define this if you have the gdk_pixbuf_apply_embedded_orientation
function (gdk-pixbuf 2.12).])
#
# Image loading.
#
AH_TEMPLATE([HAVE_JPEGLIB],
[Define this if you have the JPEG Group's JPEG library.])
AH_TEMPLATE([HAVE_LIBPNG],
[Define this if you have the Portable Network Graphics library.])
AH_TEMPLATE([HAVE_XUTF8DRAWSTRING],
[Define this if you have the function Xutf8DrawString.])
AH_TEMPLATE([HAVE_XFT],
[Define this if you have libXft2.])
#
# Graphics libraries.
#
AH_TEMPLATE([HAVE_GL],
[Define this if you have OpenGL.])
AH_TEMPLATE([HAVE_GLES],
[Define this if the native OpenGL library is OpenGLES 1.x.])
AH_TEMPLATE([HAVE_GLES2],
[Define this if the native OpenGL library is OpenGLES 2.x.])
AH_TEMPLATE([HAVE_GLES3],
[Define this if the native OpenGL library is OpenGLES 3.x.])
AH_TEMPLATE([HAVE_JWZGLES],
[Define this to emulate OpenGL 1.3 in terms of OpenGLES 1.x.])
AH_TEMPLATE([HAVE_EGL],
[Define this if OpenGL bindings are via EGL instead of GLX.])
AH_TEMPLATE([HAVE_GLSL],
[Define this if OpenGL supports the OpenGL Shading Language.])
AH_TEMPLATE([HAVE_GLBINDTEXTURE],
[Define this if the OpenGL version is 1.1 or newer.])
AH_TEMPLATE([HAVE_GLE],
[Define this if you have the GL Extrusion library.])
AH_TEMPLATE([HAVE_GLE3],
[Define this if GL Extrusion is version 3.])
AH_TEMPLATE([HAVE_FFMPEG],
[Define this if you have the ffmpeg libraries.])
AH_TEMPLATE([HAVE_RECORD_ANIM],
[Define this to enable recording of videos.])
#
# Locking.
#
AH_TEMPLATE([NO_LOCKING],
[Define this to remove the option of locking the screen at all.])
AH_TEMPLATE([HAVE_PAM],
[Define this if you have Pluggable Authentication Modules.])
AH_TEMPLATE([PAM_SERVICE_NAME],
[The name of the "xscreensaver" PAM service.])
AH_TEMPLATE([HAVE_PAM_FAIL_DELAY],
[Define this if you have pam_fail_delay.])
AH_TEMPLATE([PAM_CHECK_ACCOUNT_TYPE],
[Whether PAM should check the result of account modules
when authenticating.])
AH_TEMPLATE([PAM_STRERROR_TWO_ARGS],
[Define if pam_strerror requires two arguments.])
AH_TEMPLATE([HAVE_KERBEROS],
[Define this if you want to use Kerberos authentication to
lock/unlock the screen instead of PAM.])
AH_TEMPLATE([HAVE_KERBEROS5],
[Define this if you have Kerberos 5.])
AH_TEMPLATE([ALLOW_ROOT_PASSWD],
[Define this to allow root to unlock, when not using PAM.])
AH_TEMPLATE([HAVE_SHADOW_PASSWD],
[Define this if your system uses /etc/shadow.])
AH_TEMPLATE([HAVE_PWNAM_SHADOW_PASSWD],
[Define this if your system uses getpwnam_shadow.])
AH_TEMPLATE([HAVE_ENHANCED_PASSWD],
[Define this for DEC/SCO "Enhanced Security" with getprpwnam.])
AH_TEMPLATE([HAVE_ADJUNCT_PASSWD],
[Define this for Solaris getpwanam.])
AH_TEMPLATE([HAVE_HPUX_PASSWD],
[Define this for HPUX so-called "Secure Passwords".])
AH_TEMPLATE([HAVE_SYSLOG],
[Define this if you have openlog/syslog/closelog.])
# After checking to see that --srcdir is correct (which AC_INIT does)
# check for some random other files that come later in the tar file,
# to make sure everything is here.
#
for d in utils jwxyz hacks hacks/glx driver ; do
f=$srcdir/$d/Makefile.in
if test \! -r $f ; then
echo ""
echo "ERROR: The package is incomplete: $f does not exist."
echo " This probably means that your download was truncated."
echo ""
exit 1
fi
done
###############################################################################
#
# Check for availability of various gcc command-line options.
#
###############################################################################
AC_DEFUN([AC_CHECK_GCC_ARG],
[if test -n "$GCC"; then
AC_CACHE_CHECK([whether gcc accepts [$2]],
ac_cv_gcc_accepts_[$1],
[rm -rf conftest.$ac_ext
touch conftest.$ac_ext
#
# July 2023: With gcc 10.2.1 We get the "unrecognized" warning with
# "-Wlanguage-extension-token" but no warning is printed with
# "-Wno-language-extension-token"... And then later other unrelated
# warnings will volunteer that "unrecognized command-line option
# ‘-Wno-language-extension-token’ may have been intended to silence
# earlier diagnostics".
#
without_no=`echo $2 | sed s/Wno-/W/`
if ( ( gcc -c $without_no conftest.$ac_ext -o/dev/null >/dev/null ) \
2>&1 | \
grep unrecognized >/dev/null ); then
ac_cv_gcc_accepts_[$1]=no
else
ac_cv_gcc_accepts_[$1]=yes
CC="$CC [$2]"
fi])
ac_gcc_accepts_[$1]="$ac_cv_gcc_accepts_[$1]"
fi
])
###############################################################################
#
# Function to figure out how to run the compiler.
#
###############################################################################
AC_DEFUN([AC_PROG_CC_ANSI],
[AC_REQUIRE([AC_PROG_CC])
if test -z "$GCC"; then
# not using GCC
AC_MSG_CHECKING(for extra compiler flags)
case "$host" in
*-aix* )
AC_MSG_RESULT(AIX: adding -qhalt=e)
CC="$CC -qlanglvl=ansi -qhalt=e"
;;
*)
AC_MSG_RESULT(none)
;;
esac
else
# using GCC
case "$host" in
*-solaris*)
AC_MSG_RESULT(Solaris: adding -D__EXTENSIONS__)
CC="$CC -D__EXTENSIONS__"
;;
esac
# Prior to 1996, XScreenSaver was written in K&R C, because ANSI C
# compilers (function prototypes!) were not yet universally deployed.
# And even after the conversion to ANSI C, GNU C's various non-standard
# extensions (such as allowing C++ style "//" comments in C code, and
# declarations after statements) were not supported by non-gcc compilers
# for many years, so we continued to use "-std=c89" to prevent those
# GNU-isms from sneaking in to the code.
#
# These days XScreenSaver uses C99, which supports "//" comments and
# declarations after statements.
#
AC_CHECK_GCC_ARG(gnu99, -std=gnu99)
AC_CHECK_GCC_ARG(pedantic, -pedantic)
AC_CHECK_GCC_ARG(Wall, -Wall)
AC_CHECK_GCC_ARG(wnested_externs, -Wnested-externs)
AC_CHECK_GCC_ARG(wstrict_prototypes, -Wstrict-prototypes)
AC_CHECK_GCC_ARG(wmissing_prototypes, -Wmissing-prototypes)
# "string length is greater than ISO C89 compilers required to support"
AC_CHECK_GCC_ARG(no_overlength_strings, -Wno-overlength-strings)
fi
])
###############################################################################
#
# Function to figure out how to create directory trees.
#
###############################################################################
AC_DEFUN([AC_PROG_INSTALL_DIRS],
[AC_CACHE_CHECK([whether "\${INSTALL} -d" creates intermediate directories],
ac_cv_install_d_creates_dirs,
[ac_cv_install_d_creates_dirs=no
rm -rf conftestdir
if mkdir conftestdir; then
cd conftestdir 2>/dev/null
${INSTALL} -d `pwd`/dir1/dir2 >/dev/null 2>&1
if test -d dir1/dir2/. ; then
ac_cv_install_d_creates_dirs=yes
fi
cd .. 2>/dev/null
rm -rf conftestdir
fi
])
if test "$ac_cv_install_d_creates_dirs" = no ; then
AC_CACHE_CHECK([whether "mkdir -p" creates intermediate directories],
ac_cv_mkdir_p_creates_dirs,
[ac_cv_mkdir_p_creates_dirs=no
rm -rf conftestdir
if mkdir conftestdir; then
cd conftestdir 2>/dev/null
mkdir -p dir1/dir2 >/dev/null 2>&1
if test -d dir1/dir2/. ; then
ac_cv_mkdir_p_creates_dirs=yes
fi
cd .. 2>/dev/null
rm -rf conftestdir
fi
])
fi
if test "$ac_cv_install_d_creates_dirs" = yes ; then
INSTALL_DIRS='${INSTALL} -d'
elif test "$ac_cv_mkdir_p_creates_dirs" = yes ; then
INSTALL_DIRS='mkdir -p'
else
# any other ideas?
INSTALL_DIRS='${INSTALL} -d'
fi
])
###############################################################################
#
# Function to check whether gettimeofday() exists, and how to call it.
# This may define HAVE_GETTIMEOFDAY and GETTIMEOFDAY_TWO_ARGS.
#
###############################################################################
AC_DEFUN([AC_GETTIMEOFDAY_ARGS],
[AC_MSG_CHECKING(how to call gettimeofday)
AC_CACHE_VAL(ac_cv_gettimeofday_args,
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <stdlib.h>
#include <sys/time.h>],
[struct timeval tv; struct timezone tzp;
gettimeofday(&tv, &tzp);])],
[ac_gettimeofday_args=2],
[ac_gettimeofday_args=1])
ac_cv_gettimeofday_args=$ac_gettimeofday_args])
ac_gettimeofday_args=$ac_cv_gettimeofday_args
if test "$ac_gettimeofday_args" = 1 ; then
AC_DEFINE(HAVE_GETTIMEOFDAY)
AC_MSG_RESULT(one argument)
elif test "$ac_gettimeofday_args" = 2 ; then
AC_DEFINE(HAVE_GETTIMEOFDAY)
AC_DEFINE(GETTIMEOFDAY_TWO_ARGS)
AC_MSG_RESULT(two arguments)
else
AC_MSG_RESULT(unknown)
fi
])
###############################################################################
#
# Function to find perl5 (defines PERL and PERL_VERSION.)
#
###############################################################################
# M4 sucks!! perl sucks too!!
changequote(X,Y)
perl_version_cmd='print $]'
changequote([,])
AC_DEFUN([AC_PROG_PERL],
[AC_PATH_PROGS(PERL, [perl5 perl],,)
if test -z "$PERL" ; then
PERL_VERSION=0
else
AC_CACHE_CHECK([perl version], ac_cv_perl_version,
[ac_cv_perl_version=`$PERL -e "$perl_version_cmd"`])
PERL_VERSION=$ac_cv_perl_version
fi
])
###############################################################################
#
# Functions to check how to do ICMP PING requests.
#
###############################################################################
AC_DEFUN([AC_CHECK_ICMP],
[AC_CACHE_CHECK([for struct icmp], ac_cv_have_icmp,
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <limits.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/socket.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <netinet/udp.h>
#include <arpa/inet.h>
#include <netdb.h>],
[struct icmp i;
struct sockaddr s;
struct sockaddr_in si;
struct ip ip;
i.icmp_type = ICMP_ECHO;
i.icmp_code = 0;
i.icmp_cksum = 0;
i.icmp_id = 0;
i.icmp_seq = 0;
si.sin_family = AF_INET;
#if defined(__DECC) || defined(_IP_VHL)
ip.ip_vhl = 0;
#else
ip.ip_hl = 0;
#endif
])],
[ac_cv_have_icmp=yes],
[ac_cv_have_icmp=no])])
if test "$ac_cv_have_icmp" = yes ; then
AC_DEFINE(HAVE_ICMP)
fi])
AC_DEFUN([AC_CHECK_ICMPHDR],
[AC_CACHE_CHECK([for struct icmphdr], ac_cv_have_icmphdr,
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <limits.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/socket.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <netinet/udp.h>
#include <arpa/inet.h>
#include <netdb.h>],
[struct icmphdr i;
struct sockaddr s;
struct sockaddr_in si;
struct ip ip;
i.type = ICMP_ECHO;
i.code = 0;
i.checksum = 0;
i.un.echo.id = 0;
i.un.echo.sequence = 0;
si.sin_family = AF_INET;
ip.ip_hl = 0;])],
[ac_cv_have_icmphdr=yes],
[ac_cv_have_icmphdr=no])])
if test "$ac_cv_have_icmphdr" = yes ; then
AC_DEFINE(HAVE_ICMPHDR)
fi])
###############################################################################
#
# Functions to check for various X11 crap.
#
###############################################################################
# Try and find the app-defaults directory.
# It sucks that autoconf doesn't do this already...
# (AC_PATH_X_APP_DEFAULTS_XMKMF is no longer used.)
#
AC_DEFUN([AC_PATH_X_APP_DEFAULTS_XMKMF],[
rm -fr conftestdir
if mkdir conftestdir; then
cd conftestdir 2>/dev/null
# Make sure to not put "make" in the Imakefile rules, since we grep it out.
cat > Imakefile <<'EOF'
acfindx:
@echo 'ac_x_app_defaults="${XAPPLOADDIR}"'
EOF
if (xmkmf) >/dev/null 2>&1 && test -f Makefile; then
# GNU make sometimes prints "make[1]: Entering...", which'd confuse us.
eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
fi
cd .. 2>/dev/null
rm -fr conftestdir
fi])
AC_DEFUN([AC_PATH_X_APP_DEFAULTS_DIRECT],[
# Look for the directory under a standard set of common directories.
# Check X11 before X11Rn because it's often a symlink to the current release.
for ac_dir in \
\
/usr/share/X11/app-defaults \
\
/usr/X11/lib/app-defaults \
/usr/X11R6/lib/app-defaults \
/usr/X11R6/lib/X11/app-defaults \
/usr/X11R5/lib/app-defaults \
/usr/X11R5/lib/X11/app-defaults \
/usr/X11R4/lib/app-defaults \
/usr/X11R4/lib/X11/app-defaults \
\
/usr/lib/X11/app-defaults \
/usr/lib/X11R6/app-defaults \
/usr/lib/X11R5/app-defaults \
/usr/lib/X11R4/app-defaults \
\
/etc/X11/app-defaults \
\
/usr/local/X11/lib/app-defaults \
/usr/local/X11R6/lib/app-defaults \
/usr/local/X11R5/lib/app-defaults \
/usr/local/X11R4/lib/app-defaults \
\
/usr/local/lib/X11/app-defaults \
/usr/local/lib/X11R6/app-defaults \
/usr/local/lib/X11R6/X11/app-defaults \
/usr/local/lib/X11R5/app-defaults \
/usr/local/lib/X11R5/X11/app-defaults \
/usr/local/lib/X11R4/app-defaults \
/usr/local/lib/X11R4/X11/app-defaults \
\
/usr/X386/lib/X11/app-defaults \
/usr/x386/lib/X11/app-defaults \
/usr/XFree86/lib/X11/app-defaults \
\
/usr/lib/X11/app-defaults \
/usr/local/lib/X11/app-defaults \
/usr/unsupported/lib/X11/app-defaults \
/usr/athena/lib/X11/app-defaults \
/usr/local/x11r5/lib/X11/app-defaults \
/usr/lpp/Xamples/lib/X11/app-defaults \
/lib/usr/lib/X11/app-defaults \
\
/usr/openwin/lib/app-defaults \
/usr/openwin/lib/X11/app-defaults \
/usr/openwin/share/lib/app-defaults \
/usr/openwin/share/lib/X11/app-defaults \
\
/X11R6/lib/app-defaults \
/X11R5/lib/app-defaults \
/X11R4/lib/app-defaults \
; \
do
if test -d "$ac_dir"; then
ac_x_app_defaults=$ac_dir
break
fi
done
])
AC_DEFUN([AC_PATH_X_APP_DEFAULTS],
[AC_REQUIRE_CPP()
AC_CACHE_CHECK([for X app-defaults directory], ac_cv_x_app_defaults,
[# skip this, it's always wrong these days.
# AC_PATH_X_APP_DEFAULTS_XMKMF
if test x"$ac_x_app_defaults" = x; then
true AC_PATH_X_APP_DEFAULTS_DIRECT
fi
if test x"$ac_x_app_defaults" = x; then
/bin/echo -n 'fallback: '
ac_cv_x_app_defaults="/usr/lib/X11/app-defaults"
else
# Record where we found app-defaults for the cache.
ac_cv_x_app_defaults="$ac_x_app_defaults"
fi])
eval ac_x_app_defaults="$ac_cv_x_app_defaults"])
AC_DEFUN([AC_XPOINTER],
[AC_CACHE_CHECK([for XPointer], ac_cv_xpointer,
[AC_TRY_X_COMPILE([#include <X11/Xlib.h>],
[XPointer foo = (XPointer) 0;],
[ac_cv_xpointer=yes],
[ac_cv_xpointer=no])])
if test "$ac_cv_xpointer" != yes; then
AC_DEFINE(XPointer,[char*])
fi])
AC_DEFUN([AC_XT],
[AC_CACHE_CHECK([for Xt], ac_cv_libxt,
[AC_TRY_X_COMPILE([#include <X11/Xlib.h>
#include <X11/Intrinsic.h>],
[Widget foo = (Widget) 0;],
[ac_cv_libxt=yes],
[ac_cv_libxt=no])])])
# Random special-cases for X on certain pathological OSes.
# You know who you are.
#
AC_DEFUN([AC_X_RANDOM_PATHS],
[case "$host" in
*-hpux*)
# The following arcana was gleaned from conversations with
# Eric Schwartz <[email protected]>:
#
# On HPUX 10.x, the parts of X that HP considers "standard" live in
# /usr/{include,lib}/X11R6/. The parts that HP doesn't consider
# "standard", notably, Xaw and Xmu, live in /usr/contrib/X11R6/.
# Yet /usr/contrib/X11R6/ comes preinstalled on all HPUX systems.
# Also, there are symlinks from /usr/include/ and /usr/lib/ into
# /usr/{include,lib}/X11R6/, so that (if you don't use Xmu at all)
# you don't need any -I or -L arguments.
#
# On HPUX 9.x, /usr/{include,lib}/X11R5/ and /usr/contrib/X11R5/
# are the same division as 10.x. However, there are no symlinks to
# the X stuff from /usr/include/ and /usr/lib/, so -I and -L
# arguments are always necessary.
#
# However, X11R6 was available on HPUX 9.x as a patch: if that
# patch was installed, then all of X11R6 went in to
# /usr/contrib/X11R6/ (there was no /usr/{include,lib}/X11R6/.)
#
# HPUX 8.x was the same as 9.x, but was X11R4 instead (I don't know
# whether R5 was available as a patch; R6 undoubtedly was not.)
#
# So. We try and use the highest numbered pair of
# /usr/{include,lib}/X11R?/ and /usr/contrib/X11R?/{include,lib}/
# that are available. We do not mix and match different versions
# of X.
#
# Question I still don't know the answer to: (do you?)
#
# * On HPUX 9.x, where /usr/include/X11R5/ was standard, and
# /usr/contrib/X11R6/ could be installed as a patch, what was in
# that contrib directory? Did it contain so-called "standard"
# X11R6, or did it include Xaw and Xmu as well? If the former,
# where did one find Xaw and Xmu on 9.x R6 systems? Would this
# be a situation where one had to reach into the R5 headers and
# libs to find Xmu? That is, must both R6 and R5 directories
# be on the -I and -L lists in that case?
#
for version in X11R6 X11R5 X11R4 ; do
# if either pair of directories exists...
if test -d /usr/include/$version || \
test -d /usr/contrib/$version/include
then
# if contrib exists, use it...
if test -d /usr/contrib/$version/include ; then
X_CFLAGS="$X_CFLAGS -I/usr/contrib/$version/include"
X_LIBS="$X_LIBS -L/usr/contrib/$version/lib"
fi
# if the "standard" one exists, use it.
if test -d /usr/include/$version ; then
X_CFLAGS="$X_CFLAGS -I/usr/include/$version"
X_LIBS="$X_LIBS -L/usr/lib/$version"
fi
# since at least one of the pair exists, go no farther.
break
fi
done
# Now find Motif. Thanks for not making xmkmf find this by
# default, you losers.
#
if test -d /usr/include/Motif2.1 ; then
X_CFLAGS="$X_CFLAGS -I/usr/include/Motif2.1"
X_LIBS="$X_LIBS -L/usr/lib/Motif2.1"
elif test -d /usr/include/Motif1.2 ; then
X_CFLAGS="$X_CFLAGS -I/usr/include/Motif1.2"
X_LIBS="$X_LIBS -L/usr/lib/Motif1.2"
elif test -d /usr/include/Motif1.1 ; then
X_CFLAGS="$X_CFLAGS -I/usr/include/Motif1.1"
X_LIBS="$X_LIBS -L/usr/lib/Motif1.1"
fi
# Now let's check for the pseudo-standard locations for OpenGL.
#
if test -d /opt/graphics/OpenGL/include ; then
# HP-UX 10.20 puts it here
X_CFLAGS="-I/opt/graphics/OpenGL/include $X_CFLAGS"
X_LIBS="-L/opt/graphics/OpenGL/lib $X_LIBS"
elif test -d /opt/Mesa/lib ; then
X_CFLAGS="-I/opt/Mesa/include $X_CFLAGS"
X_LIBS="-L/opt/Mesa/lib $X_LIBS"
fi
# On HPUX, default to installing in /opt/xscreensaver/ instead of
# in /usr/local/, unless there is already an xscreensaver in
# /usr/local/bin/. This can be overridden with the --prefix arg
# to configure. I'm not sure this is the right thing to do, but
# Richard Lloyd says so...
#
if test \! -x /usr/local/bin/xscreensaver ; then
ac_default_prefix=/opt/xscreensaver
fi
;;
*-solaris*)
# Thanks for not making xmkmf find this by default, pinheads.
# And thanks for moving things around again, too. Is this
# really the standard location now? What happened to the
# joke that this kind of thing went in /opt?
# cthomp says "answer: CDE (Common Disorganized Environment)"
#
if test -f /usr/dt/include/Xm/Xm.h ; then
X_CFLAGS="$X_CFLAGS -I/usr/dt/include"
MOTIF_LIBS="$MOTIF_LIBS -L/usr/dt/lib -R/usr/dt/lib"
# Some versions of Slowlaris Motif require -lgen. But not all. Why?
AC_CHECK_LIB(gen, regcmp, [MOTIF_LIBS="$MOTIF_LIBS -lgen"])
fi
;;
*-darwin*)
# MacPorts on macOS
if test -d /opt/local/include ; then
X_CFLAGS="-I/opt/local/include $X_CFLAGS"
X_LIBS="-L/opt/local/lib $X_LIBS"
fi
# Fink on macOS
if test -d /sw/include ; then
X_CFLAGS="-I/sw/include $X_CFLAGS"
X_LIBS="-L/sw/lib $X_LIBS"
fi
# Homebrew on macOS Intel
if test -d /usr/local/include ; then
X_CFLAGS="-I/usr/local/include $X_CFLAGS"
X_LIBS="-L/usr/local/lib $X_LIBS"
fi
# Homebrew on macOS ARM
if test -d /opt/homebrew/include ; then
X_CFLAGS="-I/opt/homebrew/include $X_CFLAGS"
X_LIBS="-L/opt/homebrew/lib $X_LIBS"
fi
;;
esac])
AC_DEFUN([AC_CHECK_GETIFADDRS],
[AC_CACHE_CHECK([for getifaddrs], ac_cv_have_getifaddrs,
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <ifaddrs.h>],
[struct ifaddrs *ifa;
getifaddrs (&ifa);
ifa->ifa_next = 0;
ifa->ifa_addr->sa_family = 0;])],
[ac_cv_have_getifaddrs=yes],
[ac_cv_have_getifaddrs=no])])
if test "$ac_cv_have_getifaddrs" = yes ; then
AC_DEFINE(HAVE_GETIFADDRS)
fi])
AC_DEFUN([AC_TYPE_SOCKLEN_T],
[AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([
#include <sys/types.h>
#include <sys/socket.h>],
[socklen_t socklen;])],
[ac_cv_type_socklen_t=yes],
[ac_cv_type_socklen_t=no])])
if test "$ac_cv_type_socklen_t" != yes; then
AC_DEFINE(socklen_t, int,
[Define to `int' if <sys/types.h> or <sys/socket.h> does not define.])
fi])
###############################################################################
#
# Some utility functions to make checking for X things easier.
#
###############################################################################
# Like AC_CHECK_HEADER, but it uses the already-computed -I directories.
#
AC_DEFUN([AC_CHECK_X_HEADER], [
ac_save_CPPFLAGS="$CPPFLAGS"
if test \! -z "$includedir" ; then
CPPFLAGS="$CPPFLAGS -I$includedir"
fi
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
AC_CHECK_HEADER([$1],[$2],[$3],[$4])
CPPFLAGS="$ac_save_CPPFLAGS"])
# Like AC_EGREP_HEADER, but it uses the already-computed -I directories.
#
AC_DEFUN([AC_EGREP_X_HEADER], [
ac_save_CPPFLAGS="$CPPFLAGS"
if test \! -z "$includedir" ; then
CPPFLAGS="$CPPFLAGS -I$includedir"
fi
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
AC_EGREP_HEADER([$1], [$2], [$3], [$4])
CPPFLAGS="$ac_save_CPPFLAGS"])
# Like AC_COMPILE_IFELSE but it uses the already-computed -I directories.
#
AC_DEFUN([AC_TRY_X_COMPILE], [
ac_save_CPPFLAGS="$CPPFLAGS"
if test \! -z "$includedir" ; then
CPPFLAGS="$CPPFLAGS -I$includedir"
fi
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], [$2])],[$3],[$4])
CPPFLAGS="$ac_save_CPPFLAGS"])
# Like AC_CHECK_LIB, but it uses the already-computed -I and -L directories.
# Use this sparingly; it probably doesn't work very well on X programs.
#
AC_DEFUN([AC_CHECK_X_LIB], [
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LDFLAGS="$LDFLAGS"
# ac_save_LIBS="$LIBS"
if test \! -z "$includedir" ; then
CPPFLAGS="$CPPFLAGS -I$includedir"
fi
# note: $X_CFLAGS includes $x_includes
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
if test \! -z "$libdir" ; then
LDFLAGS="$LDFLAGS -L$libdir"
fi
# note: $X_LIBS includes $x_libraries
LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])
CPPFLAGS="$ac_save_CPPFLAGS"
LDFLAGS="$ac_save_LDFLAGS"
# LIBS="$ac_save_LIBS"
])
# Like AC_RUN_IFELSE but it uses the already-computed -I directories.
# (But not the -L directories!)
#
AC_DEFUN([AC_TRY_X_RUN], [
ac_save_CPPFLAGS="$CPPFLAGS"
if test \! -z "$includedir" ; then
CPPFLAGS="$CPPFLAGS -I$includedir"
fi
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
AC_RUN_IFELSE([AC_LANG_SOURCE([$1])],[$2],[$3],[$4])
CPPFLAGS="$ac_save_CPPFLAGS"])
# Usage: HANDLE_X_PATH_ARG([variable_name],
# [--command-line-option],
# [descriptive string])
#
# All of the --with options take three forms:
#
# --with-foo (or --with-foo=yes)
# --without-foo (or --with-foo=no)
# --with-foo=/DIR
#
# This function, HANDLE_X_PATH_ARG, deals with the /DIR case. When it sees
# a directory (string beginning with a slash) it checks to see whether
# /DIR/include and /DIR/lib exist, and adds them to $X_CFLAGS and $X_LIBS
# as appropriate.
#
AC_DEFUN([HANDLE_X_PATH_ARG], [
case "$[$1]" in
yes) ;;
no) ;;
/*)
AC_MSG_CHECKING([for [$3] headers])
d=$[$1]/include
if test -d $d; then
X_CFLAGS="-I$d $X_CFLAGS"
AC_MSG_RESULT($d)
else
AC_MSG_RESULT(not found ($d: no such directory))