-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
4727 lines (3992 loc) · 149 KB
/
configure.in
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 (c) 1997-2014 Jamie Zawinski.
#
AC_PREREQ(2.52)
AC_INIT(driver/subprocs.c)
AC_CONFIG_HEADERS([config.h])
echo "current directory: `pwd`"
echo "command line was: $0 $@"
###############################################################################
#
# Autoheader stuff
#
###############################################################################
AH_TOP([
/* config.h.in --- xscreensaver, Copyright (c) 1991-2014 Jamie Zawinski.
*
* The best way to set these parameters is by running the included `configure'
* script. That examines your system, and generates `config.h' from
* `config.h.in'.
*
* If something goes very wrong, you can edit `config.h' directly, but beware
* that your changes will be lost if you ever run `configure' again.
*/
])
AH_TEMPLATE([HAVE_READ_DISPLAY_EXTENSION],
[Define this if you have the XReadDisplay extension (I think
this is an SGI-only thing; it's in
<X11/extensions/readdisplay.h>.) A few of the screenhacks will
take advantage of this if it's available.])
AH_TEMPLATE([HAVE_XHPDISABLERESET],
[Define this if you have the XHPDisableReset function (an HP only
thing which allows the Ctrl-Sh-Reset key sequence to be
temporarily disabled.)])
# This only ever existed in X11R4 and X11R5.
#AH_TEMPLATE([HAVE_XIDLE_EXTENSION],
# [Define this if you have the XIDLE extension installed. If you
# have the XIDLE extension, this is recommended. (You have this
# extension if the file /usr/include/X11/extensions/xidle.h
# exists.) Turning on this flag lets XScreenSaver work better with
# servers which support this extension; but it will still work
# with servers which do not suport it, so it's a good idea to
# compile in support for it if you can.])
# Using this extension will crash your X server and make fading not work.
#AH_TEMPLATE([HAVE_MIT_SAVER_EXTENSION],
# [Define this if you have the MIT-SCREEN-SAVER extension
# installed. See the caveats about this extension, above.
# (It's available if /usr/include/X11/extensions/scrnsaver.h
# exists.)])
# This only ever existed on SGI hardware.
#AH_TEMPLATE([HAVE_SGI_SAVER_EXTENSION],
# [Define this if you have the SGI SCREEN_SAVER extension. This is
# standard on Irix systems, and not available elsewhere.])
# This only ever existed on SGI hardware.
#AH_TEMPLATE([HAVE_SGI_VC_EXTENSION],
# [Define this if you have the SGI-VIDEO-CONTROL extension. This
# is standard on Irix systems, and not available elsewhere.])
AH_TEMPLATE([HAVE_DPMS_EXTENSION],
[Define this if you have the XDPMS extension. This is standard
on sufficiently-recent XFree86 systems, and possibly elsewhere.
(It's available if the file /usr/include/X11/extensions/dpms.h
exists.)])
AH_TEMPLATE([HAVE_XF86VMODE],
[Define this if you have the functions XF86VidModeGetModeLine()
and XF86VidModeGetViewPort(), in support of virtual desktops
where the X server's root window is bigger than the actual
screen. This is an XFree86 thing, and probably doesn't exist
elsewhere. (It's available if the file
/usr/include/X11/extensions/xf86vmode.h exists.)])
AH_TEMPLATE([HAVE_XF86VMODE_GAMMA],
[Define this if you have the functions XF86VidModeGetGamma() and
XF86VidModeSetGamma(), which allow clients to change the gamma
response of the monitor. This is an XFree86 4.0.x thing, and
probably doesn't exist elsewhere. (It's available if the file
/usr/include/X11/extensions/xf86vmode.h exists and has stuff about
gamma in it.)])
AH_TEMPLATE([HAVE_XF86VMODE_GAMMA_RAMP],
[Define this if you have the functions XF86VidModeGetGammaRamp()
and XF86VidModeSetGammaRamp(), which provide finer-grained
control than XF86VidMode[GS]etGamma(). These appeared in
XFree86 4.1.0.])
AH_TEMPLATE([HAVE_XINERAMA],
[Define this if you have the Xinerama extension. This is
standard on sufficiently-recent XFree86 systems, and possibly
elsewhere. (It's available if the file
/usr/include/X11/extensions/Xinerama.h exists.)])
AH_TEMPLATE([HAVE_XINPUT],
[Define this if you have the Xinput extension. This is
standard since X11R5, and is thus almost everywhere.
(It's available if the file /usr/include/X11/extensions/XInput.h
exists.)])
AH_TEMPLATE([HAVE_XF86MISCSETGRABKEYSSTATE],
[Define this if you have the XF86MiscSetGrabKeysState function
(which allows the Ctrl-Alt-KP_star and Ctrl-Alt-KP_slash key
sequences to be temporarily disabled. Sadly, it doesn't affect
Ctrl-Alt-BS or Ctrl-Alt-F1.)])
AH_TEMPLATE([HAVE_RANDR],
[Define this if you have the Resize and Rotate extension.
This is standard on sufficiently-recent XFree86 systems, and
possibly elsewhere. (It's available if the file
/usr/include/X11/extensions/Xrandr.h exists.)])
AH_TEMPLATE([HAVE_RANDR_12],
[Define this if the RANDR library is version 1.2 or newer.])
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.])
AH_TEMPLATE([HAVE_MOTIF],[Define this if you have Motif.])
AH_TEMPLATE([HAVE_XMCOMBOBOX],
[Define this if you have the XmComboBox Motif widget (Motif 2.0.)])
AH_TEMPLATE([HAVE_GTK],[Define this if you have Gtk (any version.)])
AH_TEMPLATE([HAVE_GTK2],[Define this if you have Gtk 2.x.])
AH_TEMPLATE([HAVE_CRAPPLET],
[Define this if you have Gnome and want to build support for the
xscreensaver control panel in the Gnome Control Center
(gnomecc). (This is needed only with Gtk 1.x.)])
AH_TEMPLATE([HAVE_CRAPPLET_IMMEDIATE],
[Define this if HAVE_CRAPPLET is defined, and the function
capplet_widget_changes_are_immediate() is available.])
AH_TEMPLATE([HAVE_XML],[Define this if you have the XML library.])
AH_TEMPLATE([HAVE_OLD_XML_HEADERS],
[Define this if you have the XML library headers in their old,
non-namespaced location (you lack the gnome-xml/libxml symlink)])
AH_TEMPLATE([HAVE_XPM],
[Define this if you have the XPM library installed. Some of the
demos can make use of this if it is available.])
AH_TEMPLATE([HAVE_GDK_PIXBUF],
[Define this if you have the GDK_Pixbuf library installed. Some
of the demos can make use of this if it is available.])
AH_TEMPLATE([HAVE_GDK_PIXBUF_APPLY_EMBEDDED_ORIENTATION],
[Define this if you have the gdk_pixbuf_apply_embedded_orientation
function (gdk-pixbuf 2.12).])
AH_TEMPLATE([HAVE_JPEGLIB],
[Define this if you have the Independent JPEG Group's JPEG
library installed. Some of the demos can make use of this if it
is available.])
AH_TEMPLATE([HAVE_XMU],
[Define this if you have the Xmu library. This is standard part
of X, and if your vendor doesn't ship it, you should report that
as a bug.])
AH_TEMPLATE([HAVE_XUTF8DRAWSTRING],
[Define this if you have the function Xutf8DrawString().])
AH_TEMPLATE([HAVE_XFT],
[Define this if you have libXft2.])
AH_TEMPLATE([HAVE_GL],
[Define this if you have OpenGL. Some of the demos require it,
so if you don't have it, then those particular demos won't be
built. (This won't affect the screen saver as a whole.)])
AH_TEMPLATE([HAVE_MESA_GL],
[Define this if you have OpenGL, but it's the MesaGL variant.
(The libraries have different names.) (HAVE_GL should be defined
too.)])
AH_TEMPLATE([HAVE_GLBINDTEXTURE],
[Define this if your version of OpenGL has the glBindTexture()
routine. This is the case for OpenGL 1.1, but not for OpenGL
1.0.])
AH_TEMPLATE([HAVE_GLE],
[Define this if you have the -lgle and -lmatrix libraries (GL
extrusion.)])
AH_TEMPLATE([HAVE_GLE3],[Define this if you have the -lgle from GLE version 3])
AH_TEMPLATE([HAVE_JWZGLES],[Define this to target the OpenGL ES 1.x API
instead of OpenGL 1.3.])
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([FORTUNE_PROGRAM],
[Some screenhacks like to run an external program to generate
random pieces of text; set this to the one you like. Note that
this is just the default; X resources can be used to override
it.])
AH_TEMPLATE([PASSWD_HELPER_PROGRAM],
[Set the name of the password helper program, if any])
AH_TEMPLATE([NO_LOCKING],
[Define this to remove the option of locking the screen at all.])
AH_TEMPLATE([ALLOW_ROOT_PASSWD],
[Define this to allow the root password to unlock the screen.])
AH_TEMPLATE([HAVE_KERBEROS],
[Define this if you want to use Kerberos authentication to
lock/unlock the screen instead of your local password. This
currently uses Kerberos V4, but a V5 server with V4
compatibility will work. WARNING: DO NOT USE AFS string-to-key
passwords with this option. This option currently *only* works
with standard Kerberos des_string_to_key. If your password is
an AFS password and not a kerberos password, it will not
authenticate properly. See the comments in driver/kpasswd.c for
more information if you need it.])
AH_TEMPLATE([HAVE_KERBEROS5],
[Define this if you have Kerberos 5, meaning we need to use the
Kerberos 4 compatibility layer.])
AH_TEMPLATE([HAVE_PAM],
[Define this if you want to use PAM (Pluggable Authentication
Modules) to lock/unlock the screen, instead of standard
/etc/passwd authentication.])
AH_TEMPLATE([PAM_SERVICE_NAME],
[If PAM is being used, this is the name of the PAM service that
xscreensaver will authenticate as. The default is
"xscreensaver", which means that the PAM library will look for
an "xscreensaver" line in /etc/pam.conf, or (on recent Linux
systems) will look for a file called /etc/pam.d/xscreensaver.
Some systems might already have a PAM installation that is
configured for xlock, so setting this to "xlock" would also work
in that case.])
AH_TEMPLATE([HAVE_PAM_FAIL_DELAY],
[Define this if you have pam_fail_delay function.
see driver/passwd-pam.c.])
AH_TEMPLATE([PAM_CHECK_ACCOUNT_TYPE],
[Whether PAM should check the result of account modules
when authenticating. Only do this if you have account
configured properly on your system.])
AH_TEMPLATE([PAM_STRERROR_TWO_ARGS],
[Define if you have PAM and pam_strerror() requires two
arguments.])
AH_TEMPLATE([HAVE_SIGTIMEDWAIT],
[Define to 1 if you have the `sigtimedwait' function.])
AH_TEMPLATE([HAVE_SHADOW_PASSWD],
[Define this if your system uses 'shadow' passwords, that is, the
passwords live in /etc/shadow instead of /etc/passwd, and one
reads them with getspnam() instead of getpwnam(). (Note that
SCO systems do some random other thing; others might as well.
See the ifdefs in driver/passwd-pwent.c if you're having trouble
related to reading passwords.)])
AH_TEMPLATE([HAVE_ENHANCED_PASSWD],
[Define this if your system is Digital or SCO Unix with so-called
``Enhanced Security'', that is, the passwords live in
/tcb/files/auth/<x>/<xyz> instead of in /etc/passwd, and one
reads them with getprpwnam() instead of getpwnam().])
AH_TEMPLATE([HAVE_ADJUNCT_PASSWD],
[Define this if your system is Solaris with ``adjunct'' passwords
(this is the version where one gets at the passwords with
getpwanam() instead of getpwnam().) I haven't tested this one,
let me know if it works.])
AH_TEMPLATE([HAVE_HPUX_PASSWD],
[Define this if you are running HPUX with so-called ``Secure
Passwords'' (if you have /usr/include/hpsecurity.h, you probably
have this.) I haven't tested this one, let me know if it works.])
AH_TEMPLATE([HAVE_SYSLOG],
[Define this if you the openlog(), syslog(), and closelog()
functions. This is used for logging failed login attempts.])
AH_TEMPLATE([HAVE_ICMP],
[Define this if you do pings with a `struct icmp' and an
`icmp_id' slot.])
AH_TEMPLATE([HAVE_ICMPHDR],
[Define this if you do pings with a `struct icmphdr' and an
`un.echo.id' slot.])
AH_TEMPLATE([HAVE_GETIFADDRS],
[Define this if you have the getifaddrs() function.])
AH_TEMPLATE([HAVE_FORKPTY],
[Define this if you have the 'forkpty' function:
This allows 'phosphor' and 'apple2' to run curses-based
programs, or be used as terminal windows.])
AH_TEMPLATE([HAVE_GETTIMEOFDAY],
[Define this if you have the gettimeofday function.])
AH_TEMPLATE([GETTIMEOFDAY_TWO_ARGS],
[Define this if gettimeofday() takes two arguments.])
AH_TEMPLATE([XPointer],
[Define this to void* if you're using X11R4 or earlier.])
AH_TEMPLATE([HAVE_PTHREAD],
[Define this if your system supports POSIX threads.])
AH_TEMPLATE([HAVE_RECORD_ANIM],
[Define this to enable recording of videos.])
# 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
###############################################################################
#
# Query AX_PTHREAD, and figure out which compiler gets used.
#
###############################################################################
AC_DEFUN([AC_PROG_CC_PTHREAD],
[have_pthread=no
with_pthread_req=unspecified
# AX_PTHREAD is from the GNU Autoconf Archive.
# https://savannah.gnu.org/projects/autoconf-archive/
m4_include(ax_pthread.m4)
# This affects CC, LIBS, and CFLAGS, instead of defining new variables.
AC_ARG_WITH([pthread],
[ --with-pthread Enables POSIX threads, for SMP support.],
[with_pthread="$withval"; with_pthread_req="$withval"],
[with_pthread=yes])
if test "$with_pthread" = yes; then
# AX_PTHREAD might want a different compiler.
AX_PTHREAD(
[if test "$CC" = "$PTHREAD_CC" -o -z "$ac_original_cc"; then
have_pthread=yes
else
ac_prog_cc_no_pthread=yes
fi
])
if test "$have_pthread" = yes; then
AC_DEFINE([HAVE_PTHREAD])
CC=$PTHREAD_CC
fi
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(how to request ANSI compilation)
case "$host" in
*-hpux* )
AC_MSG_RESULT(HPUX: adding -Ae)
CC="$CC -Ae"
;;
*-aix* )
AC_MSG_RESULT(AIX: adding -qlanglvl=ansi -qhalt=e)
CC="$CC -qlanglvl=ansi -qhalt=e"
;;
*-dec-* )
AC_MSG_RESULT(DEC: adding -std1 -ieee)
CC="$CC -std1"
;;
*)
AC_MSG_RESULT(no idea)
;;
esac
else
# using GCC
case "$host" in
*-solaris*)
AC_MSG_RESULT(Solaris: adding -D__EXTENSIONS__)
CC="$CC -D__EXTENSIONS__"
;;
esac
fi
OBJCC="$CC"
AC_MSG_CHECKING([whether the compiler works on ANSI C])
AC_TRY_RUN([ main(int ac, char **av) { return 0; } ],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
AC_MSG_ERROR(Couldn't build even a trivial ANSI C program: check CC.),
AC_MSG_ERROR(Couldn't build even a trivial ANSI C program: check CC.))
if test -n "$GCC"; then
AC_MSG_RESULT(Turning on gcc compiler warnings.)
CC="$CC -pedantic -Wall -Wstrict-prototypes -Wnested-externs -Wmissing-prototypes"
OBJCC="$OBJCC -Wall"
# As of gcc 3.4, we have "-Wdeclaration-after-statement"
# and so perhaps now we can do without -pedantic?
else
case "$host" in
*-irix5* |*-irix6.[0-3]* )
AC_MSG_RESULT(Turning on SGI compiler warnings.)
CC="$CC -fullwarn -use_readonly_const -rdata_shared -g3"
;;
# *-dec-osf* )
# if test -z "$GCC"; then
# AC_MSG_RESULT(Turning on DEC C compiler warnings.)
# CC="$CC -migrate -w0 -verbose -warnprotos"
# fi
# ;;
esac
fi
])
###############################################################################
#
# 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
if ( ( gcc -c [$2] 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
])
AC_DEFUN([AC_NO_LONG_STRING_WARNINGS],
[AC_CHECK_GCC_ARG(no_overlength, -Wno-overlength-strings)])
AC_DEFUN([AC_NO_MISPLACED_DECLARATIONS],
[AC_CHECK_GCC_ARG(no_decl_after, -Wdeclaration-after-statement)])
# Need to disable Objective C extensions in ANSI C on MacOS X to work
# around an Apple-specific gcc bug.
#
AC_DEFUN([AC_NO_OBJECTIVE_C],
[AC_CHECK_GCC_ARG(no_cpp_precomp, -no-cpp-precomp)])
###############################################################################
#
# Function to figure out how to disable // comments in ANSI C code.
#
# (With recent gcc, this is done with "-std=c89". With older gcc, this
# is done by passing "-lang-c89" to cpp, by passing "-Wp,-lang-c89" to
# gcc. Old gcc doesn't support -std, and new gcc doesn't support -lang.
# so much for compatibility!)
#
# UPDATE: apparently there is NO WAY to tell gcc 3.2.2 to require that
# declarations preceed statements, without resorting to "-pedantic".
# This means that there is no way to get gcc3 to issue warnings that
# ensure that your code complies with the ANSI/ISO C89 standard, without
# also drowning in totally useless warnings. Thank you master may I
# have another.
#
# So, I give up, let's just use -pedantic.
#
###############################################################################
AC_DEFUN([AC_GCC_ACCEPTS_STD], [
case "$host" in
*-darwin* )
# Fucking Apple let // comments sneak into OpenGL headers, so
# we *must* allow // comments when compiling on Mac OS 10.6! FUCK!
;;
*)
AC_CHECK_GCC_ARG(std, -std=c89)
;;
esac
])
AC_DEFUN([AC_NO_CPLUSPLUS_COMMENTS_IN_C_CODE],
[if test -n "$GCC"; then
AC_GCC_ACCEPTS_STD
AC_MSG_RESULT(Disabling C++ comments in ANSI C code.)
#
# The reason that // comments are banned from xscreensaver is that gcc is
# basically the only compiler in the world that supports them in C code.
# All other vendors support them only in their C++ compilers, not in their
# ANSI C compilers. This means that it's a portability problem: every time
# these comments have snuck into the xscreensaver source code, I've gotten
# complaints about it the next day. So we turn off support for them in gcc
# as well to prevent them from accidentially slipping in.
#
if test "$ac_gcc_accepts_std" = yes ; then
#
# -std=c89 defines __STRICT_ANSI__, which we don't want.
# (That appears to be the only additional preprocessor symbol
# it defines, in addition to the syntax changes it makes.)
#
# -std=gnu89 is no good, because // comments were a GNU extension
# before they were in the ANSI C 99 spec... (gcc 2.96 permits //
# with -std=gnu89 but not with -std=c89.)
#
# $CC already contains "-std=c89" via AC_GCC_ACCEPTS_STD
CC="$CC -U__STRICT_ANSI__"
# else
# # The old way:
# CC="$CC -Wp,-lang-c89"
fi
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_TRY_COMPILE([#include <stdlib.h>
#include <sys/time.h>],
[struct timeval tv; struct timezone tzp;
gettimeofday(&tv, &tzp);],
[ac_gettimeofday_args=2],
[AC_TRY_COMPILE([#include <stdlib.h>
#include <sys/time.h>],
[struct timeval tv; gettimeofday(&tv);],
[ac_gettimeofday_args=1],
[ac_gettimeofday_args=0])])
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
])
###############################################################################
#
# Function to demand "bc". Losers.
#
###############################################################################
AC_DEFUN([AC_DEMAND_BC],
[ac_bc_result=`echo 6+9 | bc 2>/dev/null`
AC_MSG_CHECKING([for bc])
if test "$ac_bc_result" = "15" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
echo ''
AC_MSG_ERROR([Your system doesn't have \"bc\", which has been a standard
part of Unix since the 1970s. Come back when your vendor
has grown a clue.])
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_TRY_COMPILE([#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_TRY_COMPILE([#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_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])
###############################################################################
#
# Handle the --with-x-app-defaults option HERE
#
###############################################################################
AC_ARG_WITH(x-app-defaults,[],
[ac_cv_x_app_defaults="$withval"],
[eval ac_x_app_defaults="$withval"])
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])
# 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 and XPM.
#
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
if test -d /opt/xpm/lib/X11 ; then
X_CFLAGS="-I/opt/xpm/include $X_CFLAGS"
X_LIBS="-L/opt/xpm/lib/X11 $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...