From 26b6e4255d4b9ff79a6dca10de5bec7bfc8691f9 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 6 Apr 2021 14:23:46 +0200 Subject: xscreensaver 6.00 --- INSTALL | 32 +- Makefile.in | 236 +- README | 103 +- README.VMS | 57 - README.hacking | 35 + aclocal.m4 | 6 +- ax_pthread.m4 | 448 +- config.guess | 578 +- config.h-vms | 284 - config.h.in | 225 +- config.sub | 2570 +- configure | 16420 +- configure.ac | 4859 + configure.in | 4924 - driver/Makefile.in | 1119 +- driver/XScreenSaver-Xm.ad | 2 +- driver/XScreenSaver.ad.in | 546 +- driver/XScreenSaver_Xm_ad.h | 108 + driver/XScreenSaver_ad.h | 534 + driver/atoms.c | 70 + driver/atoms.h | 38 + driver/atomswm.c | 101 + driver/auth.h | 79 +- driver/blurb.c | 50 + driver/blurb.h | 11 + driver/clientmsg.c | 123 + driver/clientmsg.h | 19 + driver/demo-Gtk-conf.c | 24 +- driver/demo-Gtk.c | 535 +- driver/demo-Xm-widgets.c | 49 +- driver/demo-Xm.c | 166 +- driver/dialog.c | 2507 + driver/dpms.c | 190 +- driver/exec.c | 32 +- driver/exts.c | 238 + driver/fade.c | 1749 + driver/fade.h | 20 + driver/passwd-helper.c | 64 +- driver/passwd-kerberos.c | 45 +- driver/passwd-pam.c | 312 +- driver/passwd-pwent.c | 110 +- driver/passwd.c | 319 +- driver/prefs.c | 1694 +- driver/prefs.h | 28 +- driver/prefsw.c | 1555 + driver/remote.c | 288 +- driver/remote.h | 3 +- driver/screens.c | 592 +- driver/screens.h | 37 + driver/screensaver-properties.desktop.in | 2 +- driver/setuid.c | 229 +- driver/subprocs.c | 1271 +- driver/test-fade.c | 172 +- driver/test-grab.c | 146 +- driver/test-passwd.c | 333 +- driver/test-randr.c | 25 +- driver/test-screens.c | 31 +- driver/test-uid.c | 14 +- driver/test-vp.c | 24 +- driver/test-xdpms.c | 47 +- driver/test-xinerama.c | 26 +- driver/test-xinput.c | 306 + driver/test-xkb.c | 89 + driver/test-yarandom.c | 3 +- driver/types.h | 306 +- driver/windows.c | 2063 +- driver/xdpyinfo.c | 112 +- driver/xinput.c | 381 + driver/xinput.h | 19 + driver/xscreensaver-auth.c | 340 + driver/xscreensaver-auth.man | 27 + driver/xscreensaver-command.c | 152 +- driver/xscreensaver-command.man | 268 +- driver/xscreensaver-gfx.c | 595 + driver/xscreensaver-gfx.man | 28 + driver/xscreensaver-settings.man | 420 + driver/xscreensaver-systemd.c | 1090 +- driver/xscreensaver-systemd.man | 80 +- driver/xscreensaver.c | 4203 +- driver/xscreensaver.h | 134 +- driver/xscreensaver.man | 1180 +- driver/xscreensaver.ui | 2994 + hacks/Makefile.in | 359 +- hacks/README | 3 + hacks/abstractile.man | 2 +- hacks/analogtv-cli.c | 257 +- hacks/analogtv.c | 62 +- hacks/analogtv.h | 2 +- hacks/anemone.man | 2 +- hacks/anemotaxis.man | 2 +- hacks/ant.man | 2 +- hacks/apollonian.c | 141 +- hacks/apollonian.man | 2 +- hacks/apple2-main.c | 17 +- hacks/apple2.man | 53 +- hacks/asm6502.c | 25 +- hacks/attraction.man | 24 +- hacks/barcode.c | 6 + hacks/barcode.man | 2 +- hacks/binaryring.man | 2 +- hacks/blaster.man | 2 +- hacks/blitspin.man | 8 +- hacks/bouboule.man | 2 +- hacks/boxfit.man | 8 +- hacks/braid.man | 2 +- hacks/bsod.c | 857 +- hacks/bsod.man | 15 +- hacks/bubbles.c | 16 +- hacks/bubbles.h | 9 - hacks/bubbles.man | 15 +- hacks/bumps.man | 8 +- hacks/ccurve.man | 2 +- hacks/celtic.man | 2 +- hacks/check-configs.pl | 63 +- hacks/cloudlife.man | 2 +- hacks/compass.c | 1 - hacks/compass.man | 2 +- hacks/config/README | 11 +- hacks/config/antinspect.xml | 2 +- hacks/config/antmaze.xml | 2 +- hacks/config/antspotlight.xml | 2 +- hacks/config/apple2.xml | 2 +- hacks/config/beats.xml | 42 + hacks/config/binaryring.xml | 2 +- hacks/config/blinkbox.xml | 2 +- hacks/config/blitspin.xml | 2 +- hacks/config/blocktube.xml | 2 +- hacks/config/bouncingcow.xml | 2 +- hacks/config/boxfit.xml | 2 +- hacks/config/bsod.xml | 33 +- hacks/config/bubble3d.xml | 2 +- hacks/config/cage.xml | 4 +- hacks/config/ccurve.xml | 2 +- hacks/config/cityflow.xml | 2 +- hacks/config/cloudlife.xml | 2 +- hacks/config/co____9.xml | 38 + hacks/config/companioncube.xml | 2 +- hacks/config/covid19.xml | 38 + hacks/config/cube21.xml | 2 +- hacks/config/cubestack.xml | 2 +- hacks/config/cubestorm.xml | 2 +- hacks/config/cubetwist.xml | 2 +- hacks/config/cubicgrid.xml | 8 +- hacks/config/cwaves.xml | 2 +- hacks/config/dangerball.xml | 2 +- hacks/config/decayscreen.xml | 2 +- hacks/config/deepstars.xml | 2 +- hacks/config/dymaxionmap.xml | 2 +- hacks/config/energystream.xml | 2 +- hacks/config/epicycle.xml | 11 + hacks/config/etruscanvenus.xml | 4 +- hacks/config/euler2d.xml | 2 +- hacks/config/fadeplot.xml | 2 +- hacks/config/fiberlamp.xml | 2 +- hacks/config/filmleader.xml | 2 +- hacks/config/flipflop.xml | 2 +- hacks/config/flipscreen3d.xml | 2 +- hacks/config/fliptext.xml | 2 +- hacks/config/fluidballs.xml | 2 +- hacks/config/flyingtoasters.xml | 2 +- hacks/config/fontglide.xml | 2 +- hacks/config/fuzzyflakes.xml | 2 +- hacks/config/gears.xml | 4 +- hacks/config/geodesicgears.xml | 2 +- hacks/config/glblur.xml | 2 +- hacks/config/glcells.xml | 2 +- hacks/config/glforestfire.xml | 2 +- hacks/config/glhanoi.xml | 2 +- hacks/config/glknots.xml | 2 +- hacks/config/glmatrix.xml | 2 +- hacks/config/glplanet.xml | 2 +- hacks/config/glschool.xml | 2 +- hacks/config/glslideshow.xml | 2 +- hacks/config/glsnake.xml | 2 +- hacks/config/gltext.xml | 2 +- hacks/config/gravitywell.xml | 2 +- hacks/config/headroom.xml | 48 + hacks/config/hexstrut.xml | 2 +- hacks/config/hyperball.xml | 2 +- hacks/config/hypercube.xml | 2 +- hacks/config/hypnowheel.xml | 2 +- hacks/config/imsmap.xml | 2 +- hacks/config/jigglypuff.xml | 2 +- hacks/config/juggler3d.xml | 2 +- hacks/config/klein.xml | 6 +- hacks/config/lcdscrub.xml | 2 +- hacks/config/maze3d.xml | 2 +- hacks/config/memscroller.xml | 2 +- hacks/config/menger.xml | 2 +- hacks/config/metaballs.xml | 8 +- hacks/config/mirrorblob.xml | 2 +- hacks/config/moebius.xml | 8 +- hacks/config/moebiusgears.xml | 6 +- hacks/config/moire.xml | 6 +- hacks/config/moire2.xml | 4 +- hacks/config/morph3d.xml | 2 +- hacks/config/nerverot.xml | 2 +- hacks/config/noseguy.xml | 2 +- hacks/config/pacman.xml | 2 +- hacks/config/photopile.xml | 2 +- hacks/config/pinion.xml | 4 +- hacks/config/popsquares.xml | 2 +- hacks/config/projectiveplane.xml | 4 +- hacks/config/quasicrystal.xml | 2 +- hacks/config/raverhoop.xml | 2 +- hacks/config/razzledazzle.xml | 2 +- hacks/config/rd-bomb.xml | 2 +- hacks/config/romanboy.xml | 4 +- hacks/config/rotzoomer.xml | 2 +- hacks/config/rubikblocks.xml | 2 +- hacks/config/shadebobs.xml | 2 +- hacks/config/sierpinski3d.xml | 2 +- hacks/config/skytentacles.xml | 2 +- hacks/config/slidescreen.xml | 2 +- hacks/config/speedmine.xml | 2 +- hacks/config/sphereeversion.xml | 98 + hacks/config/spheremonics.xml | 2 +- hacks/config/spiral.xml | 4 +- hacks/config/splitflap.xml | 2 +- hacks/config/starwars.xml | 2 +- hacks/config/stonerview.xml | 2 +- hacks/config/surfaces.xml | 4 +- hacks/config/testx11.xml | 2 +- hacks/config/timetunnel.xml | 2 +- hacks/config/topblock.xml | 2 +- hacks/config/tronbit.xml | 2 +- hacks/config/unknownpleasures.xml | 2 +- hacks/config/vidwhacker.xml | 2 +- hacks/config/webcollage.xml | 2 +- hacks/config/whirlwindwarp.xml | 2 +- hacks/config/winduprobot.xml | 2 +- hacks/coral.man | 2 +- hacks/critical.man | 6 +- hacks/crystal.c | 3 +- hacks/crystal.man | 2 +- hacks/cwaves.c | 7 +- hacks/cwaves.man | 2 +- hacks/cynosure.man | 2 +- hacks/decayscreen.man | 8 +- hacks/deco.man | 2 +- hacks/delaunay.c | 2 + hacks/delaunay.h | 4 - hacks/deluxe.c | 1 - hacks/deluxe.man | 2 +- hacks/demon.man | 2 +- hacks/discrete.man | 2 +- hacks/distort.man | 6 +- hacks/drift.man | 2 +- hacks/epicycle.man | 39 +- hacks/euler2d.man | 2 +- hacks/fadeplot.man | 2 +- hacks/fiberlamp.man | 2 +- hacks/filmleader.c | 40 +- hacks/filmleader.man | 2 +- hacks/fireworkx.man | 2 +- hacks/flag.c | 4 +- hacks/flag.man | 2 +- hacks/flame.man | 2 +- hacks/flow.man | 2 +- hacks/fluidballs.c | 46 +- hacks/fluidballs.man | 2 +- hacks/fontglide.c | 112 +- hacks/fontglide.man | 6 +- hacks/fonts/Makefile.in | 96 + hacks/fonts/OCRAStd.otf | Bin 0 -> 30636 bytes hacks/fonts/SpecialElite.ttf | Bin 0 -> 166224 bytes hacks/fonts/clacon.ttf | Bin 0 -> 103892 bytes hacks/fonts/gallant12x22.ttf | Bin 0 -> 25644 bytes hacks/fonts/luximr.ttf | Bin 0 -> 71784 bytes hacks/forest.c | 4 - hacks/forest.man | 2 +- hacks/fps.c | 125 +- hacks/fps.h | 4 - hacks/fpsI.h | 12 +- hacks/fuzzyflakes.c | 3 + hacks/fuzzyflakes.man | 2 +- hacks/galaxy.man | 2 +- hacks/glitchpeg.c | 46 +- hacks/glitchpeg.man | 2 +- hacks/glx/Makefile.in | 1416 +- hacks/glx/README | 5 +- hacks/glx/antinspect.c | 23 +- hacks/glx/antinspect.man | 4 +- hacks/glx/antmaze.c | 14 +- hacks/glx/antmaze.man | 4 +- hacks/glx/antspotlight.c | 12 - hacks/glx/antspotlight.man | 4 +- hacks/glx/atlantis.h | 19 +- hacks/glx/atlantis.man | 2 +- hacks/glx/atunnel.c | 3 - hacks/glx/atunnel.man | 15 +- hacks/glx/b_lockglue.c | 17 +- hacks/glx/beats.c | 439 + hacks/glx/beats.man | 75 + hacks/glx/blinkbox.c | 19 +- hacks/glx/blocktube.c | 11 +- hacks/glx/blocktube.man | 2 +- hacks/glx/boing.c | 2 - hacks/glx/boing.man | 2 +- hacks/glx/bouncingcow.c | 15 +- hacks/glx/bouncingcow.man | 2 +- hacks/glx/boxed.c | 14 +- hacks/glx/boxed.man | 2 +- hacks/glx/bubble3d.h | 16 +- hacks/glx/bubble3d.man | 2 +- hacks/glx/buildlwo.c | 4 +- hacks/glx/buildlwo.h | 19 - hacks/glx/cage.c | 12 + hacks/glx/cage.man | 2 +- hacks/glx/carousel.c | 38 +- hacks/glx/carousel.man | 8 +- hacks/glx/chessmodels.c | 22 +- hacks/glx/circuit.c | 21 +- hacks/glx/circuit.man | 2 +- hacks/glx/cityflow.c | 2 - hacks/glx/cityflow.man | 2 +- hacks/glx/companion.c | 12 +- hacks/glx/companioncube.man | 8 +- hacks/glx/covid19.c | 656 + hacks/glx/covid19.man | 72 + hacks/glx/crackberg.c | 2 - hacks/glx/crackberg.man | 2 +- hacks/glx/crumbler.c | 109 +- hacks/glx/crumbler.man | 2 +- hacks/glx/cube21.c | 13 +- hacks/glx/cube21.man | 2 +- hacks/glx/cubenetic.c | 11 +- hacks/glx/cubenetic.man | 2 +- hacks/glx/cubestack.c | 11 +- hacks/glx/cubestack.man | 2 +- hacks/glx/cubestorm.c | 11 +- hacks/glx/cubestorm.man | 2 +- hacks/glx/cubetwist.c | 11 +- hacks/glx/cubetwist.man | 2 +- hacks/glx/cubicgrid.c | 81 +- hacks/glx/cubicgrid.man | 7 +- hacks/glx/dangerball.c | 11 +- hacks/glx/dangerball.man | 2 +- hacks/glx/deepstars.c | 3 - hacks/glx/deepstars.man | 2 +- hacks/glx/discoball.c | 11 +- hacks/glx/discoball.man | 2 +- hacks/glx/dnalogo.c | 32 +- hacks/glx/dropshadow.c | 7 +- hacks/glx/dropshadow.h | 6 - hacks/glx/dymaxionmap-coords.c | 2 +- hacks/glx/dymaxionmap.c | 16 +- hacks/glx/dymaxionmap.man | 4 +- hacks/glx/endgame.c | 3 - hacks/glx/endgame.man | 4 +- hacks/glx/energystream.c | 2 - hacks/glx/energystream.man | 2 +- hacks/glx/engine.c | 15 +- hacks/glx/engine.man | 2 +- hacks/glx/esper.c | 100 +- hacks/glx/esper.man | 2 +- hacks/glx/etruscanvenus.c | 1899 +- hacks/glx/etruscanvenus.man | 2 +- hacks/glx/extrusion.c | 15 - hacks/glx/extrusion.h | 10 +- hacks/glx/extrusion.man | 2 +- hacks/glx/flipflop.c | 1168 +- hacks/glx/flipflop.man | 2 +- hacks/glx/flipscreen3d.c | 4 - hacks/glx/flipscreen3d.man | 2 +- hacks/glx/fliptext.c | 8 +- hacks/glx/fliptext.man | 6 +- hacks/glx/flurry.h | 24 +- hacks/glx/flurry.man | 2 +- hacks/glx/flyingtoasters.c | 11 +- hacks/glx/flyingtoasters.man | 2 +- hacks/glx/fps-gl.c | 17 - hacks/glx/gears.c | 11 +- hacks/glx/gears.man | 2 +- hacks/glx/geodesic.c | 11 +- hacks/glx/geodesic.man | 2 +- hacks/glx/geodesicgears.c | 32 +- hacks/glx/geodesicgears.man | 6 +- hacks/glx/gflux.c | 25 +- hacks/glx/gflux.man | 6 +- hacks/glx/gibson.c | 38 +- hacks/glx/gibson.man | 2 +- hacks/glx/glblur.c | 11 +- hacks/glx/glblur.man | 2 +- hacks/glx/glcells.c | 7 - hacks/glx/glcells.man | 4 +- hacks/glx/gleidescope.c | 10 +- hacks/glx/gleidescope.man | 2 +- hacks/glx/glforestfire.c | 14 - hacks/glx/glforestfire.man | 15 +- hacks/glx/glhanoi.c | 13 +- hacks/glx/glhanoi.man | 2 +- hacks/glx/glknots.c | 11 +- hacks/glx/glknots.man | 2 +- hacks/glx/gllist.h | 19 +- hacks/glx/glmatrix.c | 2 - hacks/glx/glmatrix.man | 2 +- hacks/glx/glplanet.c | 11 - hacks/glx/glplanet.man | 4 +- hacks/glx/glschool.c | 3 - hacks/glx/glschool.man | 2 +- hacks/glx/glschool_alg.c | 2 +- hacks/glx/glschool_gl.h | 27 +- hacks/glx/glsl-utils.c | 391 + hacks/glx/glsl-utils.h | 73 + hacks/glx/glslideshow.c | 136 +- hacks/glx/glslideshow.man | 8 +- hacks/glx/glsnake.c | 38 +- hacks/glx/glsnake.man | 18 +- hacks/glx/gltext.c | 142 +- hacks/glx/gltext.man | 33 +- hacks/glx/gltrackball.c | 25 +- hacks/glx/gltrackball.h | 2 +- hacks/glx/glut_stroke.c | 19 +- hacks/glx/glut_swidth.c | 14 +- hacks/glx/grab-ximage.c | 468 +- hacks/glx/grab-ximage.h | 51 + hacks/glx/gravitywell.c | 4 - hacks/glx/gravitywell.man | 2 +- hacks/glx/handsy.c | 2 - hacks/glx/handsy.man | 2 +- hacks/glx/headroom.c | 559 + hacks/glx/headroom.dxf | 259600 ++++++++++++++++++++++++++++ hacks/glx/headroom.man | 72 + hacks/glx/headroom_model.c | 26005 +++ hacks/glx/hexstrut.c | 11 +- hacks/glx/hexstrut.man | 2 +- hacks/glx/hilbert.c | 11 +- hacks/glx/hilbert.man | 2 +- hacks/glx/hydrostat.c | 11 +- hacks/glx/hydrostat.man | 2 +- hacks/glx/hypertorus.c | 990 +- hacks/glx/hypertorus.man | 2 +- hacks/glx/hypnowheel.c | 11 +- hacks/glx/hypnowheel.man | 2 +- hacks/glx/involute.c | 22 - hacks/glx/jigglypuff.c | 18 +- hacks/glx/jigglypuff.man | 2 +- hacks/glx/jigsaw.c | 25 +- hacks/glx/jigsaw.man | 8 +- hacks/glx/juggler3d.c | 6 +- hacks/glx/juggler3d.man | 2 +- hacks/glx/kaleidocycle.c | 11 +- hacks/glx/kaleidocycle.man | 15 +- hacks/glx/klein.c | 2572 +- hacks/glx/klein.man | 2 +- hacks/glx/lament.c | 2 - hacks/glx/lament.man | 2 +- hacks/glx/lavalite.c | 7 +- hacks/glx/lavalite.man | 15 +- hacks/glx/lockward.c | 3 - hacks/glx/lockward.man | 2 +- hacks/glx/marching.c | 23 +- hacks/glx/maze3d.c | 3 - hacks/glx/maze3d.man | 2 +- hacks/glx/menger.c | 11 +- hacks/glx/menger.man | 4 +- hacks/glx/mirrorblob.c | 15 +- hacks/glx/mirrorblob.man | 2 +- hacks/glx/moebius.c | 21 +- hacks/glx/moebius.man | 2 +- hacks/glx/moebiusgears.c | 11 +- hacks/glx/moebiusgears.man | 2 +- hacks/glx/molecule.c | 30 +- hacks/glx/molecule.man | 2 +- hacks/glx/morph3d.c | 10 +- hacks/glx/morph3d.man | 2 +- hacks/glx/noof.man | 2 +- hacks/glx/normals.c | 5 +- hacks/glx/normals.h | 18 +- hacks/glx/peepers.c | 7 +- hacks/glx/peepers.man | 2 +- hacks/glx/photopile.c | 30 +- hacks/glx/photopile.man | 8 +- hacks/glx/pinion.c | 10 +- hacks/glx/pinion.man | 2 +- hacks/glx/pipeobjs.c | 4 +- hacks/glx/pipes.c | 12 - hacks/glx/pipes.man | 2 +- hacks/glx/polyhedra-gl.c | 47 +- hacks/glx/polyhedra.man | 2 +- hacks/glx/polytopes.c | 2 + hacks/glx/polytopes.man | 6 +- hacks/glx/projectiveplane.c | 1381 +- hacks/glx/projectiveplane.man | 2 +- hacks/glx/providence.c | 12 +- hacks/glx/providence.man | 6 +- hacks/glx/pulsar.c | 11 - hacks/glx/pulsar.man | 2 +- hacks/glx/quasicrystal.c | 2 - hacks/glx/quasicrystal.man | 2 +- hacks/glx/queens.c | 16 - hacks/glx/queens.man | 4 +- hacks/glx/quickhull.c | 104 +- hacks/glx/quickhull.h | 1 + hacks/glx/raverhoop.c | 11 +- hacks/glx/raverhoop.man | 2 +- hacks/glx/razzledazzle.c | 12 +- hacks/glx/razzledazzle.man | 2 +- hacks/glx/romanboy.c | 1611 +- hacks/glx/romanboy.man | 6 +- hacks/glx/rubik.c | 10 + hacks/glx/rubik.man | 2 +- hacks/glx/rubikblocks.c | 13 +- hacks/glx/rubikblocks.man | 2 +- hacks/glx/sballs.c | 30 +- hacks/glx/sballs.man | 15 +- hacks/glx/sierpinski3d.c | 12 +- hacks/glx/sierpinski3d.man | 2 +- hacks/glx/skytentacles.c | 2 - hacks/glx/skytentacles.man | 2 +- hacks/glx/sonar-icmp.c | 61 +- hacks/glx/sonar.c | 18 +- hacks/glx/sonar.man | 57 +- hacks/glx/sphere.c | 20 +- hacks/glx/sphereeversion.c | 3339 + hacks/glx/sphereeversion.man | 256 + hacks/glx/spheremonics.c | 145 +- hacks/glx/spheremonics.man | 2 +- hacks/glx/splitflap.c | 66 +- hacks/glx/splitflap.man | 2 +- hacks/glx/splodesic.c | 11 +- hacks/glx/splodesic.man | 2 +- hacks/glx/sproingies.c | 6 +- hacks/glx/sproingies.man | 4 +- hacks/glx/sproingiewrap.c | 5 +- hacks/glx/stairs.c | 10 + hacks/glx/stairs.man | 2 +- hacks/glx/starwars.c | 25 +- hacks/glx/starwars.man | 35 +- hacks/glx/starwars.txt | 51 + hacks/glx/stonerview-view.c | 19 +- hacks/glx/stonerview.c | 2 - hacks/glx/stonerview.h | 6 +- hacks/glx/stonerview.man | 2 +- hacks/glx/superquadrics.c | 14 +- hacks/glx/superquadrics.man | 2 +- hacks/glx/surfaces.c | 13 +- hacks/glx/surfaces.man | 2 +- hacks/glx/swim.c | 2 +- hacks/glx/tangram.c | 12 +- hacks/glx/tangram.man | 2 +- hacks/glx/tangram_shapes.c | 17 +- hacks/glx/teapot.c | 16 +- hacks/glx/texfont.c | 949 +- hacks/glx/texfont.h | 16 +- hacks/glx/timetunnel.c | 4 - hacks/glx/timetunnel.man | 2 +- hacks/glx/topblock.c | 17 +- hacks/glx/topblock.man | 2 +- hacks/glx/trackball.h | 2 +- hacks/glx/tronbit.c | 13 +- hacks/glx/tronbit.man | 2 +- hacks/glx/tube.c | 22 +- hacks/glx/tunnel_draw.c | 23 +- hacks/glx/unicrud.c | 33 +- hacks/glx/unicrud.man | 2 +- hacks/glx/unknownpleasures.c | 2 - hacks/glx/unknownpleasures.man | 2 +- hacks/glx/vigilance.c | 14 +- hacks/glx/vigilance.man | 2 +- hacks/glx/voronoi.c | 4 +- hacks/glx/voronoi.man | 2 +- hacks/glx/winduprobot.c | 71 +- hacks/glx/winduprobot.man | 4 +- hacks/glx/xlock-gl-utils.c | 158 +- hacks/glx/xscreensaver-gl-visual.c | 87 + hacks/glx/xscreensaver-gl-visual.man | 33 + hacks/goop.man | 2 +- hacks/grav.man | 2 +- hacks/greynetic.man | 2 +- hacks/halftone.man | 2 +- hacks/halo.man | 2 +- hacks/helix.man | 2 +- hacks/hexadrop.c | 1 - hacks/hexadrop.man | 2 +- hacks/hopalong.man | 2 +- hacks/hyperball.man | 2 +- hacks/hypercube.man | 2 +- hacks/ifs.c | 10 +- hacks/ifs.man | 2 +- hacks/images/Makefile | 43 +- hacks/images/Makefile.in | 43 +- hacks/images/gnome1.png | Bin 0 -> 17901 bytes hacks/images/gnome2.png | Bin 0 -> 1867 bytes hacks/images/logo-360.png | Bin 0 -> 27394 bytes hacks/imsmap.man | 2 +- hacks/interaggregate.man | 2 +- hacks/interference.c | 12 +- hacks/interference.man | 2 +- hacks/intermomentary.man | 2 +- hacks/juggle.man | 2 +- hacks/julia.man | 2 +- hacks/kaleidescope.man | 15 +- hacks/kumppa.c | 3 - hacks/kumppa.man | 2 +- hacks/laser.man | 2 +- hacks/lcdscrub.c | 3 - hacks/lcdscrub.man | 2 +- hacks/lightning.man | 2 +- hacks/lisa.man | 2 +- hacks/lissie.man | 2 +- hacks/lmorph.c | 2 +- hacks/loop.man | 2 +- hacks/m6502.c | 21 +- hacks/maze.c | 11 +- hacks/memscroller.c | 61 +- hacks/memscroller.man | 2 +- hacks/metaballs.man | 2 +- hacks/moire.man | 2 +- hacks/moire2.man | 2 +- hacks/mountain.man | 2 +- hacks/munch.c | 19 +- hacks/munch.man | 56 +- hacks/munge-ad.pl | 33 +- hacks/nerverot.man | 2 +- hacks/noseguy.c | 17 +- hacks/noseguy.man | 6 +- hacks/pacman.c | 7 +- hacks/pacman.h | 8 - hacks/pacman.man | 2 +- hacks/pacman_ai.c | 6 +- hacks/pacman_level.c | 3 +- hacks/pedal.man | 2 +- hacks/penetrate.c | 96 +- hacks/penetrate.man | 15 +- hacks/penrose.c | 11 - hacks/penrose.man | 4 +- hacks/petri.man | 2 +- hacks/phosphor.c | 149 +- hacks/phosphor.man | 64 +- hacks/piecewise.man | 2 +- hacks/polyominoes.c | 7 +- hacks/polyominoes.man | 2 +- hacks/pong.c | 2 +- hacks/pong.man | 2 +- hacks/pyro.man | 2 +- hacks/qix.man | 2 +- hacks/rd-bomb.man | 2 +- hacks/recanim.c | 51 +- hacks/recanim.h | 6 +- hacks/ripples.man | 2 +- hacks/rocks.man | 2 +- hacks/rorschach.man | 2 +- hacks/rotor.man | 2 +- hacks/rotzoomer.man | 8 +- hacks/scooter.man | 6 +- hacks/screenhack.c | 47 +- hacks/screenhackI.h | 65 +- hacks/shadebobs.man | 2 +- hacks/sierpinski.man | 2 +- hacks/slidescreen.man | 8 +- hacks/slip.man | 8 +- hacks/speedmine.man | 40 +- hacks/sphere.man | 2 +- hacks/spiral.man | 2 +- hacks/spotlight.c | 15 +- hacks/spotlight.man | 8 +- hacks/squiral.man | 2 +- hacks/starfish.man | 2 +- hacks/strange.man | 2 +- hacks/substrate.man | 2 +- hacks/swirl.man | 2 +- hacks/tessellimage.c | 5 +- hacks/tessellimage.man | 2 +- hacks/testx11.c | 5 +- hacks/thornbird.man | 2 +- hacks/triangle.man | 2 +- hacks/truchet.man | 2 +- hacks/twang.man | 2 +- hacks/vermiculate.c | 5 +- hacks/vermiculate.man | 2 +- hacks/vfeedback.c | 9 - hacks/vfeedback.man | 2 +- hacks/vidwhacker | 77 +- hacks/vidwhacker.man | 10 +- hacks/vines.man | 2 +- hacks/wander.man | 2 +- hacks/webcollage-cocoa.m | 4 +- hacks/webcollage-helper.c | 14 +- hacks/webcollage.man | 47 +- hacks/whirlwindwarp.man | 2 +- hacks/worm.man | 2 +- hacks/wormhole.man | 2 +- hacks/xanalogtv.c | 14 +- hacks/xanalogtv.man | 8 +- hacks/xflame.c | 3 - hacks/xflame.man | 2 +- hacks/ximage-loader.c | 36 +- hacks/xjack.c | 83 +- hacks/xjack.man | 2 +- hacks/xlockmore.c | 42 +- hacks/xlockmore.h | 9 +- hacks/xlockmoreI.h | 79 +- hacks/xlyap.c | 3 - hacks/xmatrix.c | 72 +- hacks/xmatrix.man | 30 +- hacks/xml2man.pl | 4 +- hacks/xrayswarm.c | 8 +- hacks/xrayswarm.man | 2 +- hacks/xscreensaver-getimage-file | 1342 + hacks/xscreensaver-getimage-file.man | 63 + hacks/xscreensaver-getimage-video | 141 + hacks/xscreensaver-getimage-video.man | 51 + hacks/xscreensaver-getimage.c | 2068 + hacks/xscreensaver-getimage.man | 76 + hacks/xscreensaver-text | 1000 + hacks/xscreensaver-text.man | 88 + hacks/xspirograph.man | 2 +- hacks/xsublim.c | 5 + hacks/xsublim.man | 2 +- hacks/zoom.man | 8 +- install-sh | 693 +- intltool-update.in | 6 +- jwxyz/Makefile.in | 30 +- jwxyz/jwxyz-android.c | 300 +- jwxyz/jwxyz-cocoa.h | 16 +- jwxyz/jwxyz-cocoa.m | 69 +- jwxyz/jwxyz-common.c | 48 +- jwxyz/jwxyz-gl.c | 21 +- jwxyz/jwxyz-image.c | 10 +- jwxyz/jwxyz.h | 18 + jwxyz/jwxyz.m | 42 +- jwxyz/jwxyzI.h | 5 +- jwxyz/jwzgles.c | 108 +- jwxyz/jwzgles.h | 2 - jwxyz/jwzglesI.h | 4 +- makevms.com | 57 - po/Makefile.in.in | 13 +- po/POTFILES.in | 11 +- po/da.po | 2 +- po/de.po | 2 +- po/es.po | 2 +- po/et.po | 2 +- po/fi.po | 2 +- po/fr.po | 2 +- po/hu.po | 2 +- po/it.po | 2 +- po/ja.po | 4300 +- po/ko.po | 2 +- po/nb.po | 2 +- po/nl.po | 2 +- po/pl.po | 2 +- po/pt.po | 2 +- po/pt_BR.po | 2 +- po/ru.po | 2 +- po/sk.po | 2 +- po/sv.po | 2 +- po/vi.po | 2 +- po/wa.po | 2 +- po/zh_CN.po | 2 +- po/zh_TW.po | 2 +- setup.com | 131 - utils/Makefile.in | 73 +- utils/aligned_malloc.c | 259 +- utils/aligned_malloc.h | 8 +- utils/async_netdb.c | 4 +- utils/font-retry.c | 630 +- utils/font-retry.h | 14 +- utils/grabclient.c | 21 +- utils/grabscreen.c | 19 +- utils/grabscreen.h | 4 +- utils/images/logo-180.xpm | 4 +- utils/images/logo-360.gif | Bin 0 -> 7868 bytes utils/images/logo-360.xpm | 390 + utils/images/logo-50.xpm | 2 +- utils/images/logo.pdf | 1156 + utils/logo.c | 52 +- utils/minixpm.c | 2 +- utils/minixpm.h | 3 +- utils/queue.h | 638 + utils/textclient-mobile.c | 2 +- utils/textclient.c | 129 +- utils/textclient.h | 4 +- utils/thread_util.c | 239 +- utils/thread_util.h | 2 +- utils/usleep.h | 4 - utils/utf8wc.c | 6 +- utils/version.h | 4 +- utils/visual-gl.c | 350 +- utils/visual.h | 6 +- utils/xdbe.c | 5 +- utils/xft.c | 110 +- utils/xft.h | 7 +- utils/xftwrap.c | 206 + utils/xftwrap.h | 35 + utils/xmu.c | 197 +- utils/xmu.h | 8 +- utils/xshm.c | 29 +- utils/yarandom.c | 4 +- xscreensaver.spec | 23 +- 791 files changed, 353671 insertions(+), 35540 deletions(-) delete mode 100644 README.VMS delete mode 100644 config.h-vms mode change 100644 => 100755 config.sub create mode 100644 configure.ac delete mode 100644 configure.in create mode 100644 driver/XScreenSaver_Xm_ad.h create mode 100644 driver/XScreenSaver_ad.h create mode 100644 driver/atoms.c create mode 100644 driver/atoms.h create mode 100644 driver/atomswm.c create mode 100644 driver/blurb.c create mode 100644 driver/blurb.h create mode 100644 driver/clientmsg.c create mode 100644 driver/clientmsg.h create mode 100644 driver/dialog.c create mode 100644 driver/exts.c create mode 100644 driver/fade.c create mode 100644 driver/fade.h create mode 100644 driver/prefsw.c create mode 100644 driver/screens.h create mode 100644 driver/test-xinput.c create mode 100644 driver/test-xkb.c create mode 100644 driver/xinput.c create mode 100644 driver/xinput.h create mode 100644 driver/xscreensaver-auth.c create mode 100644 driver/xscreensaver-auth.man create mode 100644 driver/xscreensaver-gfx.c create mode 100644 driver/xscreensaver-gfx.man create mode 100644 driver/xscreensaver-settings.man create mode 100644 driver/xscreensaver.ui create mode 100644 hacks/config/beats.xml create mode 100644 hacks/config/co____9.xml create mode 100644 hacks/config/covid19.xml create mode 100644 hacks/config/headroom.xml create mode 100644 hacks/config/sphereeversion.xml create mode 100644 hacks/fonts/Makefile.in create mode 100644 hacks/fonts/OCRAStd.otf create mode 100644 hacks/fonts/SpecialElite.ttf create mode 100644 hacks/fonts/clacon.ttf create mode 100644 hacks/fonts/gallant12x22.ttf create mode 100644 hacks/fonts/luximr.ttf create mode 100644 hacks/glx/beats.c create mode 100644 hacks/glx/beats.man create mode 100644 hacks/glx/covid19.c create mode 100644 hacks/glx/covid19.man create mode 100644 hacks/glx/glsl-utils.c create mode 100644 hacks/glx/glsl-utils.h create mode 100644 hacks/glx/headroom.c create mode 100644 hacks/glx/headroom.dxf create mode 100644 hacks/glx/headroom.man create mode 100644 hacks/glx/headroom_model.c create mode 100644 hacks/glx/sphereeversion.c create mode 100644 hacks/glx/sphereeversion.man create mode 100644 hacks/glx/xscreensaver-gl-visual.c create mode 100644 hacks/glx/xscreensaver-gl-visual.man create mode 100644 hacks/images/gnome1.png create mode 100644 hacks/images/gnome2.png create mode 100644 hacks/images/logo-360.png create mode 100755 hacks/xscreensaver-getimage-file create mode 100644 hacks/xscreensaver-getimage-file.man create mode 100755 hacks/xscreensaver-getimage-video create mode 100644 hacks/xscreensaver-getimage-video.man create mode 100644 hacks/xscreensaver-getimage.c create mode 100644 hacks/xscreensaver-getimage.man create mode 100755 hacks/xscreensaver-text create mode 100644 hacks/xscreensaver-text.man mode change 100644 => 100755 install-sh mode change 100644 => 100755 intltool-update.in delete mode 100644 makevms.com delete mode 100644 setup.com create mode 100644 utils/images/logo-360.gif create mode 100644 utils/images/logo-360.xpm create mode 100644 utils/images/logo.pdf create mode 100644 utils/queue.h create mode 100644 utils/xftwrap.c create mode 100644 utils/xftwrap.h diff --git a/INSTALL b/INSTALL index 50dbe43..67d57d3 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,30 @@ -Basic Installation -================== +XScreenSaver Installation +========================= + + ./configure --help + + ./configure --prefix=/usr + make + sudo make install + make clean + + xscreensaver & + xscreensaver-settings + + There are many compilation dependencies. The configure script will + tell you what is missing. At the least, you will need development + versions of these libraries: + + perl pkg-config gettext intltool libx11 libxext libxi libxt + libxft libxinerama libxrandr libxxf86vm libgl libglu libgle + libgtk2 gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 libxml2 libpam + dbus libsystemd elogind + + BSD systems might need gmake instead of make. + + +Boilerplate 'Configure' Instructions +==================================== These are generic installation instructions. @@ -36,8 +61,7 @@ The simplest way to compile this package is: 2. Type `make' to compile the package. - 3. Optionally, type `make check' to run any self-tests that come with - the package. + 3. [There is no number three] 4. Type `make install' to install the programs and any data files and documentation. diff --git a/Makefile.in b/Makefile.in index 52f1b4f..42742d3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in --- xscreensaver, Copyright (c) 1999-2014 Jamie Zawinski. +# Makefile.in --- xscreensaver, Copyright © 1999-2021 Jamie Zawinski. # the `../configure' script generates `Makefile' from this file. @SET_MAKE@ @@ -6,23 +6,23 @@ srcdir = @srcdir@ VPATH = @srcdir@ SHELL = /bin/sh -SUBDIRS = utils jwxyz hacks/images hacks hacks/glx driver po +SUBDIRS = utils jwxyz hacks/images hacks hacks/glx hacks/fonts \ + driver po SUBDIRS2 = $(SUBDIRS) OSX android -TARFILES = README README.hacking README.VMS INSTALL \ - configure configure.in Makefile.in config.h.in \ - config.h-vms install-sh setup.com config.guess aclocal.m4 \ - ax_pthread.m4 config.sub makevms.com \ +TARFILES = README README.hacking INSTALL \ + configure configure.ac Makefile.in config.h.in \ + install-sh config.guess aclocal.m4 \ + ax_pthread.m4 config.sub \ intltool-merge.in intltool-extract.in intltool-update.in \ - xscreensaver.spec \ - OSX/xscreensaver.xcodeproj/project.pbxproj + xscreensaver.spec TAR = tar # Using $(MAKE) directly means the shell executes things even with "make -n" MAKE2 = $(MAKE) -MAKE_SUBDIR = for dir in $(SUBDIRS); do (cd $$dir; $(MAKE2) $@) || exit 5; done -MAKE_SUBDIR2 = for dir in $(SUBDIRS2); do (cd $$dir; $(MAKE2) $@) || exit 5; done +MAKE_SUBDIR = for dir in $(SUBDIRS); do (cd $$dir && $(MAKE2) $@) || exit 5; done +MAKE_SUBDIR2 = for dir in $(SUBDIRS2); do (cd $$dir && $(MAKE2) $@) || exit 5; done default:: @+$(MAKE_SUBDIR) @@ -57,8 +57,8 @@ clean:: @$(MAKE_SUBDIR2) distclean:: clean - -rm -f config.h Makefile config.status config.cache config.log TAGS *~ "#"* intltool-extract intltool-merge intltool-update @$(MAKE_SUBDIR2) + -rm -f config.h Makefile config.status config.cache config.log TAGS *~ "#"* intltool-extract intltool-merge intltool-update dist:: tar @@ -71,26 +71,31 @@ tar:: $(MAKE2) version-date distdepend ; \ $(MAKE2) _tar +list_tarfiles: + @find $(TARFILES) -type f -print | sort + _tar: @ \ - VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' utils/version.h` ; \ + VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' utils/version.h | \ + head -1` ; \ NAME="xscreensaver-$$VERS" ; \ rm -rf $$NAME ; ln -s . $$NAME ; \ - FILES= ; \ + LIST="tar$$$$.txt" ; \ ADIR=archive/ ; \ - for subdir in $(SUBDIRS2) ; do \ - d=`pwd` ; \ - cd $$subdir ; \ - FILES="$$FILES `$(MAKE2) echo_tarfiles \ - | grep -v '^.*make\[' \ - | sed \"s|^|$$subdir/|g;s| | $$subdir/|g\" \ - ` "; \ - cd $$d ; done ; \ + rm -f "$$LIST" ; \ + for subdir in . $(SUBDIRS2) ; do \ + ( cd $$subdir ; \ + $(MAKE2) list_tarfiles \ + | grep -v '^.*make\[' \ + | sed -e "s@^@$$NAME/$$subdir/@g" \ + | sed -e "s@/\./@/@g" \ + ) >> "$$LIST" ; \ + done ; \ echo creating tar file $$ADIR$$NAME.tar.gz... ; \ export COPYFILE_DISABLE=true ; \ - GZIP="-9v" $(TAR) -vczf $$ADIR$$NAME.tar.gz \ - `echo $(TARFILES) $$FILES | sed "s|^|$$NAME/|g; s| | $$NAME/|g" ` ; \ - rm $$NAME + export GZIP="-9v" ; \ + $(TAR) -vczf $$ADIR$$NAME.tar.gz -T "$$LIST" ; \ + rm "$$LIST" "$$NAME" # This also makes me sick... @@ -101,9 +106,12 @@ _tar: # of autoconf other than the ones I've tried (2.12 and 2.13.) # configure:: + rm -f configure aclocal autoconf autoheader + +configure:: @TMP=configure.$$$$ ; \ echo "munging configure's --help message..." ; \ ( perl -e ' \ @@ -111,26 +119,24 @@ configure:: while (<>) { $$file .= $$_; } \ $$_ = $$file; \ \ - s/^(Configuration:)$$/\n$$1\n/m; \ - s/^(Directory and file names:)$$/\n$$1\n/m; \ - s/^ --sbindir=.*\n//m; \ - s/^ --sysconfdir.*\n//m; \ - s/^ --sharedstatedir.*\n.*\n//m; \ - s/^ --localstatedir.*\n//m; \ - s/^ --infodir.*\n//m; \ - s/^(Host type:)$$/\n$$1\n/m; \ - s/\nFeatures and packages:\n.*library files are in DIR\n/\n/s;\ - s/--enable and --with options recognized://m; \ - s/\n --with-x .*?(["\n])/$$1/s; \ - s/\n(Installation options:\n)/$$1/s; \ + s/\nInstallation directories:.*?\n\n/\n/s; \ + s/\nOptional Features:.*?\n\n/\n/s; \ + s/\nOptional Packages:.*?\n\n/\n/s; \ \ - s/^ --oldincludedir=.*$$/ \ - --x-includes=DIR X include files are in DIR\n \ - --x-libraries=DIR X library files are in DIR/m; \ + s/^ +--sbindir=.*\n//m; \ + s/^ +--sysconfdir.*\n//m; \ + s/^ +--sharedstatedir.*\n.*\n//m; \ + s/^ +--oldincludedir.*\n//m; \ + s/^ +--infodir.*\n//m; \ + s/^ +--htmldir.*\n//m; \ + s/^ +--dvidir.*\n//m; \ + s/^ +--pdfdir.*\n//m; \ + s/^ +--psdir.*\n//m; \ + s/^ +--with-x .*\n//m; \ \ - s@mandir=.\$$\{prefix}/man.@mandir=\\\$${datadir}/man@; \ + s/(\n\n)\n+/$$1/gs; \ \ - s@rm -f conftest@rm -rf conftest@g; \ + s/rm -f conftest/rm -rf conftest/g; \ \ print;' \ < configure \ @@ -138,37 +144,68 @@ configure:: cat $$TMP > configure ) ; \ rm -f $$TMP +# WARNING: This stands a good chance of breaking the world. +# Be prepared to roll back all of /opt/local/ from Time Machine. +automake-upgrade: + sudo port upgrade autoconf automake libtool autoconf-archive + cp -p /opt/local/share/automake*/{config.guess,config.sub,install-sh} . + cp -p /opt/local/share/libtool/aclocal.m4 . + cp -p /opt/local/share/aclocal/ax_pthread.m4 . + echo also consider autoupdate + $(MAKE2) configure + + bump-version:: @ \ SRC=utils/version.h ; \ - VERS=`sed -n 's/[^0-9]*\([0-9]\)\.\([0-9][^. ]*\).*/\1 \2/p' $$SRC` ; \ + VERS=`sed -n \ + 's/[^0-9]*\([0-9]\)\.\([0-9][0-9]*\)\([^. \"]*\).*/\1 \2 \3/p' $$SRC | \ + head -1` ; \ set - $$VERS ; \ - MAJOR="$$1"; MINOR="$$2"; \ - NEW=`echo $$MINOR + 1 | bc` ; \ - NEW=`echo $$NEW | sed 's/^\([0-9]\)$$/0\1/'` ; \ - D=`date '+%d-%b-%Y'`; \ + MAJOR="$$1"; MINOR="$$2"; SUF="$$3"; \ + VERS="$$MAJOR.$$MINOR$$SUF" ; \ + if [ -z "$$SUF" ]; then \ + MINOR=`echo $$MINOR + 1 | bc | sed 's/^\(.\)/0\1/'` ; \ + else \ + set - `echo $$SUF | sed 's/^\([^0-9]*\)/\1 /'` ; \ + AA="$$1"; BB="$$2"; \ + BB=`echo $$BB + 1 | bc` ; \ + SUF="$$AA$$BB" ; \ + fi ; \ + VERS2="$$MAJOR.$$MINOR$$SUF" ; \ ADIR=archive/ ; \ - if [ ! -f $${ADIR}xscreensaver-$$MAJOR.$$MINOR.tar.gz ]; then \ - echo "WARNING: $${ADIR}xscreensaver-$$MAJOR.$$MINOR.tar.gz does not exist.";\ + if [ ! -f "$${ADIR}xscreensaver-$$VERS.tar.gz" ]; then \ + echo "WARNING: $${ADIR}xscreensaver-$$VERS.tar.gz does not exist."; \ fi ; \ - if [ -f $${ADIR}xscreensaver-$$MAJOR.$$NEW.tar.gz ]; then \ - echo "WARNING: $${ADIR}xscreensaver-$$MAJOR.$$NEW.tar.gz already exists.";\ + if [ -f "$${ADIR}xscreensaver-$$VERS2.tar.gz" ]; then \ + echo "WARNING: $${ADIR}xscreensaver-$$VERS2.tar.gz already exists."; \ fi ; \ - /bin/echo -n "Bumping $$MAJOR.$$MINOR to $$MAJOR.$$NEW ($$D), ok? "; \ + /bin/echo -n "Bumping $$VERS to $$VERS2, ok? "; \ read line; \ if [ "x$$line" != "xyes" -a "x$$line" != "xy" ]; then \ exit 1 ; \ fi ; \ + \ TMP=/tmp/bv.$$ ; \ - sed -e "s/\([0-9]\.[0-9][0-9]*\)/$$MAJOR.$$NEW/" \ - -e "s/\(([0-9][0-9]*-[A-Za-z][a-z][a-z]-[0-9][0-9][0-9]*\))/($$D)/" \ - $$SRC > $$TMP ; \ - /bin/echo -n "New version and date are "; \ - sed -n "s/[^0-9]*\([0-9]\.[0-9][0-9]*\) (\([-A-Za-z0-9]*\)).*/\1, \2./p" \ - $$TMP; \ + sed -e "s/\([0-9]\.[0-9][^. \"]*\)/$$VERS2/" $$SRC > $$TMP ; \ + if cmp -s $$SRC $$TMP ; then \ + echo "ERROR! UNCHANGED!" ; \ + exit 1 ; \ + fi ; \ + \ cat $$TMP > $$SRC ; \ rm -f $$TMP; \ - echo "overwrote $$SRC"; \ + \ + VERS3=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. \"]*\).*/\1/p' < $$SRC | \ + tail -1`; \ + if [ x"$$VERS2" != x"$$VERS3" ]; then \ + echo "ERROR! \"$$VERS2\" vs \"$$VERS3\"!" ; \ + exit 1 ; \ + fi ; \ + \ + echo "Updated $$SRC version to \"$$VERS3\"" ; \ + \ + $(MAKE) version-date ; \ ls -lFd $$SRC bump_version:: bump-version @@ -178,15 +215,18 @@ tick_version:: bump-version version-date:: @ \ SRC=utils/version.h ; \ + VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. \"]*\).*/\1/p' < $$SRC | \ + head -1`; \ D=`date '+%d-%b-%Y'`; \ + TIME_T=`perl -e "use Date::Parse; print str2time('$$D 12:00')"` ; \ TMP=/tmp/bv.$$ ; \ - sed -e "s/([0-9][^()]*)/($$D)/" < $$SRC > $$TMP ; \ - /bin/echo -n "Updating date in $$SRC to \"$$D\"... " ; \ - if cmp -s $$SRC $$TMP ; then \ - echo "unchanged." ; \ - else \ + sed -e "s/\([0-9]\.[0-9][^. \"]*\)/$$VERS/" \ + -e "s/([0-9][^()]*)/($$D)/" \ + -e "s/\(_RELEASED *\)[0-9][0-9]*/\1$$TIME_T/" \ + < $$SRC > $$TMP ; \ + if ! cmp -s $$SRC $$TMP ; then \ cat $$TMP > $$SRC ; \ - echo "done." ; \ + echo "Updated $$SRC date to \"$$D\"" ; \ fi ; \ rm -f $$TMP @@ -194,7 +234,8 @@ version-date:: update_spec_version:: @S=$(srcdir)/xscreensaver.spec ; \ U=$(srcdir)/utils/version.h ; \ - VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' < $$U` ; \ + VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' < $$U | \ + head -1` ; \ /bin/echo -n "Updating $$S to \"$$VERS\"... " ; \ T=/tmp/xs.$$$$ ; \ sed "s/^\(%define.version[^0-9]*\)\(.*\)/\1$$VERS/" \ @@ -209,7 +250,8 @@ update_spec_version:: rpm:: @ \ - VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' utils/version.h` ; \ + VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' utils/version.h | \ + head -1` ; \ DIR=`pwd`/rpm_build ; \ ARCH=`rpm --showrc | sed -n 's/^build arch *: //p'` ; \ ADIR=archive/ ; \ @@ -245,7 +287,8 @@ apk:: www:: @ \ DEST=$$HOME/www/xscreensaver ; \ - VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' utils/version.h` ; \ + VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' utils/version.h | \ + head -1` ; \ HEAD="xscreensaver-$$VERS" ; \ ADIR=archive/ ; \ BNAME="$$HEAD.tar.gz" ; \ @@ -355,10 +398,55 @@ www:: count:: @ \ - /bin/echo -n "Current hack count: " ; \ - ( ( cd hacks; make -s INSTALL=true install-program install-scripts ) ; \ - ( cd hacks/glx; make -s INSTALL=true install-program ) ) | \ - grep true | \ - grep -v helper | \ - grep -v ljlatest | \ - wc -l + echo "Current hack count: " ; \ + A=`cd hacks ; ( make -s INSTALL=true install-man | \ + grep true | grep -v helper | grep -v ljlatest | wc -l )` ; \ + echo " X11:" $$A ; \ + B=`cd hacks/glx ; ( make -s INSTALL=true install-man | \ + grep true | grep -v helper | grep -v ljlatest | wc -l )` ; \ + echo " GLX:" $$B ; \ + C=`echo $$A + $$B | bc` ; \ + echo " Total:" $$C ; \ + + +#cerebrum:: +# rsync -vax . cerebrum:src/xscreensaver/ \ + +cerebrum:: + rsync -vax . pi@10.0.1.19:xscreensaver/ \ + --omit-dir-times \ + --delete-during \ + --exclude .git \ + --exclude OSX \ + --exclude android \ + --exclude archive \ + --exclude build \ + --exclude gen \ + --exclude videos \ + --exclude config.h \ + --exclude XScreenSaver_ad.h \ + --include xscreensaver-getimage-file \ + --include xscreensaver-getimage-video \ + --include xscreensaver-text \ + --exclude '*~' \ + --include '*.asm' \ + --include '*.c' \ + --include '*.gif' \ + --include '*.h' \ + --include '*.in' \ + --include '*.jpg' \ + --include '*.m' \ + --include '*.m4' \ + --include '*.pdb' \ + --include '*.png' \ + --include '*.po' \ + --include '*.xml' \ + --include '*.xpm' \ + --include '*.man' \ + --include '*.ttf' \ + --include '*.otf' \ + --include '*.ui' \ + --include 'configure*' \ + --include '*/' \ + --exclude '*' + diff --git a/README b/README index 0b55bd1..ddb9786 100644 --- a/README +++ b/README @@ -18,33 +18,93 @@ that you install a binary release rather than trying to compile it yourself. Executables are available for almost all platforms, including macOS, iOS, and Android. See the XScreenSaver web site for details. + +=============================================================================== To compile for a Unix system with X11: +=============================================================================== + + ./configure --help + + ./configure --prefix=/usr + make + sudo make install + make clean - ./configure - make - make install + xscreensaver & + xscreensaver-settings - If you are on an "apt"-based system, "apt-get build-dep xscreensaver" - might install most of the compilation dependencies. + There are many compilation dependencies. The configure script will + tell you what is missing. At the least, you will need development + versions of these libraries: + + perl pkg-config gettext intltool libx11 libxext libxi libxt + libxft libxinerama libxrandr libxxf86vm libgl libglu libgle + libgtk2 gdk-pixbuf-2.0 gdk-pixbuf-xlib-2.0 libxml2 libpam + dbus libsystemd elogind + + BSD systems might need gmake instead of make. + + +=============================================================================== +To compile for macOS or iOS: +=============================================================================== -To compile for macOS X or iOS: + See OSX/README. Use the included Xcode project. - Use the included XCode project. Requires XCode 6 and macOS 10.8 - or newer. +=============================================================================== To compile for Android: +=============================================================================== See android/README. + +=============================================================================== Interested in writing a new screen saver? +=============================================================================== See the README.hacking file. + +=============================================================================== +Version History =============================================================================== -XScreenSaver has an extensive manual -- please read it! +6.00 * X11: Major refactor of the `xscreensaver' daemon for improved + security, dividing it into three programs: `xscreensaver', + `xscreensaver-gfx' and `xscreensaver-auth'. + * X11: Dropped support for systems older than X11R7 (2009). + * X11: Renamed `xscreensaver-demo' to `xscreensaver-settings'. + * X11: Unlock dialog has user-selectable color schemes. + * X11: Everything uses XFreeType for fonts now. + * X11: Install a few custom fonts needed by some savers. + * X11: Fading works on systems without gamma (e.g. Raspberry Pi). + * X11: Use EGL instead of GLX when available. + * X11: `xscreensaver-systemd' now detects when a video player has + inhibited screen blanking and then exits without uninhibiting. + * Improved GLSL and GLES3 support: Phong shading in `etruscanvenus', + `hypertorus', `klein', `projectiveplane',`romanboy' and + `sphereeversion'. + * Updates to `cubicgrid'. + * macOS: Added a `Random XScreenSaver' screen saver, which implements + cycle mode, among other things. + * iOS: Also added cycle mode. + +5.45 * New hacks, `covid19', `headroom', `sphereeversion' and `beats'. + * Shader updates to `hypertorus'. + * No more image-loading pause in `glslideshow'. + * BSOD supports GNOME. + * Image loaders support SVG. + * macOS: Fixed text loading on 10.15. + * X11: `xscreensaver-systemd' now allows video players to request that + the screen not blank. + * X11: -log implies -verbose -no-capture-stderr. + * X11: Glade -> GtkBuilder. + * Android: These hacks work now: `carousel', `juggler3d', `molecule', + `photopile', `polyominoes'. + * Various bug fixes. -=============================================================================== +5.44.1 * macOS: fixed some signing problems in the DMG. 5.44 * New hacks, `gibson', `etruscanvenus' and `scooter'. * BSOD supports Tivo and Nintendo. @@ -538,7 +598,7 @@ XScreenSaver has an extensive manual -- please read it! run `gdmflexiserver'. Experimental! * Fixed non-ASCII display bug in `starwars'. * Configure finds a default for imageDirectory. - * "xscreensaver-command -lock" now works even if in "screensaver + * `xscreensaver-command -lock' now works even if in "screensaver disabled" mode. * If a bad password is typed while CapsLock is on, the unlock dialog says "CapsLock?" instead of "Sorry". @@ -634,7 +694,7 @@ XScreenSaver has an extensive manual -- please read it! 4.12 * New GL hacks, `flipflop', `antspotlight', and `polytopes'. * Added VMS to `bsod'. - * Compile without warnings in "gcc -pedantic". + * Compile without warnings in `gcc -pedantic'. * Updates to `webcollage' and `queens'. * Fixed a bug that could cause PAM to hang. @@ -722,8 +782,8 @@ XScreenSaver has an extensive manual -- please read it! * Fixed a bug in `webcollage' (due to recent Alta Vista url changes) that was causing it to try and load incorrect image URLs. * Made `xscreensaver-getimage' use gdk_pixbuf if it is available: this - means that those hacks that load images will no longer rely on "xv", - "xloadimage", etc. This will close a race condition that could + means that those hacks that load images will no longer rely on `xv', + `xloadimage', etc. This will close a race condition that could sometimes cause your desktop background to be changed; and also makes it possible for those programs to operate on image files when running in windowed mode. @@ -1126,7 +1186,7 @@ XScreenSaver has an extensive manual -- please read it! * Made xscreensaver notice when there has been a sudden large jump in wall-clock time, and if so, lock right away, instead of waiting for "lockTimeout" to expire first. (Laptops need this for safer - recovery from ``hibernation.'') + recovery from hibernation.) * Added `-throttle' option to `xscreensaver-command'. 3.10 * Added `phosphor', `xmatrix', and `pulsar' hacks. @@ -1198,7 +1258,7 @@ XScreenSaver has an extensive manual -- please read it! 3.04 * Added an `xscreensaver.spec' file, to make it easier for other folks to generate RPMs. * Made the password code work on HPUX in the situation where: - ``enhanced security'' is available; but not used; but the user typed + "enhanced security" is available; but not used; but the user typed a password more than 8 characters long anyway. FTSOHPUX. 3.03 * Made locking work when passwd aging is enabled. @@ -1344,7 +1404,7 @@ XScreenSaver has an extensive manual -- please read it! * Added a `timestamp' resource that makes the `-verbose' messages include the time at which they were printed. -2.23 * The fix for SGI's ``scheme'' nonsense broke things, and let the +2.23 * The fix for SGI's "scheme" nonsense broke things, and let the user's "*background" resource show through. Fixed it in a different way. @@ -1377,7 +1437,7 @@ XScreenSaver has an extensive manual -- please read it! xscreensaver-command, which does a totally different thing. * Removed xscreensaver's `-demo' command-line option for a similar reason; use `xscreensaver-command -demo' instead. - * Disabled SGI's ``scheme'' nonsense in a better way than + * Disabled SGI's "scheme" nonsense in a better way than fully-qualifying the background colors in every single hack. * Fixed some other minor cosmetic problems when *sgiMode is turned on. * Fixed an X error in `bsod -root' (how ironic...) @@ -1498,7 +1558,7 @@ XScreenSaver has an extensive manual -- please read it! 2.06 * Merged in VMS support from Patrick Moreau. 2.05 * Fixed a MIT-SCREEN-SAVER-related crash, and tweaked - configure to detect the extra-random -Xss library. + configure to detect the extra-random -lXss library. 2.04 * HP configure tweaks. Detect and warn about LessTif. * Fixed low-color behavior of `goop', `pyro', `starfish', @@ -1650,5 +1710,6 @@ XScreenSaver has an extensive manual -- please read it! * Fixed a BadDrawable error in non-XIdle mode. * Added `blitspin' and `imsmap'. -1.01 * Current list of included hacks is now: qix, helix, rorschach, - attraction, greynetic, rocks, pyro, hopalong, and noseguy. +1.01 * Current list of included hacks is now: `qix', `helix', `rorschach', + `attraction', `greynetic', `rocks', `pyro', `hopalong', and + `noseguy'. diff --git a/README.VMS b/README.VMS deleted file mode 100644 index d190344..0000000 --- a/README.VMS +++ /dev/null @@ -1,57 +0,0 @@ -OpenVMS port of Xscreensavser version 2.10 October 1997 -========================================== - -Xscreensaver distribution can be found in 3 subdirectories: - -[.DRIVER] The Xscreensaver and Xscreensaver-command programs. -[.HACKS] Graphic demos ,can be run either through the xscreensaver program - or standalone. -[.UTILS] A small libraries of various utilities. - -This port has been tested with VAX VMS 6.1 (compiled with DEC 5 5.0 and -Motif 1.2) and AXP VMS 6.2 (compiled with DEC C 5.0 and Motif 1.2-4). - -To rebuild, you need to rebuild [.UTILS] directory first and create the -object library (look at the end of COMPILE*.COM procedure). - -You can now build the [.HACKS] directory and the [.DRIVER] directory. - -A one-step build is now available via the MAKEVMS.COM script. - -WARNING : before building [.HACKS], you may need to correct some of the -DECwindows bitmap files. Some files are bogus !! (they have a long line of -null chars at the end). These files are under -SYS$COMMON:[DECW$INCLUDE.BITMAPS] directory: - -STIPPLE.XBM -HLINES2.XBM -LIGHT_GRAY.XBM -ROOT_WEAVES.XBM -VLINES2.XBM - -These files are all used by Greynetic demo. - -Nota: link procedure automagically select appropriate X and Motif Libraries -(X11R4/Motif 1.1 - X11R5/Motif 1.2). - -The SETUP.COM procedure gives you a definition of all DCL foreign command -symbols needed to run Xscreensaver and all the graphic hacks. You need to -modify this procedure if you install these programs in another directory tree. - -You can easily add new graphic demos without recompiling Xscreensaver. You just -need to add them in resource file XSCREENSAVER.DAT. This file (originally -present in [.DRIVER] directory ) can be installed under your SYS$LOGIN -directory for a per-user customization basis. You can also install it under -the system-wide user resource directory SYS$COMMON:[DECW$DEFAULT.USER] -(with (W:RE) protections). The new graphics hack must be run in root-window -mode to be accepted by Xscreensaver. - -The graphic demos are spawn into subprocess created by the system() call (in -the Unix version the execvp() call is used). - -The VMS passord checking programs were picked up in the Xlock distribution. - -Enjoy, - -Patrick MOREAU - CENA/Athis-Mons - FRANCE (pmoreau@cena.dgac.fr) - (moreau_p@decus.decus.fr) diff --git a/README.hacking b/README.hacking index f2958b4..39f9e14 100644 --- a/README.hacking +++ b/README.hacking @@ -50,6 +50,11 @@ Requirements for inclusion with the XScreenSaver collection your name and the current year). The GNU GPL is not compatible with the rest of XScreenSaver. + - No clocks! Just as time travellers always try to kill Hitler on their + first trip, everyone seems to think that their first screen saver + should be a clock of some kind. Nobody needs to know what time it is + with such frequency. Fight The Tyranny Of The Clock. + ========================================================================== The XScreenSaver API @@ -184,6 +189,10 @@ Programming Tips in long-lived processes where no such cleanup takes place. Consider Valgrind or gcc -fsanitize=leak to find memory leaks. + - Again, don't use global variables. If you are doing your developent + under X11, test your saver from the command line with the "-pair" + argument. If that crashes, you're using global variables! + ========================================================================== macOS, iOS and Android @@ -201,4 +210,30 @@ macOS, iOS and Android To check that an X11 saver will fit well on a mobile device, test it with -geometry 640x1136 and 640x960. That's a good first step, anyway. + +========================================================================== +Theory behind the ifdefs +========================================================================== + + HAVE_ macros indicate that an API is available. + USE_ macros indicate that a feature is requested. + + Some notable ones: + + HAVE_GL The OpenGL 1.3 API is available, natively or through emulation. + HAVE_GLES The OpenGLES 1.x API is available. + HAVE_COCOA The Cocoa API is available, meaning compiling for macOS or iOS. + HAVE_IPHONE Compiling for iOS, including iPad. + HAVE_ANDROID Compiling for Android. + HAVE_MOBILE iOS or Android, typically used for things related to rotation + or screen size that apply to all phones and tablets. + HAVE_JWXYZ Compiling on a system where the X11 API is emulated + (macOS, iOS or Android). + HAVE_JWZGLES Compiling on a system where the OpenGL 1.3 API is emulated + (iOS, Android, possibly Linux). + HAVE_GLSL Compiling against a library that supports the GL Shading + Language. Note that using GLSL also requires a runtime check + to see which version of GLSL the *running* system supports. + HAVE_EGL OpenGL interfaces with native windows via EGL instead of GLX. + ========================================================================== diff --git a/aclocal.m4 b/aclocal.m4 index d25f855..45eab98 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.1 -*- Autoconf -*- +# generated automatically by aclocal 1.16.3 -*- Autoconf -*- -# Copyright (C) 1996-2018 Free Software Foundation, Inc. +# Copyright (C) 1996-2020 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -701,7 +701,7 @@ AC_DEFUN([AM_NLS], AC_SUBST([USE_NLS]) ]) -# Copyright (C) 2006-2018 Free Software Foundation, Inc. +# Copyright (C) 2006-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/ax_pthread.m4 b/ax_pthread.m4 index d383ad5..e5858e5 100644 --- a/ax_pthread.m4 +++ b/ax_pthread.m4 @@ -1,5 +1,5 @@ # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_pthread.html +# https://www.gnu.org/software/autoconf-archive/ax_pthread.html # =========================================================================== # # SYNOPSIS @@ -14,24 +14,28 @@ # flags that are needed. (The user can also force certain compiler # flags/libs to be tested by setting these environment variables.) # -# Also sets PTHREAD_CC to any special C compiler that is needed for -# multi-threaded programs (defaults to the value of CC otherwise). (This -# is necessary on AIX to use the special cc_r compiler alias.) +# Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is +# needed for multi-threaded programs (defaults to the value of CC +# respectively CXX otherwise). (This is necessary on e.g. AIX to use the +# special cc_r/CC_r compiler alias.) # # NOTE: You are assumed to not only compile your program with these flags, -# but also link it with them as well. e.g. you should link with +# but also to link with them as well. For example, you might link with # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS # -# If you are only building threads programs, you may wish to use these +# If you are only building threaded programs, you may wish to use these # variables in your default LIBS, CFLAGS, and CC: # # LIBS="$PTHREAD_LIBS $LIBS" # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" # CC="$PTHREAD_CC" +# CXX="$PTHREAD_CXX" # # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant -# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name -# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to +# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). # # Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the # PTHREAD_PRIO_INHERIT symbol is defined when compiling with @@ -55,6 +59,7 @@ # # Copyright (c) 2008 Steven G. Johnson # Copyright (c) 2011 Daniel Richard G. +# Copyright (c) 2019 Marc Stevens # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the @@ -67,7 +72,7 @@ # Public License for more details. # # You should have received a copy of the GNU General Public License along -# with this program. If not, see . +# with this program. If not, see . # # As a special exception, the respective Autoconf Macro's copyright owner # gives unlimited permission to copy, distribute and modify the configure @@ -82,35 +87,41 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 21 +#serial 30 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ -AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_CANONICAL_TARGET]) +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_PROG_SED]) AC_LANG_PUSH([C]) ax_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h -# requires special compiler flags (e.g. on True64 or Sequent). +# requires special compiler flags (e.g. on Tru64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: -if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then - save_CFLAGS="$CFLAGS" +if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then + ax_pthread_save_CC="$CC" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) + AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"]) CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) - AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes]) + AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) + AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) AC_MSG_RESULT([$ax_pthread_ok]) - if test x"$ax_pthread_ok" = xno; then + if test "x$ax_pthread_ok" = "xno"; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" + CC="$ax_pthread_save_CC" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" fi # We must check for the threads library under a number of different @@ -118,12 +129,14 @@ fi # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). -# Create a list of thread flags to try. Items starting with a "-" are -# C compiler flags, and other items are library names, except for "none" -# which indicates that we try without any flags at all, and "pthread-config" -# which is a program returning the flags for the Pth emulation library. +# Create a list of thread flags to try. Items with a "," contain both +# C compiler flags (before ",") and linker flags (after ","). Other items +# starting with a "-" are C compiler flags, and remaining items are +# library names, except for "none" which indicates that we try without +# any flags at all, and "pthread-config" which is a program returning +# the flags for the Pth emulation library. -ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" +ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: @@ -132,82 +145,163 @@ ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mt # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) -# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) -# -pthreads: Solaris/gcc -# -mthreads: Mingw32/gcc, Lynx/gcc +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 +# (Note: HP C rejects this with "bad form for `-t' option") +# -pthreads: Solaris/gcc (Note: HP C also rejects) # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads too; -# also defines -D_REENTRANT) -# ... -mt is also the pthreads flag for HP/aCC +# doesn't hurt to check since this sometimes defines pthreads and +# -D_REENTRANT too), HP C (must be checked before -lpthread, which +# is present but should not be used directly; and before -mthreads, +# because the compiler interprets this as "-mt" + "-hreads") +# -mthreads: Mingw32/gcc, Lynx/gcc # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) -case ${host_os} in +case $target_os in + + freebsd*) + + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + + ax_pthread_flags="-kthread lthread $ax_pthread_flags" + ;; + + hpux*) + + # From the cc(1) man page: "[-mt] Sets various -D flags to enable + # multi-threading and also sets -lpthread." + + ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" + ;; + + openedition*) + + # IBM z/OS requires a feature-test macro to be defined in order to + # enable POSIX threads at all, so give the user a hint if this is + # not set. (We don't define these ourselves, as they can affect + # other portions of the system API in unpredictable ways.) + + AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], + [ +# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) + AX_PTHREAD_ZOS_MISSING +# endif + ], + [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) + ;; + solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthreads/-mt/ - # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather - # a function called by this macro, so we could check for that, but - # who knows whether they'll stub that too in a future libc.) So, - # we'll just look for -pthreads and -lpthread first: + # tests will erroneously succeed. (N.B.: The stubs are missing + # pthread_cleanup_push, or rather a function called by this macro, + # so we could check for that, but who knows whether they'll stub + # that too in a future libc.) So we'll check first for the + # standard Solaris way of linking pthreads (-mt -lpthread). + + ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags" + ;; +esac + +# Are we compiling with Clang? + +AC_CACHE_CHECK([whether $CC is Clang], + [ax_cv_PTHREAD_CLANG], + [ax_cv_PTHREAD_CLANG=no + # Note that Autoconf sets GCC=yes for Clang as well as GCC + if test "x$GCC" = "xyes"; then + AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], + [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif + ], + [ax_cv_PTHREAD_CLANG=yes]) + fi + ]) +ax_pthread_clang="$ax_cv_PTHREAD_CLANG" + + +# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) + +# Note that for GCC and Clang -pthread generally implies -lpthread, +# except when -nostdlib is passed. +# This is problematic using libtool to build C++ shared libraries with pthread: +# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460 +# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333 +# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555 +# To solve this, first try -pthread together with -lpthread for GCC + +AS_IF([test "x$GCC" = "xyes"], + [ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"]) + +# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first + +AS_IF([test "x$ax_pthread_clang" = "xyes"], + [ax_pthread_flags="-pthread,-lpthread -pthread"]) - ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" + +# The presence of a feature test macro requesting re-entrant function +# definitions is, on some systems, a strong hint that pthreads support is +# correctly enabled + +case $target_os in + darwin* | hpux* | linux* | osf* | solaris*) + ax_pthread_check_macro="_REENTRANT" ;; - darwin*) - ax_pthread_flags="-pthread $ax_pthread_flags" + aix*) + ax_pthread_check_macro="_THREAD_SAFE" ;; -esac -# Clang doesn't consider unrecognized options an error unless we specify -# -Werror. We throw in some extra Clang-specific options to ensure that -# this doesn't happen for GCC, which also accepts -Werror. + *) + ax_pthread_check_macro="--" + ;; +esac +AS_IF([test "x$ax_pthread_check_macro" = "x--"], + [ax_pthread_check_cond=0], + [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) -AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags]) -save_CFLAGS="$CFLAGS" -ax_pthread_extra_flags="-Werror" -CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument" -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])], - [AC_MSG_RESULT([yes])], - [ax_pthread_extra_flags= - AC_MSG_RESULT([no])]) -CFLAGS="$save_CFLAGS" -if test x"$ax_pthread_ok" = xno; then -for flag in $ax_pthread_flags; do +if test "x$ax_pthread_ok" = "xno"; then +for ax_pthread_try_flag in $ax_pthread_flags; do - case $flag in + case $ax_pthread_try_flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; + *,*) + PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"` + PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"` + AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"]) + ;; + -*) - AC_MSG_CHECKING([whether pthreads work with $flag]) - PTHREAD_CFLAGS="$flag" + AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) + PTHREAD_CFLAGS="$ax_pthread_try_flag" ;; pthread-config) AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) - if test x"$ax_pthread_config" = xno; then continue; fi + AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) - AC_MSG_CHECKING([for the pthreads library -l$flag]) - PTHREAD_LIBS="-l$flag" + AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) + PTHREAD_LIBS="-l$ax_pthread_try_flag" ;; esac - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we @@ -218,8 +312,18 @@ for flag in $ax_pthread_flags; do # pthread_cleanup_push because it is one of the few pthread # functions on Solaris that doesn't have a non-functional libc stub. # We try pthread_create on general principles. + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include - static void routine(void *a) { a = 0; } +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif + static void *some_global = NULL; + static void routine(void *a) + { + /* To avoid any unused-parameter or + unused-but-set-parameter warning. */ + some_global = a; + } static void *start_routine(void *a) { return a; }], [pthread_t th; pthread_attr_t attr; pthread_create(&th, 0, start_routine, 0); @@ -227,101 +331,187 @@ for flag in $ax_pthread_flags; do pthread_attr_init(&attr); pthread_cleanup_push(routine, 0); pthread_cleanup_pop(0) /* ; */])], - [ax_pthread_ok=yes], - []) + [ax_pthread_ok=yes], + []) - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" AC_MSG_RESULT([$ax_pthread_ok]) - if test "x$ax_pthread_ok" = xyes; then - break; - fi + AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi + +# Clang needs special handling, because older versions handle the -pthread +# option in a rather... idiosyncratic way + +if test "x$ax_pthread_clang" = "xyes"; then + + # Clang takes -pthread; it has never supported any other flag + + # (Note 1: This will need to be revisited if a system that Clang + # supports has POSIX threads in a separate library. This tends not + # to be the way of modern systems, but it's conceivable.) + + # (Note 2: On some systems, notably Darwin, -pthread is not needed + # to get POSIX threads support; the API is always present and + # active. We could reasonably leave PTHREAD_CFLAGS empty. But + # -pthread does define _REENTRANT, and while the Darwin headers + # ignore this macro, third-party headers might not.) + + # However, older versions of Clang make a point of warning the user + # that, in an invocation where only linking and no compilation is + # taking place, the -pthread option has no effect ("argument unused + # during compilation"). They expect -pthread to be passed in only + # when source code is being compiled. + # + # Problem is, this is at odds with the way Automake and most other + # C build frameworks function, which is that the same flags used in + # compilation (CFLAGS) are also used in linking. Many systems + # supported by AX_PTHREAD require exactly this for POSIX threads + # support, and in fact it is often not straightforward to specify a + # flag that is used only in the compilation phase and not in + # linking. Such a scenario is extremely rare in practice. + # + # Even though use of the -pthread flag in linking would only print + # a warning, this can be a nuisance for well-run software projects + # that build with -Werror. So if the active version of Clang has + # this misfeature, we search for an option to squash it. + + AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown + # Create an alternate version of $ac_link that compiles and + # links in two steps (.c -> .o, .o -> exe) instead of one + # (.c -> exe), because the warning occurs only in the second + # step + ax_pthread_save_ac_link="$ac_link" + ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' + ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"` + ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" + ax_pthread_save_CFLAGS="$CFLAGS" + for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do + AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) + CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" + ac_link="$ax_pthread_save_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [ac_link="$ax_pthread_2step_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [break]) + ]) + done + ac_link="$ax_pthread_save_ac_link" + CFLAGS="$ax_pthread_save_CFLAGS" + AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" + ]) + + case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in + no | unknown) ;; + *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; + esac + +fi # $ax_pthread_clang = yes + + + # Various other checks: -if test "x$ax_pthread_ok" = xyes; then - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - save_CFLAGS="$CFLAGS" +if test "x$ax_pthread_ok" = "xyes"; then + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - AC_MSG_CHECKING([for joinable pthread attribute]) - attr_name=unknown - for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], - [int attr = $attr; return attr /* ; */])], - [attr_name=$attr; break], - []) - done - AC_MSG_RESULT([$attr_name]) - if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then - AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name], - [Define to necessary symbol if this constant - uses a non-standard name on your system.]) - fi - - AC_MSG_CHECKING([if more special flags are required for pthreads]) - flag=no - case ${host_os} in - aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; - osf* | hpux*) flag="-D_REENTRANT";; - solaris*) - if test "$GCC" = "yes"; then - flag="-D_REENTRANT" - else - # TODO: What about Clang on Solaris? - flag="-mt -D_REENTRANT" - fi - ;; - esac - AC_MSG_RESULT([$flag]) - if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" - fi + AC_CACHE_CHECK([for joinable pthread attribute], + [ax_cv_PTHREAD_JOINABLE_ATTR], + [ax_cv_PTHREAD_JOINABLE_ATTR=unknown + for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $ax_pthread_attr; return attr /* ; */])], + [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], + []) + done + ]) + AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ + test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ + test "x$ax_pthread_joinable_attr_defined" != "xyes"], + [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], + [$ax_cv_PTHREAD_JOINABLE_ATTR], + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + ax_pthread_joinable_attr_defined=yes + ]) + + AC_CACHE_CHECK([whether more special flags are required for pthreads], + [ax_cv_PTHREAD_SPECIAL_FLAGS], + [ax_cv_PTHREAD_SPECIAL_FLAGS=no + case $target_os in + solaris*) + ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" + ;; + esac + ]) + AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ + test "x$ax_pthread_special_flags_added" != "xyes"], + [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" + ax_pthread_special_flags_added=yes]) AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], - [ax_cv_PTHREAD_PRIO_INHERIT], [ - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[int i = PTHREAD_PRIO_INHERIT;]])], - [ax_cv_PTHREAD_PRIO_INHERIT=yes], - [ax_cv_PTHREAD_PRIO_INHERIT=no]) + [ax_cv_PTHREAD_PRIO_INHERIT], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[int i = PTHREAD_PRIO_INHERIT; + return i;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) ]) - AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], - [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ + test "x$ax_pthread_prio_inherit_defined" != "xyes"], + [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) + ax_pthread_prio_inherit_defined=yes + ]) - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" # More AIX lossage: compile with *_r variant - if test "x$GCC" != xyes; then - case $host_os in + if test "x$GCC" != "xyes"; then + case $target_os in aix*) AS_CASE(["x/$CC"], - [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], - [#handle absolute path differently from PATH based program lookup - AS_CASE(["x$CC"], - [x/*], - [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], - [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], + [#handle absolute path differently from PATH based program lookup + AS_CASE(["x$CC"], + [x/*], + [ + AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"]) + AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])]) + ], + [ + AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC]) + AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])]) + ] + ) + ]) ;; esac fi fi test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" +test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" AC_SUBST([PTHREAD_LIBS]) AC_SUBST([PTHREAD_CFLAGS]) AC_SUBST([PTHREAD_CC]) +AC_SUBST([PTHREAD_CXX]) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$ax_pthread_ok" = xyes; then +if test "x$ax_pthread_ok" = "xyes"; then ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) : else diff --git a/config.guess b/config.guess index 256083a..0fc11ed 100755 --- a/config.guess +++ b/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2018 Free Software Foundation, Inc. +# Copyright 1992-2020 Free Software Foundation, Inc. -timestamp='2018-03-08' +timestamp='2020-11-07' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ timestamp='2018-03-08' # Please send patches to . -me=`echo "$0" | sed -e 's,.*/,,'` +me=$(echo "$0" | sed -e 's,.*/,,') usage="\ Usage: $0 [OPTION] @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2018 Free Software Foundation, Inc. +Copyright 1992-2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -84,8 +84,6 @@ if test $# != 0; then exit 1 fi -trap 'exit 1' 1 2 15 - # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a @@ -96,41 +94,47 @@ trap 'exit 1' 1 2 15 # Portable tmp directory creation inspired by the Autoconf team. -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > "$dummy.c" ; - for c in cc gcc c89 c99 ; do - if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039 + { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD="$driver" + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then +if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown +UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown +UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown +UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) @@ -138,7 +142,7 @@ Linux|GNU|GNU/*) # We could probably try harder. LIBC=gnu - eval "$set_cc_for_build" + set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) @@ -146,17 +150,15 @@ Linux|GNU|GNU/*) #elif defined(__dietlibc__) LIBC=dietlibc #else + #include + #ifdef __DEFINED_va_list + LIBC=musl + #else LIBC=gnu #endif + #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" - - # If ldd exists, use it to detect musl libc. - if command -v ldd >/dev/null && \ - ldd --version 2>&1 | grep -q ^musl - then - LIBC=musl - fi + eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')" ;; esac @@ -175,19 +177,20 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ - echo unknown)` + echo unknown)) case "$UNAME_MACHINE_ARCH" in + aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) - arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,') + endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p') machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; @@ -199,7 +202,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval "$set_cc_for_build" + set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then @@ -218,7 +221,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr") ;; esac # The OS release @@ -231,24 +234,24 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in release='-gnu' ;; *) - release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2) ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "$machine-${os}${release}${abi}" + echo "$machine-${os}${release}${abi-}" exit ;; *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//') echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//') echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//') echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) @@ -260,6 +263,9 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; + *:OS108:*:*) + echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE" + exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; @@ -269,26 +275,29 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; + *:Twizzler:*:*) + echo "$UNAME_MACHINE"-unknown-twizzler + exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) - echo mips-dec-osf1 - exit ;; + echo mips-dec-osf1 + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}') ;; *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}') ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1) case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; @@ -326,7 +335,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" + echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -360,7 +369,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then + if test "$( (/bin/universe) 2>/dev/null)" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd @@ -373,28 +382,28 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in + case $(/usr/bin/uname -p) in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) - echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" exit ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval "$set_cc_for_build" + set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null @@ -402,30 +411,30 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in SUN_ARCH=x86_64 fi fi - echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in + case "$(/usr/bin/arch -k)" in Series*|S4*) - UNAME_RELEASE=`uname -v` + UNAME_RELEASE=$(uname -v) ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" + echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null) test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 - case "`/bin/arch`" in + case "$(/bin/arch)" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; @@ -482,7 +491,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) - eval "$set_cc_for_build" + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ @@ -505,8 +514,8 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && - dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`"$dummy" "$dummyarg"` && + dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') && + SYSTEM_NAME=$("$dummy" "$dummyarg") && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; @@ -533,11 +542,11 @@ EOF exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] + UNAME_PROCESSOR=$(/usr/bin/uname -p) + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then - if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ - [ "$TARGET_BINARY_INTERFACE"x = x ] + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x then echo m88k-dg-dgux"$UNAME_RELEASE" else @@ -561,17 +570,17 @@ EOF echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) - echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" + echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + exit ;; # Note that: echo "'$(uname -s)'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if test -x /usr/bin/oslevel ; then + IBM_REV=$(/usr/bin/oslevel) else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi @@ -579,7 +588,7 @@ EOF exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval "$set_cc_for_build" + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include @@ -591,7 +600,7 @@ EOF exit(0); } EOF - if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") then echo "$SYSTEM_NAME" else @@ -604,15 +613,15 @@ EOF fi exit ;; *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }') if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi - if [ -x /usr/bin/lslpp ] ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + if test -x /usr/bin/lslpp ; then + IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/) else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi @@ -640,14 +649,14 @@ EOF echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + if test -x /usr/bin/getconf; then + sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null) + sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null) case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 @@ -659,8 +668,8 @@ EOF esac ;; esac fi - if [ "$HP_ARCH" = "" ]; then - eval "$set_cc_for_build" + if test "$HP_ARCH" = ""; then + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE @@ -694,13 +703,13 @@ EOF exit (0); } EOF - (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy") test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ "$HP_ARCH" = hppa2.0w ] + if test "$HP_ARCH" = hppa2.0w then - eval "$set_cc_for_build" + set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler @@ -722,11 +731,11 @@ EOF echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) - eval "$set_cc_for_build" + set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int @@ -752,7 +761,7 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; @@ -772,7 +781,7 @@ EOF echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then + if test -x /usr/sbin/sysversion ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 @@ -821,14 +830,14 @@ EOF echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz) + FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') + FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/') echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') + FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/') echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -840,15 +849,26 @@ EOF *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=$(uname -p) + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi + else + echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf + fi + exit ;; *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` + UNAME_PROCESSOR=$(/usr/bin/uname -p) case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac - echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" + echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin @@ -881,21 +901,21 @@ EOF echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin + echo x86_64-pc-cygwin exit ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; *:GNU:*:*) # the GNU system - echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" + echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" + echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC" exit ;; - i*86:Minix:*:*) - echo "$UNAME_MACHINE"-pc-minix + *:Minix:*:*) + echo "$UNAME_MACHINE"-unknown-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" @@ -905,7 +925,7 @@ EOF echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; @@ -922,7 +942,7 @@ EOF echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) - eval "$set_cc_for_build" + set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then @@ -971,23 +991,51 @@ EOF echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) - eval "$set_cc_for_build" + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el + MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} + MIPS_ENDIAN= #else - CPU= + MIPS_ENDIAN= #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" - test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } + eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" @@ -1006,7 +1054,7 @@ EOF exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; @@ -1046,7 +1094,17 @@ EOF echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + set_cc_for_build + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_X32 >/dev/null + then + LIBCABI="$LIBC"x32 + fi + fi + echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" @@ -1086,7 +1144,7 @@ EOF echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) - UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//') if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else @@ -1095,19 +1153,19 @@ EOF exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in + case $(/bin/uname -X | grep "^Machine") in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" + echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //')) (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 @@ -1157,7 +1215,7 @@ EOF 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ @@ -1168,7 +1226,7 @@ EOF NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ @@ -1201,7 +1259,7 @@ EOF exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=$( (uname -p) 2>/dev/null) echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv @@ -1235,7 +1293,7 @@ EOF echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then + if test -d /usr/nec; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" @@ -1283,44 +1341,48 @@ EOF *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; + arm64:Darwin:*:*) + echo aarch64-apple-darwin"$UNAME_RELEASE" + exit ;; *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval "$set_cc_for_build" - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc + UNAME_PROCESSOR=$(uname -p) + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build fi - if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc - if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_PPC >/dev/null - then - UNAME_PROCESSOR=powerpc - fi + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` + UNAME_PROCESSOR=$(uname -p) if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc @@ -1358,6 +1420,7 @@ EOF # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. + # shellcheck disable=SC2154 if test "$cputype" = 386; then UNAME_MACHINE=i386 else @@ -1387,10 +1450,10 @@ EOF echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) - echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" + echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" exit ;; *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` + UNAME_MACHINE=$( (uname -p) 2>/dev/null) case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; @@ -1400,7 +1463,7 @@ EOF echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" + echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos @@ -1414,8 +1477,148 @@ EOF amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; + *:Unleashed:*:*) + echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" + exit ;; esac +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" < +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=$( (hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null); + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); +#endif + +#if defined (vax) +#if !defined (ultrix) +#include +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=$($dummy) && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } + echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in @@ -1438,6 +1641,12 @@ copies of config.guess and config.sub with the latest versions from: https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess and https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub +EOF + +year=$(echo $timestamp | sed 's,-.*,,') +# shellcheck disable=SC2003 +if test "$(expr "$(date +%Y)" - "$year")" -lt 3 ; then + cat >&2 </dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` +uname -m = $( (uname -m) 2>/dev/null || echo unknown) +uname -r = $( (uname -r) 2>/dev/null || echo unknown) +uname -s = $( (uname -s) 2>/dev/null || echo unknown) +uname -v = $( (uname -v) 2>/dev/null || echo unknown) -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` +/usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null) +/bin/uname -X = $( (/bin/uname -X) 2>/dev/null) -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` +hostinfo = $( (hostinfo) 2>/dev/null) +/bin/universe = $( (/bin/universe) 2>/dev/null) +/usr/bin/arch -k = $( (/usr/bin/arch -k) 2>/dev/null) +/bin/arch = $( (/bin/arch) 2>/dev/null) +/usr/bin/oslevel = $( (/usr/bin/oslevel) 2>/dev/null) +/usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null) UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF +fi exit 1 diff --git a/config.h-vms b/config.h-vms deleted file mode 100644 index 7a30b19..0000000 --- a/config.h-vms +++ /dev/null @@ -1,284 +0,0 @@ -/* This is a config.h file that has been pregenerated (from config.h.in) - * with settings that are correct for VMS. - */ - - - -/* config.h.in --- xscreensaver, Copyright (c) 1998 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. - */ - - -/* ************************************************************************* - CONFIGURING SERVER EXTENSIONS - ************************************************************************* */ - -/* Define this if you have the XReadDisplay extension (I think this is an - SGI-only thing; it's in .) A few of the - screenhacks will take advantage of this if it's available. - */ -#undef HAVE_READ_DISPLAY_EXTENSION - -/* Define this if you have the Iris Video Library (dmedia/vl.h on SGI.) - A few of the screenhacks will take advantage of this if it's available. - */ -#undef HAVE_SGI_VIDEO - -/* Define this if you have the XHPDisableReset function (an HP only thing.) - */ -#undef HAVE_XHPDISABLERESET - -/* First, some background: there are three distinct server extensions which - * are useful to a screen saver program: they are XIDLE, MIT-SCREEN-SAVER, - * and SCREEN_SAVER. - * - * The XIDLE extension resides in .../contrib/extensions/xidle/ on the X11R5 - * contrib tape. This extension lets the client get accurate idle-time - * information from the X server in a potentially more reliable way than by - * simply watching for keyboard and mouse activity. However, the XIDLE - * extension has apparently not been ported to X11R6. - * - * The SCREEN_SAVER extension is found (as far as I know) only in the SGI - * X server, and it exists in all releases since (at least) Irix 5. The - * relevant header file is /usr/include/X11/extensions/XScreenSaver.h. - * - * The similarly-named MIT-SCREEN-SAVER extension came into existence long - * after the SGI SCREEN_SAVER extension was already in use, and resides in - * .../contrib/extensions/screensaver/ on the X11R6 contrib tape. It is - * also found in certain recent X servers built in to NCD X terminals. - * - * The MIT extension does basically the same thing that the XIDLE extension - * does, but there are two things wrong with it: first, because of the way - * the extension was designed, the `fade' option to XScreenSaver will be - * uglier: just before the screen fades out, there will be an unattractive - * flicker to black, because this extension blanks the screen *before* - * telling us that it is time to do so. Second, this extension is known to - * be buggy; on the systems I use, it works, but some people have reported - * X server crashes as a result of using it. XScreenSaver uses this - * extension rather conservatively, because when I tried to use any of its - * more complicated features, I could get it to crash the server at the - * drop of a hat. - * - * In short, the MIT-SCREEN-SAVER extension is a piece of junk. The older - * SGI SCREEN_SAVER extension works great, as does XIDLE. It would be nice - * If those two existed on more systems, that is, would be adopted by the - * X Consortium in favor of their inferior "not-invented-here" entry. - */ - -/* 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. - */ -#undef HAVE_XIDLE_EXTENSION - -/* Define this if you have the MIT-SCREEN-SAVER extension installed. See the - * caveats about this extension, above. (It's available if the file - * /usr/include/X11/extensions/scrnsaver.h exists.) - */ -#undef HAVE_MIT_SAVER_EXTENSION - -/* Define this if you have the SGI SCREEN_SAVER extension. This is standard - * on Irix systems, and not available elsewhere. - */ -#undef HAVE_SGI_SAVER_EXTENSION - -/* Define this if you have the SGI-VIDEO-CONTROL extension. This is standard - * on Irix systems, and not available elsewhere. - */ -#undef HAVE_SGI_VC_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.) - */ -#define HAVE_DPMS_EXTENSION 1 - - -/* ************************************************************************* - CONFIGURING GRAPHICS TOOLKITS - ************************************************************************* */ - -/* Define this if you have Motif. - */ -#define HAVE_MOTIF 1 - -/* Define this if you have the XmComboBox Motif widget (Motif 2.0.) - */ -#undef HAVE_XMCOMBOBOX - -/* Define this if you have the XPM library installed. Some of the demos can - * make use of this if it is available. - */ -#define HAVE_XPM 1 - -/* 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. - */ -#define HAVE_XMU 1 - -/* 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.) - */ -#undef HAVE_GL - -/* Define this if you have OpenGL, but it's the MesaGL variant. (The - libraries have different names.) (HAVE_GL should be defined too.) - */ -#undef HAVE_MESA_GL - -/* 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. - */ -#undef HAVE_GLBINDTEXTURE - -/* Define this if you have the X Shared Memory Extension. - */ -#undef HAVE_XSHM_EXTENSION - - -/* ************************************************************************* - CONFIGURING PASSWORD AUTHENTICATION - ************************************************************************* */ - -/* Define this to remove the option of locking the screen at all. - */ -#undef NO_LOCKING - -/* 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. - */ -#undef HAVE_KERBEROS - - -/* 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.c if - * you're having trouble related to reading passwords.) - */ -#undef HAVE_SHADOW_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// - instead of in /etc/passwd, and one reads them with getprpwnam() instead - of getpwnam(). - */ -#undef HAVE_ENHANCED_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. - */ -#undef HAVE_ADJUNCT_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. - */ -#undef HAVE_HPUX_PASSWD - -/* Define this if you are on a system that supports the VT_LOCKSWITCH and - VT_UNLOCKSWITCH ioctls. If this is defined, then when the screen is - locked, switching to another virtual terminal will also be prevented. - That is, the whole console will be locked, rather than just the VT on - which X is running. - */ -#define HAVE_VT_LOCKSWITCH 1 - - -/* ************************************************************************* - OTHER C ENVIRONMENT JUNK - ************************************************************************* */ - -/* Define this to void* if you're using X11R4 or earlier. */ -#undef XPointer - -/* Define if you have the nice function. */ -#undef HAVE_NICE - -/* Define if you have the setpriority function. */ -#undef HAVE_SETPRIORITY - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define if you have that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H - -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline - -/* Define to `int' if doesn't define. */ -#undef mode_t - -/* Define to `int' if doesn't define. */ -#undef pid_t - -/* Define as the return type of signal handlers (int or void). */ -#define RETSIGTYPE void - -/* Define to `unsigned' if doesn't define. */ -#undef size_t - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Define if you have the gettimeofday function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define if gettimeofday requires two arguments. */ -#undef GETTIMEOFDAY_TWO_ARGS - -/* Define if you have the putenv function. */ -#undef HAVE_PUTENV - -/* Define if you have the select function. */ -#undef HAVE_SELECT - -/* Define if you have the getcwd function. */ -#undef HAVE_GETCWD - -/* Define if you have the getcwd function. */ -#undef HAVE_GETWD - -/* Define if you have the uname function. */ -#undef HAVE_UNAME -#if (__VMS_VER >= 70000000) -# define HAVE_UNAME 1 -#endif - -/* Define if you have the fcntl function. */ -#undef HAVE_FCNTL - -/* Define if you have the sigaction function. */ -#undef HAVE_SIGACTION - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the header file. */ -#undef HAVE_CRYPT_H - -/* Define to use sigaction() instead of signal() for SIGCHLD-related activity. - This is necessary at least on SCO OpenServer 5, due to a Unix kernel bug. - */ -#undef USE_SIGACTION diff --git a/config.h.in b/config.h.in index 9f66b48..11a0ab9 100644 --- a/config.h.in +++ b/config.h.in @@ -1,37 +1,24 @@ -/* config.h.in. Generated from configure.in by autoheader. */ +/* config.h.in. Generated from configure.ac by autoheader. */ -/* 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. +/* xscreensaver, Copyright © 1991-2021 Jamie Zawinski. + * Generate this file by running 'configure' rather than editing it by hand. */ -/* Define this to allow the root password to unlock the screen. */ +/* Define this to allow root to unlock, when not using PAM. */ #undef ALLOW_ROOT_PASSWD /* always defined to indicate that i18n is enabled */ #undef ENABLE_NLS -/* 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. */ -#undef FORTUNE_PROGRAM - /* This is the name of the gettext package to use. */ #undef GETTEXT_PACKAGE -/* Define this if gettimeofday() takes two arguments. */ +/* Define this if gettimeofday takes two arguments. */ #undef GETTIMEOFDAY_TWO_ARGS -/* 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. */ +/* Define this for Solaris getpwanam. */ #undef HAVE_ADJUNCT_PASSWD /* Define to 1 if you have the `bind_textdomain_codeset' function. */ @@ -46,12 +33,11 @@ #undef HAVE_CFPREFERENCESCOPYAPPVALUE /* 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.) */ + xscreensaver control panel in the Gtk 1.x Gnome Control Center. */ #undef HAVE_CRAPPLET /* Define this if HAVE_CRAPPLET is defined, and the function - capplet_widget_changes_are_immediate() is available. */ + capplet_widget_changes_are_immediate is available. */ #undef HAVE_CRAPPLET_IMMEDIATE /* Define to 1 if you have the header file. */ @@ -67,26 +53,22 @@ /* Define this if you have the X Double Buffer Extension. */ #undef HAVE_DOUBLE_BUFFER_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.) */ +/* Define this if you have the XDPMS extension. */ #undef HAVE_DPMS_EXTENSION -/* Define this if your system is Digital or SCO Unix with so-called ``Enhanced - Security'', that is, the passwords live in /tcb/files/auth// - instead of in /etc/passwd, and one reads them with getprpwnam() instead of - getpwnam(). */ +/* Define this if OpenGL bindings are via EGL instead of GLX. */ +#undef HAVE_EGL + +/* Define this for DEC/SCO "Enhanced Security" with getprpwnam. */ #undef HAVE_ENHANCED_PASSWD /* Define to 1 if you have the `fcntl' function. */ #undef HAVE_FCNTL -/* Define this if you have the 'forkpty' function: This allows 'phosphor' and - 'apple2' to run curses-based programs, or be used as terminal windows. */ +/* Define this if you have forkpty. */ #undef HAVE_FORKPTY -/* Define this if you have the GDK_Pixbuf library installed. Some of the demos - can make use of this if it is available. */ +/* Define this if you have GDK_Pixbuf. */ #undef HAVE_GDK_PIXBUF /* Define this if you have the gdk_pixbuf_apply_embedded_orientation function @@ -99,73 +81,71 @@ /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD -/* Define this if you have the getifaddrs() function. */ +/* Define this if you have getifaddrs. */ #undef HAVE_GETIFADDRS /* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT -/* Define this if you have the gettimeofday function. */ +/* Define this if you have gettimeofday. */ #undef HAVE_GETTIMEOFDAY /* Define to 1 if you have the `getwd' function. */ #undef HAVE_GETWD -/* 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.) */ +/* Define this if you have OpenGL. */ #undef HAVE_GL -/* 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. */ +/* Define this if the OpenGL version is 1.1 or newer. */ #undef HAVE_GLBINDTEXTURE -/* Define this if you have the -lgle and -lmatrix libraries (GL extrusion.) */ +/* Define this if you have the GL Extrusion library. */ #undef HAVE_GLE -/* Define this if you have the -lgle from GLE version 3 */ +/* Define this if GL Extrusion is version 3. */ #undef HAVE_GLE3 -/* Define this if you have Gtk (any version.) */ +/* Define this if the native OpenGL library is OpenGLES 1.x. */ +#undef HAVE_GLES + +/* Define this if the native OpenGL library is OpenGLES 2.x. */ +#undef HAVE_GLES2 + +/* Define this if the native OpenGL library is OpenGLES 3.x. */ +#undef HAVE_GLES3 + +/* Define this if OpenGL supports the OpenGL Shading Language. */ +#undef HAVE_GLSL + +/* Define this if you have Gtk */ #undef HAVE_GTK /* Define this if you have Gtk 2.x. */ #undef HAVE_GTK2 -/* 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. */ +/* Define this for HPUX so-called "Secure Passwords". */ #undef HAVE_HPUX_PASSWD -/* Define this if you do pings with a `struct icmp' and an `icmp_id' slot. */ +/* Define this if ping uses struct icmp.icmp_id. */ #undef HAVE_ICMP -/* Define this if you do pings with a `struct icmphdr' and an `un.echo.id' - slot. */ +/* Define this if ping uses struct icmphdr.un.echo.id. */ #undef HAVE_ICMPHDR /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H -/* 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. */ +/* Define this if you have the JPEG Group's JPEG library. */ #undef HAVE_JPEGLIB -/* Define this to target the OpenGL ES 1.x API instead of OpenGL 1.3. */ +/* Define this to emulate OpenGL 1.3 in terms of OpenGLES 1.x. */ #undef HAVE_JWZGLES /* 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. - */ + screen instead of PAM. */ #undef HAVE_KERBEROS -/* Define this if you have Kerberos 5, meaning we need to use the Kerberos 4 - compatibility layer. */ +/* Define this if you have Kerberos 5. */ #undef HAVE_KERBEROS5 /* Define if your file defines LC_MESSAGES. */ @@ -174,9 +154,7 @@ /* Define this if your system has libcap. */ #undef HAVE_LIBCAP -/* Define this if the Portable Network Graphics library is installed. It is - basically required, but many things will more-or-less limp along without - it. */ +/* Define this if you have the Portable Network Graphics library. */ #undef HAVE_LIBPNG /* Define this if you have libsystemd. */ @@ -188,9 +166,10 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H -/* Define this if you have OpenGL, but it's the MesaGL variant. (The libraries - have different names.) (HAVE_GL should be defined too.) */ -#undef HAVE_MESA_GL +/* 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. */ +#undef HAVE_MIT_SAVER_EXTENSION /* Define this if you have Motif. */ #undef HAVE_MOTIF @@ -201,27 +180,26 @@ /* Define to 1 if you have the `nice' function. */ #undef HAVE_NICE -/* Define this if you have the XML library headers in their old, - non-namespaced location (you lack the gnome-xml/libxml symlink) */ +/* Define this if you the XML library headers lack the gnome-xml/libxml + symlink. */ #undef HAVE_OLD_XML_HEADERS -/* Define this if you want to use PAM (Pluggable Authentication Modules) to - lock/unlock the screen, instead of standard /etc/passwd authentication. */ +/* Define this if you have Pluggable Authentication Modules. */ #undef HAVE_PAM -/* Define this if you have pam_fail_delay function. see driver/passwd-pam.c. - */ +/* Define this if you have pam_fail_delay. */ #undef HAVE_PAM_FAIL_DELAY /* Define this if you have a Linux-like /proc/interrupts file which can be - examined to determine when keyboard activity has occurred. */ + examined to determine when keyboard activity has occurred, and you use PS/2 + input devices instead of USB. */ #undef HAVE_PROC_INTERRUPTS /* 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 . */ + be adjusted by root to exempt us from the out-of-memory killer. */ #undef HAVE_PROC_OOM -/* Define this if your system supports POSIX threads. */ +/* Define this if you have POSIX threads. */ #undef HAVE_PTHREAD /* Have PTHREAD_PRIO_INHERIT. */ @@ -233,17 +211,16 @@ /* Define to 1 if you have the `putenv' function. */ #undef HAVE_PUTENV -/* 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.) */ +/* Define this if your system uses getpwnam_shadow. */ +#undef HAVE_PWNAM_SHADOW_PASSWD + +/* Define this if you have the Resize and Rotate extension. */ #undef HAVE_RANDR /* Define this if the RANDR library is version 1.2 or newer. */ #undef HAVE_RANDR_12 -/* Define this if you have the XReadDisplay extension (I think this is an - SGI-only thing; it's in .) A few of the - screenhacks will take advantage of this if it's available. */ +/* Define this if you have the SGI XReadDisplay extension. */ #undef HAVE_READ_DISPLAY_EXTENSION /* Define to 1 if you have the `realpath' function. */ @@ -267,11 +244,13 @@ /* Define to 1 if you have the `setrlimit' function. */ #undef HAVE_SETRLIMIT -/* 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.) */ +/* Define this if you have the SGI SCREEN_SAVER extension. */ +#undef HAVE_SGI_SAVER_EXTENSION + +/* Define this if you have the SGI-VIDEO-CONTROL extension. */ +#undef HAVE_SGI_VC_EXTENSION + +/* Define this if your system uses /etc/shadow. */ #undef HAVE_SHADOW_PASSWD /* Define to 1 if you have the `sigaction' function. */ @@ -333,70 +312,49 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UTIL_H -/* 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.) */ -#undef HAVE_XF86MISCSETGRABKEYSSTATE - -/* 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.) */ +/* Define this if you have XF86VidModeGetViewPort, for virtual desktops. */ #undef HAVE_XF86VMODE -/* 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.) */ +/* Define this if you have XF86VidModeSetGamma, for fading. */ #undef HAVE_XF86VMODE_GAMMA -/* 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. */ +/* Define this if you have XF86VidModeSetGammaRamp, for fading. */ #undef HAVE_XF86VMODE_GAMMA_RAMP /* Define this if you have libXft2. */ #undef HAVE_XFT -/* Define this if you have the XHPDisableReset function (an HP only thing - which allows the Ctrl-Sh-Reset key sequence to be temporarily disabled.) */ +/* Define this if you have XHPDisableReset, which allows Ctrl-Sh-Reset to be + temporarily disabled. */ #undef HAVE_XHPDISABLERESET -/* 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.) */ +/* Define this if you have the X11R5 XIDLE extension. */ +#undef HAVE_XIDLE_EXTENSION + +/* Define this if you have the Xinerama extension. */ #undef HAVE_XINERAMA -/* 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.) */ +/* Define this if you have the XInput2 extension. */ #undef HAVE_XINPUT -/* Define this if you have the XmComboBox Motif widget (Motif 2.0.) */ +/* Define this if you have the X Keyboard Extension. */ +#undef HAVE_XKB + +/* Define this if you have the XmComboBox Motif 2.0 widget. */ #undef HAVE_XMCOMBOBOX /* Define this if you have the XML library. */ #undef HAVE_XML -/* 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. */ -#undef HAVE_XMU - /* Define this if you have the X Shared Memory Extension. */ #undef HAVE_XSHM_EXTENSION -/* Define this if you have the function Xutf8DrawString(). */ +/* Define this if you have the function Xutf8DrawString. */ #undef HAVE_XUTF8DRAWSTRING /* Define this to remove the option of locking the screen at all. */ #undef NO_LOCKING -/* This is the same as GETTEXT_PACKAGE, but for the glade generated code. */ -#undef PACKAGE - /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT @@ -416,37 +374,26 @@ #undef PACKAGE_VERSION /* Whether PAM should check the result of account modules when authenticating. - Only do this if you have account configured properly on your system. */ + */ #undef PAM_CHECK_ACCOUNT_TYPE -/* 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. */ +/* The name of the "xscreensaver" PAM service. */ #undef PAM_SERVICE_NAME -/* Define if you have PAM and pam_strerror() requires two arguments. */ +/* Define if pam_strerror requires two arguments. */ #undef PAM_STRERROR_TWO_ARGS -/* Set the name of the password helper program, if any */ -#undef PASSWD_HELPER_PROGRAM - /* Define to necessary symbol if this constant uses a non-standard name on your system. */ #undef PTHREAD_CREATE_JOINABLE -/* Define as the return type of signal handlers (`int' or `void'). */ +/* Return type of signal handlers */ #undef RETSIGTYPE /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS -/* Define to 1 if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Define this to void* if you're using X11R4 or earlier. */ +/* Stare into the void. */ #undef XPointer /* Define to 1 if the X Window System is missing or not being used. */ diff --git a/config.sub b/config.sub old mode 100644 new mode 100755 index 9ccf09a..c874b7a --- a/config.sub +++ b/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2018 Free Software Foundation, Inc. +# Copyright 1992-2020 Free Software Foundation, Inc. -timestamp='2018-03-08' +timestamp='2020-11-07' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ timestamp='2018-03-08' # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. -me=`echo "$0" | sed -e 's,.*/,,'` +me=$(echo "$0" | sed -e 's,.*/,,') usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS @@ -67,7 +67,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2018 Free Software Foundation, Inc. +Copyright 1992-2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -89,7 +89,7 @@ while test $# -gt 0 ; do - ) # Use stdin as input. break ;; -* ) - echo "$me: invalid option $1$help" + echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) @@ -110,1223 +110,1167 @@ case $# in exit 1;; esac -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | cloudabi*-eabi* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo "$1" | sed 's/-[^-]*$//'` - if [ "$basic_machine" != "$1" ] - then os=`echo "$1" | sed 's/.*-/-/'` - else os=; fi - ;; -esac +# Split fields of configuration type +# shellcheck disable=SC2162 +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 ;; - -lynx*) - os=-lynxos + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 ;; - -ptx*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova*) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac ;; - -psos*) - os=-psos + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ + | convergent* | ncr* | news | 32* | 3600* | 3100* \ + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ + | ultra | tti* | harris | dolphin | highlevel | gould \ + | cbm | ns | masscomp | apple | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac ;; esac -# Decode aliases for certain CPU-COMPANY combinations. +# Decode 1-component or ad-hoc basic machines case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | ba \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | e2k | epiphany \ - | fido | fr30 | frv | ft32 \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia16 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ - | pdp10 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pru \ - | pyramid \ - | riscv32 | riscv64 \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | visium \ - | wasm32 \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - leon|leon[3-9]) - basic_machine=sparc-$basic_machine - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + cpu=hppa1.1 + vendor=winbond ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) + op50n) + cpu=hppa1.1 + vendor=oki ;; - ms1) - basic_machine=mt-unknown + op60c) + cpu=hppa1.1 + vendor=oki ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown + ibm*) + cpu=i370 + vendor=ibm ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none + orion105) + cpu=clipper + vendor=highlevel ;; - xscaleeb) - basic_machine=armeb-unknown + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple ;; - - xscaleel) - basic_machine=armel-unknown + pmac | pmac-mpw) + cpu=powerpc + vendor=apple ;; - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | ba-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | e2k-* | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ - | ip2k-* | iq2000-* \ - | k1om-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | or1k*-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pru-* \ - | pyramid-* \ - | riscv32-* | riscv64-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | visium-* \ - | wasm32-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-pc - os=-bsd - ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att + cpu=m68000 + vendor=att ;; 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - asmjs) - basic_machine=asmjs-unknown - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux + cpu=we32k + vendor=att ;; bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec + cpu=powerpc + vendor=ibm + basic_os=cnk ;; decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 + cpu=pdp10 + vendor=dec + basic_os=tops10 ;; decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 + cpu=pdp10 + vendor=dec + basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx + cpu=m68k + vendor=motorola ;; dpx2*) - basic_machine=m68k-bull - os=-sysv3 - ;; - e500v[12]) - basic_machine=powerpc-unknown - os=$os"spe" - ;; - e500v[12]-*) - basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=$os"spe" - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd + cpu=m68k + vendor=bull + basic_os=sysv3 ;; encore | umax | mmax) - basic_machine=ns32k-encore + cpu=ns32k + vendor=encore ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} ;; fx2800) - basic_machine=i860-alliant + cpu=i860 + vendor=alliant ;; genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 + cpu=ns32k + vendor=ns ;; h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp + cpu=hppa1.0 + vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp + cpu=m68000 + vendor=hp ;; hp9k3[2-9][0-9]) - basic_machine=m68k-hp + cpu=m68k + vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp + cpu=hppa1.0 + vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm + cpu=hppa1.0 + vendor=hp ;; i*86v32) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv32 + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=sysv32 ;; i*86v4*) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv4 + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=sysv4 ;; i*86v) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=sysv ;; i*86sol2) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-solaris2 + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=solaris2 ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - vsta) - basic_machine=i386-unknown - os=-vsta + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} ;; iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) + cpu=mips + vendor=sgi + case $basic_os in + irix*) ;; *) - os=-irix4 + basic_os=irix4 ;; esac ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - leon-*|leon[3-9]-*) - basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos + cpu=m68000 + vendor=convergent ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint ;; news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv + cpu=mips + vendor=sony + basic_os=newsos ;; next | m*-next) - basic_machine=m68k-next - case $os in - -nextstep* ) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) ;; - -ns2*) - os=-nextstep2 + ns2*) + basic_os=nextstep2 ;; *) - os=-nextstep3 + basic_os=nextstep3 ;; esac ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - nsv-tandem) - basic_machine=nsv-tandem - ;; - nsx-tandem) - basic_machine=nsx-tandem + cpu=np1 + vendor=gould ;; op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k + cpu=hppa1.1 + vendor=oki + basic_os=proelf ;; pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 ;; pbd) - basic_machine=sparc-tti + cpu=sparc + vendor=tti ;; pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc + cpu=m68k + vendor=tti ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` + pc532) + cpu=ns32k + vendor=pc532 ;; pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm + cpu=pn + vendor=gould ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` + power) + cpu=power + vendor=ibm ;; - ppc64) basic_machine=powerpc64-unknown + ps2) + cpu=i386 + vendor=ibm ;; - ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` + rm[46]00) + cpu=mips + vendor=siemens ;; - ppc64le | powerpc64little) - basic_machine=powerpc64le-unknown + rtpc | rtpc-*) + cpu=romp + vendor=ibm ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} ;; - ps2) - basic_machine=i386-ibm + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks ;; - pw32) - basic_machine=i586-unknown - os=-pw32 + tower | tower-32) + cpu=m68k + vendor=ncr ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu ;; - rdos32) - basic_machine=i386-pc - os=-rdos + w65) + cpu=w65 + vendor=wdc ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf ;; - rm[46]00) - basic_machine=mips-siemens + none) + cpu=none + vendor=none ;; - rtpc | rtpc-*) - basic_machine=romp-ibm + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine ;; - s390 | s390-*) - basic_machine=s390-ibm + leon-*|leon[3-9]-*) + cpu=sparc + vendor=$(echo "$basic_machine" | sed 's/-.*//') ;; - s390x | s390x-*) - basic_machine=s390x-ibm + + *-*) + # shellcheck disable=SC2162 + IFS="-" read cpu vendor <&2 - exit 1 + # Recognize the canonical CPU types that are allowed with any + # company name. + case $cpu in + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | abacus \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ + | alphapca5[67] | alpha64pca5[67] \ + | am33_2.0 \ + | amdgcn \ + | arc | arceb \ + | arm | arm[lb]e | arme[lb] | armv* \ + | avr | avr32 \ + | asmjs \ + | ba \ + | be32 | be64 \ + | bfin | bpf | bs2000 \ + | c[123]* | c30 | [cjt]90 | c4x \ + | c8051 | clipper | craynv | csky | cydra \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | elxsi | epiphany \ + | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ + | h8300 | h8500 \ + | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i*86 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle \ + | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64eb | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mmix \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nfp \ + | nios | nios2 | nios2eb | nios2el \ + | none | np1 | ns16k | ns32k | nvptx \ + | open8 \ + | or1k* \ + | or32 \ + | orion \ + | picochip \ + | pdp10 | pdp11 | pj | pjl | pn | power \ + | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ + | pru \ + | pyramid \ + | riscv | riscv32 | riscv64 \ + | rl78 | romp | rs6000 | rx \ + | s390 | s390x \ + | score \ + | sh | shl \ + | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ + | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ + | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ + | spu \ + | tahoe \ + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ + | tron \ + | ubicom32 \ + | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ + | vax \ + | visium \ + | w65 \ + | wasm32 | wasm64 \ + | we32k \ + | x86 | x86_64 | xc16x | xgate | xps100 \ + | xstormy16 | xtensa* \ + | ymp \ + | z8k | z80) + ;; + + *) + echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 + exit 1 + ;; + esac ;; esac # Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` +case $vendor in + digital*) + vendor=dec ;; - *-commodore*) - basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` + commodore*) + vendor=cbm ;; *) ;; @@ -1334,203 +1278,213 @@ esac # Decode manufacturer-specific aliases for certain operating systems. -if [ x"$os" != x"" ] +if test x$basic_os != x then + +# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just +# set os. +case $basic_os in + gnu/linux*) + kernel=linux + os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|') + ;; + os2-emx) + kernel=os2 + os=$(echo $basic_os | sed -e 's|os2-emx|emx|') + ;; + nto-qnx*) + kernel=nto + os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|') + ;; + *-*) + # shellcheck disable=SC2162 + IFS="-" read kernel os <&2 - exit 1 + # No normalization, but not necessarily accepted, that comes below. ;; esac + else # Here we handle the default operating systems that come with various machines. @@ -1543,254 +1497,352 @@ else # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. -case $basic_machine in +kernel= +case $cpu-$vendor in score-*) - os=-elf + os=elf ;; spu-*) - os=-elf + os=elf ;; *-acorn) - os=-riscix1.2 + os=riscix1.2 ;; arm*-rebel) - os=-linux + kernel=linux + os=gnu ;; arm*-semi) - os=-aout + os=aout ;; c4x-* | tic4x-*) - os=-coff + os=coff ;; c8051-*) - os=-elf + os=elf + ;; + clipper-intergraph) + os=clix ;; hexagon-*) - os=-elf + os=elf ;; tic54x-*) - os=-coff + os=coff ;; tic55x-*) - os=-coff + os=coff ;; tic6x-*) - os=-coff + os=coff ;; # This must come before the *-dec entry. pdp10-*) - os=-tops20 + os=tops20 ;; pdp11-*) - os=-none + os=none ;; *-dec | vax-*) - os=-ultrix4.2 + os=ultrix4.2 ;; m68*-apollo) - os=-domain + os=domain ;; i386-sun) - os=-sunos4.0.2 + os=sunos4.0.2 ;; m68000-sun) - os=-sunos3 + os=sunos3 ;; m68*-cisco) - os=-aout + os=aout ;; mep-*) - os=-elf + os=elf ;; mips*-cisco) - os=-elf + os=elf ;; mips*-*) - os=-elf + os=elf ;; or32-*) - os=-coff + os=coff ;; *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 + os=sysv3 ;; sparc-* | *-sun) - os=-sunos4.1.1 + os=sunos4.1.1 ;; pru-*) - os=-elf + os=elf ;; *-be) - os=-beos + os=beos ;; *-ibm) - os=-aix + os=aix ;; *-knuth) - os=-mmixware + os=mmixware ;; *-wec) - os=-proelf + os=proelf ;; *-winbond) - os=-proelf + os=proelf ;; *-oki) - os=-proelf + os=proelf ;; *-hp) - os=-hpux + os=hpux ;; *-hitachi) - os=-hiux + os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv + os=sysv ;; *-cbm) - os=-amigaos + os=amigaos ;; *-dg) - os=-dgux + os=dgux ;; *-dolphin) - os=-sysv3 + os=sysv3 ;; m68k-ccur) - os=-rtu + os=rtu ;; m88k-omron*) - os=-luna + os=luna ;; *-next) - os=-nextstep + os=nextstep ;; *-sequent) - os=-ptx + os=ptx ;; *-crds) - os=-unos + os=unos ;; *-ns) - os=-genix + os=genix ;; i370-*) - os=-mvs + os=mvs ;; *-gould) - os=-sysv + os=sysv ;; *-highlevel) - os=-bsd + os=bsd ;; *-encore) - os=-bsd + os=bsd ;; *-sgi) - os=-irix + os=irix ;; *-siemens) - os=-sysv4 + os=sysv4 ;; *-masscomp) - os=-rtu + os=rtu ;; f30[01]-fujitsu | f700-fujitsu) - os=-uxpv + os=uxpv ;; *-rom68k) - os=-coff + os=coff ;; *-*bug) - os=-coff + os=coff ;; *-apple) - os=-macos + os=macos ;; *-atari*) - os=-mint + os=mint + ;; + *-wrs) + os=vxworks ;; *) - os=-none + os=none ;; esac + fi +# Now, validate our (potentially fixed-up) OS. +case $os in + # Sometimes we do "kernel-abi", so those need to count as OSes. + musl* | newlib* | uclibc*) + ;; + # Likewise for "kernel-libc" + eabi | eabihf | gnueabi | gnueabihf) + ;; + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. + gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ + | hiux* | abug | nacl* | netware* | windows* \ + | os9* | macos* | osx* | ios* \ + | mpw* | magic* | mmixware* | mon960* | lnews* \ + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ + | aos* | aros* | cloudabi* | sortix* | twizzler* \ + | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ + | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ + | mirbsd* | netbsd* | dicos* | openedition* | ose* \ + | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \ + | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ + | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ + | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ + | udi* | lites* | ieee* | go32* | aux* | hcos* \ + | chorusrdb* | cegcc* | glidix* \ + | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ + | midipix* | mingw32* | mingw64* | mint* \ + | uxpv* | beos* | mpeix* | udk* | moxiebox* \ + | interix* | uwin* | mks* | rhapsody* | darwin* \ + | openstep* | oskit* | conix* | pw32* | nonstopux* \ + | storm-chaos* | tops10* | tenex* | tops20* | its* \ + | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ + | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ + | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + ;; + none) + ;; + *) + echo Invalid configuration \`"$1"\': OS \`"$os"\' not recognized 1>&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) + ;; + uclinux-uclibc* ) + ;; + -dietlibc* | -newlib* | -musl* | -uclibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + nto-qnx*) + ;; + os2-emx) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) vendor=acorn ;; - -sunos*) + *-sunos*) vendor=sun ;; - -cnk*|-aix*) + *-cnk* | *-aix*) vendor=ibm ;; - -beos*) + *-beos*) vendor=be ;; - -hpux*) + *-hpux*) vendor=hp ;; - -mpeix*) + *-mpeix*) vendor=hp ;; - -hiux*) + *-hiux*) vendor=hitachi ;; - -unos*) + *-unos*) vendor=crds ;; - -dgux*) + *-dgux*) vendor=dg ;; - -luna*) + *-luna*) vendor=omron ;; - -genix*) + *-genix*) vendor=ns ;; - -mvs* | -opened*) + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) vendor=ibm ;; - -os400*) + s390-* | s390x-*) vendor=ibm ;; - -ptx*) + *-ptx*) vendor=sequent ;; - -tpf*) + *-tpf*) vendor=ibm ;; - -vxsim* | -vxworks* | -windiss*) + *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; - -aux*) + *-aux*) vendor=apple ;; - -hms*) + *-hms*) vendor=hitachi ;; - -mpw* | -macos*) + *-mpw* | *-macos*) vendor=apple ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; - -vos*) + *-vos*) vendor=stratus ;; esac - basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac -echo "$basic_machine$os" +echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: diff --git a/configure b/configure index e566796..4a03e1e 100755 --- a/configure +++ b/configure @@ -30,7 +30,6 @@ else esac fi - as_nl=' ' export as_nl @@ -78,7 +77,6 @@ if test "${PATH_SEPARATOR+set}" != set; then } fi - # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. @@ -234,7 +232,6 @@ $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && fi; } IFS=$as_save_IFS - if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a @@ -354,7 +351,6 @@ $as_echo X"$as_dir" | test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - } # as_fn_mkdir_p # as_fn_executable_p FILE @@ -399,7 +395,6 @@ else } fi # as_fn_arith - # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are @@ -461,7 +456,6 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits - as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && @@ -553,7 +547,6 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - test -n "$DJDIR" || exec 7<&0 &1 @@ -627,7 +620,7 @@ DEPEND APPDEFAULTS ANIM_LIBS ANIM_OBJS -GTK_EXTRA_OBJS +FONT_DIR HACK_CONF_DIR PO_DATADIR GTK_DATADIR @@ -648,24 +641,16 @@ GL_EXES JPEG_EXES LOCK_OBJS LOCK_SRCS -SAVER_GL_LIBS -SAVER_GL_OBJS -SAVER_GL_SRCS XFT_LIBS XFT_OBJS XFT_SRCS -XMU_LIBS -XMU_OBJS -XMU_SRCS PASSWD_OBJS PASSWD_SRCS MEN_OSX SCRIPTS_OSX +SYSTEMD_LIBS EXES_SYSTEMD EXES_OSX -OBJCC -COMMENT_DEMO_GLADE2_GTK_2_22_TAIL -COMMENT_DEMO_GLADE2_GTK_2_22_HEAD WITH_BROWSER DEFAULT_TEXT_FILE DEFAULT_IMAGE_DIRECTORY @@ -675,11 +660,10 @@ NEW_LOGIN_COMMAND COMMENT_PAM_CHECK_ACCOUNT HAVE_PAM_FAIL_DELAY INSTALL_PAM -NEED_SETUID INSTALL_DIRS SETCAP_HACKS SETUID_HACKS -INSTALL_SETUID +SETUID_AUTH PROG_SETCAP LIBCAP_LIBS LIBCAP_CFLAGS @@ -699,11 +683,19 @@ SAVER_LIBS ALL_DEMO_PROGRAMS PREFERRED_DEMO_PROGRAM INCLUDES -setcap_program +PTHREAD_CFLAGS +PTHREAD_LIBS +PTHREAD_CXX +PTHREAD_CC +ax_pthread_config +SED +target_os +target_vendor +target_cpu +target +login_manager_tmp gnome_url_show_program gnome_open_program -pkg_config -login_manager_tmp MKINSTALLDIRS POSUB POFILES @@ -753,6 +745,7 @@ INTLTOOL_EXTRACT INTLTOOL_MERGE INTLTOOL_UPDATE USE_NLS +pkg_config X_EXTRA_LIBS X_LIBS X_PRE_LIBS @@ -766,10 +759,6 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM CPP -PTHREAD_CFLAGS -PTHREAD_LIBS -PTHREAD_CC -ax_pthread_config OBJEXT EXEEXT ac_ct_CC @@ -826,22 +815,30 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking -with_x_app_defaults -with_pthread enable_largefile with_x enable_nls +with_app_defaults with_hackdir enable_subdir with_configdir +with_fontdir with_dpms_ext +with_xf86vmode_ext with_xinerama_ext +with_randr_ext with_xinput_ext -with_xf86vmode_ext with_xf86gamma_ext -with_randr_ext +with_xidle_ext +with_sgi_ext +with_sgivc_ext +with_readdisplay +with_xshm_ext +with_xdbe_ext +with_xkb_ext with_proc_interrupts with_proc_oom +with_systemd enable_locking enable_root_passwd with_pam @@ -849,26 +846,22 @@ with_pam_service_name enable_pam_check_account_type with_kerberos with_shadow -with_passwd_helper -with_login_manager with_gtk with_motif +with_login_manager +with_image_directory +with_text_file +with_browser +with_pthread +with_gles with_gl +with_glx with_gle -with_gles +with_jpeg with_png with_pixbuf -with_jpeg with_xft -with_systemd -with_xshm_ext -with_xdbe_ext -with_readdisplay -with_image_directory -with_text_file -with_browser with_setuid_hacks -with_setcap_hacks with_record_animation ' ac_precious_vars='build_alias @@ -882,7 +875,6 @@ CPPFLAGS CPP XMKMF' - # Initialize some variables set by options. ac_init_help= ac_init_version=false @@ -1346,7 +1338,6 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null - ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || @@ -1354,7 +1345,6 @@ ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" - # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes @@ -1430,9 +1420,7 @@ VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. - Configuration: - -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages @@ -1443,12 +1431,6 @@ Configuration: -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', @@ -1461,17 +1443,11 @@ Fine tuning of the installation directories: --libexecdir=DIR program executables [EPREFIX/libexec] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF @@ -1483,6 +1459,7 @@ X features: System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi @@ -1490,88 +1467,72 @@ if test -n "$ac_init_help"; then cat <<\_ACEOF -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-largefile omit support for large files - --disable-nls do not use Native Language Support - -Screen locking options: - --enable-locking Compile in support for locking the display. - --disable-locking Do not allow locking at all. +Installation Options: - --enable-root-passwd Allow root passwd to unlock screen. - --disable-root-passwd Do not allow that. - --enable-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. - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --prefix=PREFIX Install root of architecture-independent files. + --exec-prefix=EPREFIX Install root of architecture-dependent files. + --with-app-defaults=DIR Where to install the default settings file. + --with-hackdir=DIR Where to install the hundreds of demo executables. + --with-configdir=DIR Where to install the GUI configuration files. + --with-fontdir=DIR Where to install the extra font files. - --with-pthread Enables POSIX threads, for SMP support. +Server Extension Options: -Installation options: - --with-hackdir=DIR Where to install the hundreds of demo executables. - Default: `PREFIX/libexec/xscreensaver/' - --with-configdir=DIR Where to install the data files that describe each - of the display modes to the GUI. - Default: `PREFIX/share/xscreensaver/config/' - --with-x-app-defaults=DIR - Where to install xscreensaver configuration file. - - --with-dpms-ext Include support for the DPMS extension. - --with-xinerama-ext Include support for the XINERAMA extension. - --with-xinput-ext Include support for the XInput extension. - --with-xf86vmode-ext Include support for XFree86 virtual screens. + --with-dpms-ext Include support for power management. + --with-xf86vmode-ext Include support for virtual screens. + --with-xinerama-ext Include support for multiple monitors. + --with-randr-ext Include support for multiple monitors. + --with-xinput-ext Include support for the XInput2 extension. --with-xf86gamma-ext Include support for XFree86 gamma fading. - --with-randr-ext Include support for the X Resize+Rotate extension. - --with-proc-interrupts Include support for consulting the /proc/interrupts - file to notice keyboard activity. - --with-proc-oom Include support for disabling the OOM-killer. - --with-pam Include support for PAM (Pluggable Auth Modules.) - --with-pam-service-name NAME arg is the name of the PAM service that - xscreensaver will authenticate as. + --with-xidle-ext Include support for the X11R5 XIDLE extension. + --with-sgi-ext Include support for the SGI SCREEN_SAVER extension. + --with-sgivc-ext Include support for the SGI-VIDEO-CONTROL extension. + --with-readdisplay Include support for the SGI XReadDisplay extension. + --with-xshm-ext Include support for the Shared Memory extension. + --with-xdbe-ext Include support for the DOUBLE-BUFFER extension. + --with-xkb-ext Include support for the X Keyboard extension. + --with-proc-interrupts Include support for consulting /proc/interrupts to + notice activity on PS/2 keyboards and mice. + --with-proc-oom Include support to duck the out-of-memory killer. + --with-systemd Support systemd requests to lock on suspend, and to + allow video players to inhibit the screen saver. + +Screen Locking Options: + + --disable-locking Do not allow locking of the display at all. + --with-pam Include support for PAM (Pluggable Auth Modules). + --with-pam-service-name Set the name of the xscreensaver PAM service. + --enable-pam-account Whether PAM should check the result of account + modules when authenticating. Only do this if you + have "account" modules configured on your system. + --enable-root-passwd Allow the root passwd to unlock, if not using PAM. --with-kerberos Include support for Kerberos authentication. --with-shadow Include support for shadow password authentication. - --with-passwd-helper Include support for an external password - verification helper program. - --with-login-manager Put a "New Login" button on the unlock dialog that - runs a login manager like gdmflexiserver or kdmctl. -User interface options: +User Interface Options: --with-gtk Use the Gtk toolkit for the user interface. - --with-motif Use the Motif toolkit for the user interface - (no longer supported.) + --with-motif Use the Motif toolkit for the user interface. + --with-login-manager Put a "New Login" button on the unlock dialog that + runs a login manager like gdmflexiserver or kdmctl. + --with-image-directory Some demos will display random images from here. + --with-text-file=FILE Some demos will use this as a source of text. + --with-browser=BROWSER The web browser used to open the "Help" URL. -Graphics options: +Graphics Options: --with-gl Build those demos which depend on OpenGL. - --with-gle Build those demos which depend on GLE - (the OpenGL "extrusion" library.) - --with-gles Target OpenGL ES 1.x API instead of OpenGL 1.3. - --with-png Include support for the PNG library. - --with-pixbuf Include support for the GDK-Pixbuf library in some - demos, which will make it possible for them to read - GIF, JPEG, and PNG files as well. + --with-gles Emulate OpenGL 1.3 in terms of OpenGL ES 1.x. + --with-glx Use GLX to interface OpenGL and X11 instead of EGL. + --with-gle Include support for the GL Extrusion library. --with-jpeg Include support for the JPEG library. + --with-png Include support for the PNG library. + --with-pixbuf Include support for the GDK-Pixbuf library, which + allows the display of JPEG, PNG, GIF and SVG images. --with-xft Include support for the X Freetype library. - --with-systemd Build xscreensaver-systemd to lock on suspend. - --with-xshm-ext Include support for the Shared Memory extension. - --with-xdbe-ext Include support for the DOUBLE-BUFFER extension. - --with-readdisplay Include support for the XReadDisplay extension. - --with-image-directory Arg is the default directory from which some demos - will choose random images to display. - --with-text-file=FILE By default, some demos may display this file. - --with-browser=BROWSER Specify the web browser used to show the help URL. - --with-setuid-hacks Allow some demos to be installed `setuid root' - (which is needed in order to ping other hosts.) - --with-setcap-hacks Allow some demos to be installed with setcap - (which is needed in order to ping other hosts.) + --with-pthread Enables POSIX threads, for SMP support. + --with-setuid-hacks Install the "sonar" demo as setuid root, which is + needed in order to ping other hosts. --with-record-animation Include code for generating MP4 videos. Some influential environment variables: @@ -1703,52 +1664,6 @@ fi } # ac_fn_c_try_compile -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -rf conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. @@ -1786,48 +1701,6 @@ fi } # ac_fn_c_try_cpp -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using @@ -1915,6 +1788,48 @@ fi } # ac_fn_c_check_header_mongrel +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in @@ -2000,6 +1915,52 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_type +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -rf conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly @@ -2172,14 +2133,12 @@ IFS=$as_save_IFS cat >&5 <<_ACEOF - ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF - # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. @@ -2356,7 +2315,6 @@ cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF - # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE @@ -2474,10 +2432,8 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - ac_config_headers="$ac_config_headers config.h" - echo "current directory: `pwd`" echo "command line was: $0 $@" @@ -2487,161 +2443,44 @@ echo "command line was: $0 $@" # ############################################################################### +# Defines in config.h are dumped out alphabetically rather than in any kind +# of sane order, sigh. +# +# OS stuff. +# - - - +# +# X11 server stuff. +# # 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_XCOMPOSITE_EXTENSION], +# [Define this if you have the X Composite Extension.]) +# +# GUI stuff. +# +# +# Image loading. +# +# +# Graphics libraries. +# +# +# Locking. +# +#AH_TEMPLATE([PASSWD_HELPER_PROGRAM], +# [Define this to use a third-party password helper program.]) # 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, @@ -2658,75 +2497,24 @@ for d in utils jwxyz hacks hacks/glx driver ; do fi done -############################################################################### -# -# Query AX_PTHREAD, and figure out which compiler gets used. -# -############################################################################### - - - - -############################################################################### -# -# Function to figure out how to run the compiler. -# -############################################################################### - - - - ############################################################################### # # Check for availability of various gcc command-line options. # ############################################################################### - - - - - - -# Need to disable Objective C extensions in ANSI C on MacOS X to work -# around an Apple-specific gcc bug. -# - - ############################################################################### # -# 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. +# Function to figure out how to run the compiler. # ############################################################################### - - - - - ############################################################################### # # Function to figure out how to create directory trees. # ############################################################################### - - - ############################################################################### # # Function to check whether gettimeofday() exists, and how to call it. @@ -2734,9 +2522,6 @@ done # ############################################################################### - - - ############################################################################### # # Function to find perl5 (defines PERL and PERL_VERSION.) @@ -2747,29 +2532,12 @@ done perl_version_cmd='print $]' - - - - -############################################################################### -# -# Function to demand "bc". Losers. -# -############################################################################### - - - ############################################################################### # # Functions to check how to do ICMP PING requests. # ############################################################################### - - - - - ############################################################################### # # Functions to check for various X11 crap. @@ -2778,42 +2546,13 @@ perl_version_cmd='print $]' # 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.) # - -############################################################################### -# -# Handle the --with-x-app-defaults option HERE -# -############################################################################### - - -# Check whether --with-x-app-defaults was given. -if test "${with_x_app_defaults+set}" = set; then : - withval=$with_x_app_defaults; ac_cv_x_app_defaults="$withval" -else - eval ac_x_app_defaults="$withval" -fi - - - - - - - - - - - # Random special-cases for X on certain pathological OSes. # You know who you are. # - - - - - ############################################################################### # # Some utility functions to make checking for X things easier. @@ -2823,28 +2562,20 @@ fi # Like AC_CHECK_HEADER, but it uses the already-computed -I directories. # - # Like AC_EGREP_HEADER, but it uses the already-computed -I directories. # - -# Like AC_TRY_COMPILE, but it uses the already-computed -I directories. +# Like AC_COMPILE_IFELSE but it uses the already-computed -I directories. # - - # 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. # - -# Like AC_TRY_RUN, but it uses the already-computed -I directories. +# Like AC_RUN_IFELSE but it uses the already-computed -I directories. # (But not the -L directories!) # - - - # Usage: HANDLE_X_PATH_ARG([variable_name], # [--command-line-option], # [descriptive string]) @@ -2861,9 +2592,6 @@ fi # as appropriate. # - - - ############################################################################### ############################################################################### # @@ -2872,11 +2600,14 @@ fi ############################################################################### ############################################################################### +# Default $PATH might not contain /sbin and thus miss /sbin/setcap. +# +export PATH="$PATH:/usr/bin:/bin:/usr/sbin:/sbin" + # WTF! autoconf emits this *way* too late. Do it earlier. test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - # random compiler setup ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do @@ -2906,7 +2637,6 @@ ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 @@ -2944,7 +2674,6 @@ build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : @@ -2977,8 +2706,6 @@ host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - ac_original_cc=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -3022,7 +2749,6 @@ else $as_echo "no" >&6; } fi - fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC @@ -3115,7 +2841,6 @@ else $as_echo "no" >&6; } fi - fi fi if test -z "$CC"; then @@ -3172,7 +2897,6 @@ else $as_echo "no" >&6; } fi - fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then @@ -3214,7 +2938,6 @@ else $as_echo "no" >&6; } fi - test -n "$CC" && break done fi @@ -3258,7 +2981,6 @@ else $as_echo "no" >&6; } fi - test -n "$ac_ct_CC" && break done @@ -3277,7 +2999,6 @@ fi fi - test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH @@ -3769,1390 +3490,1341 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test -z "$GCC"; then + # not using GCC + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to request ANSI compilation" >&5 +$as_echo_n "checking how to request ANSI compilation... " >&6; } + case "$host" in + *-hpux* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: HPUX: adding -Ae" >&5 +$as_echo "HPUX: adding -Ae" >&6; } + CC="$CC -Ae" + ;; + *-aix* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: AIX: adding -qlanglvl=ansi -qhalt=e" >&5 +$as_echo "AIX: adding -qlanglvl=ansi -qhalt=e" >&6; } + CC="$CC -qlanglvl=ansi -qhalt=e" + ;; + *-dec-* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: DEC: adding -std1 -ieee" >&5 +$as_echo "DEC: adding -std1 -ieee" >&6; } + CC="$CC -std1" + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no idea" >&5 +$as_echo "no idea" >&6; } + ;; + esac + else + # using GCC + case "$host" in + *-solaris*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Solaris: adding -D__EXTENSIONS__" >&5 +$as_echo "Solaris: adding -D__EXTENSIONS__" >&6; } + CC="$CC -D__EXTENSIONS__" + ;; + esac -have_pthread=no - with_pthread_req=unspecified - - # AX_PTHREAD is from the GNU Autoconf Archive. - # https://savannah.gnu.org/projects/autoconf-archive/ - # =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_pthread.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro figures out how to build C programs using POSIX threads. It -# sets the PTHREAD_LIBS output variable to the threads library and linker -# flags, and the PTHREAD_CFLAGS output variable to any special C compiler -# flags that are needed. (The user can also force certain compiler -# flags/libs to be tested by setting these environment variables.) -# -# Also sets PTHREAD_CC to any special C compiler that is needed for -# multi-threaded programs (defaults to the value of CC otherwise). (This -# is necessary on AIX to use the special cc_r compiler alias.) -# -# NOTE: You are assumed to not only compile your program with these flags, -# but also link it with them as well. e.g. you should link with -# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS -# -# If you are only building threads programs, you may wish to use these -# variables in your default LIBS, CFLAGS, and CC: -# -# LIBS="$PTHREAD_LIBS $LIBS" -# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -# CC="$PTHREAD_CC" -# -# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant -# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name -# (e.g. PTHREAD_CREATE_UNDETACHED on AIX). -# -# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the -# PTHREAD_PRIO_INHERIT symbol is defined when compiling with -# PTHREAD_CFLAGS. -# -# ACTION-IF-FOUND is a list of shell commands to run if a threads library -# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it -# is not found. If ACTION-IF-FOUND is not specified, the default action -# will define HAVE_PTHREAD. -# -# Please let the authors know if this macro fails on any platform, or if -# you have any other suggestions or comments. This macro was based on work -# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help -# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by -# Alejandro Forero Cuervo to the autoconf macro repository. We are also -# grateful for the helpful feedback of numerous users. -# -# Updated for Autoconf 2.68 by Daniel Richard G. -# -# LICENSE -# -# Copyright (c) 2008 Steven G. Johnson -# Copyright (c) 2011 Daniel Richard G. -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 21 - -# This is what autoupdate's m4 run will expand. It fires -# the warning (with _au_warn_XXX), outputs it into the -# updated configure.ac (with AC_DIAGNOSE), and then outputs -# the replacement expansion. - - -# This is an auxiliary macro that is also run when -# autoupdate runs m4. It simply calls m4_warning, but -# we need a wrapper so that each warning is emitted only -# once. We break the quoting in m4_warning's argument in -# order to expand this macro's arguments, not AU_DEFUN's. + # 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. Well, these days various + # vendors have sloppily allowed non-ANSI syntax to slip into their + # library header files. GTK and OpenGL have been major offenders in this + # way. So... as of 2021, I guess we are forced to use "-std=gnu89", to + # allow those extensions, and hope that the warnings generated by + # "-pedantic" are heeded. + # + if test -n "$GCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc accepts -std=gnu89" >&5 +$as_echo_n "checking whether gcc accepts -std=gnu89... " >&6; } +if ${ac_cv_gcc_accepts_gnu89+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -rf conftest.$ac_ext + touch conftest.$ac_ext + if ( ( gcc -c -std=gnu89 conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ + grep unrecognized >/dev/null ); then + ac_cv_gcc_accepts_gnu89=no + else + ac_cv_gcc_accepts_gnu89=yes + CC="$CC -std=gnu89" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_accepts_gnu89" >&5 +$as_echo "$ac_cv_gcc_accepts_gnu89" >&6; } + ac_gcc_accepts_gnu89="$ac_cv_gcc_accepts_gnu89" + fi + if test -n "$GCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc accepts -pedantic" >&5 +$as_echo_n "checking whether gcc accepts -pedantic... " >&6; } +if ${ac_cv_gcc_accepts_pedantic+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -rf conftest.$ac_ext + touch conftest.$ac_ext + if ( ( gcc -c -pedantic conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ + grep unrecognized >/dev/null ); then + ac_cv_gcc_accepts_pedantic=no + else + ac_cv_gcc_accepts_pedantic=yes + CC="$CC -pedantic" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_accepts_pedantic" >&5 +$as_echo "$ac_cv_gcc_accepts_pedantic" >&6; } + ac_gcc_accepts_pedantic="$ac_cv_gcc_accepts_pedantic" + fi -# Finally, this is the expansion that is picked up by -# autoconf. It tells the user to run autoupdate, and -# then outputs the replacement expansion. We do not care -# about autoupdate's warning because that contains -# information on what to do *after* running autoupdate. + if test -n "$GCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc accepts -Wall" >&5 +$as_echo_n "checking whether gcc accepts -Wall... " >&6; } +if ${ac_cv_gcc_accepts_Wall+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -rf conftest.$ac_ext + touch conftest.$ac_ext + if ( ( gcc -c -Wall conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ + grep unrecognized >/dev/null ); then + ac_cv_gcc_accepts_Wall=no + else + ac_cv_gcc_accepts_Wall=yes + CC="$CC -Wall" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_accepts_Wall" >&5 +$as_echo "$ac_cv_gcc_accepts_Wall" >&6; } + ac_gcc_accepts_Wall="$ac_cv_gcc_accepts_Wall" + fi + if test -n "$GCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc accepts -Wnested-externs" >&5 +$as_echo_n "checking whether gcc accepts -Wnested-externs... " >&6; } +if ${ac_cv_gcc_accepts_wnested_externs+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -rf conftest.$ac_ext + touch conftest.$ac_ext + if ( ( gcc -c -Wnested-externs conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ + grep unrecognized >/dev/null ); then + ac_cv_gcc_accepts_wnested_externs=no + else + ac_cv_gcc_accepts_wnested_externs=yes + CC="$CC -Wnested-externs" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_accepts_wnested_externs" >&5 +$as_echo "$ac_cv_gcc_accepts_wnested_externs" >&6; } + ac_gcc_accepts_wnested_externs="$ac_cv_gcc_accepts_wnested_externs" + fi + if test -n "$GCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc accepts -Wstrict-prototypes" >&5 +$as_echo_n "checking whether gcc accepts -Wstrict-prototypes... " >&6; } +if ${ac_cv_gcc_accepts_wstrict_prototypes+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -rf conftest.$ac_ext + touch conftest.$ac_ext + if ( ( gcc -c -Wstrict-prototypes conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ + grep unrecognized >/dev/null ); then + ac_cv_gcc_accepts_wstrict_prototypes=no + else + ac_cv_gcc_accepts_wstrict_prototypes=yes + CC="$CC -Wstrict-prototypes" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_accepts_wstrict_prototypes" >&5 +$as_echo "$ac_cv_gcc_accepts_wstrict_prototypes" >&6; } + ac_gcc_accepts_wstrict_prototypes="$ac_cv_gcc_accepts_wstrict_prototypes" + fi - # This affects CC, LIBS, and CFLAGS, instead of defining new variables. + if test -n "$GCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc accepts -Wmissing-prototypes" >&5 +$as_echo_n "checking whether gcc accepts -Wmissing-prototypes... " >&6; } +if ${ac_cv_gcc_accepts_wmissing_prototypes+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -rf conftest.$ac_ext + touch conftest.$ac_ext + if ( ( gcc -c -Wmissing-prototypes conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ + grep unrecognized >/dev/null ); then + ac_cv_gcc_accepts_wmissing_prototypes=no + else + ac_cv_gcc_accepts_wmissing_prototypes=yes + CC="$CC -Wmissing-prototypes" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_accepts_wmissing_prototypes" >&5 +$as_echo "$ac_cv_gcc_accepts_wmissing_prototypes" >&6; } + ac_gcc_accepts_wmissing_prototypes="$ac_cv_gcc_accepts_wmissing_prototypes" + fi + if test -n "$GCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc accepts -Wdeclaration-after-statement" >&5 +$as_echo_n "checking whether gcc accepts -Wdeclaration-after-statement... " >&6; } +if ${ac_cv_gcc_accepts_declaration_after+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -rf conftest.$ac_ext + touch conftest.$ac_ext + if ( ( gcc -c -Wdeclaration-after-statement conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ + grep unrecognized >/dev/null ); then + ac_cv_gcc_accepts_declaration_after=no + else + ac_cv_gcc_accepts_declaration_after=yes + CC="$CC -Wdeclaration-after-statement" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_accepts_declaration_after" >&5 +$as_echo "$ac_cv_gcc_accepts_declaration_after" >&6; } + ac_gcc_accepts_declaration_after="$ac_cv_gcc_accepts_declaration_after" + fi -# Check whether --with-pthread was given. -if test "${with_pthread+set}" = set; then : - withval=$with_pthread; with_pthread="$withval"; with_pthread_req="$withval" + # "string length is greater than ISO C89 compilers required to support" + if test -n "$GCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc accepts -Wno-overlength-strings" >&5 +$as_echo_n "checking whether gcc accepts -Wno-overlength-strings... " >&6; } +if ${ac_cv_gcc_accepts_no_overlength_strings+:} false; then : + $as_echo_n "(cached) " >&6 else - with_pthread=yes + rm -rf conftest.$ac_ext + touch conftest.$ac_ext + if ( ( gcc -c -Wno-overlength-strings conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ + grep unrecognized >/dev/null ); then + ac_cv_gcc_accepts_no_overlength_strings=no + else + ac_cv_gcc_accepts_no_overlength_strings=yes + CC="$CC -Wno-overlength-strings" + fi fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_accepts_no_overlength_strings" >&5 +$as_echo "$ac_cv_gcc_accepts_no_overlength_strings" >&6; } + ac_gcc_accepts_no_overlength_strings="$ac_cv_gcc_accepts_no_overlength_strings" + fi + # Ignore warnings about using "inline" + if test -n "$GCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc accepts -Wno-language-extension-token" >&5 +$as_echo_n "checking whether gcc accepts -Wno-language-extension-token... " >&6; } +if ${ac_cv_gcc_accepts_no_language_ext_token+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -rf conftest.$ac_ext + touch conftest.$ac_ext + if ( ( gcc -c -Wno-language-extension-token conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ + grep unrecognized >/dev/null ); then + ac_cv_gcc_accepts_no_language_ext_token=no + else + ac_cv_gcc_accepts_no_language_ext_token=yes + CC="$CC -Wno-language-extension-token" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_accepts_no_language_ext_token" >&5 +$as_echo "$ac_cv_gcc_accepts_no_language_ext_token" >&6; } + ac_gcc_accepts_no_language_ext_token="$ac_cv_gcc_accepts_no_language_ext_token" + fi - if test "$with_pthread" = yes; then - # AX_PTHREAD might want a different compiler. + # Xlib headers use named variadic macros. + if test -n "$GCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc accepts -Wno-variadic-macros" >&5 +$as_echo_n "checking whether gcc accepts -Wno-variadic-macros... " >&6; } +if ${ac_cv_gcc_accepts_no_variadic_macros+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -rf conftest.$ac_ext + touch conftest.$ac_ext + if ( ( gcc -c -Wno-variadic-macros conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ + grep unrecognized >/dev/null ); then + ac_cv_gcc_accepts_no_variadic_macros=no + else + ac_cv_gcc_accepts_no_variadic_macros=yes + CC="$CC -Wno-variadic-macros" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_accepts_no_variadic_macros" >&5 +$as_echo "$ac_cv_gcc_accepts_no_variadic_macros" >&6; } + ac_gcc_accepts_no_variadic_macros="$ac_cv_gcc_accepts_no_variadic_macros" + fi + fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ax_pthread_ok=no - -# We used to check for pthread.h first, but this fails if pthread.h -# requires special compiler flags (e.g. on True64 or Sequent). -# It gets checked for in the link test anyway. - -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 -$as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" +#ifdef __STDC__ +# include +#else +# include #endif -char pthread_join (); -int -main () -{ -return pthread_join (); - ; - return 0; -} + Syntax error _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ax_pthread_ok=yes -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 -$as_echo "$ax_pthread_ok" >&6; } - if test x"$ax_pthread_ok" = xno; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" -fi +if ac_fn_c_try_cpp "$LINENO"; then : -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). +else + # Broken: fails on valid input. +continue +fi +rm -rf conftest.err conftest.i conftest.$ac_ext -# Create a list of thread flags to try. Items starting with a "-" are -# C compiler flags, and other items are library names, except for "none" -# which indicates that we try without any flags at all, and "pthread-config" -# which is a program returning the flags for the Pth emulation library. + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -rf conftest.err conftest.i conftest.$ac_ext -ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -rf conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: + done + ac_cv_prog_CPP=$CPP -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) -# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) -# -pthreads: Solaris/gcc -# -mthreads: Mingw32/gcc, Lynx/gcc -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads too; -# also defines -D_REENTRANT) -# ... -mt is also the pthreads flag for HP/aCC -# pthread: Linux, etcetera -# --thread-safe: KAI C++ -# pthread-config: use pthread-config program (for GNU Pth library) +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : -case ${host_os} in - solaris*) +else + # Broken: fails on valid input. +continue +fi +rm -rf conftest.err conftest.i conftest.$ac_ext - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthreads/-mt/ - # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather - # a function called by this macro, so we could check for that, but - # who knows whether they'll stub that too in a future libc.) So, - # we'll just look for -pthreads and -lpthread first: + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -rf conftest.err conftest.i conftest.$ac_ext - ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" - ;; +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -rf conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : - darwin*) - ax_pthread_flags="-pthread $ax_pthread_flags" - ;; -esac +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi -# Clang doesn't consider unrecognized options an error unless we specify -# -Werror. We throw in some extra Clang-specific options to ensure that -# this doesn't happen for GCC, which also accepts -Werror. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler needs -Werror to reject unknown flags" >&5 -$as_echo_n "checking if compiler needs -Werror to reject unknown flags... " >&6; } -save_CFLAGS="$CFLAGS" -ax_pthread_extra_flags="-Werror" -CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -int foo(void); + int main () { -foo() + +#ifndef __cplusplus + /* Ultrix mips cc rejects this sort of thing. */ + typedef int charset[2]; + const charset cs = { 0, 0 }; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this sort of thing. */ + char tx; + char *t = &tx; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; } bx; + struct s *b = &bx; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + ac_cv_c_const=yes else - ax_pthread_extra_flags= - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS="$save_CFLAGS" - -if test x"$ax_pthread_ok" = xno; then -for flag in $ax_pthread_flags; do +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then - case $flag in - none) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 -$as_echo_n "checking whether pthreads work without any flags... " >&6; } - ;; +$as_echo "#define const /**/" >>confdefs.h - -*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5 -$as_echo_n "checking whether pthreads work with $flag... " >&6; } - PTHREAD_CFLAGS="$flag" - ;; +fi - pthread-config) - # Extract the first word of "pthread-config", so it can be a program name with args. -set dummy pthread-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ax_pthread_config+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$ax_pthread_config"; then - ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ax_pthread_config="yes" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif - test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no" -fi -fi -ax_pthread_config=$ac_cv_prog_ax_pthread_config -if test -n "$ax_pthread_config"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5 -$as_echo "$ax_pthread_config" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } - if test x"$ax_pthread_config" = xno; then continue; fi - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; - - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 -$as_echo_n "checking for the pthreads library -l$flag... " >&6; } - PTHREAD_LIBS="-l$flag" - ;; - esac - - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - static void routine(void *a) { a = 0; } - static void *start_routine(void *a) { return a; } -int -main () -{ -pthread_t th; pthread_attr_t attr; - pthread_create(&th, 0, start_routine, 0); - pthread_join(th, 0); - pthread_attr_init(&attr); - pthread_cleanup_push(routine, 0); - pthread_cleanup_pop(0) /* ; */ - ; - return 0; -} +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ax_pthread_ok=yes -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" + ;; +esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 -$as_echo "$ax_pthread_ok" >&6; } - if test "x$ax_pthread_ok" = xyes; then - break; - fi +# stuff for Makefiles +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi + done +IFS=$as_save_IFS -# Various other checks: -if test "x$ax_pthread_ok" = xyes; then - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +rm -rf conftest.one conftest.two conftest.dir - # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 -$as_echo_n "checking for joinable pthread attribute... " >&6; } - attr_name=unknown - for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -int attr = $attr; return attr /* ; */ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - attr_name=$attr; break fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5 -$as_echo "$attr_name" >&6; } - if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } -cat >>confdefs.h <<_ACEOF -#define PTHREAD_CREATE_JOINABLE $attr_name -_ACEOF +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - fi +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5 -$as_echo_n "checking if more special flags are required for pthreads... " >&6; } - flag=no - case ${host_os} in - aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; - osf* | hpux*) flag="-D_REENTRANT";; - solaris*) - if test "$GCC" = "yes"; then - flag="-D_REENTRANT" - else - # TODO: What about Clang on Solaris? - flag="-mt -D_REENTRANT" - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag" >&5 -$as_echo "$flag" >&6; } - if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" - fi +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 -$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; } -if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \"\${INSTALL} -d\" creates intermediate directories" >&5 +$as_echo_n "checking whether \"\${INSTALL} -d\" creates intermediate directories... " >&6; } +if ${ac_cv_install_d_creates_dirs+:} false; then : $as_echo_n "(cached) " >&6 else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -int i = PTHREAD_PRIO_INHERIT; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ax_cv_PTHREAD_PRIO_INHERIT=yes -else - ax_cv_PTHREAD_PRIO_INHERIT=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + 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 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 -$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } - if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_install_d_creates_dirs" >&5 +$as_echo "$ac_cv_install_d_creates_dirs" >&6; } -$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h + if test "$ac_cv_install_d_creates_dirs" = no ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \"mkdir -p\" creates intermediate directories" >&5 +$as_echo_n "checking whether \"mkdir -p\" creates intermediate directories... " >&6; } +if ${ac_cv_mkdir_p_creates_dirs+:} false; then : + $as_echo_n "(cached) " >&6 +else + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mkdir_p_creates_dirs" >&5 +$as_echo "$ac_cv_mkdir_p_creates_dirs" >&6; } + fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" + 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 - # More AIX lossage: compile with *_r variant - if test "x$GCC" != xyes; then - case $host_os in - aix*) - case "x/$CC" in #( - x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) : - #handle absolute path differently from PATH based program lookup - case "x$CC" in #( - x/*) : - if as_fn_executable_p ${CC}_r; then : - PTHREAD_CC="${CC}_r" -fi ;; #( - *) : - for ac_prog in ${CC}_r -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_PTHREAD_CC+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$PTHREAD_CC"; then - ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -rf conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +# By default, autoconf sets INSTALL_SCRIPT to '${INSTALL_PROGRAM}'. +# That's wrong: it should be set to '${INSTALL}', so that one can +# implement the "install-strip" target properly (strip executables, +# but do not try to strip scripts.) +# +INSTALL_SCRIPT='${INSTALL}' + +# random libc stuff + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_PTHREAD_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break done -IFS=$as_save_IFS + rm -rf conftest.in conftest.tmp conftest.nl conftest.out;; +esac -fi -fi -PTHREAD_CC=$ac_cv_prog_PTHREAD_CC -if test -n "$PTHREAD_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 -$as_echo "$PTHREAD_CC" >&6; } + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + ac_cv_path_GREP=$GREP fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" - test -n "$PTHREAD_CC" && break -done -test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" - ;; -esac ;; #( - *) : - ;; +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -rf conftest.in conftest.tmp conftest.nl conftest.out;; esac - ;; - esac - fi + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP fi -test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$ax_pthread_ok" = xyes; then - if test "$CC" = "$PTHREAD_CC" -o -z "$ac_original_cc"; then - have_pthread=yes - else - ac_prog_cc_no_pthread=yes - fi +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : - : else - ax_pthread_ok=no - + ac_cv_header_stdc=no fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +rm -rf conftest* +fi +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include - if test "$have_pthread" = yes; then - $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : - CC=$PTHREAD_CC - fi - fi - # Needs ac_original_cc. +else + ac_cv_header_stdc=no +fi +rm -rf conftest* +fi +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif - if test -z "$GCC"; then - # not using GCC - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to request ANSI compilation" >&5 -$as_echo_n "checking how to request ANSI compilation... " >&6; } - case "$host" in - *-hpux* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: HPUX: adding -Ae" >&5 -$as_echo "HPUX: adding -Ae" >&6; } - CC="$CC -Ae" - ;; - *-aix* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: AIX: adding -qlanglvl=ansi -qhalt=e" >&5 -$as_echo "AIX: adding -qlanglvl=ansi -qhalt=e" >&6; } - CC="$CC -qlanglvl=ansi -qhalt=e" - ;; - *-dec-* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: DEC: adding -std1 -ieee" >&5 -$as_echo "DEC: adding -std1 -ieee" >&6; } - CC="$CC -std1" - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no idea" >&5 -$as_echo "no idea" >&6; } - ;; - esac - else - # using GCC - case "$host" in - *-solaris*) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Solaris: adding -D__EXTENSIONS__" >&5 -$as_echo "Solaris: adding -D__EXTENSIONS__" >&6; } - CC="$CC -D__EXTENSIONS__" - ;; - esac - fi - - OBJCC="$CC" - - # This test makes cross-compiling fail, so let's just assume that nobody - # is using a K&R compiler any more... - # -# 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Turning on gcc compiler warnings." >&5 -$as_echo "Turning on gcc compiler warnings." >&6; } - 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* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Turning on SGI compiler warnings." >&5 -$as_echo "Turning on SGI compiler warnings." >&6; } - 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 +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : -if test -n "$GCC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc accepts -Wno-overlength-strings" >&5 -$as_echo_n "checking whether gcc accepts -Wno-overlength-strings... " >&6; } -if ${ac_cv_gcc_accepts_no_overlength+:} false; then : - $as_echo_n "(cached) " >&6 else - rm -rf conftest.$ac_ext - touch conftest.$ac_ext - if ( ( gcc -c -Wno-overlength-strings conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ - grep unrecognized >/dev/null ); then - ac_cv_gcc_accepts_no_overlength=no - else - ac_cv_gcc_accepts_no_overlength=yes - CC="$CC -Wno-overlength-strings" - fi + ac_cv_header_stdc=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_accepts_no_overlength" >&5 -$as_echo "$ac_cv_gcc_accepts_no_overlength" >&6; } - ac_gcc_accepts_no_overlength="$ac_cv_gcc_accepts_no_overlength" - fi - -if test -n "$GCC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc accepts -Wdeclaration-after-statement" >&5 -$as_echo_n "checking whether gcc accepts -Wdeclaration-after-statement... " >&6; } -if ${ac_cv_gcc_accepts_no_decl_after+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -rf conftest.$ac_ext - touch conftest.$ac_ext - if ( ( gcc -c -Wdeclaration-after-statement conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ - grep unrecognized >/dev/null ); then - ac_cv_gcc_accepts_no_decl_after=no - else - ac_cv_gcc_accepts_no_decl_after=yes - CC="$CC -Wdeclaration-after-statement" - fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_accepts_no_decl_after" >&5 -$as_echo "$ac_cv_gcc_accepts_no_decl_after" >&6; } - ac_gcc_accepts_no_decl_after="$ac_cv_gcc_accepts_no_decl_after" - fi -if test -n "$GCC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc accepts -no-cpp-precomp" >&5 -$as_echo_n "checking whether gcc accepts -no-cpp-precomp... " >&6; } -if ${ac_cv_gcc_accepts_no_cpp_precomp+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -rf conftest.$ac_ext - touch conftest.$ac_ext - if ( ( gcc -c -no-cpp-precomp conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ - grep unrecognized >/dev/null ); then - ac_cv_gcc_accepts_no_cpp_precomp=no - else - ac_cv_gcc_accepts_no_cpp_precomp=yes - CC="$CC -no-cpp-precomp" - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_accepts_no_cpp_precomp" >&5 -$as_echo "$ac_cv_gcc_accepts_no_cpp_precomp" >&6; } - ac_gcc_accepts_no_cpp_precomp="$ac_cv_gcc_accepts_no_cpp_precomp" - fi - -if test -n "$GCC"; then - - 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! - ;; - *) - if test -n "$GCC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc accepts -std=c89" >&5 -$as_echo_n "checking whether gcc accepts -std=c89... " >&6; } -if ${ac_cv_gcc_accepts_std+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -rf conftest.$ac_ext - touch conftest.$ac_ext - if ( ( gcc -c -std=c89 conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ - grep unrecognized >/dev/null ); then - ac_cv_gcc_accepts_std=no - else - ac_cv_gcc_accepts_std=yes - CC="$CC -std=c89" - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gcc_accepts_std" >&5 -$as_echo "$ac_cv_gcc_accepts_std" >&6; } - ac_gcc_accepts_std="$ac_cv_gcc_accepts_std" - fi - - ;; - esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Disabling C++ comments in ANSI C code." >&5 -$as_echo "Disabling C++ comments in ANSI C code." >&6; } - # - # 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 +$as_echo "#define STDC_HEADERS 1" >>confdefs.h -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : -else - # Broken: fails on valid input. -continue fi -rm -rf conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include +done + +for ac_header in unistd.h inttypes.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break + fi -rm -rf conftest.err conftest.i conftest.$ac_ext done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -rf conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - done - ac_cv_prog_CPP=$CPP +ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" +if test "x$ac_cv_type_mode_t" = xyes; then : -fi - CPP=$ac_cv_prog_CPP else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error + +cat >>confdefs.h <<_ACEOF +#define mode_t int _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : -else - # Broken: fails on valid input. -continue fi -rm -rf conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue +ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" +if test "x$ac_cv_type_pid_t" = xyes; then : + else - # Passes both tests. -ac_preproc_ok=: -break + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + fi -rm -rf conftest.err conftest.i conftest.$ac_ext -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -rf conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : +fi + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE void +_ACEOF + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 +$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } +if ${ac_cv_header_sys_wait_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include +#include +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) +#endif +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif int main () { - -#ifndef __cplusplus - /* Ultrix mips cc rejects this sort of thing. */ - typedef int charset[2]; - const charset cs = { 0, 0 }; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *pcpcc; - char **ppc; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this sort of thing. */ - char tx; - char *t = &tx; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - if (s) return 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; } bx; - struct s *b = &bx; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - if (!foo) return 0; - } - return !cs[0] && !zero.x; -#endif - + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_const=yes + ac_cv_header_sys_wait_h=yes else - ac_cv_c_const=no + ac_cv_header_sys_wait_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 +$as_echo "$ac_cv_header_sys_wait_h" >&6; } +if test $ac_cv_header_sys_wait_h = yes; then -$as_echo "#define const /**/" >>confdefs.h +$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 +$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } +if eval \${$as_ac_Header+:} false; then : $as_echo_n "(cached) " >&6 else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif +#include +#include <$ac_hdr> +int +main () +{ +if ((DIR *) 0) +return 0; + ; + return 0; +} _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_inline=$ac_kw + eval "$as_ac_Header=yes" +else + eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done +fi +eval ac_res=\$$as_ac_Header + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +_ACEOF +ac_header_dirent=$ac_hdr; break fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +$as_echo_n "checking for library containing opendir... " >&6; } +if ${ac_cv_search_opendir+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" #endif +char opendir (); +int +main () +{ +return opendir (); + ; + return 0; +} _ACEOF - ;; -esac - - -ac_bc_result=`echo 6+9 | bc 2>/dev/null` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bc" >&5 -$as_echo_n "checking for bc... " >&6; } - if test "$ac_bc_result" = "15" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +for ac_lib in '' dir; do + if test -z "$ac_lib"; then + ac_res="none required" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - echo '' - as_fn_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." "$LINENO" 5 + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_opendir=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_opendir+:} false; then : + break +fi +done +if ${ac_cv_search_opendir+:} false; then : +else + ac_cv_search_opendir=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +$as_echo "$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" -# stuff for Makefiles -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : +fi + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 +$as_echo_n "checking for library containing opendir... " >&6; } +if ${ac_cv_search_opendir+:} false; then : $as_echo_n "(cached) " >&6 else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char opendir (); +int +main () +{ +return opendir (); + ; + return 0; +} +_ACEOF +for ac_lib in '' x; do + if test -z "$ac_lib"; then + ac_res="none required" else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_opendir=$ac_res fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_opendir+:} false; then : + break +fi +done +if ${ac_cv_search_opendir+:} false; then : -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +else + ac_cv_search_opendir=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 +$as_echo "$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' +fi -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \"\${INSTALL} -d\" creates intermediate directories" >&5 -$as_echo_n "checking whether \"\${INSTALL} -d\" creates intermediate directories... " >&6; } -if ${ac_cv_install_d_creates_dirs+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to call gettimeofday" >&5 +$as_echo_n "checking how to call gettimeofday... " >&6; } + if ${ac_cv_gettimeofday_args+:} false; then : $as_echo_n "(cached) " >&6 else - 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 - + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include +int +main () +{ +struct timeval tv; struct timezone tzp; + gettimeofday(&tv, &tzp); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_gettimeofday_args=2 +else + ac_gettimeofday_args=1 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_gettimeofday_args=$ac_gettimeofday_args fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_install_d_creates_dirs" >&5 -$as_echo "$ac_cv_install_d_creates_dirs" >&6; } - if test "$ac_cv_install_d_creates_dirs" = no ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \"mkdir -p\" creates intermediate directories" >&5 -$as_echo_n "checking whether \"mkdir -p\" creates intermediate directories... " >&6; } -if ${ac_cv_mkdir_p_creates_dirs+:} false; then : - $as_echo_n "(cached) " >&6 -else - 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 + ac_gettimeofday_args=$ac_cv_gettimeofday_args + if test "$ac_gettimeofday_args" = 1 ; then + $as_echo "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mkdir_p_creates_dirs" >&5 -$as_echo "$ac_cv_mkdir_p_creates_dirs" >&6; } - fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: one argument" >&5 +$as_echo "one argument" >&6; } + elif test "$ac_gettimeofday_args" = 2 ; then + $as_echo "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h - 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' + $as_echo "#define GETTIMEOFDAY_TWO_ARGS 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: two arguments" >&5 +$as_echo "two arguments" >&6; } else - # any other ideas? - INSTALL_DIRS='${INSTALL} -d' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5 +$as_echo "unknown" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } +if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} _ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -rf conftest.make + if ac_fn_c_try_compile "$LINENO"; then : + break fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_largefile_CC=' -n32'; break fi +rm -f core conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -rf conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +$as_echo "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi - -# By default, autoconf sets INSTALL_SCRIPT to '${INSTALL_PROGRAM}'. -# That's wrong: it should be set to '${INSTALL}', so that one can -# implement the "install-strip" target properly (strip executables, -# but do not try to strip scripts.) -# -INSTALL_SCRIPT='${INSTALL}' - -# random libc stuff - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -rf conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -rf conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else + while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include -#include - +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int main () { @@ -5162,518 +4834,674 @@ main () } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no + ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + ; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=64; break fi -rm -rf conftest* - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi +;; +esac rm -rf conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : + if test $ac_cv_sys_file_offset_bits = unknown; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } +if ${ac_cv_sys_large_files+:} false; then : + $as_echo_n "(cached) " >&6 else + while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int main () { - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; + + ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=no; break fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=1; break fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +$as_echo "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF +;; +esac +rm -rf conftest* + fi fi -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h +for ac_func in select fcntl uname nice setpriority getcwd getwd putenv sbrk do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi - done - -for ac_header in unistd.h inttypes.h +for ac_func in sigaction syslog realpath setrlimit do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi - done -ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" -if test "x$ac_cv_type_mode_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define mode_t int +for ac_func in setlocale sqrtf +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi +done -ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define pid_t int +for ac_func in getaddrinfo +do : + ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo" +if test "x$ac_cv_func_getaddrinfo" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETADDRINFO 1 _ACEOF fi +done -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : - -else +ac_fn_c_check_member "$LINENO" "struct sockaddr" "sa_len" "ac_cv_member_struct_sockaddr_sa_len" "#include +" +if test "x$ac_cv_member_struct_sockaddr_sa_len" = xyes; then : cat >>confdefs.h <<_ACEOF -#define size_t unsigned int +#define HAVE_STRUCT_SOCKADDR_SA_LEN 1 _ACEOF fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 -$as_echo_n "checking return type of signal handlers... " >&6; } -if ${ac_cv_type_signal+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct icmp" >&5 +$as_echo_n "checking for struct icmp... " >&6; } +if ${ac_cv_have_icmp+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include - +#include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include int main () { -return *(signal (0, 0)) (0) == 1; +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 + ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_type_signal=int + ac_cv_have_icmp=yes else - ac_cv_type_signal=void + ac_cv_have_icmp=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 -$as_echo "$ac_cv_type_signal" >&6; } - -cat >>confdefs.h <<_ACEOF -#define RETSIGTYPE $ac_cv_type_signal -_ACEOF - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_icmp" >&5 +$as_echo "$ac_cv_have_icmp" >&6; } + if test "$ac_cv_have_icmp" = yes ; then + $as_echo "#define HAVE_ICMP 1" >>confdefs.h -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : + fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct icmphdr" >&5 +$as_echo_n "checking for struct icmphdr... " >&6; } +if ${ac_cv_have_icmphdr+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include - +#include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include int main () { -if ((struct tm *) 0) -return 0; +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; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_time=yes + ac_cv_have_icmphdr=yes else - ac_cv_header_time=no + ac_cv_have_icmphdr=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then - -$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h - -fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_icmphdr" >&5 +$as_echo "$ac_cv_have_icmphdr" >&6; } + if test "$ac_cv_have_icmphdr" = yes ; then + $as_echo "#define HAVE_ICMPHDR 1" >>confdefs.h -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 -$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } -if ${ac_cv_header_sys_wait_h+:} false; then : + fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getifaddrs" >&5 +$as_echo_n "checking for getifaddrs... " >&6; } +if ${ac_cv_have_getifaddrs+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#ifndef WEXITSTATUS -# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) -#endif -#ifndef WIFEXITED -# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) -#endif - +#include + #include + #include + #include int main () { - int s; - wait (&s); - s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; +struct ifaddrs *ifa; + getifaddrs (&ifa); + ifa->ifa_next = 0; + ifa->ifa_addr->sa_family = 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_sys_wait_h=yes + ac_cv_have_getifaddrs=yes else - ac_cv_header_sys_wait_h=no + ac_cv_have_getifaddrs=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 -$as_echo "$ac_cv_header_sys_wait_h" >&6; } -if test $ac_cv_header_sys_wait_h = yes; then - -$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h - -fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_getifaddrs" >&5 +$as_echo "$ac_cv_have_getifaddrs" >&6; } + if test "$ac_cv_have_getifaddrs" = yes ; then + $as_echo "#define HAVE_GETIFADDRS 1" >>confdefs.h -ac_header_dirent=no -for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 -$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } -if eval \${$as_ac_Header+:} false; then : + fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t" >&5 +$as_echo_n "checking for socklen_t... " >&6; } +if ${ac_cv_type_socklen_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include <$ac_hdr> + #include + #include int main () { -if ((DIR *) 0) -return 0; +socklen_t socklen; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_ac_Header=yes" + ac_cv_type_socklen_t=yes else - eval "$as_ac_Header=no" + ac_cv_type_socklen_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -eval ac_res=\$$as_ac_Header - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_socklen_t" >&5 +$as_echo "$ac_cv_type_socklen_t" >&6; } + if test "$ac_cv_type_socklen_t" != yes; then + +$as_echo "#define socklen_t int" >>confdefs.h + + fi +for ac_header in crypt.h sys/select.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF -ac_header_dirent=$ac_hdr; break fi done -# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. -if test $ac_header_dirent = dirent.h; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : + +for ac_prog in perl5 perl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PERL+:} false; then : $as_echo_n "(cached) " >&6 else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char opendir (); -int -main () -{ -return opendir (); - ; - return 0; -} -_ACEOF -for ac_lib in '' dir; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" + case $PERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_PERL="$PERL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_opendir=$ac_res +done + done +IFS=$as_save_IFS + + ;; +esac fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : - break +PERL=$ac_cv_path_PERL +if test -n "$PERL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 +$as_echo "$PERL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + + test -n "$PERL" && break done -if ${ac_cv_search_opendir+:} false; then : + if test -z "$PERL" ; then + PERL_VERSION=0 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking perl version" >&5 +$as_echo_n "checking perl version... " >&6; } +if ${ac_cv_perl_version+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_search_opendir=no + ac_cv_perl_version=`$PERL -e "$perl_version_cmd"` fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_perl_version" >&5 +$as_echo "$ac_cv_perl_version" >&6; } + PERL_VERSION=$ac_cv_perl_version + fi + +if test -z "$PERL" ; then + # don't let it be blank... + PERL=/usr/bin/perl fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } -ac_res=$ac_cv_search_opendir -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 +$as_echo_n "checking for X... " >&6; } + +# Check whether --with-x was given. +if test "${with_x+set}" = set; then : + withval=$with_x; fi +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } -if ${ac_cv_search_opendir+:} false; then : + case $x_includes,$x_libraries in #( + *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( + *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : $as_echo_n "(cached) " >&6 else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char opendir (); -int -main () -{ -return opendir (); - ; - return 0; -} + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=no ac_x_libraries=no +rm -f -r conftest.dir +if mkdir conftest.dir; then + cd conftest.dir + cat >Imakefile <<'_ACEOF' +incroot: + @echo incroot='${INCROOT}' +usrlibdir: + @echo usrlibdir='${USRLIBDIR}' +libdir: + @echo libdir='${LIBDIR}' _ACEOF -for ac_lib in '' x; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" + if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. + for ac_var in incroot usrlibdir libdir; do + eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" + done + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl dylib la dll; do + if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && + test -f "$ac_im_libdir/libX11.$ac_extension"; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case $ac_im_incroot in + /usr/include) ac_x_includes= ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; + esac + case $ac_im_usrlibdir in + /usr/lib | /usr/lib64 | /lib | /lib64) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; + esac fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_opendir=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_opendir+:} false; then : - break + cd .. + rm -f -r conftest.dir fi -done -if ${ac_cv_search_opendir+:} false; then : -else - ac_cv_search_opendir=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } -ac_res=$ac_cv_search_opendir -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +# Standard set of common directories for X headers. +# Check X11 before X11Rn because it is often a symlink to the current release. +ac_x_header_dirs=' +/usr/X11/include +/usr/X11R7/include +/usr/X11R6/include +/usr/X11R5/include +/usr/X11R4/include -fi +/usr/include/X11 +/usr/include/X11R7 +/usr/include/X11R6 +/usr/include/X11R5 +/usr/include/X11R4 -fi +/usr/local/X11/include +/usr/local/X11R7/include +/usr/local/X11R6/include +/usr/local/X11R5/include +/usr/local/X11R4/include -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to call gettimeofday" >&5 -$as_echo_n "checking how to call gettimeofday... " >&6; } - if ${ac_cv_gettimeofday_args+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include -int -main () -{ -struct timeval tv; struct timezone tzp; - gettimeofday(&tv, &tzp); - ; - return 0; -} +/usr/local/include/X11 +/usr/local/include/X11R7 +/usr/local/include/X11R6 +/usr/local/include/X11R5 +/usr/local/include/X11R4 + +/usr/X386/include +/usr/x386/include +/usr/XFree86/include/X11 + +/usr/include +/usr/local/include +/usr/unsupported/include +/usr/athena/include +/usr/local/x11r5/include +/usr/lpp/Xamples/include + +/usr/openwin/include +/usr/openwin/share/include' + +if test "$ac_x_includes" = no; then + # Guess where to find include files, by looking for Xlib.h. + # First, try using that file with no special directory specified. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_gettimeofday_args=2 +if ac_fn_c_try_cpp "$LINENO"; then : + # We can compile using X headers with no special include directory. +ac_x_includes= else + for ac_dir in $ac_x_header_dirs; do + if test -r "$ac_dir/X11/Xlib.h"; then + ac_x_includes=$ac_dir + break + fi +done +fi +rm -rf conftest.err conftest.i conftest.$ac_ext +fi # $ac_x_includes = no + +if test "$ac_x_libraries" = no; then + # Check for the libraries. + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS=$LIBS + LIBS="-lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #include +#include int main () { -struct timeval tv; gettimeofday(&tv); +XrmInitialize () ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_gettimeofday_args=1 +if ac_fn_c_try_link "$LINENO"; then : + LIBS=$ac_save_LIBS +# We can link X programs with no special library path. +ac_x_libraries= else - ac_gettimeofday_args=0 -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + LIBS=$ac_save_LIBS +for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +do + # Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl dylib la dll; do + if test -r "$ac_dir/libX11.$ac_extension"; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cv_gettimeofday_args=$ac_gettimeofday_args +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi # $ac_x_libraries = no + +case $ac_x_includes,$ac_x_libraries in #( + no,* | *,no | *\'*) + # Didn't find X, or a directory has "'" in its name. + ac_cv_have_x="have_x=no";; #( + *) + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes\ + ac_x_includes='$ac_x_includes'\ + ac_x_libraries='$ac_x_libraries'" +esac fi +;; #( + *) have_x=yes;; + esac + eval "$ac_cv_have_x" +fi # $with_x != no - ac_gettimeofday_args=$ac_cv_gettimeofday_args - if test "$ac_gettimeofday_args" = 1 ; then - $as_echo "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h +if test "$have_x" != yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 +$as_echo "$have_x" >&6; } + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes\ + ac_x_includes='$x_includes'\ + ac_x_libraries='$x_libraries'" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 +$as_echo "libraries $x_libraries, headers $x_includes" >&6; } +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: one argument" >&5 -$as_echo "one argument" >&6; } - elif test "$ac_gettimeofday_args" = 2 ; then - $as_echo "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h +if test "$no_x" = yes; then + # Not all programs may use this symbol, but it does not hurt to define it. - $as_echo "#define GETTIMEOFDAY_TWO_ARGS 1" >>confdefs.h +$as_echo "#define X_DISPLAY_MISSING 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: two arguments" >&5 -$as_echo "two arguments" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5 -$as_echo "unknown" >&6; } + X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= +else + if test -n "$x_includes"; then + X_CFLAGS="$X_CFLAGS -I$x_includes" fi -# Check whether --enable-largefile was given. -if test "${enable_largefile+set}" = set; then : - enableval=$enable_largefile; -fi + # It would also be nice to do this for all -L options, not just this one. + if test -n "$x_libraries"; then + X_LIBS="$X_LIBS -L$x_libraries" + # For Solaris; some versions of Sun CC require a space after -R and + # others require no space. Words are not sufficient . . . . + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5 +$as_echo_n "checking whether -R must be followed by a space... " >&6; } + ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" + ac_xsave_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -if test "$enable_largefile" != no; then +int +main () +{ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 -$as_echo_n "checking for special C compiler options needed for large files... " >&6; } -if ${ac_cv_sys_largefile_CC+:} false; then : - $as_echo_n "(cached) " >&6 + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + X_LIBS="$X_LIBS -R$x_libraries" else - ac_cv_sys_largefile_CC=no - if test "$GCC" != yes; then - ac_save_CC=$CC - while :; do - # IRIX 6.2 and later do not support large files by default, - # so use the C compiler's -n32 option if that helps. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + LIBS="$ac_xsave_LIBS -R $x_libraries" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + int main () { @@ -5682,792 +5510,568 @@ main () return 0; } _ACEOF - if ac_fn_c_try_compile "$LINENO"; then : - break -fi -rm -f core conftest.err conftest.$ac_objext - CC="$CC -n32" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_largefile_CC=' -n32'; break +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + X_LIBS="$X_LIBS -R $x_libraries" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: neither works" >&5 +$as_echo "neither works" >&6; } fi -rm -f core conftest.err conftest.$ac_objext - break - done - CC=$ac_save_CC - rm -rf conftest.$ac_ext - fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 -$as_echo "$ac_cv_sys_largefile_CC" >&6; } - if test "$ac_cv_sys_largefile_CC" != no; then - CC=$CC$ac_cv_sys_largefile_CC +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_c_werror_flag=$ac_xsave_c_werror_flag + LIBS=$ac_xsave_LIBS fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } -if ${ac_cv_sys_file_offset_bits+:} false; then : - $as_echo_n "(cached) " >&6 -else - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # Check for system-dependent libraries X programs must link with. + # Do this before checking for the system-independent R6 libraries + # (-lICE), since we may need -lsocket or whatever for X linking. + + if test "$ISC" = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" + else + # Martyn Johnson says this is needed for Ultrix, if the X + # libraries were built with DECnet support. And Karl Berry says + # the Alpha needs dnet_stub (dnet does not exist). + ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char XOpenDisplay (); int main () { - +return XOpenDisplay (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_file_offset_bits=no; break -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#define _FILE_OFFSET_BITS 64 -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; +if ac_fn_c_try_link "$LINENO"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5 +$as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; } +if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldnet $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dnet_ntoa (); int main () { - +return dnet_ntoa (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_file_offset_bits=64; break +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dnet_dnet_ntoa=yes +else + ac_cv_lib_dnet_dnet_ntoa=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cv_sys_file_offset_bits=unknown - break -done +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 -$as_echo "$ac_cv_sys_file_offset_bits" >&6; } -case $ac_cv_sys_file_offset_bits in #( - no | unknown) ;; - *) -cat >>confdefs.h <<_ACEOF -#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits -_ACEOF -;; -esac -rm -rf conftest* - if test $ac_cv_sys_file_offset_bits = unknown; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 -$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } -if ${ac_cv_sys_large_files+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 +$as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; } +if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then : + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" +fi + + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5 +$as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; } +if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldnet_stub $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dnet_ntoa (); int main () { - +return dnet_ntoa (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_large_files=no; break +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dnet_stub_dnet_ntoa=yes +else + ac_cv_lib_dnet_stub_dnet_ntoa=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 +$as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } +if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then : + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" +fi + + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$ac_xsave_LIBS" + + # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, + # to get the SysV transport functions. + # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) + # needs -lnsl. + # The nsl library prevents programs from opening the X display + # on Irix 5.2, according to T.E. Dickey. + # The functions gethostbyname, getservbyname, and inet_addr are + # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. + ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" +if test "x$ac_cv_func_gethostbyname" = xyes; then : + +fi + + if test $ac_cv_func_gethostbyname = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 +$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } +if ${ac_cv_lib_nsl_gethostbyname+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#define _LARGE_FILES 1 -#include - /* Check that off_t can represent 2**63 - 1 correctly. - We can't simply define LARGE_OFF_T to be 9223372036854775807, - since some C++ compilers masquerading as C compilers - incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - && LARGE_OFF_T % 2147483647 == 1) - ? 1 : -1]; + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); int main () { - +return gethostbyname (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sys_large_files=1; break +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_nsl_gethostbyname=yes +else + ac_cv_lib_nsl_gethostbyname=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cv_sys_large_files=unknown - break -done +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 -$as_echo "$ac_cv_sys_large_files" >&6; } -case $ac_cv_sys_large_files in #( - no | unknown) ;; - *) -cat >>confdefs.h <<_ACEOF -#define _LARGE_FILES $ac_cv_sys_large_files -_ACEOF -;; -esac -rm -rf conftest* - fi - - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 +$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } +if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi -for ac_func in select fcntl uname nice setpriority getcwd getwd putenv sbrk -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF + if test $ac_cv_lib_nsl_gethostbyname = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5 +$as_echo_n "checking for gethostbyname in -lbsd... " >&6; } +if ${ac_cv_lib_bsd_gethostbyname+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lbsd $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); +int +main () +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_bsd_gethostbyname=yes +else + ac_cv_lib_bsd_gethostbyname=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5 +$as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; } +if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then : + X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi -done -for ac_func in sigaction syslog realpath setrlimit -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF + fi + fi + + # lieder@skyler.mavd.honeywell.com says without -lsocket, + # socket/setsockopt and other routines are undefined under SCO ODT + # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary + # on later versions), says Simon Leinen: it contains gethostby* + # variants that don't use the name server (or something). -lsocket + # must be given before -lnsl if both are needed. We assume that + # if connect needs -lnsl, so does gethostbyname. + ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" +if test "x$ac_cv_func_connect" = xyes; then : fi -done -for ac_func in setlocale sqrtf -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -for ac_func in getaddrinfo -do : - ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo" -if test "x$ac_cv_func_getaddrinfo" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETADDRINFO 1 -_ACEOF - -fi -done - -ac_fn_c_check_member "$LINENO" "struct sockaddr" "sa_len" "ac_cv_member_struct_sockaddr_sa_len" "#include -" -if test "x$ac_cv_member_struct_sockaddr_sa_len" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SOCKADDR_SA_LEN 1 -_ACEOF - - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct icmp" >&5 -$as_echo_n "checking for struct icmp... " >&6; } -if ${ac_cv_have_icmp+:} false; then : + if test $ac_cv_func_connect = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 +$as_echo_n "checking for connect in -lsocket... " >&6; } +if ${ac_cv_lib_socket_connect+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $X_EXTRA_LIBS $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char connect (); int main () { -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 - +return connect (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_have_icmp=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_socket_connect=yes else - ac_cv_have_icmp=no + ac_cv_lib_socket_connect=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_icmp" >&5 -$as_echo "$ac_cv_have_icmp" >&6; } - if test "$ac_cv_have_icmp" = yes ; then - $as_echo "#define HAVE_ICMP 1" >>confdefs.h - - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct icmphdr" >&5 -$as_echo_n "checking for struct icmphdr... " >&6; } -if ${ac_cv_have_icmphdr+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -int -main () -{ -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; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_have_icmphdr=yes -else - ac_cv_have_icmphdr=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 +$as_echo "$ac_cv_lib_socket_connect" >&6; } +if test "x$ac_cv_lib_socket_connect" = xyes; then : + X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + fi + + # Guillermo Gomez says -lposix is necessary on A/UX. + ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove" +if test "x$ac_cv_func_remove" = xyes; then : + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_icmphdr" >&5 -$as_echo "$ac_cv_have_icmphdr" >&6; } - if test "$ac_cv_have_icmphdr" = yes ; then - $as_echo "#define HAVE_ICMPHDR 1" >>confdefs.h - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getifaddrs" >&5 -$as_echo_n "checking for getifaddrs... " >&6; } -if ${ac_cv_have_getifaddrs+:} false; then : + if test $ac_cv_func_remove = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5 +$as_echo_n "checking for remove in -lposix... " >&6; } +if ${ac_cv_lib_posix_remove+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #include - #include - #include + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char remove (); int main () { -struct ifaddrs *ifa; - getifaddrs (&ifa); - ifa->ifa_next = 0; - ifa->ifa_addr->sa_family = 0; +return remove (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_have_getifaddrs=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_posix_remove=yes else - ac_cv_have_getifaddrs=no + ac_cv_lib_posix_remove=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5 +$as_echo "$ac_cv_lib_posix_remove" >&6; } +if test "x$ac_cv_lib_posix_remove" = xyes; then : + X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_getifaddrs" >&5 -$as_echo "$ac_cv_have_getifaddrs" >&6; } - if test "$ac_cv_have_getifaddrs" = yes ; then - $as_echo "#define HAVE_GETIFADDRS 1" >>confdefs.h - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t" >&5 -$as_echo_n "checking for socklen_t... " >&6; } -if ${ac_cv_type_socklen_t+:} false; then : + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat" +if test "x$ac_cv_func_shmat" = xyes; then : + +fi + + if test $ac_cv_func_shmat = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5 +$as_echo_n "checking for shmat in -lipc... " >&6; } +if ${ac_cv_lib_ipc_shmat+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lipc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shmat (); int main () { - - socklen_t socklen; - +return shmat (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_type_socklen_t=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ipc_shmat=yes else - ac_cv_type_socklen_t=no + ac_cv_lib_ipc_shmat=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_socklen_t" >&5 -$as_echo "$ac_cv_type_socklen_t" >&6; } - if test "$ac_cv_type_socklen_t" != yes; then - -$as_echo "#define socklen_t int" >>confdefs.h - - fi -for ac_header in crypt.h sys/select.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -for ac_prog in perl5 perl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PERL+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PERL in - [\\/]* | ?:[\\/]*) - ac_cv_path_PERL="$PERL" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PERL=$ac_cv_path_PERL -if test -n "$PERL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 -$as_echo "$PERL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5 +$as_echo "$ac_cv_lib_ipc_shmat" >&6; } +if test "x$ac_cv_lib_ipc_shmat" = xyes; then : + X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi - - test -n "$PERL" && break -done - - if test -z "$PERL" ; then - PERL_VERSION=0 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking perl version" >&5 -$as_echo_n "checking perl version... " >&6; } -if ${ac_cv_perl_version+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_perl_version=`$PERL -e "$perl_version_cmd"` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_perl_version" >&5 -$as_echo "$ac_cv_perl_version" >&6; } - PERL_VERSION=$ac_cv_perl_version + fi fi - -if test -z "$PERL" ; then - # don't let it be blank... - PERL=/usr/bin/perl -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 -$as_echo_n "checking for X... " >&6; } - - -# Check whether --with-x was given. -if test "${with_x+set}" = set; then : - withval=$with_x; -fi - -# $have_x is `yes', `no', `disabled', or empty when we do not yet know. -if test "x$with_x" = xno; then - # The user explicitly disabled X. - have_x=disabled -else - case $x_includes,$x_libraries in #( - *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( - *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : + # Check for libraries that X11R6 Xt/Xaw programs need. + ac_save_LDFLAGS=$LDFLAGS + test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" + # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to + # check for ICE first), but we must link in the order -lSM -lICE or + # we get undefined symbols. So assume we have SM if we have ICE. + # These have to be linked with before -lX11, unlike the other + # libraries we check for below, so use a different variable. + # John Interrante, Karl Berry + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5 +$as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; } +if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then : $as_echo_n "(cached) " >&6 else - # One or both of the vars are not set, and there is no cached value. -ac_x_includes=no ac_x_libraries=no -rm -f -r conftest.dir -if mkdir conftest.dir; then - cd conftest.dir - cat >Imakefile <<'_ACEOF' -incroot: - @echo incroot='${INCROOT}' -usrlibdir: - @echo usrlibdir='${USRLIBDIR}' -libdir: - @echo libdir='${LIBDIR}' -_ACEOF - if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then - # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. - for ac_var in incroot usrlibdir libdir; do - eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" - done - # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. - for ac_extension in a so sl dylib la dll; do - if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && - test -f "$ac_im_libdir/libX11.$ac_extension"; then - ac_im_usrlibdir=$ac_im_libdir; break - fi - done - # Screen out bogus values from the imake configuration. They are - # bogus both because they are the default anyway, and because - # using them would break gcc on systems where it needs fixed includes. - case $ac_im_incroot in - /usr/include) ac_x_includes= ;; - *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; - esac - case $ac_im_usrlibdir in - /usr/lib | /usr/lib64 | /lib | /lib64) ;; - *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; - esac - fi - cd .. - rm -f -r conftest.dir -fi - -# Standard set of common directories for X headers. -# Check X11 before X11Rn because it is often a symlink to the current release. -ac_x_header_dirs=' -/usr/X11/include -/usr/X11R7/include -/usr/X11R6/include -/usr/X11R5/include -/usr/X11R4/include - -/usr/include/X11 -/usr/include/X11R7 -/usr/include/X11R6 -/usr/include/X11R5 -/usr/include/X11R4 - -/usr/local/X11/include -/usr/local/X11R7/include -/usr/local/X11R6/include -/usr/local/X11R5/include -/usr/local/X11R4/include - -/usr/local/include/X11 -/usr/local/include/X11R7 -/usr/local/include/X11R6 -/usr/local/include/X11R5 -/usr/local/include/X11R4 - -/usr/X386/include -/usr/x386/include -/usr/XFree86/include/X11 - -/usr/include -/usr/local/include -/usr/unsupported/include -/usr/athena/include -/usr/local/x11r5/include -/usr/lpp/Xamples/include - -/usr/openwin/include -/usr/openwin/share/include' - -if test "$ac_x_includes" = no; then - # Guess where to find include files, by looking for Xlib.h. - # First, try using that file with no special directory specified. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lICE $X_EXTRA_LIBS $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # We can compile using X headers with no special include directory. -ac_x_includes= -else - for ac_dir in $ac_x_header_dirs; do - if test -r "$ac_dir/X11/Xlib.h"; then - ac_x_includes=$ac_dir - break - fi -done -fi -rm -rf conftest.err conftest.i conftest.$ac_ext -fi # $ac_x_includes = no -if test "$ac_x_libraries" = no; then - # Check for the libraries. - # See if we find them without any special options. - # Don't add to $LIBS permanently. - ac_save_LIBS=$LIBS - LIBS="-lX11 $LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char IceConnectionNumber (); int main () { -XrmInitialize () +return IceConnectionNumber (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - LIBS=$ac_save_LIBS -# We can link X programs with no special library path. -ac_x_libraries= + ac_cv_lib_ICE_IceConnectionNumber=yes else - LIBS=$ac_save_LIBS -for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` -do - # Don't even attempt the hair of trying to link an X program! - for ac_extension in a so sl dylib la dll; do - if test -r "$ac_dir/libX11.$ac_extension"; then - ac_x_libraries=$ac_dir - break 2 - fi - done -done + ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -fi # $ac_x_libraries = no - -case $ac_x_includes,$ac_x_libraries in #( - no,* | *,no | *\'*) - # Didn't find X, or a directory has "'" in its name. - ac_cv_have_x="have_x=no";; #( - *) - # Record where we found X for the cache. - ac_cv_have_x="have_x=yes\ - ac_x_includes='$ac_x_includes'\ - ac_x_libraries='$ac_x_libraries'" -esac +LIBS=$ac_check_lib_save_LIBS fi -;; #( - *) have_x=yes;; - esac - eval "$ac_cv_have_x" -fi # $with_x != no - -if test "$have_x" != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 -$as_echo "$have_x" >&6; } - no_x=yes -else - # If each of the values was on the command line, it overrides each guess. - test "x$x_includes" = xNONE && x_includes=$ac_x_includes - test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries - # Update the cache value to reflect the command line values. - ac_cv_have_x="have_x=yes\ - ac_x_includes='$x_includes'\ - ac_x_libraries='$x_libraries'" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 -$as_echo "libraries $x_libraries, headers $x_includes" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 +$as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } +if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then : + X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi -if test "$no_x" = yes; then - # Not all programs may use this symbol, but it does not hurt to define it. - -$as_echo "#define X_DISPLAY_MISSING 1" >>confdefs.h + LDFLAGS=$ac_save_LDFLAGS - X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= -else - if test -n "$x_includes"; then - X_CFLAGS="$X_CFLAGS -I$x_includes" - fi +fi - # It would also be nice to do this for all -L options, not just this one. - if test -n "$x_libraries"; then - X_LIBS="$X_LIBS -L$x_libraries" - # For Solaris; some versions of Sun CC require a space after -R and - # others require no space. Words are not sufficient . . . . - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5 -$as_echo_n "checking whether -R must be followed by a space... " >&6; } - ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" - ac_xsave_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +if test "$have_x" != yes; then + as_fn_error $? "Couldn't find X11 headers/libs. Try \`$0 --help'." "$LINENO" 5 +fi -int -main () -{ +case "$host" in + *-hpux*) - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - X_LIBS="$X_LIBS -R$x_libraries" -else - LIBS="$ac_xsave_LIBS -R $x_libraries" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + # The following arcana was gleaned from conversations with + # Eric Schwartz : + # + # 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 -int -main () -{ + # 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 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - X_LIBS="$X_LIBS -R $x_libraries" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: neither works" >&5 -$as_echo "neither works" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_c_werror_flag=$ac_xsave_c_werror_flag - LIBS=$ac_xsave_LIBS - 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 - # Check for system-dependent libraries X programs must link with. - # Do this before checking for the system-independent R6 libraries - # (-lICE), since we may need -lsocket or whatever for X linking. + # 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 - if test "$ISC" = yes; then - X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" - else - # Martyn Johnson says this is needed for Ultrix, if the X - # libraries were built with DECnet support. And Karl Berry says - # the Alpha needs dnet_stub (dnet does not exist). - ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + ;; + *-solaris*) -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char XOpenDisplay (); -int -main () -{ -return XOpenDisplay (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : + # 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" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5 -$as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; } -if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then : + # Some versions of Slowlaris Motif require -lgen. But not all. Why? + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for regcmp in -lgen" >&5 +$as_echo_n "checking for regcmp in -lgen... " >&6; } +if ${ac_cv_lib_gen_regcmp+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-ldnet $LIBS" +LIBS="-lgen $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -6477,732 +6081,338 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char dnet_ntoa (); +char regcmp (); int main () { -return dnet_ntoa (); +return regcmp (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dnet_dnet_ntoa=yes + ac_cv_lib_gen_regcmp=yes else - ac_cv_lib_dnet_dnet_ntoa=no + ac_cv_lib_gen_regcmp=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 -$as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; } -if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then : - X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gen_regcmp" >&5 +$as_echo "$ac_cv_lib_gen_regcmp" >&6; } +if test "x$ac_cv_lib_gen_regcmp" = xyes; then : + MOTIF_LIBS="$MOTIF_LIBS -lgen" fi - if test $ac_cv_lib_dnet_dnet_ntoa = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5 -$as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; } -if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldnet_stub $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + fi -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dnet_ntoa (); -int -main () -{ -return dnet_ntoa (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dnet_stub_dnet_ntoa=yes -else - ac_cv_lib_dnet_stub_dnet_ntoa=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 -$as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } -if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then : - X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" -fi + ;; + *-darwin*) - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS="$ac_xsave_LIBS" + # 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 - # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, - # to get the SysV transport functions. - # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) - # needs -lnsl. - # The nsl library prevents programs from opening the X display - # on Irix 5.2, according to T.E. Dickey. - # The functions gethostbyname, getservbyname, and inet_addr are - # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. - ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = xyes; then : + # Fink on macOS + if test -d /sw/include ; then + X_CFLAGS="-I/sw/include $X_CFLAGS" + X_LIBS="-L/sw/lib $X_LIBS" + fi -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 - if test $ac_cv_func_gethostbyname = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 -$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } -if ${ac_cv_lib_nsl_gethostbyname+:} false; then : + # 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XPointer" >&5 +$as_echo_n "checking for XPointer... " >&6; } +if ${ac_cv_xpointer+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnsl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname (); + 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` + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include int main () { -return gethostbyname (); +XPointer foo = (XPointer) 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_nsl_gethostbyname=yes +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_xpointer=yes else - ac_cv_lib_nsl_gethostbyname=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + ac_cv_xpointer=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 -$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } -if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : - X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$ac_save_CPPFLAGS" fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_xpointer" >&5 +$as_echo "$ac_cv_xpointer" >&6; } + if test "$ac_cv_xpointer" != yes; then + $as_echo "#define XPointer char*" >>confdefs.h - if test $ac_cv_lib_nsl_gethostbyname = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5 -$as_echo_n "checking for gethostbyname in -lbsd... " >&6; } -if ${ac_cv_lib_bsd_gethostbyname+:} false; then : + fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xt" >&5 +$as_echo_n "checking for Xt... " >&6; } +if ${ac_cv_libxt+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lbsd $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname (); + 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` + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include int main () { -return gethostbyname (); +Widget foo = (Widget) 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_bsd_gethostbyname=yes +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_libxt=yes else - ac_cv_lib_bsd_gethostbyname=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + ac_cv_libxt=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5 -$as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; } -if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then : - X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$ac_save_CPPFLAGS" fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libxt" >&5 +$as_echo "$ac_cv_libxt" >&6; } - fi - fi - - # lieder@skyler.mavd.honeywell.com says without -lsocket, - # socket/setsockopt and other routines are undefined under SCO ODT - # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary - # on later versions), says Simon Leinen: it contains gethostby* - # variants that don't use the name server (or something). -lsocket - # must be given before -lnsl if both are needed. We assume that - # if connect needs -lnsl, so does gethostbyname. - ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" -if test "x$ac_cv_func_connect" = xyes; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether this is macOS" >&5 +$as_echo_n "checking whether this is macOS... " >&6; } + ac_macosx=no + ac_irix=no + case "$host" in + *-apple-darwin* ) + ac_macosx=yes + ;; + *-irix* ) + ac_irix=yes + ;; + esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_macosx" >&5 +$as_echo "$ac_macosx" >&6; } -fi +############################################################################### +# +# pkg-config +# +############################################################################### - if test $ac_cv_func_connect = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 -$as_echo_n "checking for connect in -lsocket... " >&6; } -if ${ac_cv_lib_socket_connect+:} false; then : +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_pkg_config+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $X_EXTRA_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + case $pkg_config in + [\\/]* | ?:[\\/]*) + ac_cv_path_pkg_config="$pkg_config" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_pkg_config="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char connect (); -int -main () -{ -return connect (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_socket_connect=yes -else - ac_cv_lib_socket_connect=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + ;; +esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 -$as_echo "$ac_cv_lib_socket_connect" >&6; } -if test "x$ac_cv_lib_socket_connect" = xyes; then : - X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" +pkg_config=$ac_cv_path_pkg_config +if test -n "$pkg_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pkg_config" >&5 +$as_echo "$pkg_config" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - fi - - # Guillermo Gomez says -lposix is necessary on A/UX. - ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove" -if test "x$ac_cv_func_remove" = xyes; then : - fi - - if test $ac_cv_func_remove = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5 -$as_echo_n "checking for remove in -lposix... " >&6; } -if ${ac_cv_lib_posix_remove+:} false; then : +if test -z "$ac_cv_path_pkg_config"; then + ac_pt_pkg_config=$pkg_config + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_pkg_config+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lposix $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char remove (); -int -main () -{ -return remove (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_posix_remove=yes -else - ac_cv_lib_posix_remove=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5 -$as_echo "$ac_cv_lib_posix_remove" >&6; } -if test "x$ac_cv_lib_posix_remove" = xyes; then : - X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" -fi - - fi - - # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. - ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat" -if test "x$ac_cv_func_shmat" = xyes; then : + case $ac_pt_pkg_config in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_pkg_config="$ac_pt_pkg_config" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_pkg_config="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + ;; +esac fi - - if test $ac_cv_func_shmat = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5 -$as_echo_n "checking for shmat in -lipc... " >&6; } -if ${ac_cv_lib_ipc_shmat+:} false; then : - $as_echo_n "(cached) " >&6 +ac_pt_pkg_config=$ac_cv_path_ac_pt_pkg_config +if test -n "$ac_pt_pkg_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_pkg_config" >&5 +$as_echo "$ac_pt_pkg_config" >&6; } else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lipc $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shmat (); -int -main () -{ -return shmat (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ipc_shmat=yes + if test "x$ac_pt_pkg_config" = x; then + pkg_config="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + pkg_config=$ac_pt_pkg_config + fi else - ac_cv_lib_ipc_shmat=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + pkg_config="$ac_cv_path_pkg_config" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5 -$as_echo "$ac_cv_lib_ipc_shmat" >&6; } -if test "x$ac_cv_lib_ipc_shmat" = xyes; then : - X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" + +if test -z "$pkg_config" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config not found!" >&5 +$as_echo "$as_me: WARNING: pkg-config not found!" >&2;} + pkg_config="false" fi +# Utility function for running pkg-config-based tests... +# +pkgs='' +pkg_check_version() { + if test "$ok" = yes ; then + req="$1" + min="$2" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $req" >&5 +$as_echo_n "checking for $req... " >&6; } + if $pkg_config --exists "$req" ; then + vers=`$pkg_config --modversion "$req"` + if $pkg_config --exists "$req >= $min" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vers" >&5 +$as_echo "$vers" >&6; } + pkgs="$pkgs $req" + return 1 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vers (wanted >= $min)" >&5 +$as_echo "$vers (wanted >= $min)" >&6; } + ok=no + return 0 + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ok=no + return 0 fi fi +} - # Check for libraries that X11R6 Xt/Xaw programs need. - ac_save_LDFLAGS=$LDFLAGS - test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" - # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to - # check for ICE first), but we must link in the order -lSM -lICE or - # we get undefined symbols. So assume we have SM if we have ICE. - # These have to be linked with before -lX11, unlike the other - # libraries we check for below, so use a different variable. - # John Interrante, Karl Berry - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5 -$as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; } -if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lICE $X_EXTRA_LIBS $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +############################################################################### +# +# Gettext support +# +############################################################################### -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char IceConnectionNumber (); -int -main () -{ -return IceConnectionNumber (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ICE_IceConnectionNumber=yes +# Wow, this is complete madness. Why does po/Makefile.in.in exist?? Why does +# aclocal.m4 exist?? Why can't I upgrade it without everything breaking?? +# This IT_PROG_INTLTOOL nonsense has so many self-modifying levels of insanity +# that it *must* have been written by RMS. Or an equally demented protégé. +# Won't someone please have mercy on us all and write a normal po/Makefile.in +# that uses wildcards, and write a sane set of rules to detect gettext(3) and +# msgfmt(1) and just do the obviously straightforward thing? + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 +$as_echo_n "checking whether NLS is requested... " >&6; } + # Check whether --enable-nls was given. +if test "${enable_nls+set}" = set; then : + enableval=$enable_nls; USE_NLS=$enableval else - ac_cv_lib_ICE_IceConnectionNumber=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 -$as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } -if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then : - X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" + USE_NLS=yes fi - LDFLAGS=$ac_save_LDFLAGS - -fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 +$as_echo "$USE_NLS" >&6; } +case "$am__api_version" in + 1.01234) + as_fn_error $? "Automake 1.5 or newer is required to use intltool" "$LINENO" 5 + ;; + *) + ;; +esac -if test "$have_x" != yes; then - as_fn_error $? "Couldn't find X11 headers/libs. Try \`$0 --help'." "$LINENO" 5 +INTLTOOL_REQUIRED_VERSION_AS_INT=`echo | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` +INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3` +INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` +if test -n ""; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for intltool >= " >&5 +$as_echo_n "checking for intltool >= ... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_APPLIED_VERSION found" >&5 +$as_echo "$INTLTOOL_APPLIED_VERSION found" >&6; } + test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || + as_fn_error $? "Your intltool is too old. You need intltool or later." "$LINENO" 5 fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X app-defaults directory" >&5 -$as_echo_n "checking for X app-defaults directory... " >&6; } -if ${ac_cv_x_app_defaults+:} false; then : - $as_echo_n "(cached) " >&6 -else - # skip this, it's always wrong these days. - # AC_PATH_X_APP_DEFAULTS_XMKMF - if test x"$ac_x_app_defaults" = x; then - true - # 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 - - 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 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_x_app_defaults" >&5 -$as_echo "$ac_cv_x_app_defaults" >&6; } - eval ac_x_app_defaults="$ac_cv_x_app_defaults" -case "$host" in - *-hpux*) - - # The following arcana was gleaned from conversations with - # Eric Schwartz : - # - # 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? - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for regcmp in -lgen" >&5 -$as_echo_n "checking for regcmp in -lgen... " >&6; } -if ${ac_cv_lib_gen_regcmp+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgen $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char regcmp (); -int -main () -{ -return regcmp (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gen_regcmp=yes -else - ac_cv_lib_gen_regcmp=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gen_regcmp" >&5 -$as_echo "$ac_cv_lib_gen_regcmp" >&6; } -if test "x$ac_cv_lib_gen_regcmp" = xyes; then : - MOTIF_LIBS="$MOTIF_LIBS -lgen" -fi - - fi - - ;; - *-darwin*) - - # On MacOS X (10.x with "fink"), many things are under /sw/. - # - if test -d /sw/include ; then - X_CFLAGS="-I/sw/include $X_CFLAGS" - X_LIBS="-L/sw/lib $X_LIBS" - fi - ;; - esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XPointer" >&5 -$as_echo_n "checking for XPointer... " >&6; } -if ${ac_cv_xpointer+:} false; then : - $as_echo_n "(cached) " >&6 -else - - 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` - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -XPointer foo = (XPointer) 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_xpointer=yes -else - ac_cv_xpointer=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$ac_save_CPPFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_xpointer" >&5 -$as_echo "$ac_cv_xpointer" >&6; } - if test "$ac_cv_xpointer" != yes; then - $as_echo "#define XPointer char*" >>confdefs.h - - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether this is MacOS X" >&5 -$as_echo_n "checking whether this is MacOS X... " >&6; } - ac_macosx=no - case "$host" in - *-apple-darwin* ) - ac_macosx=yes - ;; - esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_macosx" >&5 -$as_echo "$ac_macosx" >&6; } - - -############################################################################### -# -# Gettext support -# -############################################################################### - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 -$as_echo_n "checking whether NLS is requested... " >&6; } - # Check whether --enable-nls was given. -if test "${enable_nls+set}" = set; then : - enableval=$enable_nls; USE_NLS=$enableval -else - USE_NLS=yes -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 -$as_echo "$USE_NLS" >&6; } - - - - -case "$am__api_version" in - 1.01234) - as_fn_error $? "Automake 1.5 or newer is required to use intltool" "$LINENO" 5 - ;; - *) - ;; -esac - -INTLTOOL_REQUIRED_VERSION_AS_INT=`echo | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` -INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3` -INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` -if test -n ""; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for intltool >= " >&5 -$as_echo_n "checking for intltool >= ... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_APPLIED_VERSION found" >&5 -$as_echo "$INTLTOOL_APPLIED_VERSION found" >&6; } - test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || - as_fn_error $? "Your intltool is too old. You need intltool or later." "$LINENO" 5 -fi - -# Extract the first word of "intltool-update", so it can be a program name with args. -set dummy intltool-update; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_INTLTOOL_UPDATE+:} false; then : +# Extract the first word of "intltool-update", so it can be a program name with args. +set dummy intltool-update; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_INTLTOOL_UPDATE+:} false; then : $as_echo_n "(cached) " >&6 else case $INTLTOOL_UPDATE in @@ -7237,7 +6447,6 @@ else $as_echo "no" >&6; } fi - # Extract the first word of "intltool-merge", so it can be a program name with args. set dummy intltool-merge; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -7277,7 +6486,6 @@ else $as_echo "no" >&6; } fi - # Extract the first word of "intltool-extract", so it can be a program name with args. set dummy intltool-extract; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -7296,170 +6504,66 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_INTLTOOL_EXTRACT="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -INTLTOOL_EXTRACT=$ac_cv_path_INTLTOOL_EXTRACT -if test -n "$INTLTOOL_EXTRACT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_EXTRACT" >&5 -$as_echo "$INTLTOOL_EXTRACT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then - as_fn_error $? "The intltool scripts were not found. Please install intltool." "$LINENO" 5 -fi - -if test -z "$AM_DEFAULT_VERBOSITY"; then - AM_DEFAULT_VERBOSITY=1 -fi - - -INTLTOOL_V_MERGE='$(INTLTOOL__v_MERGE_$(V))' -INTLTOOL__v_MERGE_='$(INTLTOOL__v_MERGE_$(AM_DEFAULT_VERBOSITY))' -INTLTOOL__v_MERGE_0='@echo " ITMRG " $@;' - - - - -INTLTOOL_V_MERGE_OPTIONS='$(intltool__v_merge_options_$(V))' -intltool__v_merge_options_='$(intltool__v_merge_options_$(AM_DEFAULT_VERBOSITY))' -intltool__v_merge_options_0='-q' - - - - - INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' -INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -p $(top_srcdir)/po $< $@' - INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' -INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' -if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge 5000; then - INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u --no-translations $< $@' -else - INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)_it_tmp_dir=tmp.intltool.$$RANDOM && mkdir $$_it_tmp_dir && LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u $$_it_tmp_dir $< $@ && rmdir $$_it_tmp_dir' -fi - INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_INTLTOOL_EXTRACT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + ;; +esac +fi +INTLTOOL_EXTRACT=$ac_cv_path_INTLTOOL_EXTRACT +if test -n "$INTLTOOL_EXTRACT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_EXTRACT" >&5 +$as_echo "$INTLTOOL_EXTRACT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then + as_fn_error $? "The intltool scripts were not found. Please install intltool." "$LINENO" 5 +fi +if test -z "$AM_DEFAULT_VERBOSITY"; then + AM_DEFAULT_VERBOSITY=1 +fi +INTLTOOL_V_MERGE='$(INTLTOOL__v_MERGE_$(V))' +INTLTOOL__v_MERGE_='$(INTLTOOL__v_MERGE_$(AM_DEFAULT_VERBOSITY))' +INTLTOOL__v_MERGE_0='@echo " ITMRG " $@;' +INTLTOOL_V_MERGE_OPTIONS='$(intltool__v_merge_options_$(V))' +intltool__v_merge_options_='$(intltool__v_merge_options_$(AM_DEFAULT_VERBOSITY))' +intltool__v_merge_options_0='-q' + INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' +INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_KEYS_RULE='%.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_PROP_RULE='%.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_OAF_RULE='%.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -p $(top_srcdir)/po $< $@' + INTLTOOL_PONG_RULE='%.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SERVER_RULE='%.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SHEET_RULE='%.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' +INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' +if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge 5000; then + INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u --no-translations $< $@' +else + INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)_it_tmp_dir=tmp.intltool.$$RANDOM && mkdir $$_it_tmp_dir && LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u $$_it_tmp_dir $< $@ && rmdir $$_it_tmp_dir' +fi + INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' + INTLTOOL_POLICY_RULE='%.policy: %.policy.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@' # Check the gettext tools to make sure they are GNU # Extract the first word of "xgettext", so it can be a program name with args. @@ -7501,7 +6605,6 @@ else $as_echo "no" >&6; } fi - # Extract the first word of "msgmerge", so it can be a program name with args. set dummy msgmerge; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -7541,7 +6644,6 @@ else $as_echo "no" >&6; } fi - # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -7581,7 +6683,6 @@ else $as_echo "no" >&6; } fi - # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -7622,7 +6723,6 @@ else $as_echo "no" >&6; } fi - if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then as_fn_error $? "GNU gettext tools not found; required for intltool" "$LINENO" 5 fi @@ -7635,23 +6735,12 @@ fi # Substitute ALL_LINGUAS so we can use it in po/Makefile - - - - GETTEXT_PACKAGE=xscreensaver cat >>confdefs.h <<_ACEOF #define GETTEXT_PACKAGE "$GETTEXT_PACKAGE" _ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$GETTEXT_PACKAGE" -_ACEOF - - - ALL_LINGUAS="da de es et fi fr hu it ja ko nb nl pl pt pt_BR ru sk sv vi wa zh_CN zh_TW" for ac_header in locale.h @@ -7701,14 +6790,12 @@ $as_echo "#define HAVE_LC_MESSAGES 1" >>confdefs.h fi USE_NLS=yes - gt_cv_have_gettext=no CATOBJEXT=NONE XGETTEXT=: INTLLIBS= - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 $as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; } if ${gt_cv_func_CFPreferencesCopyAppValue+:} false; then : @@ -7782,8 +6869,6 @@ $as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi - - ac_fn_c_check_header_mongrel "$LINENO" "libintl.h" "ac_cv_header_libintl_h" "$ac_includes_default" if test "x$ac_cv_header_libintl_h" = xyes; then : gt_cv_func_dgettext_libintl="no" @@ -7993,7 +7078,6 @@ fi fi - if test "$gt_cv_func_dgettext_libintl" != "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -liconv is needed to use gettext" >&5 $as_echo_n "checking if -liconv is needed to use gettext... " >&6; } @@ -8249,7 +7333,6 @@ else $as_echo "no" >&6; } fi - # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -8335,118 +7418,369 @@ rm -f core conftest.err conftest.$ac_objext \ fi + if test "$gt_cv_have_gettext" = "yes" ; then + +$as_echo "#define ENABLE_NLS 1" >>confdefs.h + + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found xgettext program is not GNU xgettext; ignore it" >&5 +$as_echo "found xgettext program is not GNU xgettext; ignore it" >&6; } + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + + ac_config_commands="$ac_config_commands default-1" + + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + if test "$gt_cv_have_gettext" = "yes"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for catalogs to be installed" >&5 +$as_echo_n "checking for catalogs to be installed... " >&6; } + NEW_LINGUAS= + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + NEW_LINGUAS="$NEW_LINGUAS $presentlang" + fi + done + LINGUAS=$NEW_LINGUAS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINGUAS" >&5 +$as_echo "$LINGUAS" >&6; } + fi + + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + rm -f po/POTFILES + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + +MKINSTALLDIRS="$INSTALL_DIRS" + +############################################################################### +# +# The --with-x-app-defaults option +# +############################################################################### + +#### H1 + +# Check whether --with-app-defaults was given. +if test "${with_app_defaults+set}" = set; then : + withval=$with_app_defaults; ac_cv_x_app_defaults="$withval" +else + eval ac_x_app_defaults="$withval" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X app-defaults directory" >&5 +$as_echo_n "checking for X app-defaults directory... " >&6; } +if ${ac_cv_x_app_defaults+:} false; then : + $as_echo_n "(cached) " >&6 +else + # skip this, it's always wrong these days. + # AC_PATH_X_APP_DEFAULTS_XMKMF + if test x"$ac_x_app_defaults" = x; then + true + # 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 + + 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 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_x_app_defaults" >&5 +$as_echo "$ac_cv_x_app_defaults" >&6; } + eval ac_x_app_defaults="$ac_cv_x_app_defaults" + +############################################################################### +# +# Handle the --with-hackdir option +# +############################################################################### +have_hackdir=yes +with_hackdir_req=unspecified - if test "$gt_cv_have_gettext" = "yes" ; then +# Check whether --with-hackdir was given. +if test "${with_hackdir+set}" = set; then : + withval=$with_hackdir; with_hackdir="$withval"; with_hackdir_req="$withval" +else + with_hackdir=yes +fi -$as_echo "#define ENABLE_NLS 1" >>confdefs.h +if test x"$with_hackdir" = xyes; then + HACKDIR='${libexecdir}/xscreensaver' +elif test x"$with_hackdir" = xno; then + HACKDIR='${bindir}' +else + HACKDIR=$with_hackdir +fi - fi +# canonicalize slashes. +HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'` - if test "$XGETTEXT" != ":"; then - if $XGETTEXT --omit-header /dev/null 2> /dev/null; then - : ; - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found xgettext program is not GNU xgettext; ignore it" >&5 -$as_echo "found xgettext program is not GNU xgettext; ignore it" >&6; } - XGETTEXT=":" - fi - fi +# Expand HACKDIR as HACKDIR_FULL +HACKDIR_FULL=`eval eval eval eval eval eval eval eval eval echo $HACKDIR` - # We need to process the po/ directory. - POSUB=po +# This option used to be called --enable-subdir; make sure that is no longer +# used, since configure brain-damagedly ignores unknown --enable options. - ac_config_commands="$ac_config_commands default-1" +obsolete_enable= +# Check whether --enable-subdir was given. +if test "${enable_subdir+set}" = set; then : + enableval=$enable_subdir; obsolete_enable=yes +fi +if test -n "$obsolete_enable"; then + echo "error: the --enable-subdir option has been replaced with" + echo " the new --with-hackdir option; see \`configure --help'" + echo " for more information." + exit 1 +fi - for lang in $ALL_LINGUAS; do - GMOFILES="$GMOFILES $lang.gmo" - POFILES="$POFILES $lang.po" - done +############################################################################### +# +# Handle the --with-configdir option +# +############################################################################### +have_configdir=yes +with_configdir_req=unspecified +# Check whether --with-configdir was given. +if test "${with_configdir+set}" = set; then : + withval=$with_configdir; with_configdir="$withval"; with_configdir_req="$withval" +else + with_configdir=yes +fi +if test x"$with_configdir" = xyes; then + HACK_CONF_DIR='${datadir}/xscreensaver/config' +elif test x"$with_configdir" = xno; then + echo "error: must be yes, or a pathname: --with-configdir=$with_configdir" + exit 1 +else + # there must be a better way than this... + if test -z "`echo $with_configdir | sed 's@^/.*@@'`" ; then + # absolute path + HACK_CONF_DIR=$with_configdir + else + # relative path + HACK_CONF_DIR="\${exec_prefix}$with_configdir" + fi +fi +############################################################################### +# +# Handle the --with-fontdir option +# +############################################################################### +have_fontdir=yes +with_fontdir_req=unspecified +# Check whether --with-fontdir was given. +if test "${with_fontdir+set}" = set; then : + withval=$with_fontdir; with_fontdir="$withval"; with_fontdir_req="$withval" +else + with_fontdir=yes +fi +if test x"$with_fontdir" = xyes; then + FONT_DIR='${datarootdir}/fonts/xscreensaver' + if test "$ac_macosx" = yes; then + FONT_DIR='/Library/Fonts' + fi +elif test x"$with_fontdir" = xno; then + FONT_DIR='' +else + # there must be a better way than this... + if test -z "`echo $with_fontdir | sed 's@^/.*@@'`" ; then + # absolute path + FONT_DIR="$with_fontdir" + else + # relative path + FONT_DIR='${datarootdir}/fonts/'"$with_fontdir" + fi +fi +############################################################################### +# +# Check for the DPMS server extension. +# +############################################################################### +#### H1 +have_dpms=no +with_dpms_req=unspecified +# Check whether --with-dpms-ext was given. +if test "${with_dpms_ext+set}" = set; then : + withval=$with_dpms_ext; with_dpms="$withval"; with_dpms_req="$withval" +else + with_dpms=yes +fi + case "$with_dpms" in + yes) ;; + no) ;; - if test "$gt_cv_have_gettext" = "yes"; then - if test "x$ALL_LINGUAS" = "x"; then - LINGUAS= + /*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMS headers" >&5 +$as_echo_n "checking for DPMS headers... " >&6; } + d=$with_dpms/include + if test -d $d; then + X_CFLAGS="-I$d $X_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for catalogs to be installed" >&5 -$as_echo_n "checking for catalogs to be installed... " >&6; } - NEW_LINGUAS= - for presentlang in $ALL_LINGUAS; do - useit=no - if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then - desiredlanguages="$LINGUAS" - else - desiredlanguages="$ALL_LINGUAS" - fi - for desiredlang in $desiredlanguages; do - # Use the presentlang catalog if desiredlang is - # a. equal to presentlang, or - # b. a variant of presentlang (because in this case, - # presentlang can be used as a fallback for messages - # which are not translated in the desiredlang catalog). - case "$desiredlang" in - "$presentlang"*) useit=yes;; - esac - done - if test $useit = yes; then - NEW_LINGUAS="$NEW_LINGUAS $presentlang" - fi - done - LINGUAS=$NEW_LINGUAS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINGUAS" >&5 -$as_echo "$LINGUAS" >&6; } - fi - - if test -n "$LINGUAS"; then - for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } fi - fi - MKINSTALLDIRS= - if test -n "$ac_aux_dir"; then - MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" - fi - if test -z "$MKINSTALLDIRS"; then - MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" - fi - - - test -d po || mkdir po - if test "x$srcdir" != "x."; then - if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then - posrcprefix="$srcdir/" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMS libs" >&5 +$as_echo_n "checking for DPMS libs... " >&6; } + d=$with_dpms/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } else - posrcprefix="../$srcdir/" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } fi - else - posrcprefix="../" - fi - rm -f po/POTFILES - sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ - < $srcdir/po/POTFILES.in > po/POTFILES -MKINSTALLDIRS="$INSTALL_DIRS" + # replace the directory string with "yes". + with_dpms_req="yes" + with_dpms=$with_dpms_req + ;; + *) + echo "" + echo "error: argument to --with-dpms-ext must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac -############################################################################### -# -# Check for -lXmu (some fucked up vendors don't ship it...) -# -############################################################################### +if test "$with_dpms" = yes; then -have_xmu=no + # first check for dpms.h ac_save_CPPFLAGS="$CPPFLAGS" if test \! -z "$includedir" ; then @@ -8454,330 +7788,352 @@ have_xmu=no fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - ac_fn_c_check_header_compile "$LINENO" "X11/Xmu/Error.h" "ac_cv_header_X11_Xmu_Error_h" "#include - #include - #include + ac_fn_c_check_header_compile "$LINENO" "X11/extensions/dpms.h" "ac_cv_header_X11_extensions_dpms_h" "#include + #include " -if test "x$ac_cv_header_X11_Xmu_Error_h" = xyes; then : - have_xmu=yes +if test "x$ac_cv_header_X11_extensions_dpms_h" = xyes; then : + have_dpms=yes fi - CPPFLAGS="$ac_save_CPPFLAGS" -if test "$have_xmu" = no ; then - XMU_SRCS='$(UTILS_SRC)/xmu.c' - XMU_OBJS='$(UTILS_BIN)/xmu.o' - XMU_LIBS='' -else - XMU_SRCS='' - XMU_OBJS='' - XMU_LIBS='-lXmu' - $as_echo "#define HAVE_XMU 1" >>confdefs.h -fi + # if that succeeded, then check for the DPMS code in the libraries + if test "$have_dpms" = yes; then + # first look in -lXext (this is where it is with XFree86 4.0) + have_dpms=no -############################################################################### -# -# Check for the SunOS 4.1.x _get_wmShellWidgetClass bug. -# See comp.windows.x FAQ question 124. The right fix is to -# get OpenWindows 3.0 patches 100512-02 and 100573-03. -# -############################################################################### + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" +# ac_save_LIBS="$LIBS" -if test "$have_xmu" = yes ; then - case "$host" in - *-sunos4*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the SunOS 4.1.x _get_wmShellWidgetClass bug" >&5 -$as_echo_n "checking for the SunOS 4.1.x _get_wmShellWidgetClass bug... " >&6; } -if ${ac_cv_sunos_xmu_bug+:} false; then : + 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` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMSInfo in -lXext" >&5 +$as_echo_n "checking for DPMSInfo in -lXext... " >&6; } +if ${ac_cv_lib_Xext_DPMSInfo+:} false; then : $as_echo_n "(cached) " >&6 else - ac_save_LDFLAGS="$LDFLAGS" - if test \! -z "$x_libraries" ; then - LDFLAGS="$LDFLAGS -L$x_libraries" - fi - # Note: this trick never works! (Generally.) - # We're only getting away with using AC_TRY_LINK - # with X libraries because we know it's SunOS. - LDFLAGS="$LDFLAGS -lXmu -lXt -lX11 -lXext -lm" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXext -lXext -lX11 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char DPMSInfo (); int main () { - +return DPMSInfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_sunos_xmu_bug=no + ac_cv_lib_Xext_DPMSInfo=yes else - ac_cv_sunos_xmu_bug=yes + ac_cv_lib_Xext_DPMSInfo=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$ac_save_LDFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sunos_xmu_bug" >&5 -$as_echo "$ac_cv_sunos_xmu_bug" >&6; } - if test "$ac_cv_sunos_xmu_bug" = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -static" >&5 -$as_echo_n "checking whether the compiler understands -static... " >&6; } -if ${ac_cv_ld_static+:} false; then : - $as_echo_n "(cached) " >&6 +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_DPMSInfo" >&5 +$as_echo "$ac_cv_lib_Xext_DPMSInfo" >&6; } +if test "x$ac_cv_lib_Xext_DPMSInfo" = xyes; then : + have_dpms=yes else + true +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + + # if that failed, look in -lXdpms (this is where it was in XFree86 3.x) + if test "$have_dpms" = no; then + + ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -static" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +# 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` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMSInfo in -lXdpms" >&5 +$as_echo_n "checking for DPMSInfo in -lXdpms... " >&6; } +if ${ac_cv_lib_Xdpms_DPMSInfo+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXdpms -lXext -lX11 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char DPMSInfo (); int main () { - +return DPMSInfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_ld_static=yes + ac_cv_lib_Xdpms_DPMSInfo=yes else - ac_cv_ld_static=no + ac_cv_lib_Xdpms_DPMSInfo=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$ac_save_LDFLAGS" +LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ld_static" >&5 -$as_echo "$ac_cv_ld_static" >&6; } - if test "$ac_cv_ld_static" = yes ; then - LDFLAGS="$LDFLAGS -static" - else - LDFLAGS="$LDFLAGS -Bstatic" - fi - fi - ;; - esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xdpms_DPMSInfo" >&5 +$as_echo "$ac_cv_lib_Xdpms_DPMSInfo" >&6; } +if test "x$ac_cv_lib_Xdpms_DPMSInfo" = xyes; then : + have_dpms=yes; XDPMS_LIBS="-lXdpms" +else + true fi + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + + fi + fi + + # if that succeeded, then we've really got it. + if test "$have_dpms" = yes; then + $as_echo "#define HAVE_DPMS_EXTENSION 1" >>confdefs.h + + fi + +elif test "$with_dpms" != no; then + echo "error: must be yes or no: --with-dpms-ext=$with_dpms" + exit 1 +fi ############################################################################### # -# Handle the --with-hackdir option +# Check for the XF86VMODE server extension (for virtual screens.) # ############################################################################### -have_hackdir=yes -with_hackdir_req=unspecified +have_xf86vmode=no +with_xf86vmode_req=unspecified -# Check whether --with-hackdir was given. -if test "${with_hackdir+set}" = set; then : - withval=$with_hackdir; with_hackdir="$withval"; with_hackdir_req="$withval" +# Check whether --with-xf86vmode-ext was given. +if test "${with_xf86vmode_ext+set}" = set; then : + withval=$with_xf86vmode_ext; with_xf86vmode="$withval"; with_xf86vmode_req="$withval" else - with_hackdir=yes + with_xf86vmode=yes fi + case "$with_xf86vmode" in + yes) ;; + no) ;; -if test x"$with_hackdir" = xyes; then - HACKDIR='${libexecdir}/xscreensaver' -elif test x"$with_hackdir" = xno; then - HACKDIR='${bindir}' -else - HACKDIR=$with_hackdir -fi + /*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xf86vmode headers" >&5 +$as_echo_n "checking for xf86vmode headers... " >&6; } + d=$with_xf86vmode/include + if test -d $d; then + X_CFLAGS="-I$d $X_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi -# canonicalize slashes. -HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xf86vmode libs" >&5 +$as_echo_n "checking for xf86vmode libs... " >&6; } + d=$with_xf86vmode/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi -# Expand HACKDIR as HACKDIR_FULL -HACKDIR_FULL=`eval eval eval eval eval eval eval eval eval echo $HACKDIR` + # replace the directory string with "yes". + with_xf86vmode_req="yes" + with_xf86vmode=$with_xf86vmode_req + ;; -# This option used to be called --enable-subdir; make sure that is no longer -# used, since configure brain-damagedly ignores unknown --enable options. + *) + echo "" + echo "error: argument to --with-xf86vmode-ext must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac -obsolete_enable= -# Check whether --enable-subdir was given. -if test "${enable_subdir+set}" = set; then : - enableval=$enable_subdir; obsolete_enable=yes -fi +VIDMODE_LIBS="" -if test -n "$obsolete_enable"; then - echo "error: the --enable-subdir option has been replaced with" - echo " the new --with-hackdir option; see \`configure --help'" - echo " for more information." - exit 1 +if test "$with_xf86vmode" = yes; then + + # first check for xf86vmode.h + + 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_fn_c_check_header_compile "$LINENO" "X11/extensions/xf86vmode.h" "ac_cv_header_X11_extensions_xf86vmode_h" "#include +" +if test "x$ac_cv_header_X11_extensions_xf86vmode_h" = xyes; then : + have_xf86vmode=yes fi + CPPFLAGS="$ac_save_CPPFLAGS" -############################################################################### -# -# Handle the --with-configdir option -# Help for --with-x-app-defaults option added. -# -############################################################################### + # if that succeeded, then check for the -lXxf86vm + if test "$have_xf86vmode" = yes; then + have_xf86vmode=no -have_configdir=yes -with_configdir_req=unspecified + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" +# ac_save_LIBS="$LIBS" -# Check whether --with-configdir was given. -if test "${with_configdir+set}" = set; then : - withval=$with_configdir; with_configdir="$withval"; with_configdir_req="$withval" -else - with_configdir=yes -fi + 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" -if test x"$with_configdir" = xyes; then - HACK_CONF_DIR='${datadir}/xscreensaver/config' -elif test x"$with_configdir" = xno; then - echo "error: must be yes, or a pathname: --with-configdir=$with_configdir" - exit 1 + CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` + LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XF86VidModeGetViewPort in -lXxf86vm" >&5 +$as_echo_n "checking for XF86VidModeGetViewPort in -lXxf86vm... " >&6; } +if ${ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort+:} false; then : + $as_echo_n "(cached) " >&6 else - # there must be a better way than this... - if test -z "`echo $with_configdir | sed 's@^/.*@@'`" ; then - # absolute path - HACK_CONF_DIR=$with_configdir - else - # relative path - HACK_CONF_DIR="\${exec_prefix}$with_configdir" - fi + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXxf86vm -lXext -lX11 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char XF86VidModeGetViewPort (); +int +main () +{ +return XF86VidModeGetViewPort (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort=yes +else + ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" >&5 +$as_echo "$ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" >&6; } +if test "x$ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" = xyes; then : + have_xf86vmode=yes; + VIDMODE_LIBS="-lXxf86vm"; + SAVER_LIBS="$SAVER_LIBS $VIDMODE_LIBS" +else + true fi + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + fi + # if that succeeded, then we've really got it. + if test "$have_xf86vmode" = yes; then + $as_echo "#define HAVE_XF86VMODE 1" >>confdefs.h -############################################################################### -# -# Check for the SGI SCREEN_SAVER server extension. -# -############################################################################### - -#have_sgi=no -#with_sgi_req=unspecified -#AC_ARG_WITH(sgi-ext, -#[Except where noted, all of the --with options below can also take a -#directory argument: for example, `--with-motif=/opt/Motif'. That would -#cause /opt/Motif/include/ to be added to the -I list, and /opt/Motif/lib/ -#to be added to the -L list, assuming those directories exist. -# -#By default, support for each of these options will be built in, if the -#relevant library routines exist. At run time, they will then be used -#only if the X server being used supports them. Each --with option has -#a corresponding --without option, to override building support for them -#at all. -# -#Screen blanking and idle-detection options: -# -# --with-sgi-ext Include support for the SGI SCREEN_SAVER extension.], -# [with_sgi="$withval"; with_sgi_req="$withval"],[with_sgi=yes]) -# -#HANDLE_X_PATH_ARG(with_sgi, --with-sgi-ext, SGI SCREEN_SAVER) -# -#if test "$with_sgi" = yes; then -# AC_CHECK_X_HEADER(X11/extensions/XScreenSaver.h, -# [have_sgi=yes -# AC_DEFINE(HAVE_SGI_SAVER_EXTENSION)],, -# [#include ]) -# -#elif test "$with_sgi" != no; then -# echo "error: must be yes or no: --with-sgi-ext=$with_sgi" -# exit 1 -#fi - - -############################################################################### -# -# Check for the XIDLE server extension. -# -############################################################################### - -#have_xidle=no -#with_xidle_req=unspecified -#AC_ARG_WITH(xidle-ext, -#[ --with-xidle-ext Include support for the XIDLE extension.], -# [with_xidle="$withval"; with_xidle_req="$withval"],[with_xidle=yes]) -# -#HANDLE_X_PATH_ARG(with_xidle, --with-xidle-ext, XIDLE) -# -#if test "$with_xidle" = yes; then -# AC_CHECK_X_HEADER(X11/extensions/xidle.h, -# [have_xidle=yes -# AC_DEFINE(HAVE_XIDLE_EXTENSION)],, -# [#include ]) -#elif test "$with_xidle" != no; then -# echo "error: must be yes or no: --with-xidle-ext=$with_xidle" -# exit 1 -#fi - - -############################################################################### -# -# Check for the SGI-VIDEO-CONTROL server extension. -# -############################################################################### - -#have_sgivc=no -#with_sgivc_req=unspecified -#AC_ARG_WITH(sgivc-ext, -#[ --with-sgivc-ext Include support for the SGI-VIDEO-CONTROL extension.], -# [with_sgivc="$withval"; with_sgivc_req="$withval"],[with_sgivc=yes]) -# -#HANDLE_X_PATH_ARG(with_sgivc, --with-sgivc-ext, SGI-VIDEO-CONTROL) -# -#if test "$with_sgivc" = yes; then -# -# # first check for XSGIvc.h -# AC_CHECK_X_HEADER(X11/extensions/XSGIvc.h, [have_sgivc=yes],, -# [#include ]) -# -# # if that succeeded, then check for the -lXsgivc -# if test "$have_sgivc" = yes; then -# have_sgivc=no -# AC_CHECK_X_LIB(Xsgivc, XSGIvcQueryGammaMap, -# [have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"], [true], -# -lXext -lX11) -# fi -# -# # if that succeeded, then we've really got it. -# if test "$have_sgivc" = yes; then -# AC_DEFINE(HAVE_SGI_VC_EXTENSION) -# fi -# -#elif test "$with_sgivc" != no; then -# echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc" -# exit 1 -#fi + fi +elif test "$with_xf86vmode" != no; then + echo "error: must be yes or no: --with-xf86vmode-ext=$with_xf86vmode" + exit 1 +fi ############################################################################### # -# Check for the DPMS server extension. +# Check for the XINERAMA server extension. # ############################################################################### -have_dpms=no -with_dpms_req=unspecified +have_xinerama=no +with_xinerama_req=unspecified -# Check whether --with-dpms-ext was given. -if test "${with_dpms_ext+set}" = set; then : - withval=$with_dpms_ext; with_dpms="$withval"; with_dpms_req="$withval" +# Check whether --with-xinerama-ext was given. +if test "${with_xinerama_ext+set}" = set; then : + withval=$with_xinerama_ext; with_xinerama="$withval"; with_xinerama_req="$withval" else - with_dpms=yes + with_xinerama=yes fi - - - case "$with_dpms" in + case "$with_xinerama" in yes) ;; no) ;; /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMS headers" >&5 -$as_echo_n "checking for DPMS headers... " >&6; } - d=$with_dpms/include + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINERAMA headers" >&5 +$as_echo_n "checking for XINERAMA headers... " >&6; } + d=$with_xinerama/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -8787,9 +8143,9 @@ $as_echo "$d" >&6; } $as_echo "not found ($d: no such directory)" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMS libs" >&5 -$as_echo_n "checking for DPMS libs... " >&6; } - d=$with_dpms/lib + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINERAMA libs" >&5 +$as_echo_n "checking for XINERAMA libs... " >&6; } + d=$with_xinerama/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -8800,23 +8156,22 @@ $as_echo "not found ($d: no such directory)" >&6; } fi # replace the directory string with "yes". - with_dpms_req="yes" - with_dpms=$with_dpms_req + with_xinerama_req="yes" + with_xinerama=$with_xinerama_req ;; *) echo "" - echo "error: argument to --with-dpms-ext must be \"yes\", \"no\", or a directory." + echo "error: argument to --with-xinerama-ext must be \"yes\", \"no\", or a directory." echo " If it is a directory, then \`DIR/include' will be added to" echo " the -I list, and \`DIR/lib' will be added to the -L list." exit 1 ;; esac +if test "$with_xinerama" = yes; then -if test "$with_dpms" = yes; then - - # first check for dpms.h + # first check for Xinerama.h ac_save_CPPFLAGS="$CPPFLAGS" if test \! -z "$includedir" ; then @@ -8824,21 +8179,19 @@ if test "$with_dpms" = yes; then fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - ac_fn_c_check_header_compile "$LINENO" "X11/extensions/dpms.h" "ac_cv_header_X11_extensions_dpms_h" "#include - #include + ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xinerama.h" "ac_cv_header_X11_extensions_Xinerama_h" "#include " -if test "x$ac_cv_header_X11_extensions_dpms_h" = xyes; then : - have_dpms=yes +if test "x$ac_cv_header_X11_extensions_Xinerama_h" = xyes; then : + have_xinerama=yes fi - CPPFLAGS="$ac_save_CPPFLAGS" - # if that succeeded, then check for the DPMS code in the libraries - if test "$have_dpms" = yes; then + # if that succeeded, then check for the XINERAMA code in the libraries + if test "$have_xinerama" = yes; then - # first look in -lXext (this is where it is with XFree86 4.0) - have_dpms=no + # first look in -lXext + have_xinerama=no ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -8858,9 +8211,9 @@ fi CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMSInfo in -lXext" >&5 -$as_echo_n "checking for DPMSInfo in -lXext... " >&6; } -if ${ac_cv_lib_Xext_DPMSInfo+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XineramaQueryScreens in -lXext" >&5 +$as_echo_n "checking for XineramaQueryScreens in -lXext... " >&6; } +if ${ac_cv_lib_Xext_XineramaQueryScreens+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -8874,28 +8227,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char DPMSInfo (); +char XineramaQueryScreens (); int main () { -return DPMSInfo (); +return XineramaQueryScreens (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Xext_DPMSInfo=yes + ac_cv_lib_Xext_XineramaQueryScreens=yes else - ac_cv_lib_Xext_DPMSInfo=no + ac_cv_lib_Xext_XineramaQueryScreens=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_DPMSInfo" >&5 -$as_echo "$ac_cv_lib_Xext_DPMSInfo" >&6; } -if test "x$ac_cv_lib_Xext_DPMSInfo" = xyes; then : - have_dpms=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_XineramaQueryScreens" >&5 +$as_echo "$ac_cv_lib_Xext_XineramaQueryScreens" >&6; } +if test "x$ac_cv_lib_Xext_XineramaQueryScreens" = xyes; then : + have_xinerama=yes else true fi @@ -8904,9 +8257,8 @@ fi LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" - - # if that failed, look in -lXdpms (this is where it was in XFree86 3.x) - if test "$have_dpms" = no; then + # if that failed, look in -lXinerama (this is where it is in XFree86 4.1.) + if test "$have_xinerama" = no; then ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -8926,13 +8278,13 @@ fi CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMSInfo in -lXdpms" >&5 -$as_echo_n "checking for DPMSInfo in -lXdpms... " >&6; } -if ${ac_cv_lib_Xdpms_DPMSInfo+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XineramaQueryScreens in -lXinerama" >&5 +$as_echo_n "checking for XineramaQueryScreens in -lXinerama... " >&6; } +if ${ac_cv_lib_Xinerama_XineramaQueryScreens+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXdpms -lXext -lX11 $LIBS" +LIBS="-lXinerama -lXext -lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8942,28 +8294,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char DPMSInfo (); +char XineramaQueryScreens (); int main () { -return DPMSInfo (); +return XineramaQueryScreens (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Xdpms_DPMSInfo=yes + ac_cv_lib_Xinerama_XineramaQueryScreens=yes else - ac_cv_lib_Xdpms_DPMSInfo=no + ac_cv_lib_Xinerama_XineramaQueryScreens=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xdpms_DPMSInfo" >&5 -$as_echo "$ac_cv_lib_Xdpms_DPMSInfo" >&6; } -if test "x$ac_cv_lib_Xdpms_DPMSInfo" = xyes; then : - have_dpms=yes; XDPMS_LIBS="-lXdpms" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xinerama_XineramaQueryScreens" >&5 +$as_echo "$ac_cv_lib_Xinerama_XineramaQueryScreens" >&6; } +if test "x$ac_cv_lib_Xinerama_XineramaQueryScreens" = xyes; then : + have_xinerama=yes; XINERAMA_LIBS="-lXinerama" else true fi @@ -8975,45 +8327,45 @@ fi fi fi - # if that succeeded, then we've really got it. - if test "$have_dpms" = yes; then - $as_echo "#define HAVE_DPMS_EXTENSION 1" >>confdefs.h + if test "$have_xinerama" = yes; then + $as_echo "#define HAVE_XINERAMA 1" >>confdefs.h fi -elif test "$with_dpms" != no; then - echo "error: must be yes or no: --with-dpms-ext=$with_dpms" +elif test "$with_xinerama" != no; then + echo "error: must be yes or no: --with-xinerama-ext=$with_xinerama" exit 1 fi - ############################################################################### # -# Check for the XINERAMA server extension. +# Check for the RANDR (Resize and Rotate) server extension. +# +# We need this to detect when the resolution of the desktop +# has changed out from under us (this is a newer, different +# mechanism than the XF86VMODE virtual viewports.) # ############################################################################### -have_xinerama=no -with_xinerama_req=unspecified +have_randr=no +with_randr_req=unspecified -# Check whether --with-xinerama-ext was given. -if test "${with_xinerama_ext+set}" = set; then : - withval=$with_xinerama_ext; with_xinerama="$withval"; with_xinerama_req="$withval" +# Check whether --with-randr-ext was given. +if test "${with_randr_ext+set}" = set; then : + withval=$with_randr_ext; with_randr="$withval"; with_randr_req="$withval" else - with_xinerama=yes + with_randr=yes fi - - - case "$with_xinerama" in + case "$with_randr" in yes) ;; no) ;; /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINERAMA headers" >&5 -$as_echo_n "checking for XINERAMA headers... " >&6; } - d=$with_xinerama/include + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RANDR headers" >&5 +$as_echo_n "checking for RANDR headers... " >&6; } + d=$with_randr/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -9023,9 +8375,9 @@ $as_echo "$d" >&6; } $as_echo "not found ($d: no such directory)" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINERAMA libs" >&5 -$as_echo_n "checking for XINERAMA libs... " >&6; } - d=$with_xinerama/lib + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RANDR libs" >&5 +$as_echo_n "checking for RANDR libs... " >&6; } + d=$with_randr/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -9036,23 +8388,22 @@ $as_echo "not found ($d: no such directory)" >&6; } fi # replace the directory string with "yes". - with_xinerama_req="yes" - with_xinerama=$with_xinerama_req + with_randr_req="yes" + with_randr=$with_randr_req ;; *) echo "" - echo "error: argument to --with-xinerama-ext must be \"yes\", \"no\", or a directory." + echo "error: argument to --with-randr-ext must be \"yes\", \"no\", or a directory." echo " If it is a directory, then \`DIR/include' will be added to" echo " the -I list, and \`DIR/lib' will be added to the -L list." exit 1 ;; esac +if test "$with_randr" = yes; then -if test "$with_xinerama" = yes; then - - # first check for Xinerama.h + # first check for Xrandr.h ac_save_CPPFLAGS="$CPPFLAGS" if test \! -z "$includedir" ; then @@ -9060,20 +8411,19 @@ if test "$with_xinerama" = yes; then fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xinerama.h" "ac_cv_header_X11_extensions_Xinerama_h" "#include + ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xrandr.h" "ac_cv_header_X11_extensions_Xrandr_h" "#include " -if test "x$ac_cv_header_X11_extensions_Xinerama_h" = xyes; then : - have_xinerama=yes +if test "x$ac_cv_header_X11_extensions_Xrandr_h" = xyes; then : + have_randr=yes fi - CPPFLAGS="$ac_save_CPPFLAGS" - # if that succeeded, then check for the XINERAMA code in the libraries - if test "$have_xinerama" = yes; then + # if that succeeded, then check for the XRR code in the libraries + if test "$have_randr" = yes; then - # first look in -lXext - have_xinerama=no + # RANDR probably needs -lXrender + xrender_libs= ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -9093,13 +8443,13 @@ fi CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XineramaQueryScreens in -lXext" >&5 -$as_echo_n "checking for XineramaQueryScreens in -lXext... " >&6; } -if ${ac_cv_lib_Xext_XineramaQueryScreens+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRenderSetSubpixelOrder in -lXrender" >&5 +$as_echo_n "checking for XRenderSetSubpixelOrder in -lXrender... " >&6; } +if ${ac_cv_lib_Xrender_XRenderSetSubpixelOrder+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXext -lXext -lX11 $LIBS" +LIBS="-lXrender -lXext -lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -9109,28 +8459,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char XineramaQueryScreens (); +char XRenderSetSubpixelOrder (); int main () { -return XineramaQueryScreens (); +return XRenderSetSubpixelOrder (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Xext_XineramaQueryScreens=yes + ac_cv_lib_Xrender_XRenderSetSubpixelOrder=yes else - ac_cv_lib_Xext_XineramaQueryScreens=no + ac_cv_lib_Xrender_XRenderSetSubpixelOrder=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_XineramaQueryScreens" >&5 -$as_echo "$ac_cv_lib_Xext_XineramaQueryScreens" >&6; } -if test "x$ac_cv_lib_Xext_XineramaQueryScreens" = xyes; then : - have_xinerama=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrender_XRenderSetSubpixelOrder" >&5 +$as_echo "$ac_cv_lib_Xrender_XRenderSetSubpixelOrder" >&6; } +if test "x$ac_cv_lib_Xrender_XRenderSetSubpixelOrder" = xyes; then : + xrender_libs="-lXrender" else true fi @@ -9139,9 +8489,8 @@ fi LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" - - # if that failed, look in -lXinerama (this is where it is in XFree86 4.1.) - if test "$have_xinerama" = no; then + # first look for RANDR in -lXext + have_randr=no ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -9161,13 +8510,13 @@ fi CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XineramaQueryScreens in -lXinerama" >&5 -$as_echo_n "checking for XineramaQueryScreens in -lXinerama... " >&6; } -if ${ac_cv_lib_Xinerama_XineramaQueryScreens+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRRGetScreenInfo in -lXext" >&5 +$as_echo_n "checking for XRRGetScreenInfo in -lXext... " >&6; } +if ${ac_cv_lib_Xext_XRRGetScreenInfo+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXinerama -lXext -lX11 $LIBS" +LIBS="-lXext $xrender_libs -lXext -lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -9177,28 +8526,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char XineramaQueryScreens (); +char XRRGetScreenInfo (); int main () { -return XineramaQueryScreens (); +return XRRGetScreenInfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Xinerama_XineramaQueryScreens=yes + ac_cv_lib_Xext_XRRGetScreenInfo=yes else - ac_cv_lib_Xinerama_XineramaQueryScreens=no + ac_cv_lib_Xext_XRRGetScreenInfo=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xinerama_XineramaQueryScreens" >&5 -$as_echo "$ac_cv_lib_Xinerama_XineramaQueryScreens" >&6; } -if test "x$ac_cv_lib_Xinerama_XineramaQueryScreens" = xyes; then : - have_xinerama=yes; XINERAMA_LIBS="-lXinerama" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_XRRGetScreenInfo" >&5 +$as_echo "$ac_cv_lib_Xext_XRRGetScreenInfo" >&6; } +if test "x$ac_cv_lib_Xext_XRRGetScreenInfo" = xyes; then : + have_randr=yes; SAVER_LIBS="$SAVER_LIBS $xrender_libs" else true fi @@ -9207,105 +8556,8 @@ fi LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" - fi - fi - - # if that succeeded, then we've really got it. - if test "$have_xinerama" = yes; then - $as_echo "#define HAVE_XINERAMA 1" >>confdefs.h - - fi - -elif test "$with_xinerama" != no; then - echo "error: must be yes or no: --with-xinerama-ext=$with_xinerama" - exit 1 -fi - - -############################################################################### -# -# Check for the XINPUT server extension. -# -############################################################################### - -have_xinput=no -with_xinput_req=unspecified - -# Check whether --with-xinput-ext was given. -if test "${with_xinput_ext+set}" = set; then : - withval=$with_xinput_ext; with_xinput="$withval"; with_xinput_req="$withval" -else - with_xinput=yes -fi - - - - case "$with_xinput" in - yes) ;; - no) ;; - - /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINPUT headers" >&5 -$as_echo_n "checking for XINPUT headers... " >&6; } - d=$with_xinput/include - if test -d $d; then - X_CFLAGS="-I$d $X_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 -$as_echo "$d" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 -$as_echo "not found ($d: no such directory)" >&6; } - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINPUT libs" >&5 -$as_echo_n "checking for XINPUT libs... " >&6; } - d=$with_xinput/lib - if test -d $d; then - X_LIBS="-L$d $X_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 -$as_echo "$d" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 -$as_echo "not found ($d: no such directory)" >&6; } - fi - - # replace the directory string with "yes". - with_xinput_req="yes" - with_xinput=$with_xinput_req - ;; - - *) - echo "" - echo "error: argument to --with-xinput-ext must be \"yes\", \"no\", or a directory." - echo " If it is a directory, then \`DIR/include' will be added to" - echo " the -I list, and \`DIR/lib' will be added to the -L list." - exit 1 - ;; - esac - - -if test "$with_xinput" = yes; then - - # first check for Xinput.h - - 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_fn_c_check_header_compile "$LINENO" "X11/extensions/XInput.h" "ac_cv_header_X11_extensions_XInput_h" "#include -" -if test "x$ac_cv_header_X11_extensions_XInput_h" = xyes; then : - have_xinput=yes -fi - - - CPPFLAGS="$ac_save_CPPFLAGS" - - # if that succeeded, then check for libXi - if test "$have_xinput" = yes; then - have_xinput=no + # if that failed, look in -lXrandr + if test "$have_randr" = no; then ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -9325,13 +8577,13 @@ fi CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XListInputDevices in -lXi" >&5 -$as_echo_n "checking for XListInputDevices in -lXi... " >&6; } -if ${ac_cv_lib_Xi_XListInputDevices+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRRGetScreenInfo in -lXrandr" >&5 +$as_echo_n "checking for XRRGetScreenInfo in -lXrandr... " >&6; } +if ${ac_cv_lib_Xrandr_XRRGetScreenInfo+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXi -lXext -lX11 $LIBS" +LIBS="-lXrandr $xrender_libs -lXext -lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -9341,28 +8593,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char XListInputDevices (); +char XRRGetScreenInfo (); int main () { -return XListInputDevices (); +return XRRGetScreenInfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Xi_XListInputDevices=yes + ac_cv_lib_Xrandr_XRRGetScreenInfo=yes else - ac_cv_lib_Xi_XListInputDevices=no + ac_cv_lib_Xrandr_XRRGetScreenInfo=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xi_XListInputDevices" >&5 -$as_echo "$ac_cv_lib_Xi_XListInputDevices" >&6; } -if test "x$ac_cv_lib_Xi_XListInputDevices" = xyes; then : - have_xinput=yes; SAVER_LIBS="$SAVER_LIBS -lXi" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrandr_XRRGetScreenInfo" >&5 +$as_echo "$ac_cv_lib_Xrandr_XRRGetScreenInfo" >&6; } +if test "x$ac_cv_lib_Xrandr_XRRGetScreenInfo" = xyes; then : + have_randr=yes; SAVER_LIBS="$SAVER_LIBS -lXrandr $xrender_libs" else true fi @@ -9371,46 +8623,90 @@ fi LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" + fi fi # if that succeeded, then we've really got it. - if test "$have_xinput" = yes; then - $as_echo "#define HAVE_XINPUT 1" >>confdefs.h + if test "$have_randr" = yes; then + $as_echo "#define HAVE_RANDR 1" >>confdefs.h + + # Now check for version 1.2 in the same libs. + # Try to compile, since on macOS 10.5.7, headers are older than libs! + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRRGetScreenResources" >&5 +$as_echo_n "checking for XRRGetScreenResources... " >&6; } +if ${ac_cv_randr_12+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_randr_12=no + + 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` + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include +int +main () +{ +XRRScreenResources *res = + XRRGetScreenResources (0, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_randr_12=yes +else + ac_cv_randr_12=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$ac_save_CPPFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_randr_12" >&5 +$as_echo "$ac_cv_randr_12" >&6; } + if test "$ac_cv_randr_12" = yes ; then + $as_echo "#define HAVE_RANDR_12 1" >>confdefs.h + fi +# AC_CHECK_X_LIB(c, XRRGetOutputInfo, [AC_DEFINE(HAVE_RANDR_12)], +# [true], $SAVER_LIBS) fi -elif test "$with_xinput" != no; then - echo "error: must be yes or no: --with-xinput-ext=$with_xinput" +elif test "$with_randr" != no; then + echo "error: must be yes or no: --with-randr-ext=$with_randr" exit 1 fi - ############################################################################### # -# Check for the XF86VMODE server extension (for virtual screens.) +# Check for the XINPUT server extension. # ############################################################################### -have_xf86vmode=no -with_xf86vmode_req=unspecified +have_xinput=no +with_xinput_req=unspecified +xinput_halfassed=no -# Check whether --with-xf86vmode-ext was given. -if test "${with_xf86vmode_ext+set}" = set; then : - withval=$with_xf86vmode_ext; with_xf86vmode="$withval"; with_xf86vmode_req="$withval" +# Check whether --with-xinput-ext was given. +if test "${with_xinput_ext+set}" = set; then : + withval=$with_xinput_ext; with_xinput="$withval"; with_xinput_req="$withval" else - with_xf86vmode=yes + with_xinput=yes fi - - - case "$with_xf86vmode" in + case "$with_xinput" in yes) ;; no) ;; /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xf86vmode headers" >&5 -$as_echo_n "checking for xf86vmode headers... " >&6; } - d=$with_xf86vmode/include + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINPUT headers" >&5 +$as_echo_n "checking for XINPUT headers... " >&6; } + d=$with_xinput/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -9420,9 +8716,9 @@ $as_echo "$d" >&6; } $as_echo "not found ($d: no such directory)" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xf86vmode libs" >&5 -$as_echo_n "checking for xf86vmode libs... " >&6; } - d=$with_xf86vmode/lib + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINPUT libs" >&5 +$as_echo_n "checking for XINPUT libs... " >&6; } + d=$with_xinput/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -9433,25 +8729,22 @@ $as_echo "not found ($d: no such directory)" >&6; } fi # replace the directory string with "yes". - with_xf86vmode_req="yes" - with_xf86vmode=$with_xf86vmode_req + with_xinput_req="yes" + with_xinput=$with_xinput_req ;; *) echo "" - echo "error: argument to --with-xf86vmode-ext must be \"yes\", \"no\", or a directory." + echo "error: argument to --with-xinput-ext must be \"yes\", \"no\", or a directory." echo " If it is a directory, then \`DIR/include' will be added to" echo " the -I list, and \`DIR/lib' will be added to the -L list." exit 1 ;; esac +if test "$with_xinput" = yes; then -VIDMODE_LIBS="" - -if test "$with_xf86vmode" = yes; then - - # first check for xf86vmode.h + # first check for Xinput2.h ac_save_CPPFLAGS="$CPPFLAGS" if test \! -z "$includedir" ; then @@ -9459,18 +8752,18 @@ if test "$with_xf86vmode" = yes; then fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - ac_fn_c_check_header_compile "$LINENO" "X11/extensions/xf86vmode.h" "ac_cv_header_X11_extensions_xf86vmode_h" "#include + ac_fn_c_check_header_compile "$LINENO" "X11/extensions/XInput2.h" "ac_cv_header_X11_extensions_XInput2_h" "#include " -if test "x$ac_cv_header_X11_extensions_xf86vmode_h" = xyes; then : - have_xf86vmode=yes +if test "x$ac_cv_header_X11_extensions_XInput2_h" = xyes; then : + have_xinput=yes fi - CPPFLAGS="$ac_save_CPPFLAGS" - # if that succeeded, then check for the -lXxf86vm - if test "$have_xf86vmode" = yes; then - have_xf86vmode=no + # if that succeeded, then check for libXi + if test "$have_xinput" = yes; then + have_xinput=no + xinput_halfassed=yes ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -9490,13 +8783,13 @@ fi CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XF86VidModeGetViewPort in -lXxf86vm" >&5 -$as_echo_n "checking for XF86VidModeGetViewPort in -lXxf86vm... " >&6; } -if ${ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XISelectEvents in -lXi" >&5 +$as_echo_n "checking for XISelectEvents in -lXi... " >&6; } +if ${ac_cv_lib_Xi_XISelectEvents+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXxf86vm -lXext -lX11 $LIBS" +LIBS="-lXi -lXext -lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -9506,30 +8799,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char XF86VidModeGetViewPort (); +char XISelectEvents (); int main () { -return XF86VidModeGetViewPort (); +return XISelectEvents (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort=yes + ac_cv_lib_Xi_XISelectEvents=yes else - ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort=no + ac_cv_lib_Xi_XISelectEvents=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" >&5 -$as_echo "$ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" >&6; } -if test "x$ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" = xyes; then : - have_xf86vmode=yes; - VIDMODE_LIBS="-lXxf86vm"; - SAVER_LIBS="$SAVER_LIBS $VIDMODE_LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xi_XISelectEvents" >&5 +$as_echo "$ac_cv_lib_Xi_XISelectEvents" >&6; } +if test "x$ac_cv_lib_Xi_XISelectEvents" = xyes; then : + have_xinput=yes; xinput_halfassed=no; + SAVER_LIBS="$SAVER_LIBS -lXi" else true fi @@ -9541,17 +8833,16 @@ fi fi # if that succeeded, then we've really got it. - if test "$have_xf86vmode" = yes; then - $as_echo "#define HAVE_XF86VMODE 1" >>confdefs.h + if test "$have_xinput" = yes; then + $as_echo "#define HAVE_XINPUT 1" >>confdefs.h fi -elif test "$with_xf86vmode" != no; then - echo "error: must be yes or no: --with-xf86vmode-ext=$with_xf86vmode" +elif test "$with_xinput" != no; then + echo "error: must be yes or no: --with-xinput-ext=$with_xinput" exit 1 fi - ############################################################################### # # Check for the XF86VMODE server extension (for gamma fading.) @@ -9569,8 +8860,6 @@ else with_xf86gamma=yes fi - - case "$with_xf86gamma" in yes) ;; no) ;; @@ -9614,7 +8903,6 @@ $as_echo "not found ($d: no such directory)" >&6; } ;; esac - if test "$with_xf86gamma" = yes; then # first check for xf86vmode.h, if we haven't already @@ -9634,7 +8922,6 @@ if test "x$ac_cv_header_X11_extensions_xf86vmode_h" = xyes; then : have_xf86gamma=yes fi - CPPFLAGS="$ac_save_CPPFLAGS" fi @@ -9799,37 +9086,30 @@ elif test "$with_xf86gamma" != no; then exit 1 fi - ############################################################################### # -# Check for the RANDR (Resize and Rotate) server extension. -# -# We need this to detect when the resolution of the desktop -# has changed out from under us (this is a newer, different -# mechanism than the XF86VMODE virtual viewports.) +# Check for the XIDLE server extension. # ############################################################################### -have_randr=no -with_randr_req=unspecified +have_xidle=no +with_xidle_req=unspecified -# Check whether --with-randr-ext was given. -if test "${with_randr_ext+set}" = set; then : - withval=$with_randr_ext; with_randr="$withval"; with_randr_req="$withval" +# Check whether --with-xidle-ext was given. +if test "${with_xidle_ext+set}" = set; then : + withval=$with_xidle_ext; with_xidle="$withval"; with_xidle_req="$withval" else - with_randr=yes + with_xidle=yes fi - - - case "$with_randr" in + case "$with_xidle" in yes) ;; no) ;; /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RANDR headers" >&5 -$as_echo_n "checking for RANDR headers... " >&6; } - d=$with_randr/include + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XIDLE headers" >&5 +$as_echo_n "checking for XIDLE headers... " >&6; } + d=$with_xidle/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -9839,9 +9119,9 @@ $as_echo "$d" >&6; } $as_echo "not found ($d: no such directory)" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RANDR libs" >&5 -$as_echo_n "checking for RANDR libs... " >&6; } - d=$with_randr/lib + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XIDLE libs" >&5 +$as_echo_n "checking for XIDLE libs... " >&6; } + d=$with_xidle/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -9852,23 +9132,56 @@ $as_echo "not found ($d: no such directory)" >&6; } fi # replace the directory string with "yes". - with_randr_req="yes" - with_randr=$with_randr_req + with_xidle_req="yes" + with_xidle=$with_xidle_req ;; *) echo "" - echo "error: argument to --with-randr-ext must be \"yes\", \"no\", or a directory." + echo "error: argument to --with-xidle-ext must be \"yes\", \"no\", or a directory." echo " If it is a directory, then \`DIR/include' will be added to" echo " the -I list, and \`DIR/lib' will be added to the -L list." exit 1 ;; esac +if test "$with_xidle" = yes; then -if test "$with_randr" = yes; then + 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_fn_c_check_header_compile "$LINENO" "X11/extensions/xidle.h" "ac_cv_header_X11_extensions_xidle_h" "#include +" +if test "x$ac_cv_header_X11_extensions_xidle_h" = xyes; then : + have_xidle=yes + $as_echo "#define HAVE_XIDLE_EXTENSION 1" >>confdefs.h - # first check for Xrandr.h +fi + + CPPFLAGS="$ac_save_CPPFLAGS" +elif test "$with_xidle" != no; then + echo "error: must be yes or no: --with-xidle-ext=$with_xidle" + exit 1 +fi + +############################################################################### +# +# Check for the MIT-SCREEN-SAVER server extension. +# +############################################################################### + +have_mit=no +with_mit=no +with_mit_req=unspecified +#AC_ARG_WITH(mit-ext, +#[ --with-mit-ext Include support for the MIT-SCREEN-SAVER extension.], +# [with_mit="$withval"; with_mit_req="$withval"],[with_mit=no]) +#HANDLE_X_PATH_ARG(with_mit, --with-mit-ext, MIT-SCREEN-SAVER) + +if test "$with_mit" = yes; then ac_save_CPPFLAGS="$CPPFLAGS" if test \! -z "$includedir" ; then @@ -9876,20 +9189,86 @@ if test "$with_randr" = yes; then fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xrandr.h" "ac_cv_header_X11_extensions_Xrandr_h" "#include + ac_fn_c_check_header_compile "$LINENO" "X11/extensions/scrnsaver.h" "ac_cv_header_X11_extensions_scrnsaver_h" "#include " -if test "x$ac_cv_header_X11_extensions_Xrandr_h" = xyes; then : - have_randr=yes +if test "x$ac_cv_header_X11_extensions_scrnsaver_h" = xyes; then : + have_mit=yes fi - CPPFLAGS="$ac_save_CPPFLAGS" - # if that succeeded, then check for the XRR code in the libraries - if test "$have_randr" = yes; then + # Now check to see if it's really in the library; XF86Free-3.3 ships + # scrnsaver.h, but doesn't include the code in libXext.a, the idiots! + # + if test "$have_mit" = yes; then - # RANDR probably needs -lXrender - xrender_libs= + 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` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XScreenSaverRegister in -lXext" >&5 +$as_echo_n "checking for XScreenSaverRegister in -lXext... " >&6; } +if ${ac_cv_lib_Xext_XScreenSaverRegister+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXext -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char XScreenSaverRegister (); +int +main () +{ +return XScreenSaverRegister (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_Xext_XScreenSaverRegister=yes +else + ac_cv_lib_Xext_XScreenSaverRegister=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_XScreenSaverRegister" >&5 +$as_echo "$ac_cv_lib_Xext_XScreenSaverRegister" >&6; } +if test "x$ac_cv_lib_Xext_XScreenSaverRegister" = xyes; then : + true +else + have_mit=no +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + + if test "$have_mit" = no; then + # Fuck! Looks like XF86Free-3.3 actually puts it in XExExt instead + # of in Xext. Thank you master, may I have another. ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -9909,13 +9288,13 @@ fi CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRenderSetSubpixelOrder in -lXrender" >&5 -$as_echo_n "checking for XRenderSetSubpixelOrder in -lXrender... " >&6; } -if ${ac_cv_lib_Xrender_XRenderSetSubpixelOrder+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XScreenSaverRegister in -lXExExt" >&5 +$as_echo_n "checking for XScreenSaverRegister in -lXExExt... " >&6; } +if ${ac_cv_lib_XExExt_XScreenSaverRegister+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXrender -lXext -lX11 $LIBS" +LIBS="-lXExExt -lX11 -lXext -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -9925,28 +9304,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char XRenderSetSubpixelOrder (); +char XScreenSaverRegister (); int main () { -return XRenderSetSubpixelOrder (); +return XScreenSaverRegister (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Xrender_XRenderSetSubpixelOrder=yes + ac_cv_lib_XExExt_XScreenSaverRegister=yes else - ac_cv_lib_Xrender_XRenderSetSubpixelOrder=no + ac_cv_lib_XExExt_XScreenSaverRegister=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrender_XRenderSetSubpixelOrder" >&5 -$as_echo "$ac_cv_lib_Xrender_XRenderSetSubpixelOrder" >&6; } -if test "x$ac_cv_lib_Xrender_XRenderSetSubpixelOrder" = xyes; then : - xrender_libs="-lXrender" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_XExExt_XScreenSaverRegister" >&5 +$as_echo "$ac_cv_lib_XExExt_XScreenSaverRegister" >&6; } +if test "x$ac_cv_lib_XExExt_XScreenSaverRegister" = xyes; then : + have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXExExt" else true fi @@ -9955,9 +9334,13 @@ fi LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" + fi - # first look for RANDR in -lXext - have_randr=no + if test "$have_mit" = no; then + # Double fuck! Looks like some versions of XFree86 (whichever version + # it is that comes with RedHat Linux 2.0 -- I can't find a version + # number) put this garbage in Xss instead of Xext. Thank you master, + # may I have another. ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -9977,13 +9360,13 @@ fi CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRRGetScreenInfo in -lXext" >&5 -$as_echo_n "checking for XRRGetScreenInfo in -lXext... " >&6; } -if ${ac_cv_lib_Xext_XRRGetScreenInfo+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XScreenSaverRegister in -lXss" >&5 +$as_echo_n "checking for XScreenSaverRegister in -lXss... " >&6; } +if ${ac_cv_lib_Xss_XScreenSaverRegister+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXext $xrender_libs -lXext -lX11 $LIBS" +LIBS="-lXss -lX11 -lXext -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -9993,39 +9376,213 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char XRRGetScreenInfo (); +char XScreenSaverRegister (); int main () { -return XRRGetScreenInfo (); +return XScreenSaverRegister (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Xext_XRRGetScreenInfo=yes + ac_cv_lib_Xss_XScreenSaverRegister=yes else - ac_cv_lib_Xext_XRRGetScreenInfo=no + ac_cv_lib_Xss_XScreenSaverRegister=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_XRRGetScreenInfo" >&5 -$as_echo "$ac_cv_lib_Xext_XRRGetScreenInfo" >&6; } -if test "x$ac_cv_lib_Xext_XRRGetScreenInfo" = xyes; then : - have_randr=yes; SAVER_LIBS="$SAVER_LIBS $xrender_libs" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xss_XScreenSaverRegister" >&5 +$as_echo "$ac_cv_lib_Xss_XScreenSaverRegister" >&6; } +if test "x$ac_cv_lib_Xss_XScreenSaverRegister" = xyes; then : + have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXss" else true fi CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" -# LIBS="$ac_save_LIBS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + + fi + + if test "$have_mit" = yes; then +# AC_DEFINE(HAVE_MIT_SAVER_EXTENSION) + echo "Using the MIT-SCREEN-SAVER extension will crash your server. Don't." + exit 1 + fi + + fi + +elif test "$with_mit" != no; then + echo "error: must be yes or no: --with-mit-ext=$with_mit" + exit 1 +fi + +############################################################################### +# +# Check for the SGI SCREEN_SAVER server extension. +# +############################################################################### + +have_sgi=no +with_sgi_req=unspecified + +# Check whether --with-sgi-ext was given. +if test "${with_sgi_ext+set}" = set; then : + withval=$with_sgi_ext; with_sgi="$withval"; with_sgi_req="$withval" +else + with_sgi=$ac_irix +fi + + case "$with_sgi" in + yes) ;; + no) ;; + + /*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SGI SCREEN_SAVER headers" >&5 +$as_echo_n "checking for SGI SCREEN_SAVER headers... " >&6; } + d=$with_sgi/include + if test -d $d; then + X_CFLAGS="-I$d $X_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SGI SCREEN_SAVER libs" >&5 +$as_echo_n "checking for SGI SCREEN_SAVER libs... " >&6; } + d=$with_sgi/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + # replace the directory string with "yes". + with_sgi_req="yes" + with_sgi=$with_sgi_req + ;; + + *) + echo "" + echo "error: argument to --with-sgi-ext must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac + +if test "$with_sgi" = yes; then + + 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_fn_c_check_header_compile "$LINENO" "X11/extensions/XScreenSaver.h" "ac_cv_header_X11_extensions_XScreenSaver_h" "#include +" +if test "x$ac_cv_header_X11_extensions_XScreenSaver_h" = xyes; then : + have_sgi=yes + $as_echo "#define HAVE_SGI_SAVER_EXTENSION 1" >>confdefs.h + +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + +elif test "$with_sgi" != no; then + echo "error: must be yes or no: --with-sgi-ext=$with_sgi" + exit 1 +fi + +############################################################################### +# +# Check for the SGI-VIDEO-CONTROL server extension. +# +############################################################################### + +have_sgivc=no +with_sgivc_req=unspecified + +# Check whether --with-sgivc-ext was given. +if test "${with_sgivc_ext+set}" = set; then : + withval=$with_sgivc_ext; with_sgivc="$withval"; with_sgivc_req="$withval" +else + with_sgivc=$ac_irix +fi + + case "$with_sgivc" in + yes) ;; + no) ;; + + /*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SGI-VIDEO-CONTROL headers" >&5 +$as_echo_n "checking for SGI-VIDEO-CONTROL headers... " >&6; } + d=$with_sgivc/include + if test -d $d; then + X_CFLAGS="-I$d $X_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SGI-VIDEO-CONTROL libs" >&5 +$as_echo_n "checking for SGI-VIDEO-CONTROL libs... " >&6; } + d=$with_sgivc/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + # replace the directory string with "yes". + with_sgivc_req="yes" + with_sgivc=$with_sgivc_req + ;; + + *) + echo "" + echo "error: argument to --with-sgivc-ext must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac + +if test "$with_sgivc" = yes; then + + # first check for XSGIvc.h + + 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_fn_c_check_header_compile "$LINENO" "X11/extensions/XSGIvc.h" "ac_cv_header_X11_extensions_XSGIvc_h" "#include +" +if test "x$ac_cv_header_X11_extensions_XSGIvc_h" = xyes; then : + have_sgivc=yes +fi + + CPPFLAGS="$ac_save_CPPFLAGS" - - # if that failed, look in -lXrandr - if test "$have_randr" = no; then + # if that succeeded, then check for the -lXsgivc + if test "$have_sgivc" = yes; then + have_sgivc=no ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -10045,13 +9602,13 @@ fi CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRRGetScreenInfo in -lXrandr" >&5 -$as_echo_n "checking for XRRGetScreenInfo in -lXrandr... " >&6; } -if ${ac_cv_lib_Xrandr_XRRGetScreenInfo+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XSGIvcQueryGammaMap in -lXsgivc" >&5 +$as_echo_n "checking for XSGIvcQueryGammaMap in -lXsgivc... " >&6; } +if ${ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXrandr $xrender_libs -lXext -lX11 $LIBS" +LIBS="-lXsgivc -lXext -lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -10061,28 +9618,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char XRRGetScreenInfo (); +char XSGIvcQueryGammaMap (); int main () { -return XRRGetScreenInfo (); +return XSGIvcQueryGammaMap (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Xrandr_XRRGetScreenInfo=yes + ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap=yes else - ac_cv_lib_Xrandr_XRRGetScreenInfo=no + ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrandr_XRRGetScreenInfo" >&5 -$as_echo "$ac_cv_lib_Xrandr_XRRGetScreenInfo" >&6; } -if test "x$ac_cv_lib_Xrandr_XRRGetScreenInfo" = xyes; then : - have_randr=yes; SAVER_LIBS="$SAVER_LIBS -lXrandr $xrender_libs" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap" >&5 +$as_echo "$ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap" >&6; } +if test "x$ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap" = xyes; then : + have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc" else true fi @@ -10091,22 +9648,79 @@ fi LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" - fi fi # if that succeeded, then we've really got it. - if test "$have_randr" = yes; then - $as_echo "#define HAVE_RANDR 1" >>confdefs.h + if test "$have_sgivc" = yes; then + $as_echo "#define HAVE_SGI_VC_EXTENSION 1" >>confdefs.h + fi - # Now check for version 1.2 in the same libs. - # Try to compile, since on MacOS 10.5.7, headers are older than libs! - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRRGetScreenResources" >&5 -$as_echo_n "checking for XRRGetScreenResources... " >&6; } -if ${ac_cv_randr_12+:} false; then : - $as_echo_n "(cached) " >&6 +elif test "$with_sgivc" != no; then + echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc" + exit 1 +fi + +############################################################################### +# +# Check for the SGI XReadDisplay server extension. +# +############################################################################### + +have_readdisplay=no +with_readdisplay_req=unspecified + +# Check whether --with-readdisplay was given. +if test "${with_readdisplay+set}" = set; then : + withval=$with_readdisplay; with_readdisplay="$withval"; with_readdisplay_req="$withval" else - ac_cv_randr_12=no + with_readdisplay=$ac_irix +fi + + case "$with_readdisplay" in + yes) ;; + no) ;; + + /*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XReadDisplay headers" >&5 +$as_echo_n "checking for XReadDisplay headers... " >&6; } + d=$with_readdisplay/include + if test -d $d; then + X_CFLAGS="-I$d $X_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XReadDisplay libs" >&5 +$as_echo_n "checking for XReadDisplay libs... " >&6; } + d=$with_readdisplay/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + # replace the directory string with "yes". + with_readdisplay_req="yes" + with_readdisplay=$with_readdisplay_req + ;; + + *) + echo "" + echo "error: argument to --with-readdisplay must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac + +if test "$with_readdisplay" = yes; then ac_save_CPPFLAGS="$CPPFLAGS" if test \! -z "$includedir" ; then @@ -10114,54 +9728,142 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - #include -int -main () -{ -XRRScreenResources *res = - XRRGetScreenResources (0, 0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_randr_12=yes + ac_fn_c_check_header_compile "$LINENO" "X11/extensions/readdisplay.h" "ac_cv_header_X11_extensions_readdisplay_h" "#include +" +if test "x$ac_cv_header_X11_extensions_readdisplay_h" = xyes; then : + $as_echo "#define HAVE_READ_DISPLAY_EXTENSION 1" >>confdefs.h + +fi + + CPPFLAGS="$ac_save_CPPFLAGS" +elif test "$with_readdisplay" != no; then + echo "error: must be yes or no: --with-readdisplay=$with_readdisplay" + exit 1 +fi + +############################################################################### +# +# Check for the XSHM server extension. +# +############################################################################### + +have_xshm=no +with_xshm_req=unspecified + +# Check whether --with-xshm-ext was given. +if test "${with_xshm_ext+set}" = set; then : + withval=$with_xshm_ext; with_xshm="$withval"; with_xshm_req="$withval" else - ac_cv_randr_12=no + with_xshm=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + case "$with_xshm" in + yes) ;; + no) ;; + + /*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XSHM headers" >&5 +$as_echo_n "checking for XSHM headers... " >&6; } + d=$with_xshm/include + if test -d $d; then + X_CFLAGS="-I$d $X_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XSHM libs" >&5 +$as_echo_n "checking for XSHM libs... " >&6; } + d=$with_xshm/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + # replace the directory string with "yes". + with_xshm_req="yes" + with_xshm=$with_xshm_req + ;; + + *) + echo "" + echo "error: argument to --with-xshm-ext must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac + +if test "$with_xshm" = yes; then + + # first check for Xshm.h. + + 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_fn_c_check_header_compile "$LINENO" "X11/extensions/XShm.h" "ac_cv_header_X11_extensions_XShm_h" "#include +" +if test "x$ac_cv_header_X11_extensions_XShm_h" = xyes; then : + have_xshm=yes +fi + CPPFLAGS="$ac_save_CPPFLAGS" + + # if that succeeded, then check for sys/ipc.h. + if test "$have_xshm" = yes; then + have_xshm=no + + 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_fn_c_check_header_mongrel "$LINENO" "sys/ipc.h" "ac_cv_header_sys_ipc_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_ipc_h" = xyes; then : + have_xshm=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_randr_12" >&5 -$as_echo "$ac_cv_randr_12" >&6; } - if test "$ac_cv_randr_12" = yes ; then - $as_echo "#define HAVE_RANDR_12 1" >>confdefs.h - fi -# AC_CHECK_X_LIB(c, XRRGetOutputInfo, [AC_DEFINE(HAVE_RANDR_12)], -# [true], $SAVER_LIBS) + CPPFLAGS="$ac_save_CPPFLAGS" fi + # if that succeeded, then check for sys/shm.h. + if test "$have_xshm" = yes; then + have_xshm=no -elif test "$with_randr" != no; then - echo "error: must be yes or no: --with-randr-ext=$with_randr" - exit 1 + 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_fn_c_check_header_mongrel "$LINENO" "sys/shm.h" "ac_cv_header_sys_shm_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_shm_h" = xyes; then : + have_xshm=yes fi + CPPFLAGS="$ac_save_CPPFLAGS" + fi -############################################################################### -# -# Check for XF86MiscSetGrabKeysState (but only bother if we are already -# using other XF86 stuff.) -# -############################################################################### - -have_xf86miscsetgrabkeysstate=no -if test "$have_xf86gamma" = yes -o "$have_xf86vmode" = yes; then + # AIX is pathological, as usual: apparently it's normal for the Xshm headers + # to exist, but the library code to not exist. And even better, the library + # code is in its own library: libXextSam.a. So, if we're on AIX, and that + # lib doesn't exist, give up. (This lib gets added to X_EXTRA_LIBS, and + # that's not quite right, but close enough.) + # + case "$host" in + *-aix*) + if `uname -v` -eq 3 ; then + have_xshm=no ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -10181,13 +9883,13 @@ if test "$have_xf86gamma" = yes -o "$have_xf86vmode" = yes; then CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XF86MiscSetGrabKeysState in -lXxf86misc" >&5 -$as_echo_n "checking for XF86MiscSetGrabKeysState in -lXxf86misc... " >&6; } -if ${ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XShmQueryExtension in -lXextSam" >&5 +$as_echo_n "checking for XShmQueryExtension in -lXextSam... " >&6; } +if ${ac_cv_lib_XextSam_XShmQueryExtension+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXxf86misc -lXext -lX11 $LIBS" +LIBS="-lXextSam -lX11 -lXext -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -10197,28 +9899,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char XF86MiscSetGrabKeysState (); +char XShmQueryExtension (); int main () { -return XF86MiscSetGrabKeysState (); +return XShmQueryExtension (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState=yes + ac_cv_lib_XextSam_XShmQueryExtension=yes else - ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState=no + ac_cv_lib_XextSam_XShmQueryExtension=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState" >&5 -$as_echo "$ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState" >&6; } -if test "x$ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState" = xyes; then : - have_xf86miscsetgrabkeysstate=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_XextSam_XShmQueryExtension" >&5 +$as_echo "$ac_cv_lib_XextSam_XShmQueryExtension" >&6; } +if test "x$ac_cv_lib_XextSam_XShmQueryExtension" = xyes; then : + have_xshm=yes; X_EXTRA_LIBS="$X_EXTRA_LIBS -lXextSam" else true fi @@ -10227,13 +9929,217 @@ fi LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" - if test "$have_xf86miscsetgrabkeysstate" = yes ; then - SAVER_LIBS="$SAVER_LIBS -lXxf86misc" - $as_echo "#define HAVE_XF86MISCSETGRABKEYSSTATE 1" >>confdefs.h + fi + ;; + esac + + # if that succeeded, then we've really got it. + if test "$have_xshm" = yes; then + $as_echo "#define HAVE_XSHM_EXTENSION 1" >>confdefs.h + + fi + +elif test "$with_xshm" != no; then + echo "error: must be yes or no: --with-xshm-ext=$with_xshm" + exit 1 +fi + +############################################################################### +# +# Check for the DOUBLE-BUFFER server extension. +# +############################################################################### + +have_xdbe=no +with_xdbe_req=unspecified + +# Check whether --with-xdbe-ext was given. +if test "${with_xdbe_ext+set}" = set; then : + withval=$with_xdbe_ext; with_xdbe="$withval"; with_xdbe_req="$withval" +else + with_xdbe=yes +fi + + case "$with_xdbe" in + yes) ;; + no) ;; + + /*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DOUBLE-BUFFER headers" >&5 +$as_echo_n "checking for DOUBLE-BUFFER headers... " >&6; } + d=$with_xdbe/include + if test -d $d; then + X_CFLAGS="-I$d $X_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DOUBLE-BUFFER libs" >&5 +$as_echo_n "checking for DOUBLE-BUFFER libs... " >&6; } + d=$with_xdbe/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + # replace the directory string with "yes". + with_xdbe_req="yes" + with_xdbe=$with_xdbe_req + ;; + + *) + echo "" + echo "error: argument to --with-xdbe-ext must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac + +if test "$with_xdbe" = yes; then + + 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_fn_c_check_header_compile "$LINENO" "X11/extensions/Xdbe.h" "ac_cv_header_X11_extensions_Xdbe_h" "#include +" +if test "x$ac_cv_header_X11_extensions_Xdbe_h" = xyes; then : + have_xdbe=yes +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + if test "$have_xdbe" = yes; then + $as_echo "#define HAVE_DOUBLE_BUFFER_EXTENSION 1" >>confdefs.h + + fi + +elif test "$with_xdbe" != no; then + echo "error: must be yes or no: --with-xdbe-ext=$with_xshm" + exit 1 +fi + +############################################################################### +# +# Check for the COMPOSITE server extension. +# +############################################################################### + +#have_xcomposite=no +#with_xcomposite_req=unspecified +#AC_ARG_WITH(xcomposite-ext, +#[ --with-xcomposite-ext Include support for the XCOMPOSITE extension.], +# [with_xcomposite="$withval"; with_xcomposite_req="$withval"], +# [with_xcomposite=yes]) +# +#HANDLE_X_PATH_ARG(with_xcomposite, --with-xcomposite-ext, XCOMPOSITE) +# +#if test "$with_xcomposite" = yes; then +# +# AC_CHECK_X_HEADER(X11/extensions/Xcomposite.h, [have_xcomposite=yes],, +# [#include ]) +# if test "$have_xcomposite" = yes; then +# AC_DEFINE(HAVE_XCOMPOSITE_EXTENSION) +# SAVER_LIBS="-lXcomposite $SAVER_LIBS" +# fi +# +#elif test "$with_xcomposite" != no; then +# echo "error: must be yes or no: --with-xcomposite-ext=$with_xshm" +# exit 1 +#fi + +############################################################################### +# +# Check for the XKB server extension. +# +############################################################################### + +have_xkb=no +with_xkb_req=unspecified + +# Check whether --with-xkb-ext was given. +if test "${with_xkb_ext+set}" = set; then : + withval=$with_xkb_ext; with_xkb="$withval"; with_xkb_req="$withval" +else + with_xkb=yes +fi + + case "$with_xkb" in + yes) ;; + no) ;; + /*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XKB headers" >&5 +$as_echo_n "checking for XKB headers... " >&6; } + d=$with_xkb/include + if test -d $d; then + X_CFLAGS="-I$d $X_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XKB libs" >&5 +$as_echo_n "checking for XKB libs... " >&6; } + d=$with_xkb/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + # replace the directory string with "yes". + with_xkb_req="yes" + with_xkb=$with_xkb_req + ;; + + *) + echo "" + echo "error: argument to --with-xkb-ext must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac + +if test "$with_xkb" = yes; then + + 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_fn_c_check_header_compile "$LINENO" "X11/XKBlib.h" "ac_cv_header_X11_XKBlib_h" "#include +" +if test "x$ac_cv_header_X11_XKBlib_h" = xyes; then : + have_xkb=yes fi + CPPFLAGS="$ac_save_CPPFLAGS" + if test "$have_xkb" = yes; then + $as_echo "#define HAVE_XKB 1" >>confdefs.h + + fi + +elif test "$with_xkb" != no; then + echo "error: must be yes or no: --with-xkb-ext=$with_xshm" + exit 1 +fi ############################################################################### # @@ -10270,7 +10176,6 @@ rm -rf conftest* CPPFLAGS="$ac_save_CPPFLAGS" - ############################################################################### # # Check for /proc/interrupts. @@ -10284,10 +10189,9 @@ with_proc_interrupts_req=unspecified if test "${with_proc_interrupts+set}" = set; then : withval=$with_proc_interrupts; with_proc_interrupts="$withval"; with_proc_interrupts_req="$withval" else - with_proc_interrupts=yes + with_proc_interrupts=no fi - if test "$with_proc_interrupts" = yes; then # Note that we may be building in an environment (e.g. Debian buildd chroot) @@ -10323,13 +10227,13 @@ elif test "$with_proc_interrupts" != no; then exit 1 fi - ############################################################################### # # Check for /proc/*/oom_score_adj. # ############################################################################### +setuid_auth=no have_proc_oom=no with_proc_oom_req=unspecified @@ -10340,7 +10244,6 @@ else with_proc_oom=yes fi - if test "$with_proc_oom_req" = yes; then # Note that we may be building in an environment (e.g. Debian buildd chroot) @@ -10349,7 +10252,6 @@ if test "$with_proc_oom_req" = yes; then have_proc_oom=yes $as_echo "#define HAVE_PROC_OOM 1" >>confdefs.h - elif test "$with_proc_oom_req" = unspecified; then have_proc_oom=no @@ -10371,6 +10273,10 @@ $as_echo "$ac_cv_have_proc_oom" >&6; } if test "$have_proc_oom" = yes; then $as_echo "#define HAVE_PROC_OOM 1" >>confdefs.h + # Only root can write to /proc/$$/oom_score_adj, even though it's us. + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabling setuid to opt out of OOM-killer." >&5 +$as_echo "enabling setuid to opt out of OOM-killer." >&6; } + setuid_auth=yes fi elif test "$with_proc_oom" != no; then @@ -10378,123 +10284,32 @@ elif test "$with_proc_oom" != no; then exit 1 fi - -############################################################################### -# -# The --enable-locking option -# -############################################################################### - -# Check whether --enable-locking was given. -if test "${enable_locking+set}" = set; then : - enableval=$enable_locking; enable_locking="$enableval" -else - if test "$ac_macosx" = yes; then - # We can't lock on MacOS X, so default to not compiling in support for it. - # But allow --enable-locking to override that, so I can debug Linux locking - # under MacOS X11. - enable_locking=no - else - enable_locking=yes - fi -fi - -if test "$enable_locking" = yes; then - true -elif test "$enable_locking" = no; then - $as_echo "#define NO_LOCKING 1" >>confdefs.h - -else - echo "error: must be yes or no: --enable-locking=$enable_locking" - exit 1 -fi - - -############################################################################### -# -# Whether to allow root password to unblank. -# -############################################################################### -# Check whether --enable-root-passwd was given. -if test "${enable_root_passwd+set}" = set; then : - enableval=$enable_root_passwd; enable_root_passwd="$enableval" -else - enable_root_passwd=yes -fi - -if test "$enable_root_passwd" = yes; then - $as_echo "#define ALLOW_ROOT_PASSWD 1" >>confdefs.h - - true -elif test "$enable_root_passwd" != no; then - echo "error: must be yes or no: --enable-root-passwd=$enable_root_passwd" - exit 1 -fi - ############################################################################### # -# Check for PAM. +# Check for -lsystemd # ############################################################################### -case "$host" in - *-solaris*) - # Solaris systems tend to come with PAM misconfigured. - # Don't build it by default, even if the headers exist. - with_pam_default=no - ;; - *) - # Default to building PAM support on all other systems, if it exists. - with_pam_default=yes - ;; -esac - -have_pam=no -with_pam_req=unspecified - - -# Check whether --with-pam was given. -if test "${with_pam+set}" = set; then : - withval=$with_pam; with_pam="$withval"; with_pam_req="$withval" -else - with_pam=$with_pam_default -fi - - - -# Check whether --with-pam_service_name was given. -if test "${with_pam_service_name+set}" = set; then : - withval=$with_pam_service_name; pam_service_name="$withval" -else - pam_service_name="xscreensaver" -fi - +have_systemd=no +with_systemd_req=unspecified +systemd_halfassed=no +systemd_too_old=no -# Check whether --enable-pam-check-account-type was given. -if test "${enable_pam_check_account_type+set}" = set; then : - enableval=$enable_pam_check_account_type; enable_pam_check_account_type="$enableval" +# Check whether --with-systemd was given. +if test "${with_systemd+set}" = set; then : + withval=$with_systemd; with_systemd="$withval"; with_systemd_req="$withval" else - enable_pam_check_account_type=no -fi - -if test "$enable_pam_check_account_type" = yes ; then - $as_echo "#define PAM_CHECK_ACCOUNT_TYPE 1" >>confdefs.h - - true -elif test "$enable_pam_check_account_type" != no ; then - echo "error: must be yes or no: --enable-pam-check-account-type=$enable_pam_check_account_type" - exit 1 + with_systemd=yes fi - - case "$with_pam" in + case "$with_systemd" in yes) ;; no) ;; /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAM headers" >&5 -$as_echo_n "checking for PAM headers... " >&6; } - d=$with_pam/include + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for systemd headers" >&5 +$as_echo_n "checking for systemd headers... " >&6; } + d=$with_systemd/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -10504,9 +10319,9 @@ $as_echo "$d" >&6; } $as_echo "not found ($d: no such directory)" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAM libs" >&5 -$as_echo_n "checking for PAM libs... " >&6; } - d=$with_pam/lib + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for systemd libs" >&5 +$as_echo_n "checking for systemd libs... " >&6; } + d=$with_systemd/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -10517,26 +10332,69 @@ $as_echo "not found ($d: no such directory)" >&6; } fi # replace the directory string with "yes". - with_pam_req="yes" - with_pam=$with_pam_req + with_systemd_req="yes" + with_systemd=$with_systemd_req ;; *) echo "" - echo "error: argument to --with-pam must be \"yes\", \"no\", or a directory." + echo "error: argument to --with-systemd must be \"yes\", \"no\", or a directory." echo " If it is a directory, then \`DIR/include' will be added to" echo " the -I list, and \`DIR/lib' will be added to the -L list." exit 1 ;; esac +if test "$with_systemd" != yes -a "$with_systemd" != no ; then + echo "error: must be yes or no: --with-systemd=$with_systemd" + exit 1 +fi -if test "$enable_locking" = yes -a "$with_pam" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAM" >&5 -$as_echo_n "checking for PAM... " >&6; } -if ${ac_cv_pam+:} false; then : +if test "$with_systemd" = yes; then + + pkgs='' + ok="yes" + pkg_check_version libsystemd 221 + have_systemd="$ok" + + if test "$have_systemd" = no; then + if $pkg_config --exists libsystemd ; then + systemd_too_old=yes + fi + fi + + if test "$have_systemd" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libsystemd includes" >&5 +$as_echo_n "checking for libsystemd includes... " >&6; } +if ${ac_cv_systemd_config_cflags+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_systemd_config_cflags=`$pkg_config --cflags $pkgs` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_systemd_config_cflags" >&5 +$as_echo "$ac_cv_systemd_config_cflags" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libsystemd libs" >&5 +$as_echo_n "checking for libsystemd libs... " >&6; } +if ${ac_cv_systemd_config_libs+:} false; then : $as_echo_n "(cached) " >&6 else + ac_cv_systemd_config_libs=`$pkg_config --libs $pkgs` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_systemd_config_libs" >&5 +$as_echo "$ac_cv_systemd_config_libs" >&6; } + fi + + ac_systemd_config_cflags=$ac_cv_systemd_config_cflags + ac_systemd_config_libs=$ac_cv_systemd_config_libs + + if test "$have_systemd" = yes; then + # + # we appear to have libsystemd; check for headers/libs to be sure. + # + ac_save_systemd_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $ac_systemd_config_cflags" + + have_systemd=no ac_save_CPPFLAGS="$CPPFLAGS" if test \! -z "$includedir" ; then @@ -10544,133 +10402,48 @@ else fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_pam=yes -else - ac_cv_pam=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$ac_save_CPPFLAGS" + ac_fn_c_check_header_mongrel "$LINENO" "systemd/sd-bus.h" "ac_cv_header_systemd_sd_bus_h" "$ac_includes_default" +if test "x$ac_cv_header_systemd_sd_bus_h" = xyes; then : + have_systemd=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_pam" >&5 -$as_echo "$ac_cv_pam" >&6; } - if test "$ac_cv_pam" = yes ; then - have_pam=yes - $as_echo "#define HAVE_PAM 1" >>confdefs.h - - cat >>confdefs.h <<_ACEOF -#define PAM_SERVICE_NAME "$pam_service_name" -_ACEOF - - PASSWD_LIBS="${PASSWD_LIBS} -lpam" - - # libpam typically requires dlopen and dlsym. On FreeBSD, - # those are in libc. On Linux and Solaris, they're in libdl. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + CPPFLAGS="$ac_save_CPPFLAGS" -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - PASSWD_LIBS="${PASSWD_LIBS} -ldl" -fi + CPPFLAGS="$ac_save_systemd_CPPFLAGS" + fi + if test "$have_systemd" = yes; then + # we have the headers, now check for the libraries + have_systemd=no + systemd_halfassed=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for libsystemd usability..." >&5 +$as_echo "checking for libsystemd usability..." >&6; } - # On Linux, sigtimedwait() is in libc; on Solaris, it's in librt. - have_timedwait=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigtimedwait in -lc" >&5 -$as_echo_n "checking for sigtimedwait in -lc... " >&6; } -if ${ac_cv_lib_c_sigtimedwait+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" +# ac_save_LIBS="$LIBS" -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char sigtimedwait (); -int -main () -{ -return sigtimedwait (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_sigtimedwait=yes -else - ac_cv_lib_c_sigtimedwait=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_sigtimedwait" >&5 -$as_echo "$ac_cv_lib_c_sigtimedwait" >&6; } -if test "x$ac_cv_lib_c_sigtimedwait" = xyes; then : - have_timedwait=yes - $as_echo "#define HAVE_SIGTIMEDWAIT 1" >>confdefs.h + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + # note: $X_CFLAGS includes $x_includes + CPPFLAGS="$CPPFLAGS $X_CFLAGS" -fi + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" + fi + # note: $X_LIBS includes $x_libraries + LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" - if test "$have_timedwait" = no ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigtimedwait in -lrt" >&5 -$as_echo_n "checking for sigtimedwait in -lrt... " >&6; } -if ${ac_cv_lib_rt_sigtimedwait+:} false; then : + CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` + LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sd_bus_open_system in -lc" >&5 +$as_echo_n "checking for sd_bus_open_system in -lc... " >&6; } +if ${ac_cv_lib_c_sd_bus_open_system+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" +LIBS="-lc $ac_systemd_config_libs -lX11 -lXext -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -10680,187 +10453,178 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char sigtimedwait (); +char sd_bus_open_system (); int main () { -return sigtimedwait (); +return sd_bus_open_system (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_rt_sigtimedwait=yes + ac_cv_lib_c_sd_bus_open_system=yes else - ac_cv_lib_rt_sigtimedwait=no + ac_cv_lib_c_sd_bus_open_system=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sigtimedwait" >&5 -$as_echo "$ac_cv_lib_rt_sigtimedwait" >&6; } -if test "x$ac_cv_lib_rt_sigtimedwait" = xyes; then : - have_timedwait=yes - $as_echo "#define HAVE_SIGTIMEDWAIT 1" >>confdefs.h - - PASSWD_LIBS="${PASSWD_LIBS} -lrt" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_sd_bus_open_system" >&5 +$as_echo "$ac_cv_lib_c_sd_bus_open_system" >&6; } +if test "x$ac_cv_lib_c_sd_bus_open_system" = xyes; then : + have_systemd=yes; systemd_halfassed=no fi - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to call pam_strerror" >&5 -$as_echo_n "checking how to call pam_strerror... " >&6; } - if ${ac_cv_pam_strerror_args+:} false; then : - $as_echo_n "(cached) " >&6 -else + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" - 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` - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - #include -int -main () -{ -pam_handle_t *pamh = 0; - char *s = pam_strerror(pamh, PAM_SUCCESS); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_pam_strerror_args=2 -else - ac_save_CPPFLAGS="$CPPFLAGS" - if test \! -z "$includedir" ; then - CPPFLAGS="$CPPFLAGS -I$includedir" + if test "$have_systemd" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for libsystemd usability... no" >&5 +$as_echo "checking for libsystemd usability... no" >&6; } fi - CPPFLAGS="$CPPFLAGS $X_CFLAGS" - CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - #include -int -main () -{ -char *s = - pam_strerror(PAM_SUCCESS); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_pam_strerror_args=1 -else - ac_pam_strerror_args=0 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$ac_save_CPPFLAGS" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$ac_save_CPPFLAGS" - ac_cv_pam_strerror_args=$ac_pam_strerror_args -fi - - ac_pam_strerror_args=$ac_cv_pam_strerror_args - if test "$ac_pam_strerror_args" = 1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: one argument" >&5 -$as_echo "one argument" >&6; } - elif test "$ac_pam_strerror_args" = 2 ; then - $as_echo "#define PAM_STRERROR_TWO_ARGS 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: two arguments" >&5 -$as_echo "two arguments" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5 -$as_echo "unknown" >&6; } - fi +if test "$have_systemd" = yes; then + INCLUDES="$INCLUDES $ac_systemd_config_cflags" + EXES_SYSTEMD='$(EXES_SYSTEMD)' + SYSTEMD_LIBS="$ac_systemd_config_libs" + $as_echo "#define HAVE_LIBSYSTEMD 1" >>confdefs.h -# Check pam_fail_delay - { $as_echo "$as_me:${as_lineno-$LINENO}: checking pam_fail_delay in -lpam" >&5 -$as_echo_n "checking pam_fail_delay in -lpam... " >&6; } - if ${ac_cv_pam_fail_delay+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_LDFLAGS="$LDFLAGS" - LDFLAGS="-lpam" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -pam_handle_t *pamh = 0; - unsigned int usec = 1; - int status = pam_fail_delay (pamh, usec); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_pam_fail_delay=yes else - ac_pam_fail_delay=no + EXES_SYSTEMD='' + SYSTEMD_LIBS='' fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_cv_pam_fail_delay=$ac_pam_fail_delay, - LDFLAGS=$ac_save_LDFLAGS + +############################################################################### +# +# The --enable-locking option +# +# Note: "configure --help" list all "--enable" options before any +# "--with" options, so we document the --enable options inline with +# the --with options where it looks better, instead of in AC_ARG_ENABLE +# where it would make sense, sigh... +# +############################################################################### + +# Check whether --enable-locking was given. +if test "${enable_locking+set}" = set; then : + enableval=$enable_locking; # This is documented elsewhere because of --enable/--with option sorting. + enable_locking="$enableval" +else + if test "$ac_macosx" = yes; then + # We can't lock on macOS, so default to not compiling in support for it. + # But allow --enable-locking to override that, so I can debug Linux locking + # under macOS X11. + enable_locking=no + else + enable_locking=yes + fi fi +if test "$enable_locking" = yes; then + true +elif test "$enable_locking" = no; then + $as_echo "#define NO_LOCKING 1" >>confdefs.h - if test "$ac_pam_fail_delay" = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - $as_echo "#define HAVE_PAM_FAIL_DELAY 1" >>confdefs.h +else + echo "error: must be yes or no: --enable-locking=$enable_locking" + exit 1 +fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi +############################################################################## +# +# Whether to allow root password to unblank. +# +############################################################################### - fi +# Check whether --enable-root-passwd was given. +if test "${enable_root_passwd+set}" = set; then : + enableval=$enable_root_passwd; # This is documented elsewhere because of --enable/--with option sorting. + enable_root_passwd="$enableval" +else + enable_root_passwd=no fi +if test "$enable_root_passwd" = yes; then + $as_echo "#define ALLOW_ROOT_PASSWD 1" >>confdefs.h + + true +elif test "$enable_root_passwd" != no; then + echo "error: must be yes or no: --enable-root-passwd=$enable_root_passwd" + exit 1 +fi ############################################################################### # -# Check for Kerberos. +# Check for PAM. # ############################################################################### -have_kerberos=no -have_kerberos5=no -with_kerberos_req=unspecified +case "$host" in + *-solaris*) + # Solaris systems tend to have the PAM runtime misconfigured and unusable. + with_pam_default=no + ;; + *-freebsd* ) + # FreeBSD's PAM implementation requires the calling process to be setuid + # the whole time, which is unacceptable. + with_pam_default=no + ;; + *) + # Default to building PAM support on all other systems, if it exists. + with_pam_default=yes + ;; +esac +#### H1 -# Check whether --with-kerberos was given. -if test "${with_kerberos+set}" = set; then : - withval=$with_kerberos; with_kerberos="$withval"; with_kerberos_req="$withval" +have_pam=no +with_pam_req=unspecified + +# Check whether --with-pam was given. +if test "${with_pam+set}" = set; then : + withval=$with_pam; with_pam="$withval"; with_pam_req="$withval" else - with_kerberos=yes + with_pam=$with_pam_default +fi + +# Check whether --with-pam_service_name was given. +if test "${with_pam_service_name+set}" = set; then : + withval=$with_pam_service_name; pam_service_name="$withval" +else + pam_service_name="xscreensaver" fi +# Check whether --enable-pam-check-account-type was given. +if test "${enable_pam_check_account_type+set}" = set; then : + enableval=$enable_pam_check_account_type; # This is documented elsewhere because of --enable/--with option sorting. + enable_pam_check_account_type="$enableval" +else + enable_pam_check_account_type=no +fi +if test "$enable_pam_check_account_type" = yes ; then + $as_echo "#define PAM_CHECK_ACCOUNT_TYPE 1" >>confdefs.h - case "$with_kerberos" in + true +elif test "$enable_pam_check_account_type" != no ; then + echo "error: must be yes or no: --enable-pam-check-account-type=$enable_pam_check_account_type" + exit 1 +fi + + case "$with_pam" in yes) ;; no) ;; /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos headers" >&5 -$as_echo_n "checking for Kerberos headers... " >&6; } - d=$with_kerberos/include + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAM headers" >&5 +$as_echo_n "checking for PAM headers... " >&6; } + d=$with_pam/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -10870,9 +10634,9 @@ $as_echo "$d" >&6; } $as_echo "not found ($d: no such directory)" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos libs" >&5 -$as_echo_n "checking for Kerberos libs... " >&6; } - d=$with_kerberos/lib + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAM libs" >&5 +$as_echo_n "checking for PAM libs... " >&6; } + d=$with_pam/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -10883,24 +10647,23 @@ $as_echo "not found ($d: no such directory)" >&6; } fi # replace the directory string with "yes". - with_kerberos_req="yes" - with_kerberos=$with_kerberos_req + with_pam_req="yes" + with_pam=$with_pam_req ;; *) echo "" - echo "error: argument to --with-kerberos must be \"yes\", \"no\", or a directory." + echo "error: argument to --with-pam must be \"yes\", \"no\", or a directory." echo " If it is a directory, then \`DIR/include' will be added to" echo " the -I list, and \`DIR/lib' will be added to the -L list." exit 1 ;; esac - -if test "$enable_locking" = yes -a "$with_kerberos" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos 4" >&5 -$as_echo_n "checking for Kerberos 4... " >&6; } -if ${ac_cv_kerberos+:} false; then : +if test "$enable_locking" = yes -a "$with_pam" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAM" >&5 +$as_echo_n "checking for PAM... " >&6; } +if ${ac_cv_pam+:} false; then : $as_echo_n "(cached) " >&6 else @@ -10912,7 +10675,7 @@ else CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include int main () { @@ -10922,93 +10685,76 @@ main () } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_kerberos=yes + ac_cv_pam=yes else - ac_cv_kerberos=no + ac_cv_pam=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CPPFLAGS="$ac_save_CPPFLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_kerberos" >&5 -$as_echo "$ac_cv_kerberos" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos 5" >&5 -$as_echo_n "checking for Kerberos 5... " >&6; } -if ${ac_cv_kerberos5+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_pam" >&5 +$as_echo "$ac_cv_pam" >&6; } + if test "$ac_cv_pam" = yes ; then + have_pam=yes + $as_echo "#define HAVE_PAM 1" >>confdefs.h + + cat >>confdefs.h <<_ACEOF +#define PAM_SERVICE_NAME "$pam_service_name" +_ACEOF + + PASSWD_LIBS="${PASSWD_LIBS} -lpam" + + # libpam typically requires dlopen and dlsym. On FreeBSD, + # those are in libc. On Linux and Solaris, they're in libdl. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else - - 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` - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); int main () { - +return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_kerberos5=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes else - ac_cv_kerberos5=no + ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$ac_save_CPPFLAGS" +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + PASSWD_LIBS="${PASSWD_LIBS} -ldl" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_kerberos5" >&5 -$as_echo "$ac_cv_kerberos5" >&6; } - - if test "$ac_cv_kerberos" = yes ; then - have_kerberos=yes - $as_echo "#define HAVE_KERBEROS 1" >>confdefs.h - - fi - - if test "$ac_cv_kerberos5" = yes ; then - - # Andrew Snare wrote: - # - # You were assuming that if kerberosV (krb5) was found, then kerberosIV - # (krb4) was also available. This turns out not to be the case with - # mit-krb-1.2.7; apparently backwards-compatibility with KerberosIV - # is optional. - # - # So, disable kerberosV support if libkrb4 can't be found. - # This is not the best solution, but it makes the compile not fail. - # - - 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` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb_get_tf_realm in -lkrb4" >&5 -$as_echo_n "checking for krb_get_tf_realm in -lkrb4... " >&6; } -if ${ac_cv_lib_krb4_krb_get_tf_realm+:} false; then : + # On Linux, sigtimedwait() is in libc; on Solaris, it's in librt. + have_timedwait=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigtimedwait in -lc" >&5 +$as_echo_n "checking for sigtimedwait in -lc... " >&6; } +if ${ac_cv_lib_c_sigtimedwait+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lkrb4 $LIBS" +LIBS="-lc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -11018,210 +10764,225 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char krb_get_tf_realm (); +char sigtimedwait (); int main () { -return krb_get_tf_realm (); +return sigtimedwait (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_krb4_krb_get_tf_realm=yes + ac_cv_lib_c_sigtimedwait=yes else - ac_cv_lib_krb4_krb_get_tf_realm=no + ac_cv_lib_c_sigtimedwait=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb4_krb_get_tf_realm" >&5 -$as_echo "$ac_cv_lib_krb4_krb_get_tf_realm" >&6; } -if test "x$ac_cv_lib_krb4_krb_get_tf_realm" = xyes; then : - have_kerberos=yes -else - have_kerberos=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_sigtimedwait" >&5 +$as_echo "$ac_cv_lib_c_sigtimedwait" >&6; } +if test "x$ac_cv_lib_c_sigtimedwait" = xyes; then : + have_timedwait=yes + $as_echo "#define HAVE_SIGTIMEDWAIT 1" >>confdefs.h + fi - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" -# LIBS="$ac_save_LIBS" + if test "$have_timedwait" = no ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigtimedwait in -lrt" >&5 +$as_echo_n "checking for sigtimedwait in -lrt... " >&6; } +if ${ac_cv_lib_rt_sigtimedwait+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - if test "$have_kerberos" = yes ; then - have_kerberos5=yes - $as_echo "#define HAVE_KERBEROS 1" >>confdefs.h +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sigtimedwait (); +int +main () +{ +return sigtimedwait (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rt_sigtimedwait=yes +else + ac_cv_lib_rt_sigtimedwait=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sigtimedwait" >&5 +$as_echo "$ac_cv_lib_rt_sigtimedwait" >&6; } +if test "x$ac_cv_lib_rt_sigtimedwait" = xyes; then : + have_timedwait=yes + $as_echo "#define HAVE_SIGTIMEDWAIT 1" >>confdefs.h - $as_echo "#define HAVE_KERBEROS5 1" >>confdefs.h + PASSWD_LIBS="${PASSWD_LIBS} -lrt" +fi - else - have_kerberos5=no - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find compat lib (libkrb4) needed to use Kerberos 5" >&5 -$as_echo "$as_me: WARNING: Cannot find compat lib (libkrb4) needed to use Kerberos 5" >&2;} fi - fi - - if test "$have_kerberos5" = yes ; then - # from Matt Knopp - # (who got it from amu@mit.edu) - - PASSWD_LIBS="$PASSWD_LIBS -lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err" - - # jwz: MacOS X uses -lkrb5, but not -lcrypt + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to call pam_strerror" >&5 +$as_echo_n "checking how to call pam_strerror... " >&6; } + if ${ac_cv_pam_strerror_args+:} false; then : + $as_echo_n "(cached) " >&6 +else 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` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5 -$as_echo_n "checking for crypt in -lcrypt... " >&6; } -if ${ac_cv_lib_crypt_crypt+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcrypt $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #include + #include +int +main () +{ +pam_handle_t *pamh = 0; + char *s = pam_strerror(pamh, PAM_SUCCESS); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_pam_strerror_args=2 +else -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char crypt (); + 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` + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include int main () { -return crypt (); +char *s = + pam_strerror(PAM_SUCCESS); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_crypt_crypt=yes +if ac_fn_c_try_compile "$LINENO"; then : + ac_pam_strerror_args=1 else - ac_cv_lib_crypt_crypt=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + ac_pam_strerror_args=0 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5 -$as_echo "$ac_cv_lib_crypt_crypt" >&6; } -if test "x$ac_cv_lib_crypt_crypt" = xyes; then : - PASSWD_LIBS="$PASSWD_LIBS -lcrypt" +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$ac_save_CPPFLAGS" fi - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" -# LIBS="$ac_save_LIBS" - + ac_cv_pam_strerror_args=$ac_pam_strerror_args +fi - elif test "$have_kerberos" = yes ; then - # from Tim Showalter for FreeBSD 4.2 - PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes -lcom_err" - fi + ac_pam_strerror_args=$ac_cv_pam_strerror_args + if test "$ac_pam_strerror_args" = 1 ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: one argument" >&5 +$as_echo "one argument" >&6; } + elif test "$ac_pam_strerror_args" = 2 ; then + $as_echo "#define PAM_STRERROR_TWO_ARGS 1" >>confdefs.h - if test "$have_kerberos" = yes ; then - ac_fn_c_check_func "$LINENO" "res_search" "ac_cv_func_res_search" -if test "x$ac_cv_func_res_search" = xyes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: two arguments" >&5 +$as_echo "two arguments" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5 +$as_echo "unknown" >&6; } + fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_search in -lresolv" >&5 -$as_echo_n "checking for res_search in -lresolv... " >&6; } -if ${ac_cv_lib_resolv_res_search+:} false; then : +# Check pam_fail_delay + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pam_fail_delay in -lpam" >&5 +$as_echo_n "checking pam_fail_delay in -lpam... " >&6; } + if ${ac_cv_pam_fail_delay+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lresolv $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_save_LDFLAGS="$LDFLAGS" + LDFLAGS="-lpam" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char res_search (); +#include int main () { -return res_search (); +pam_handle_t *pamh = 0; + unsigned int usec = 1; + int status = pam_fail_delay (pamh, usec); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_resolv_res_search=yes + ac_pam_fail_delay=yes else - ac_cv_lib_resolv_res_search=no + ac_pam_fail_delay=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + ac_cv_pam_fail_delay=$ac_pam_fail_delay, + LDFLAGS=$ac_save_LDFLAGS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_res_search" >&5 -$as_echo "$ac_cv_lib_resolv_res_search" >&6; } -if test "x$ac_cv_lib_resolv_res_search" = xyes; then : - PASSWD_LIBS="${PASSWD_LIBS} -lresolv" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find DNS resolver libraries needed for Kerberos" >&5 -$as_echo "$as_me: WARNING: Can't find DNS resolver libraries needed for Kerberos" >&2;} -fi + if test "$ac_pam_fail_delay" = yes ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + $as_echo "#define HAVE_PAM_FAIL_DELAY 1" >>confdefs.h -fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi fi fi - ############################################################################### # -# Check for the nine billion variants of shadow passwords... +# Check for Kerberos. # ############################################################################### -need_setuid=no - -have_shadow=no -with_shadow_req=unspecified - +have_kerberos=no +have_kerberos5=no +with_kerberos_req=unspecified -# Check whether --with-shadow was given. -if test "${with_shadow+set}" = set; then : - withval=$with_shadow; with_shadow="$withval"; with_shadow_req="$withval" +# Check whether --with-kerberos was given. +if test "${with_kerberos+set}" = set; then : + withval=$with_kerberos; with_kerberos="$withval"; with_kerberos_req="$withval" else - with_shadow=yes + with_kerberos=yes fi - - - case "$with_shadow" in + case "$with_kerberos" in yes) ;; no) ;; /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shadow password headers" >&5 -$as_echo_n "checking for shadow password headers... " >&6; } - d=$with_shadow/include + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos headers" >&5 +$as_echo_n "checking for Kerberos headers... " >&6; } + d=$with_kerberos/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -11231,9 +10992,9 @@ $as_echo "$d" >&6; } $as_echo "not found ($d: no such directory)" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shadow password libs" >&5 -$as_echo_n "checking for shadow password libs... " >&6; } - d=$with_shadow/lib + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos libs" >&5 +$as_echo_n "checking for Kerberos libs... " >&6; } + d=$with_kerberos/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -11244,36 +11005,23 @@ $as_echo "not found ($d: no such directory)" >&6; } fi # replace the directory string with "yes". - with_shadow_req="yes" - with_shadow=$with_shadow_req + with_kerberos_req="yes" + with_kerberos=$with_kerberos_req ;; *) echo "" - echo "error: argument to --with-shadow must be \"yes\", \"no\", or a directory." + echo "error: argument to --with-kerberos must be \"yes\", \"no\", or a directory." echo " If it is a directory, then \`DIR/include' will be added to" echo " the -I list, and \`DIR/lib' will be added to the -L list." exit 1 ;; esac - -if test "$enable_locking" = no ; then - with_shadow_req=no - with_shadow=no -fi - - -############################################################################### -# -# Check for Sun "adjunct" passwords. -# -############################################################################### - -if test "$with_shadow" = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Sun-style shadow passwords" >&5 -$as_echo_n "checking for Sun-style shadow passwords... " >&6; } -if ${ac_cv_sun_adjunct+:} false; then : +if test "$enable_locking" = yes -a "$with_kerberos" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos 4" >&5 +$as_echo_n "checking for Kerberos 4... " >&6; } +if ${ac_cv_kerberos+:} false; then : $as_echo_n "(cached) " >&6 else @@ -11285,49 +11033,28 @@ else CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #include - #include - #include - #include - #include +#include int main () { -struct passwd_adjunct *p = getpwanam("nobody"); - const char *pw = p->pwa_passwd; + ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_sun_adjunct=yes + ac_cv_kerberos=yes else - ac_cv_sun_adjunct=no + ac_cv_kerberos=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CPPFLAGS="$ac_save_CPPFLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sun_adjunct" >&5 -$as_echo "$ac_cv_sun_adjunct" >&6; } - if test "$ac_cv_sun_adjunct" = yes; then - have_shadow_adjunct=yes - have_shadow=yes - need_setuid=yes - fi -fi - - -############################################################################### -# -# Check for DEC and SCO so-called "enhanced" security. -# -############################################################################### - -if test "$with_shadow" = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DEC-style shadow passwords" >&5 -$as_echo_n "checking for DEC-style shadow passwords... " >&6; } -if ${ac_cv_enhanced_passwd+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_kerberos" >&5 +$as_echo "$ac_cv_kerberos" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos 5" >&5 +$as_echo_n "checking for Kerberos 5... " >&6; } +if ${ac_cv_kerberos5+:} false; then : $as_echo_n "(cached) " >&6 else @@ -11339,51 +11066,70 @@ else CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #include - #include - #include - #include - #include +#include int main () { -struct pr_passwd *p; - const char *pw; - set_auth_parameters(0, 0); - check_auth_parameters(); - p = getprpwnam("nobody"); - pw = p->ufld.fd_encrypt; + ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_enhanced_passwd=yes + ac_cv_kerberos5=yes else - ac_cv_enhanced_passwd=no + ac_cv_kerberos5=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CPPFLAGS="$ac_save_CPPFLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enhanced_passwd" >&5 -$as_echo "$ac_cv_enhanced_passwd" >&6; } - if test $ac_cv_enhanced_passwd = yes; then - have_shadow_enhanced=yes - have_shadow=yes - need_setuid=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_kerberos5" >&5 +$as_echo "$ac_cv_kerberos5" >&6; } + + if test "$ac_cv_kerberos" = yes ; then + have_kerberos=yes + $as_echo "#define HAVE_KERBEROS 1" >>confdefs.h + + fi + + if test "$ac_cv_kerberos5" = yes ; then + + # Andrew Snare wrote: + # + # You were assuming that if kerberosV (krb5) was found, then kerberosIV + # (krb4) was also available. This turns out not to be the case with + # mit-krb-1.2.7; apparently backwards-compatibility with KerberosIV + # is optional. + # + # So, disable kerberosV support if libkrb4 can't be found. + # This is not the best solution, but it makes the compile not fail. + # + + 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" - # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx) - # (I'm told it needs -lcurses too, but I don't understand why.) - # But on DEC, it's in -lsecurity. - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getprpwnam in -lprot" >&5 -$as_echo_n "checking for getprpwnam in -lprot... " >&6; } -if ${ac_cv_lib_prot_getprpwnam+:} false; then : + 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` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb_get_tf_realm in -lkrb4" >&5 +$as_echo_n "checking for krb_get_tf_realm in -lkrb4... " >&6; } +if ${ac_cv_lib_krb4_krb_get_tf_realm+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lprot -lx $LIBS" +LIBS="-lkrb4 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -11393,36 +11139,83 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char getprpwnam (); +char krb_get_tf_realm (); int main () { -return getprpwnam (); +return krb_get_tf_realm (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_prot_getprpwnam=yes + ac_cv_lib_krb4_krb_get_tf_realm=yes else - ac_cv_lib_prot_getprpwnam=no + ac_cv_lib_krb4_krb_get_tf_realm=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_prot_getprpwnam" >&5 -$as_echo "$ac_cv_lib_prot_getprpwnam" >&6; } -if test "x$ac_cv_lib_prot_getprpwnam" = xyes; then : - PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb4_krb_get_tf_realm" >&5 +$as_echo "$ac_cv_lib_krb4_krb_get_tf_realm" >&6; } +if test "x$ac_cv_lib_krb4_krb_get_tf_realm" = xyes; then : + have_kerberos=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getprpwnam in -lsecurity" >&5 -$as_echo_n "checking for getprpwnam in -lsecurity... " >&6; } -if ${ac_cv_lib_security_getprpwnam+:} false; then : + have_kerberos=no +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + + if test "$have_kerberos" = yes ; then + have_kerberos5=yes + $as_echo "#define HAVE_KERBEROS 1" >>confdefs.h + + $as_echo "#define HAVE_KERBEROS5 1" >>confdefs.h + + else + have_kerberos5=no + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find compat lib (libkrb4) needed to use Kerberos 5" >&5 +$as_echo "$as_me: WARNING: Cannot find compat lib (libkrb4) needed to use Kerberos 5" >&2;} + fi + + fi + + if test "$have_kerberos5" = yes ; then + # from Matt Knopp + # (who got it from amu@mit.edu) + + PASSWD_LIBS="$PASSWD_LIBS -lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err" + + # jwz: macOS uses -lkrb5, but not -lcrypt + + 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` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5 +$as_echo_n "checking for crypt in -lcrypt... " >&6; } +if ${ac_cv_lib_crypt_crypt+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lsecurity $LIBS" +LIBS="-lcrypt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -11432,94 +11225,51 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char getprpwnam (); +char crypt (); int main () { -return getprpwnam (); +return crypt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_security_getprpwnam=yes + ac_cv_lib_crypt_crypt=yes else - ac_cv_lib_security_getprpwnam=no + ac_cv_lib_crypt_crypt=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_security_getprpwnam" >&5 -$as_echo "$ac_cv_lib_security_getprpwnam" >&6; } -if test "x$ac_cv_lib_security_getprpwnam" = xyes; then : - PASSWD_LIBS="$PASSWD_LIBS -lsecurity" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5 +$as_echo "$ac_cv_lib_crypt_crypt" >&6; } +if test "x$ac_cv_lib_crypt_crypt" = xyes; then : + PASSWD_LIBS="$PASSWD_LIBS -lcrypt" fi -fi + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + elif test "$have_kerberos" = yes ; then + # from Tim Showalter for FreeBSD 4.2 + PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes -lcom_err" fi -fi - -############################################################################### -# -# Check for HP's entry in the "Not Invented Here" Sweepstakes. -# -############################################################################### -if test "$with_shadow" = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HP-style shadow passwords" >&5 -$as_echo_n "checking for HP-style shadow passwords... " >&6; } -if ${ac_cv_hpux_passwd+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test "$have_kerberos" = yes ; then + ac_fn_c_check_func "$LINENO" "res_search" "ac_cv_func_res_search" +if test "x$ac_cv_func_res_search" = xyes; then : - 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` - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - #include - #include - #include - #include -int -main () -{ -struct s_passwd *p = getspwnam("nobody"); - const char *pw = p->pw_passwd; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_hpux_passwd=yes else - ac_cv_hpux_passwd=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$ac_save_CPPFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_hpux_passwd" >&5 -$as_echo "$ac_cv_hpux_passwd" >&6; } - if test "$ac_cv_hpux_passwd" = yes; then - have_shadow_hpux=yes - have_shadow=yes - need_setuid=yes - - # on HPUX, bigcrypt is in -lsec - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bigcrypt in -lsec" >&5 -$as_echo_n "checking for bigcrypt in -lsec... " >&6; } -if ${ac_cv_lib_sec_bigcrypt+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_search in -lresolv" >&5 +$as_echo_n "checking for res_search in -lresolv... " >&6; } +if ${ac_cv_lib_resolv_res_search+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lsec $LIBS" +LIBS="-lresolv $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -11529,76 +11279,166 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char bigcrypt (); +char res_search (); int main () { -return bigcrypt (); +return res_search (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_sec_bigcrypt=yes + ac_cv_lib_resolv_res_search=yes else - ac_cv_lib_sec_bigcrypt=no + ac_cv_lib_resolv_res_search=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sec_bigcrypt" >&5 -$as_echo "$ac_cv_lib_sec_bigcrypt" >&6; } -if test "x$ac_cv_lib_sec_bigcrypt" = xyes; then : - PASSWD_LIBS="$PASSWD_LIBS -lsec" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_res_search" >&5 +$as_echo "$ac_cv_lib_resolv_res_search" >&6; } +if test "x$ac_cv_lib_resolv_res_search" = xyes; then : + PASSWD_LIBS="${PASSWD_LIBS} -lresolv" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find DNS resolver libraries needed for Kerberos" >&5 +$as_echo "$as_me: WARNING: Can't find DNS resolver libraries needed for Kerberos" >&2;} + +fi + fi fi fi +############################################################################### +# +# Check for the nine billion variants of shadow passwords... +# +############################################################################### + +have_shadow=no +with_shadow_req=unspecified + +# Check whether --with-shadow was given. +if test "${with_shadow+set}" = set; then : + withval=$with_shadow; with_shadow="$withval"; with_shadow_req="$withval" +else + with_shadow=yes +fi + + case "$with_shadow" in + yes) ;; + no) ;; + + /*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shadow password headers" >&5 +$as_echo_n "checking for shadow password headers... " >&6; } + d=$with_shadow/include + if test -d $d; then + X_CFLAGS="-I$d $X_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shadow password libs" >&5 +$as_echo_n "checking for shadow password libs... " >&6; } + d=$with_shadow/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + # replace the directory string with "yes". + with_shadow_req="yes" + with_shadow=$with_shadow_req + ;; + + *) + echo "" + echo "error: argument to --with-shadow must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac + +if test "$enable_locking" = no ; then + with_shadow_req=no + with_shadow=no +fi ############################################################################### # -# Check for FreeBSD-style shadow passwords. -# -# On FreeBSD, getpwnam() and friends work just like on non-shadow- -# password systems -- except you only get stuff in the pw_passwd field -# if the running program is setuid. So, guess that we've got this -# lossage to contend with if /etc/master.passwd exists, and default to -# a setuid installation. +# Check for Sun "adjunct" passwords. # ############################################################################### if test "$with_shadow" = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeBSD-style shadow passwords" >&5 -$as_echo_n "checking for FreeBSD-style shadow passwords... " >&6; } -if ${ac_cv_master_passwd+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Sun-style shadow passwords" >&5 +$as_echo_n "checking for Sun-style shadow passwords... " >&6; } +if ${ac_cv_sun_adjunct+:} false; then : $as_echo_n "(cached) " >&6 else - if test -f /etc/master.passwd ; then - ac_cv_master_passwd=yes - else - ac_cv_master_passwd=no - fi + + 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` + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include + #include + #include + #include +int +main () +{ +struct passwd_adjunct *p = getpwanam("nobody"); + const char *pw = p->pwa_passwd; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sun_adjunct=yes +else + ac_cv_sun_adjunct=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_master_passwd" >&5 -$as_echo "$ac_cv_master_passwd" >&6; } - if test "$ac_cv_master_passwd" = yes; then - need_setuid=yes +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$ac_save_CPPFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sun_adjunct" >&5 +$as_echo "$ac_cv_sun_adjunct" >&6; } + if test "$ac_cv_sun_adjunct" = yes; then + have_shadow_adjunct=yes + have_shadow=yes + setuid_auth=yes fi fi - ############################################################################### # -# Check for traditional (ha!) shadow passwords. +# Check for DEC and SCO so-called "enhanced" security. # ############################################################################### if test "$with_shadow" = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for generic shadow passwords" >&5 -$as_echo_n "checking for generic shadow passwords... " >&6; } -if ${ac_cv_shadow+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DEC-style shadow passwords" >&5 +$as_echo_n "checking for DEC-style shadow passwords... " >&6; } +if ${ac_cv_enhanced_passwd+:} false; then : $as_echo_n "(cached) " >&6 else @@ -11614,39 +11454,47 @@ else #include #include #include - #include + #include + #include int main () { -struct spwd *p = getspnam("nobody"); - const char *pw = p->sp_pwdp; +struct pr_passwd *p; + const char *pw; + set_auth_parameters(0, 0); + check_auth_parameters(); + p = getprpwnam("nobody"); + pw = p->ufld.fd_encrypt; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_shadow=yes + ac_cv_enhanced_passwd=yes else - ac_cv_shadow=no + ac_cv_enhanced_passwd=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CPPFLAGS="$ac_save_CPPFLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_shadow" >&5 -$as_echo "$ac_cv_shadow" >&6; } - if test "$ac_cv_shadow" = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enhanced_passwd" >&5 +$as_echo "$ac_cv_enhanced_passwd" >&6; } + if test $ac_cv_enhanced_passwd = yes; then + have_shadow_enhanced=yes have_shadow=yes - need_setuid=yes + setuid_auth=yes - # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc. - have_getspnam=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getspnam in -lc" >&5 -$as_echo_n "checking for getspnam in -lc... " >&6; } -if ${ac_cv_lib_c_getspnam+:} false; then : + # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx) + # (I'm told it needs -lcurses too, but I don't understand why.) + # But on DEC, it's in -lsecurity. + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getprpwnam in -lprot" >&5 +$as_echo_n "checking for getprpwnam in -lprot... " >&6; } +if ${ac_cv_lib_prot_getprpwnam+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $LIBS" +LIBS="-lprot -lx $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -11656,38 +11504,36 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char getspnam (); +char getprpwnam (); int main () { -return getspnam (); +return getprpwnam (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_getspnam=yes + ac_cv_lib_prot_getprpwnam=yes else - ac_cv_lib_c_getspnam=no + ac_cv_lib_prot_getprpwnam=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_getspnam" >&5 -$as_echo "$ac_cv_lib_c_getspnam" >&6; } -if test "x$ac_cv_lib_c_getspnam" = xyes; then : - have_getspnam=yes -fi - - if test "$have_getspnam" = no ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getspnam in -lgen" >&5 -$as_echo_n "checking for getspnam in -lgen... " >&6; } -if ${ac_cv_lib_gen_getspnam+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_prot_getprpwnam" >&5 +$as_echo "$ac_cv_lib_prot_getprpwnam" >&6; } +if test "x$ac_cv_lib_prot_getprpwnam" = xyes; then : + PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getprpwnam in -lsecurity" >&5 +$as_echo_n "checking for getprpwnam in -lsecurity... " >&6; } +if ${ac_cv_lib_security_getprpwnam+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lgen $LIBS" +LIBS="-lsecurity $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -11697,93 +11543,94 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char getspnam (); +char getprpwnam (); int main () { -return getspnam (); +return getprpwnam (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gen_getspnam=yes + ac_cv_lib_security_getprpwnam=yes else - ac_cv_lib_gen_getspnam=no + ac_cv_lib_security_getprpwnam=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gen_getspnam" >&5 -$as_echo "$ac_cv_lib_gen_getspnam" >&6; } -if test "x$ac_cv_lib_gen_getspnam" = xyes; then : - have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_security_getprpwnam" >&5 +$as_echo "$ac_cv_lib_security_getprpwnam" >&6; } +if test "x$ac_cv_lib_security_getprpwnam" = xyes; then : + PASSWD_LIBS="$PASSWD_LIBS -lsecurity" fi - fi - fi fi + fi +fi ############################################################################### # -# Check for other libraries needed for non-shadow passwords. +# Check for HP's entry in the "Not Invented Here" Sweepstakes. # ############################################################################### -if test "$enable_locking" = yes ; then - - # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc. - have_crypt=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lc" >&5 -$as_echo_n "checking for crypt in -lc... " >&6; } -if ${ac_cv_lib_c_crypt+:} false; then : +if test "$with_shadow" = yes ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HP-style shadow passwords" >&5 +$as_echo_n "checking for HP-style shadow passwords... " >&6; } +if ${ac_cv_hpux_passwd+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char crypt (); + 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` + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include + #include + #include + #include int main () { -return crypt (); +struct s_passwd *p = getspwnam("nobody"); + const char *pw = p->pw_passwd; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_crypt=yes +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_hpux_passwd=yes else - ac_cv_lib_c_crypt=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + ac_cv_hpux_passwd=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_crypt" >&5 -$as_echo "$ac_cv_lib_c_crypt" >&6; } -if test "x$ac_cv_lib_c_crypt" = xyes; then : - have_crypt=yes +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$ac_save_CPPFLAGS" fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_hpux_passwd" >&5 +$as_echo "$ac_cv_hpux_passwd" >&6; } + if test "$ac_cv_hpux_passwd" = yes; then + have_shadow_hpux=yes + have_shadow=yes + setuid_auth=yes - if test "$have_crypt" = no ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5 -$as_echo_n "checking for crypt in -lcrypt... " >&6; } -if ${ac_cv_lib_crypt_crypt+:} false; then : + # on HPUX, bigcrypt is in -lsec + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bigcrypt in -lsec" >&5 +$as_echo_n "checking for bigcrypt in -lsec... " >&6; } +if ${ac_cv_lib_sec_bigcrypt+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lcrypt $LIBS" +LIBS="-lsec $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -11793,422 +11640,420 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char crypt (); +char bigcrypt (); int main () { -return crypt (); +return bigcrypt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_crypt_crypt=yes + ac_cv_lib_sec_bigcrypt=yes else - ac_cv_lib_crypt_crypt=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5 -$as_echo "$ac_cv_lib_crypt_crypt" >&6; } -if test "x$ac_cv_lib_crypt_crypt" = xyes; then : - have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt" -fi - - fi + ac_cv_lib_sec_bigcrypt=no fi - - -# Most of the above shadow mechanisms will have set need_setuid to yes, -# if they were found. But, on some systems, we need setuid even when -# using plain old vanilla passwords. -# -if test "$enable_locking" = yes ; then - case "$host" in - *-hpux* | *-aix* | *-netbsd* | *-freebsd* | *-openbsd* ) - need_setuid=yes - ;; - esac +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi - - -if test "$have_shadow_adjunct" = yes ; then - $as_echo "#define HAVE_ADJUNCT_PASSWD 1" >>confdefs.h - -elif test "$have_shadow_enhanced" = yes ; then - $as_echo "#define HAVE_ENHANCED_PASSWD 1" >>confdefs.h - -elif test "$have_shadow_hpux" = yes ; then - $as_echo "#define HAVE_HPUX_PASSWD 1" >>confdefs.h - -elif test "$have_shadow" = yes ; then - $as_echo "#define HAVE_SHADOW_PASSWD 1" >>confdefs.h - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sec_bigcrypt" >&5 +$as_echo "$ac_cv_lib_sec_bigcrypt" >&6; } +if test "x$ac_cv_lib_sec_bigcrypt" = xyes; then : + PASSWD_LIBS="$PASSWD_LIBS -lsec" fi + fi +fi ############################################################################### # -# Check for external password helper -# On SuSE, instead of having xscreensaver be a setuid program, they -# fork an external program that takes the password on stdin, and -# returns true if that password is a valid one. Then only that -# smaller program needs to be setuid. +# Check for FreeBSD-style shadow passwords. # -# (Note that this external program is not a GUI: the GUI is still -# all in xscreensaver itself; the external program just does auth.) +# On FreeBSD, getpwnam() and friends work just like on non-shadow- +# password systems -- except you only get stuff in the pw_passwd field +# if the running program is setuid. So, guess that we've got this +# lossage to contend with if /etc/master.passwd exists, and default to +# a setuid installation. # ############################################################################### -have_passwd_helper=no -with_passwd_helper_req=unspecified - - -# Check whether --with-passwd-helper was given. -if test "${with_passwd_helper+set}" = set; then : - withval=$with_passwd_helper; with_passwd_helper="$withval"; with_passwd_helper_req="$withval" +if test "$with_shadow" = yes ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeBSD-style shadow passwords" >&5 +$as_echo_n "checking for FreeBSD-style shadow passwords... " >&6; } +if ${ac_cv_master_passwd+:} false; then : + $as_echo_n "(cached) " >&6 else - with_passwd_helper=no + if test -f /etc/master.passwd ; then + ac_cv_master_passwd=yes + else + ac_cv_master_passwd=no + fi fi - -# no HANDLE_X_PATH_ARG for this one - -if test "$enable_locking" = no ; then - with_passwd_helper_req=no - with_passwd_helper=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_master_passwd" >&5 +$as_echo "$ac_cv_master_passwd" >&6; } + if test "$ac_cv_master_passwd" = yes; then + setuid_auth=yes + fi fi -case "$with_passwd_helper" in - ""|no) : ;; - /*) - cat >>confdefs.h <<_ACEOF -#define PASSWD_HELPER_PROGRAM "$with_passwd_helper" -_ACEOF - - have_passwd_helper=yes;; - *) - echo "error: --with-passwd-helper needs full pathname of helper (not '$with_passwd_helper')." >&2 - exit 1 -esac - - ############################################################################### # -# Check for a login manager for a "New Login" button on the lock dialog. -# Usually this will be "/usr/bin/gdmflexiserver". +# Check for OpenBSD-style shadow passwords. +# It's getpwnam_shadow instead of getpwnam, and it only works as root. # ############################################################################### -with_login_manager_req=unspecified -default_login_manager_1='gdmflexiserver -ls' -default_login_manager_2='kdmctl reserve' -default_login_manager_3='lxdm -c USER_SWITCH' -default_login_manager_4='dm-tool switch-to-greeter' - +if test "$with_shadow" = yes ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenBSD-style shadow passwords" >&5 +$as_echo_n "checking for OpenBSD-style shadow passwords... " >&6; } +if ${ac_cv_pwnam_shadow+:} false; then : + $as_echo_n "(cached) " >&6 +else -# Check whether --with-login-manager was given. -if test "${with_login_manager+set}" = set; then : - withval=$with_login_manager; with_login_manager="$withval"; with_login_manager_req="$withval" + 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` + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include + #include +int +main () +{ +struct spwd *p = getspnam_shadow("nobody"); + const char *pw = p->pw_passwd; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_pwnam_shadow=yes else - with_login_manager=yes + ac_cv_pwnam_shadow=no fi - -# no HANDLE_X_PATH_ARG for this one - -if test "$enable_locking" = no ; then - with_login_manager_req=no - with_login_manager=no +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$ac_save_CPPFLAGS" fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_pwnam_shadow" >&5 +$as_echo "$ac_cv_pwnam_shadow" >&6; } + if test "$ac_cv_pwnam_shadow" = yes; then + have_pwnam_shadow=yes -case "$with_login_manager_req" in - no) - with_login_manager="" - ;; - - yes|unspecified) - # Try various defaults, use the first one that exists. + # If we also have PAM, assume that we don't need to be setuid. + if test $have_pam != yes; then + setuid_auth=yes + fi + fi +fi - with_login_manager="" +############################################################################### +# +# Check for traditional (ha!) shadow passwords. +# +############################################################################### - if test -z "$with_login_manager" ; then - set dummy $default_login_manager_1 ; login_manager_tmp=$2 - unset ac_cv_path_login_manager_tmp # don't cache - # Extract the first word of "$login_manager_tmp", so it can be a program name with args. -set dummy $login_manager_tmp; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_login_manager_tmp+:} false; then : +if test "$with_shadow" = yes ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for generic shadow passwords" >&5 +$as_echo_n "checking for generic shadow passwords... " >&6; } +if ${ac_cv_shadow+:} false; then : $as_echo_n "(cached) " >&6 else - case $login_manager_tmp in - [\\/]* | ?:[\\/]*) - ac_cv_path_login_manager_tmp="$login_manager_tmp" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - ;; -esac -fi -login_manager_tmp=$ac_cv_path_login_manager_tmp -if test -n "$login_manager_tmp"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5 -$as_echo "$login_manager_tmp" >&6; } + 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` + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include + #include + #include +int +main () +{ +struct spwd *p = getspnam("nobody"); + const char *pw = p->sp_pwdp; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_shadow=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + ac_cv_shadow=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$ac_save_CPPFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_shadow" >&5 +$as_echo "$ac_cv_shadow" >&6; } + if test "$ac_cv_shadow" = yes; then + have_shadow=yes - - if test ! -z "$login_manager_tmp" ; then - with_login_manager="$default_login_manager_1" - fi + # If we also have PAM, assume that we don't need to be setuid. + if test $have_pam != yes; then + setuid_auth=yes fi - if test -z "$with_login_manager" ; then - set dummy $default_login_manager_2 ; login_manager_tmp=$2 - unset ac_cv_path_login_manager_tmp # don't cache - # Extract the first word of "$login_manager_tmp", so it can be a program name with args. -set dummy $login_manager_tmp; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_login_manager_tmp+:} false; then : + # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc. + have_getspnam=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getspnam in -lc" >&5 +$as_echo_n "checking for getspnam in -lc... " >&6; } +if ${ac_cv_lib_c_getspnam+:} false; then : $as_echo_n "(cached) " >&6 else - case $login_manager_tmp in - [\\/]* | ?:[\\/]*) - ac_cv_path_login_manager_tmp="$login_manager_tmp" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - ;; -esac -fi -login_manager_tmp=$ac_cv_path_login_manager_tmp -if test -n "$login_manager_tmp"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5 -$as_echo "$login_manager_tmp" >&6; } +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char getspnam (); +int +main () +{ +return getspnam (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_getspnam=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + ac_cv_lib_c_getspnam=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_getspnam" >&5 +$as_echo "$ac_cv_lib_c_getspnam" >&6; } +if test "x$ac_cv_lib_c_getspnam" = xyes; then : + have_getspnam=yes fi - - if test ! -z "$login_manager_tmp" ; then - with_login_manager="$default_login_manager_2" - fi - fi - - if test -z "$with_login_manager" ; then - set dummy $default_login_manager_3 ; login_manager_tmp=$2 - unset ac_cv_path_login_manager_tmp # don't cache - # Extract the first word of "$login_manager_tmp", so it can be a program name with args. -set dummy $login_manager_tmp; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_login_manager_tmp+:} false; then : + if test "$have_getspnam" = no ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getspnam in -lgen" >&5 +$as_echo_n "checking for getspnam in -lgen... " >&6; } +if ${ac_cv_lib_gen_getspnam+:} false; then : $as_echo_n "(cached) " >&6 else - case $login_manager_tmp in - [\\/]* | ?:[\\/]*) - ac_cv_path_login_manager_tmp="$login_manager_tmp" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgen $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - ;; -esac -fi -login_manager_tmp=$ac_cv_path_login_manager_tmp -if test -n "$login_manager_tmp"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5 -$as_echo "$login_manager_tmp" >&6; } +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char getspnam (); +int +main () +{ +return getspnam (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gen_getspnam=yes else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + ac_cv_lib_gen_getspnam=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gen_getspnam" >&5 +$as_echo "$ac_cv_lib_gen_getspnam" >&6; } +if test "x$ac_cv_lib_gen_getspnam" = xyes; then : + have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen" fi - - if test ! -z "$login_manager_tmp" ; then - with_login_manager="$default_login_manager_3" - fi fi - - if test -z "$with_login_manager" ; then - set dummy $default_login_manager_4 ; login_manager_tmp=$2 - unset ac_cv_path_login_manager_tmp # don't cache - # Extract the first word of "$login_manager_tmp", so it can be a program name with args. -set dummy $login_manager_tmp; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_login_manager_tmp+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $login_manager_tmp in - [\\/]* | ?:[\\/]*) - ac_cv_path_login_manager_tmp="$login_manager_tmp" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -login_manager_tmp=$ac_cv_path_login_manager_tmp -if test -n "$login_manager_tmp"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5 -$as_echo "$login_manager_tmp" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } fi +############################################################################### +# +# Check for other libraries needed for non-shadow passwords. +# +############################################################################### - if test ! -z "$login_manager_tmp" ; then - with_login_manager="$default_login_manager_4" - fi - fi +if test "$enable_locking" = yes ; then - ;; + # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc. + have_crypt=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lc" >&5 +$as_echo_n "checking for crypt in -lc... " >&6; } +if ${ac_cv_lib_c_crypt+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - /*) - # absolute path specified on cmd line - set dummy $with_login_manager_req ; login_manager_tmp=$2 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $login_manager_tmp" >&5 -$as_echo_n "checking for $login_manager_tmp... " >&6; } - if test -x "$login_manager_tmp" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - with_login_manager="" - fi - ;; +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char crypt (); +int +main () +{ +return crypt (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_crypt=yes +else + ac_cv_lib_c_crypt=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_crypt" >&5 +$as_echo "$ac_cv_lib_c_crypt" >&6; } +if test "x$ac_cv_lib_c_crypt" = xyes; then : + have_crypt=yes +fi - *) - # relative path specified on cmd line - set dummy $with_login_manager_req ; login_manager_tmp=$2 - unset ac_cv_path_login_manager_tmp # don't cache - # Extract the first word of "$login_manager_tmp", so it can be a program name with args. -set dummy $login_manager_tmp; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_login_manager_tmp+:} false; then : + if test "$have_crypt" = no ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5 +$as_echo_n "checking for crypt in -lcrypt... " >&6; } +if ${ac_cv_lib_crypt_crypt+:} false; then : $as_echo_n "(cached) " >&6 else - case $login_manager_tmp in - [\\/]* | ?:[\\/]*) - ac_cv_path_login_manager_tmp="$login_manager_tmp" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcrypt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - ;; -esac +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char crypt (); +int +main () +{ +return crypt (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_crypt_crypt=yes +else + ac_cv_lib_crypt_crypt=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5 +$as_echo "$ac_cv_lib_crypt_crypt" >&6; } +if test "x$ac_cv_lib_crypt_crypt" = xyes; then : + have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt" +fi + + fi fi -login_manager_tmp=$ac_cv_path_login_manager_tmp -if test -n "$login_manager_tmp"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5 -$as_echo "$login_manager_tmp" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + +############################################################################### +# +# Strongly suspect that this hasn't been used in years. Also, the same +# goal is achieved by xscreensaver-auth in XScreenSaver 6. -- jwz, 2021 +# +# Check for external password helper +# On SuSE in 1993, instead of having xscreensaver be a setuid program, +# they fork an external program that takes the password on stdin, and +# returns true if that password is a valid one. Then only that smaller +# program needs to be setuid. +# +# (Note that this external program is not a GUI: the GUI is still +# all in xscreensaver itself; the external program just does auth.) +# +############################################################################### + +#have_passwd_helper=no +#with_passwd_helper_req=unspecified +# +#AC_ARG_WITH(passwd-helper, +#[ --with-passwd-helper Include support for external password verification.], +# [with_passwd_helper="$withval"; with_passwd_helper_req="$withval"],[with_passwd_helper=no]) +## no HANDLE_X_PATH_ARG for this one +# +#if test "$enable_locking" = no ; then +# with_passwd_helper_req=no +# with_passwd_helper=no +#fi +# +#case "$with_passwd_helper" in +# ""|no) : ;; +# /*) +# AC_DEFINE_UNQUOTED(PASSWD_HELPER_PROGRAM, "$with_passwd_helper") +# have_passwd_helper=yes;; +# *) +# echo "error: --with-passwd-helper needs full pathname of helper (not '$with_passwd_helper')." >&2 +# exit 1 +#esac + +# Most of the above shadow mechanisms will have set setuid_auth to yes, +# if they were found. But, on some systems, we need setuid even when +# using plain old vanilla passwords. +# +if test "$enable_locking" = yes -a "$have_pam" = no ; then + case "$host" in + *-hpux* | *-aix* | *-netbsd* | *-freebsd* ) + setuid_auth=yes + ;; + esac fi +if test "$have_shadow_adjunct" = yes ; then + $as_echo "#define HAVE_ADJUNCT_PASSWD 1" >>confdefs.h + +elif test "$have_shadow_enhanced" = yes ; then + $as_echo "#define HAVE_ENHANCED_PASSWD 1" >>confdefs.h - if test -z "$login_manager_tmp" ; then - with_login_manager="" - else - with_login_manager="$login_manager_tmp" - fi - ;; -esac -ac_cv_login_manager_program="$with_login_manager" +elif test "$have_shadow_hpux" = yes ; then + $as_echo "#define HAVE_HPUX_PASSWD 1" >>confdefs.h -NEW_LOGIN_COMMAND_P='' -NEW_LOGIN_COMMAND="$ac_cv_login_manager_program" +elif test "$have_shadow" = yes ; then + $as_echo "#define HAVE_SHADOW_PASSWD 1" >>confdefs.h -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for login manager" >&5 -$as_echo_n "checking for login manager... " >&6; } -if test -z "$NEW_LOGIN_COMMAND" ; then - NEW_LOGIN_COMMAND="$default_login_manager_1" - NEW_LOGIN_COMMAND_P='! ' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NEW_LOGIN_COMMAND (disabled)" >&5 -$as_echo "$NEW_LOGIN_COMMAND (disabled)" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NEW_LOGIN_COMMAND" >&5 -$as_echo "$NEW_LOGIN_COMMAND" >&6; } -fi +elif test "$have_pwnam_shadow" = yes ; then + $as_echo "#define HAVE_PWNAM_SHADOW_PASSWD 1" >>confdefs.h +fi ############################################################################### # @@ -12216,6 +12061,8 @@ fi # ############################################################################### +#### H1 + have_gtk=no with_gtk_req=unspecified @@ -12226,7 +12073,6 @@ else with_gtk=yes fi - # if --with-gtk=/directory/ was specified, remember that directory so that # we can also look for the `gtk-config' program in that directory. case "$with_gtk" in @@ -12238,7 +12084,6 @@ case "$with_gtk" in ;; esac - case "$with_gtk" in yes) ;; no) ;; @@ -12282,151 +12127,31 @@ $as_echo "not found ($d: no such directory)" >&6; } ;; esac - if test "$with_gtk" != yes -a "$with_gtk" != no ; then echo "error: must be yes or no: --with-gtk=$with_gtk" exit 1 fi - -parse_gtk_version_string() { - # M4 sucks!! - - maj=`echo $ac_gtk_version_string | sed -n 's/\..*//p'` - min=`echo $ac_gtk_version_string | sed -n 's/[^.]*\.\([^.]*\).*/\1/p'` - - ac_gtk_version=`echo "$maj * 1000 + $min" | bc` - if test -z "$ac_gtk_version"; then - ac_gtk_version=unknown - ac_gtk_version_string=unknown - fi -} - -# Find pkg-config... (need this for both gtk and gdk_pixbuf.) -# if the user specified --with-gtk=/foo/ then look there. -# -gtk_path="$PATH" -if test ! -z "$gtk_dir"; then - # canonicalize slashes. - foo=`echo "${gtk_dir}/bin" | sed 's@//*@/@g'` - gtk_path="$foo:$gtk_path" -fi - -for ac_prog in pkg-config -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_pkg_config+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $pkg_config in - [\\/]* | ?:[\\/]*) - ac_cv_path_pkg_config="$pkg_config" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $gtk_path -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_pkg_config="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -pkg_config=$ac_cv_path_pkg_config -if test -n "$pkg_config"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pkg_config" >&5 -$as_echo "$pkg_config" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$pkg_config" && break -done - - -if test -z "$pkg_config" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config not found!" >&5 -$as_echo "$as_me: WARNING: pkg-config not found!" >&2;} - pkg_config="false" -fi - - -# Utility function for running pkg-config-based tests... -# -pkgs='' -pkg_check_version() { - if test "$ok" = yes ; then - req="$1" - min="$2" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $req" >&5 -$as_echo_n "checking for $req... " >&6; } - if $pkg_config --exists "$req" ; then - vers=`$pkg_config --modversion "$req"` - if $pkg_config --exists "$req >= $min" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vers" >&5 -$as_echo "$vers" >&6; } - pkgs="$pkgs $req" - return 1 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vers (wanted >= $min)" >&5 -$as_echo "$vers (wanted >= $min)" >&6; } - ok=no - return 0 - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ok=no - return 0 - fi - fi -} - - -jurassic_gtk=no gtk_halfassed=no -have_gtk_2_22_or_higher=no -COMMENT_DEMO_GLADE2_GTK_2_22_HEAD="" -COMMENT_DEMO_GLADE2_GTK_2_22_TAIL="" if test "$with_gtk" = yes; then have_gtk=no ok="yes" - pkg_check_version gtk+-2.0 2.0.1 ; ac_gtk_version_string="$vers" + pkg_check_version gtk+-2.0 2.22.0 ; ac_gtk_version_string="$vers" pkg_check_version gmodule-2.0 2.0.0 pkg_check_version libxml-2.0 2.4.6 - pkg_check_version libglade-2.0 1.99.0 pkg_check_version gdk-pixbuf-2.0 2.0.0 pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0 have_gtk="$ok" if test "$have_gtk" = no; then if test -n "$ac_gtk_version_string" ; then - gtk_halfassed="$ac_gtk_version_string" + gtk_halfassed=yes gtk_halfassed_lib="$req" fi fi - if test "$have_gtk" = yes; then - parse_gtk_version_string - jurassic_gtk=no - fi - if test "$have_gtk" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gtk includes" >&5 $as_echo_n "checking for Gtk includes... " >&6; } @@ -12451,7 +12176,6 @@ $as_echo "$ac_cv_gtk_config_libs" >&6; } ac_gtk_config_cflags=$ac_cv_gtk_config_cflags ac_gtk_config_libs=$ac_cv_gtk_config_libs - GTK_EXTRA_OBJS="" GTK_DATADIR="" if test "$have_gtk" = yes; then GTK_DATADIR=`$pkg_config --variable=prefix gtk+-2.0` @@ -12468,19 +12192,8 @@ $as_echo "$ac_cv_gtk_config_libs" >&6; } $as_echo "#define HAVE_XML 1" >>confdefs.h fi - - if test "$have_gtk" = yes; then - ok="yes" - pkg_check_version gtk+-2.0 2.22 - have_gtk_2_22_or_higher="$ok" - if test "$have_gtk_2_22_or_higher" = yes; then - COMMENT_DEMO_GLADE2_GTK_2_22_HEAD="" - fi - fi fi - # Check for the various Gnome help and URL loading programs. # WITH_BROWSER=gnome-open @@ -12523,7 +12236,6 @@ else $as_echo "no" >&6; } fi - test -n "$gnome_open_program" && break done @@ -12565,13 +12277,11 @@ else $as_echo "no" >&6; } fi - test -n "$gnome_url_show_program" && break done fi - ############################################################################### # # Check for -lXm. @@ -12588,8 +12298,6 @@ else with_motif=no fi - - case "$with_motif" in yes) ;; no) ;; @@ -12633,7 +12341,6 @@ $as_echo "not found ($d: no such directory)" >&6; } ;; esac - if test "$with_motif" != yes -a "$with_motif" != no ; then echo "error: must be yes or no: --with-motif=$with_motif" exit 1 @@ -12659,11 +12366,9 @@ if test "x$ac_cv_header_Xm_Xm_h" = xyes; then : MOTIF_LIBS="$MOTIF_LIBS -lXm" fi - CPPFLAGS="$ac_save_CPPFLAGS" fi - if test "$have_motif" = yes; then ac_save_CPPFLAGS="$CPPFLAGS" @@ -12681,11 +12386,9 @@ if test "x$ac_cv_header_Xm_ComboBox_h" = xyes; then : fi - CPPFLAGS="$ac_save_CPPFLAGS" fi - ############################################################################### # # Checking whether Motif is really Lesstif. @@ -12730,7 +12433,6 @@ $as_echo "$ac_cv_have_lesstif" >&6; } have_lesstif=$ac_cv_have_lesstif fi - lesstif_version=unknown lesstif_version_string=unknown @@ -12788,7 +12490,6 @@ $as_echo "$ac_cv_lesstif_version_string" >&6; } fi - if test "$have_motif" = yes ; then mtv=unknown echo unknown > conftest-mt @@ -12834,29 +12535,103 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi CPPFLAGS="$ac_save_CPPFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_motif_version_string" >&5 -$as_echo "$ac_cv_motif_version_string" >&6; } - rm -rf conftest-mt - motif_version=$ac_cv_motif_version - motif_version_string=$ac_cv_motif_version_string +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_motif_version_string" >&5 +$as_echo "$ac_cv_motif_version_string" >&6; } + rm -rf conftest-mt + motif_version=$ac_cv_motif_version + motif_version_string=$ac_cv_motif_version_string + +fi + +############################################################################### +# +# Checking whether Motif requires -lXp. +# +# Some versions of Motif (2.1.0, at least) require -lXp, the "X Printing +# Extension". Why this extension isn't in -lXext with all the others, +# I have no idea. +# +############################################################################### + +have_xp_ext=no +if test "$have_motif" = yes ; then + have_xp_ext=no + + 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` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpQueryExtension in -lXp" >&5 +$as_echo_n "checking for XpQueryExtension in -lXp... " >&6; } +if ${ac_cv_lib_Xp_XpQueryExtension+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXp -lX11 -lXext -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char XpQueryExtension (); +int +main () +{ +return XpQueryExtension (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_Xp_XpQueryExtension=yes +else + ac_cv_lib_Xp_XpQueryExtension=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xp_XpQueryExtension" >&5 +$as_echo "$ac_cv_lib_Xp_XpQueryExtension" >&6; } +if test "x$ac_cv_lib_Xp_XpQueryExtension" = xyes; then : + have_xp_ext=yes; MOTIF_LIBS="$MOTIF_LIBS -lXp" +else + true +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" fi - ############################################################################### # -# Checking whether Motif requires -lXp. -# -# Some versions of Motif (2.1.0, at least) require -lXp, the "X Printing -# Extension". Why this extension isn't in -lXext with all the others, -# I have no idea. +# Checking whether Motif requires -lXintl (for _Xsetlocale.) # ############################################################################### -have_xp_ext=no +have_xintl=no if test "$have_motif" = yes ; then - have_xp_ext=no ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -12876,13 +12651,13 @@ if test "$have_motif" = yes ; then CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpQueryExtension in -lXp" >&5 -$as_echo_n "checking for XpQueryExtension in -lXp... " >&6; } -if ${ac_cv_lib_Xp_XpQueryExtension+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Xsetlocale in -lXintl" >&5 +$as_echo_n "checking for _Xsetlocale in -lXintl... " >&6; } +if ${ac_cv_lib_Xintl__Xsetlocale+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXp -lX11 -lXext -lm $LIBS" +LIBS="-lXintl -lX11 -lXext -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -12892,454 +12667,767 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char XpQueryExtension (); +char _Xsetlocale (); int main () { -return XpQueryExtension (); +return _Xsetlocale (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Xp_XpQueryExtension=yes + ac_cv_lib_Xintl__Xsetlocale=yes else - ac_cv_lib_Xp_XpQueryExtension=no + ac_cv_lib_Xintl__Xsetlocale=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xp_XpQueryExtension" >&5 -$as_echo "$ac_cv_lib_Xp_XpQueryExtension" >&6; } -if test "x$ac_cv_lib_Xp_XpQueryExtension" = xyes; then : - have_xp_ext=yes; MOTIF_LIBS="$MOTIF_LIBS -lXp" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xintl__Xsetlocale" >&5 +$as_echo "$ac_cv_lib_Xintl__Xsetlocale" >&6; } +if test "x$ac_cv_lib_Xintl__Xsetlocale" = xyes; then : + have_xintl=yes else - true + have_xintl=no fi CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" + if test "$have_xintl" = yes; then + MOTIF_LIBS="$MOTIF_LIBS -lXintl" + fi fi - ############################################################################### # -# Checking whether Motif requires -lXintl (for _Xsetlocale.) +# Check for a login manager for a "New Login" button on the lock dialog. +# Usually this will be "/usr/bin/gdmflexiserver". # ############################################################################### -have_xintl=no -if test "$have_motif" = yes ; then +with_login_manager_req=unspecified +default_login_manager_1='gdmflexiserver -ls' +default_login_manager_2='kdmctl reserve' +default_login_manager_3='lxdm -c USER_SWITCH' +default_login_manager_4='dm-tool switch-to-greeter' - ac_save_CPPFLAGS="$CPPFLAGS" - ac_save_LDFLAGS="$LDFLAGS" -# ac_save_LIBS="$LIBS" +# Check whether --with-login-manager was given. +if test "${with_login_manager+set}" = set; then : + withval=$with_login_manager; with_login_manager="$withval"; with_login_manager_req="$withval" +else + with_login_manager=yes +fi - if test \! -z "$includedir" ; then - CPPFLAGS="$CPPFLAGS -I$includedir" +# no HANDLE_X_PATH_ARG for this one + +if test "$enable_locking" = no ; then + with_login_manager_req=no + with_login_manager=no +fi + +case "$with_login_manager_req" in + no) + with_login_manager="" + ;; + + yes|unspecified) + # Try various defaults, use the first one that exists. + + with_login_manager="" + + if test -z "$with_login_manager" ; then + set dummy $default_login_manager_1 ; login_manager_tmp=$2 + unset ac_cv_path_login_manager_tmp # don't cache + # Extract the first word of "$login_manager_tmp", so it can be a program name with args. +set dummy $login_manager_tmp; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_login_manager_tmp+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $login_manager_tmp in + [\\/]* | ?:[\\/]*) + ac_cv_path_login_manager_tmp="$login_manager_tmp" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi - # note: $X_CFLAGS includes $x_includes - CPPFLAGS="$CPPFLAGS $X_CFLAGS" +done + done +IFS=$as_save_IFS - if test \! -z "$libdir" ; then - LDFLAGS="$LDFLAGS -L$libdir" + ;; +esac +fi +login_manager_tmp=$ac_cv_path_login_manager_tmp +if test -n "$login_manager_tmp"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5 +$as_echo "$login_manager_tmp" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test ! -z "$login_manager_tmp" ; then + with_login_manager="$default_login_manager_1" + fi + fi + + if test -z "$with_login_manager" ; then + set dummy $default_login_manager_2 ; login_manager_tmp=$2 + unset ac_cv_path_login_manager_tmp # don't cache + # Extract the first word of "$login_manager_tmp", so it can be a program name with args. +set dummy $login_manager_tmp; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_login_manager_tmp+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $login_manager_tmp in + [\\/]* | ?:[\\/]*) + ac_cv_path_login_manager_tmp="$login_manager_tmp" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +login_manager_tmp=$ac_cv_path_login_manager_tmp +if test -n "$login_manager_tmp"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5 +$as_echo "$login_manager_tmp" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test ! -z "$login_manager_tmp" ; then + with_login_manager="$default_login_manager_2" + fi + fi + + if test -z "$with_login_manager" ; then + set dummy $default_login_manager_3 ; login_manager_tmp=$2 + unset ac_cv_path_login_manager_tmp # don't cache + # Extract the first word of "$login_manager_tmp", so it can be a program name with args. +set dummy $login_manager_tmp; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_login_manager_tmp+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $login_manager_tmp in + [\\/]* | ?:[\\/]*) + ac_cv_path_login_manager_tmp="$login_manager_tmp" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +login_manager_tmp=$ac_cv_path_login_manager_tmp +if test -n "$login_manager_tmp"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5 +$as_echo "$login_manager_tmp" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test ! -z "$login_manager_tmp" ; then + with_login_manager="$default_login_manager_3" + fi + fi + + if test -z "$with_login_manager" ; then + set dummy $default_login_manager_4 ; login_manager_tmp=$2 + unset ac_cv_path_login_manager_tmp # don't cache + # Extract the first word of "$login_manager_tmp", so it can be a program name with args. +set dummy $login_manager_tmp; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_login_manager_tmp+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $login_manager_tmp in + [\\/]* | ?:[\\/]*) + ac_cv_path_login_manager_tmp="$login_manager_tmp" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 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` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Xsetlocale in -lXintl" >&5 -$as_echo_n "checking for _Xsetlocale in -lXintl... " >&6; } -if ${ac_cv_lib_Xintl__Xsetlocale+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lXintl -lX11 -lXext -lm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +done + done +IFS=$as_save_IFS -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char _Xsetlocale (); -int -main () -{ -return _Xsetlocale (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_Xintl__Xsetlocale=yes -else - ac_cv_lib_Xintl__Xsetlocale=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + ;; +esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xintl__Xsetlocale" >&5 -$as_echo "$ac_cv_lib_Xintl__Xsetlocale" >&6; } -if test "x$ac_cv_lib_Xintl__Xsetlocale" = xyes; then : - have_xintl=yes +login_manager_tmp=$ac_cv_path_login_manager_tmp +if test -n "$login_manager_tmp"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5 +$as_echo "$login_manager_tmp" >&6; } else - have_xintl=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" -# LIBS="$ac_save_LIBS" + if test ! -z "$login_manager_tmp" ; then + with_login_manager="$default_login_manager_4" + fi + fi - if test "$have_xintl" = yes; then - MOTIF_LIBS="$MOTIF_LIBS -lXintl" - fi -fi + ;; + + *) + # Just believe whatever command was specified. + with_login_manager="$with_login_manager_req" + ;; +esac +ac_cv_login_manager_program="$with_login_manager" + +NEW_LOGIN_COMMAND_P='' +NEW_LOGIN_COMMAND="$ac_cv_login_manager_program" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for login manager" >&5 +$as_echo_n "checking for login manager... " >&6; } +if test -z "$NEW_LOGIN_COMMAND" ; then + NEW_LOGIN_COMMAND="$default_login_manager_1" + NEW_LOGIN_COMMAND_P='! ' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NEW_LOGIN_COMMAND (disabled)" >&5 +$as_echo "$NEW_LOGIN_COMMAND (disabled)" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NEW_LOGIN_COMMAND" >&5 +$as_echo "$NEW_LOGIN_COMMAND" >&6; } +fi ############################################################################### # -# Check for -lGL or -lMesaGL. +# Check for a directory full of images to use as the default value +# of the "imageDirectory" preference. # ############################################################################### -have_gl=no -ac_have_mesa_gl=no -with_gl_req=unspecified -gl_halfassed=no +have_imagedir=no +with_imagedir_req=unspecified -# Check whether --with-gl was given. -if test "${with_gl+set}" = set; then : - withval=$with_gl; with_gl="$withval"; with_gl_req="$withval" +# Check whether --with-image-directory was given. +if test "${with_image_directory+set}" = set; then : + withval=$with_image_directory; with_imagedir="$withval"; with_imagedir_req="$withval" else - with_gl=yes + with_imagedir=yes fi +# no HANDLE_X_PATH_ARG for this one +case "$with_imagedir" in + /*) + # absolute path + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for image directory $with_imagedir" >&5 +$as_echo_n "checking for image directory $with_imagedir... " >&6; } + if test -d "$with_imagedir" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + with_imagedir="" + fi + ;; + yes) + with_imagedir="" - case "$with_gl" in - yes) ;; - no) ;; - - /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GL headers" >&5 -$as_echo_n "checking for GL headers... " >&6; } - d=$with_gl/include - if test -d $d; then - X_CFLAGS="-I$d $X_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 -$as_echo "$d" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 -$as_echo "not found ($d: no such directory)" >&6; } - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GL libs" >&5 -$as_echo_n "checking for GL libs... " >&6; } - d=$with_gl/lib - if test -d $d; then - X_LIBS="-L$d $X_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 -$as_echo "$d" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 -$as_echo "not found ($d: no such directory)" >&6; } - fi - - # replace the directory string with "yes". - with_gl_req="yes" - with_gl=$with_gl_req - ;; - - *) - echo "" - echo "error: argument to --with-gl must be \"yes\", \"no\", or a directory." - echo " If it is a directory, then \`DIR/include' will be added to" - echo " the -I list, and \`DIR/lib' will be added to the -L list." - exit 1 - ;; - esac - - -ac_mesagl_version=unknown -ac_mesagl_version_string=unknown - -if test "$with_gl" = yes; then - - 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_fn_c_check_header_mongrel "$LINENO" "GL/gl.h" "ac_cv_header_GL_gl_h" "$ac_includes_default" -if test "x$ac_cv_header_GL_gl_h" = xyes; then : - have_gl=yes -else - have_gl=no -fi + fallback_imgdir="" + for dd in \ + "/usr/share/rpd-wallpaper/" \ + "/usr/share/backgrounds/images/" \ + "/usr/share/wallpapers/" \ + "/usr/share/backgrounds/" \ + "/usr/share/pixmaps/backgrounds/" \ + "/usr/share/lxde/wallpapers/" \ + "/Library/Desktop Pictures/" \ + ; do + if test -z "$with_imagedir"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for image directory $dd" >&5 +$as_echo_n "checking for image directory $dd... " >&6; } + if test -d "$dd"; then + if ( ls "$dd" | grep -q ... ) >&- 2>&- ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + with_imagedir="$dd" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: empty" >&5 +$as_echo "empty" >&6; } + if test -z "$fallback_imgdir"; then + fallback_imgdir="$dd" + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + done + if test -z "$with_imagedir"; then + with_imagedir="$fallback_imgdir" + fi +;; + no) + with_imagedir="" + ;; + *) + echo "error: must be an absolute path: --with-image-directory=$with_imagedir_req" + exit 1 + ;; +esac +ac_cv_imagedir="$with_imagedir" - CPPFLAGS="$ac_save_CPPFLAGS" - if test "$have_gl" = yes ; then +DEFAULT_IMAGES_P='True' +DEFAULT_IMAGE_DIRECTORY="$ac_cv_imagedir" - 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_fn_c_check_header_compile "$LINENO" "GL/glx.h" "ac_cv_header_GL_glx_h" "#include -" -if test "x$ac_cv_header_GL_glx_h" = xyes; then : - have_gl=yes -else - have_gl=no +if test -z "$DEFAULT_IMAGE_DIRECTORY" ; then + DEFAULT_IMAGES_P='False' fi +############################################################################### +# +# Pick a text file to use as the default of the "textFile" preference. +# Any old file will do, but preferably one that will make interesting +# shapes when displayed by "starwars" and "fontglide". +# +############################################################################### - CPPFLAGS="$ac_save_CPPFLAGS" - fi - - # If we have the headers, try and figure out which vendor it's from. - # - if test "$have_gl" = yes ; then +have_textfile=no +with_textfile_req=unspecified - # We need to know whether it's MesaGL so that we know which libraries - # to link against. - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GL is really MesaGL" >&5 -$as_echo_n "checking whether GL is really MesaGL... " >&6; } -if ${ac_cv_have_mesa_gl+:} false; then : - $as_echo_n "(cached) " >&6 +# Check whether --with-text-file was given. +if test "${with_text_file+set}" = set; then : + withval=$with_text_file; with_textfile="$withval"; with_textfile_req="$withval" else - ac_cv_have_mesa_gl=no - if test "$ac_macosx" = no; then - # WTF! MacOS 10.5.0 ships the Mesa GL headers! - # It's not really Mesa, is it? - - 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` - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Mesa|MESA" >/dev/null 2>&1; then : - ac_cv_have_mesa_gl=yes + with_textfile=yes fi -rm -rf conftest* - CPPFLAGS="$ac_save_CPPFLAGS" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_mesa_gl" >&5 -$as_echo "$ac_cv_have_mesa_gl" >&6; } - ac_have_mesa_gl=$ac_cv_have_mesa_gl +# no HANDLE_X_PATH_ARG for this one - gl_lib_1="" - GL_LIBS="" +case "$with_textfile" in + /*) + # absolute path + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for text file $with_textfile" >&5 +$as_echo_n "checking for text file $with_textfile... " >&6; } + if test -f "$with_textfile" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + with_textfile="" + fi + ;; + yes) + with_textfile="" - if test "$ac_macosx" = yes; then + #### Could use some more defaults here... + for f in \ + "/usr/X11R6/lib/X11/doc/README" \ + "/usr/share/doc/xserver-common/copyright" \ + "/usr/share/doc/xserver-xorg-core/copyright" \ + "/usr/X11R6/README" \ + "/usr/share/doc/libX11*/COPYING" \ + "/usr/X11/share/X11/doc/README*" \ + "/usr/share/doc/debian/debian-manifesto" \ + ; do + if test -z "$with_textfile"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for text file $f" >&5 +$as_echo_n "checking for text file $f... " >&6; } + f=`/bin/ls $f 2>&- | head -1` + if test -f "$f" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + with_textfile="$f" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + fi + done - # Without these, every link against libGL gets a bunch of useless - # warnings. - # - osx_crud="-bind_at_load -multiply_defined suppress" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: adding \"$osx_crud\" to GL_LIBS" >&5 -$as_echo "adding \"$osx_crud\" to GL_LIBS" >&6; } - GL_LIBS="$GL_LIBS $osx_crud" - unset osx_crud - - # New lossage in 10.5.0: without this, we get: - # ld: cycle in dylib re-exports with /usr/X11/lib/libGL.dylib - # - osx_crud="/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib" - osx_crud="-Wl,-dylib_file,${osx_crud}:${osx_crud}" - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: adding \"$osx_crud\" to GL_LIBS" >&5 -$as_echo "adding \"$osx_crud\" to GL_LIBS" >&6; } - GL_LIBS="$GL_LIBS $osx_crud" - unset osx_crud - - # New lossage in 10.6.8: we can't allow -L/opt/local/lib to be in the - # link line, or at runtime XQueryExtension gets a segv due to some kind - # of library version skew. Libs must come from /usr/X11/lib even if - # $prefix and/or $exec_prefix are set to /opt/local/. - # - { $as_echo "$as_me:${as_lineno-$LINENO}: result: omitting \"$libdir\" from LDFLAGS" >&5 -$as_echo "omitting \"$libdir\" from LDFLAGS" >&6; } - libdir='' + ;; + no) + with_textfile="" + ;; - # Looks like as of OSX 10.12, gcc can't do ObjC. - OBJCC="clang -Wall" + *) + echo "error: must be an absolute path: --with-text-file=$with_textfile_req" + exit 1 + ;; +esac +ac_cv_textfile="$with_textfile" - fi +DEFAULT_TEXT_FILE="$ac_cv_textfile" +############################################################################### +# +# Check the browser to see help URL +# +############################################################################### - # Some versions of MesaGL are compiled to require -lpthread. - # So if the Mesa headers exist, and -lpthread exists, then always - # link -lpthread after the Mesa libs (be they named -lGL or -lMesaGL.) - # - # Oftentimes, AX_PTHREAD will bring in -lpthread as well; but that ends - # up before -l(Mesa)GL, instead of after where it would belong. - # - if test "$ac_have_mesa_gl" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 -$as_echo_n "checking for pthread_create in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_create+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +have_browser=no +with_browser_req=unspecified -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_create (); -int -main () -{ -return pthread_create (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_create=yes +# Check whether --with-browser was given. +if test "${with_browser+set}" = set; then : + withval=$with_browser; with_browser="$withval"; with_browser_req="$withval" else - ac_cv_lib_pthread_pthread_create=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : - GL_LIBS="-lpthread" + with_browser=no fi - fi +# no HANDLE_X_PATH_ARG for this one +case "$with_browser" in + no ) + ;; + * ) + WITH_BROWSER=$with_browser + gnome_open_program=$with_browser + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for browser $with_browser" >&5 +$as_echo_n "checking for browser $with_browser... " >&6; } + with_browser_fullpath=`which $with_browser 2>/dev/null` + case $with_browser_fullpath in + /* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_browser=yes + ;; + * ) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +# Only warning: we don't want to install all packages for the +# dependency of the browser in building stage... + echo "WARNING: browser not found: --with-browser=$with_browser" + ;; + esac + ;; +esac +ac_cv_browser="$with_browser" - # If we have Mesa headers, check to see if we can link against -lMesaGL. - # If we don't have Mesa headers, or we don't have -lMesaGL, try -lGL. - # Else, warn that GL is busted. (We have the headers, but no libs.) - # +############################################################################### +# +# Check for pthreads. Must come before checking for OpenGL, +# since some versions of OpenGL require it. +# +############################################################################### - if test "$ac_have_mesa_gl" = yes ; then +have_pthread=no +with_pthread_req=unspecified - ac_save_CPPFLAGS="$CPPFLAGS" - ac_save_LDFLAGS="$LDFLAGS" -# ac_save_LIBS="$LIBS" +# AX_PTHREAD is from the GNU Autoconf Archive. +# https://savannah.gnu.org/projects/autoconf-archive/ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_pthread.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro figures out how to build C programs using POSIX threads. It +# sets the PTHREAD_LIBS output variable to the threads library and linker +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler +# flags that are needed. (The user can also force certain compiler +# flags/libs to be tested by setting these environment variables.) +# +# Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is +# needed for multi-threaded programs (defaults to the value of CC +# respectively CXX otherwise). (This is necessary on e.g. AIX to use the +# special cc_r/CC_r compiler alias.) +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also to link with them as well. For example, you might link with +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# +# If you are only building threaded programs, you may wish to use these +# variables in your default LIBS, CFLAGS, and CC: +# +# LIBS="$PTHREAD_LIBS $LIBS" +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" +# CC="$PTHREAD_CC" +# CXX="$PTHREAD_CXX" +# +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant +# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to +# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# +# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the +# PTHREAD_PRIO_INHERIT symbol is defined when compiling with +# PTHREAD_CFLAGS. +# +# ACTION-IF-FOUND is a list of shell commands to run if a threads library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_PTHREAD. +# +# Please let the authors know if this macro fails on any platform, or if +# you have any other suggestions or comments. This macro was based on work +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by +# Alejandro Forero Cuervo to the autoconf macro repository. We are also +# grateful for the helpful feedback of numerous users. +# +# Updated for Autoconf 2.68 by Daniel Richard G. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2011 Daniel Richard G. +# Copyright (c) 2019 Marc Stevens +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. - if test \! -z "$includedir" ; then - CPPFLAGS="$CPPFLAGS -I$includedir" - fi - # note: $X_CFLAGS includes $x_includes - CPPFLAGS="$CPPFLAGS $X_CFLAGS" +#serial 30 - if test \! -z "$libdir" ; then - LDFLAGS="$LDFLAGS -L$libdir" - fi - # note: $X_LIBS includes $x_libraries - LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" +# This is what autoupdate's m4 run will expand. It fires +# the warning (with _au_warn_XXX), outputs it into the +# updated configure.ac (with AC_DIAGNOSE), and then outputs +# the replacement expansion. - CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glXCreateContext in -lMesaGL" >&5 -$as_echo_n "checking for glXCreateContext in -lMesaGL... " >&6; } -if ${ac_cv_lib_MesaGL_glXCreateContext+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lMesaGL -lMesaGLU $GL_LIBS -lX11 -lXext $VIDMODE_LIBS -lm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +# This is an auxiliary macro that is also run when +# autoupdate runs m4. It simply calls m4_warning, but +# we need a wrapper so that each warning is emitted only +# once. We break the quoting in m4_warning's argument in +# order to expand this macro's arguments, not AU_DEFUN's. -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char glXCreateContext (); -int -main () -{ -return glXCreateContext (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_MesaGL_glXCreateContext=yes -else - ac_cv_lib_MesaGL_glXCreateContext=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_MesaGL_glXCreateContext" >&5 -$as_echo "$ac_cv_lib_MesaGL_glXCreateContext" >&6; } -if test "x$ac_cv_lib_MesaGL_glXCreateContext" = xyes; then : - gl_lib_1="MesaGL" - GL_LIBS="-lMesaGL -lMesaGLU $VIDMODE_LIBS $GL_LIBS" +# Finally, this is the expansion that is picked up by +# autoconf. It tells the user to run autoupdate, and +# then outputs the replacement expansion. We do not care +# about autoupdate's warning because that contains +# information on what to do *after* running autoupdate. + +# Check whether --with-pthread was given. +if test "${with_pthread+set}" = set; then : + withval=$with_pthread; # This is documented after --with-gl in --with-xft. + with_pthread="$withval"; with_pthread_req="$withval" +else + with_pthread=yes fi - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" -# LIBS="$ac_save_LIBS" +if test "$with_pthread" = yes; then + # AX_PTHREAD might want a different compiler. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +$as_echo_n "checking target system type... " >&6; } +if ${ac_cv_target+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +$as_echo "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -rf conftest.in conftest.tmp conftest.nl conftest.out;; +esac - if test "$gl_lib_1" = "" ; then + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi - ac_save_CPPFLAGS="$CPPFLAGS" - ac_save_LDFLAGS="$LDFLAGS" -# ac_save_LIBS="$LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -rf conftest.sed - if test \! -z "$includedir" ; then - CPPFLAGS="$CPPFLAGS -I$includedir" - fi - # note: $X_CFLAGS includes $x_includes - CPPFLAGS="$CPPFLAGS $X_CFLAGS" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu - if test \! -z "$libdir" ; then - LDFLAGS="$LDFLAGS -L$libdir" - fi - # note: $X_LIBS includes $x_libraries - LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" +ax_pthread_ok=no - CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glXCreateContext in -lGL" >&5 -$as_echo_n "checking for glXCreateContext in -lGL... " >&6; } -if ${ac_cv_lib_GL_glXCreateContext+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lGL -lGLU $GL_LIBS -lX11 -lXext $VIDMODE_LIBS -lm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on Tru64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then + ax_pthread_save_CC="$CC" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + if test "x$PTHREAD_CC" != "x"; then : + CC="$PTHREAD_CC" +fi + if test "x$PTHREAD_CXX" != "x"; then : + CXX="$PTHREAD_CXX" +fi + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS" >&5 +$as_echo_n "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -13348,609 +13436,709 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char glXCreateContext (); +char pthread_join (); int main () { -return glXCreateContext (); +return pthread_join (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_GL_glXCreateContext=yes -else - ac_cv_lib_GL_glXCreateContext=no + ax_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GL_glXCreateContext" >&5 -$as_echo "$ac_cv_lib_GL_glXCreateContext" >&6; } -if test "x$ac_cv_lib_GL_glXCreateContext" = xyes; then : - gl_lib_1="GL" - GL_LIBS="-lGL -lGLU $VIDMODE_LIBS $GL_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 +$as_echo "$ax_pthread_ok" >&6; } + if test "x$ax_pthread_ok" = "xno"; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + CC="$ax_pthread_save_CC" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" fi - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" -# LIBS="$ac_save_LIBS" - - fi - - if test "$gl_lib_1" = "" ; then - # we have headers, but no libs -- bail. - have_gl=no - ac_have_mesa_gl=no - gl_halfassed=yes - else - # linking works -- we can build the GL hacks. - $as_echo "#define HAVE_GL 1" >>confdefs.h - - if test "$ac_have_mesa_gl" = yes ; then - $as_echo "#define HAVE_MESA_GL 1" >>confdefs.h +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). - fi - fi - fi +# Create a list of thread flags to try. Items with a "," contain both +# C compiler flags (before ",") and linker flags (after ","). Other items +# starting with a "-" are C compiler flags, and remaining items are +# library names, except for "none" which indicates that we try without +# any flags at all, and "pthread-config" which is a program returning +# the flags for the Pth emulation library. +ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" - # Now that we know we have GL headers and libs, do some more GL testing. - # +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: - if test "$have_gl" = yes ; then - # If it's MesaGL, we'd like to issue a warning if the version number - # is less than or equal to 2.6, because that version had a security bug. - # - if test "$ac_have_mesa_gl" = yes; then +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 +# (Note: HP C rejects this with "bad form for `-t' option") +# -pthreads: Solaris/gcc (Note: HP C also rejects) +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads and +# -D_REENTRANT too), HP C (must be checked before -lpthread, which +# is present but should not be used directly; and before -mthreads, +# because the compiler interprets this as "-mt" + "-hreads") +# -mthreads: Mingw32/gcc, Lynx/gcc +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking MesaGL version number" >&5 -$as_echo_n "checking MesaGL version number... " >&6; } -if ${ac_cv_mesagl_version_string+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.$ac_ext < -#ifndef MESA_MAJOR_VERSION -# include -# ifdef XMESA_MAJOR_VERSION - /* Around Mesa 3.2, they took out the Mesa version number, so instead, - we have to check the XMesa version number (the number of the X protocol - support, which seems to be the same as the Mesa version number.) - */ -# define MESA_MAJOR_VERSION XMESA_MAJOR_VERSION -# define MESA_MINOR_VERSION XMESA_MINOR_VERSION -# else - /* Oh great. Some time after 3.4, they took out the xmesa.h header file, - so we have no way of telling what version of Mesa this is at all. - So, we'll guess that the osmesa version (the "offscreen protocol") - is less than or equal to the real mesa version number. Except that - if OSmesa is 3.3, assume at least Mesa 3.4, since OSmesa was 3.3 in - Mesa 3.4. And Mesa 3.3 had xmesa.h. What a complete load of shit! - */ -# include -# define MESA_MAJOR_VERSION OSMESA_MAJOR_VERSION -# define MESA_MINOR_VERSION OSMESA_MINOR_VERSION or newer, probably? -# if OSMESA_MAJOR_VERSION == 3 && OSMESA_MINOR_VERSION == 3 -# undef MESA_MINOR_VERSION -# define MESA_MINOR_VERSION 4 or newer, probably? -# endif -# endif -#endif -configure: MESA_MAJOR_VERSION MESA_MINOR_VERSION -EOF +case $target_os in - ac_save_CPPFLAGS="$CPPFLAGS" - if test \! -z "$includedir" ; then - CPPFLAGS="$CPPFLAGS -I$includedir" - fi - CPPFLAGS="$CPPFLAGS $X_CFLAGS" + freebsd*) - mglv=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | grep configure:` + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) - # M4 sucks!! + ax_pthread_flags="-kthread lthread $ax_pthread_flags" + ;; - mglv=`echo "$mglv" | sed -n \ - 's/^configure: *\([0-9][0-9]*\) *\([0-9].*\)$/\1.\2/p'` + hpux*) + # From the cc(1) man page: "[-mt] Sets various -D flags to enable + # multi-threading and also sets -lpthread." - rm -rf conftest.$ac_ext + ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" + ;; - CPPFLAGS="$ac_save_CPPFLAGS" + openedition*) - if test "$mglv" = ""; then - ac_mesagl_version=unknown - ac_mesagl_version_string=unknown - else - ac_mesagl_version_string="$mglv" - # M4 sucks!! + # IBM z/OS requires a feature-test macro to be defined in order to + # enable POSIX threads at all, so give the user a hint if this is + # not set. (We don't define these ourselves, as they can affect + # other portions of the system API in unpredictable ways.) - maj=`echo "$mglv" | sed -n 's/^\([0-9][0-9]*\)\..*$/\1/p'` - min=`echo "$mglv" | sed -n 's/^.*\.\([0-9][0-9]*\).*$/\1/p'` + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - ac_mesagl_version=`echo "$maj * 1000 + $min" | bc` - if test -z "$ac_mesagl_version"; then - ac_mesagl_version=unknown - ac_mesagl_version_string=unknown - fi - fi - ac_cv_mesagl_version=$ac_mesagl_version - ac_cv_mesagl_version_string=$ac_mesagl_version_string +# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) + AX_PTHREAD_ZOS_MISSING +# endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5 +$as_echo "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;} fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mesagl_version_string" >&5 -$as_echo "$ac_cv_mesagl_version_string" >&6; } - ac_mesagl_version=$ac_cv_mesagl_version - ac_mesagl_version_string=$ac_cv_mesagl_version_string - fi +rm -rf conftest* + ;; - # Check for OpenGL 1.1 features. - # + solaris*) - ac_save_CPPFLAGS="$CPPFLAGS" - ac_save_LDFLAGS="$LDFLAGS" -# ac_save_LIBS="$LIBS" + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (N.B.: The stubs are missing + # pthread_cleanup_push, or rather a function called by this macro, + # so we could check for that, but who knows whether they'll stub + # that too in a future libc.) So we'll check first for the + # standard Solaris way of linking pthreads (-mt -lpthread). - if test \! -z "$includedir" ; then - CPPFLAGS="$CPPFLAGS -I$includedir" - fi - # note: $X_CFLAGS includes $x_includes - CPPFLAGS="$CPPFLAGS $X_CFLAGS" + ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags" + ;; +esac - if test \! -z "$libdir" ; then - LDFLAGS="$LDFLAGS -L$libdir" - fi - # note: $X_LIBS includes $x_libraries - LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" +# Are we compiling with Clang? - CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - as_ac_Lib=`$as_echo "ac_cv_lib_$gl_lib_1''_glBindTexture" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glBindTexture in -l$gl_lib_1" >&5 -$as_echo_n "checking for glBindTexture in -l$gl_lib_1... " >&6; } -if eval \${$as_ac_Lib+:} false; then : +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC is Clang" >&5 +$as_echo_n "checking whether $CC is Clang... " >&6; } +if ${ax_cv_PTHREAD_CLANG+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-l$gl_lib_1 $GL_LIBS -lX11 -lXext -lm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ax_cv_PTHREAD_CLANG=no + # Note that Autoconf sets GCC=yes for Clang as well as GCC + if test "x$GCC" = "xyes"; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char glBindTexture (); -int -main () -{ -return glBindTexture (); - ; - return 0; -} _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$as_ac_Lib=yes" -else - eval "$as_ac_Lib=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - $as_echo "#define HAVE_GLBINDTEXTURE 1" >>confdefs.h - -else - true -fi - - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" -# LIBS="$ac_save_LIBS" - - fi - -elif test "$with_gl" != no; then - echo "error: must be yes or no: --with-gl=$with_gl" - exit 1 -fi - - -############################################################################### -# -# Check for -lgle. -# -############################################################################### - -have_gle=no -with_gle_req=unspecified -gle_halfassed=no - -# Check whether --with-gle was given. -if test "${with_gle+set}" = set; then : - withval=$with_gle; with_gle="$withval"; with_gle_req="$withval" -else - with_gle=yes +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1; then : + ax_cv_PTHREAD_CLANG=yes fi +rm -rf conftest* - - - case "$with_gle" in - yes) ;; - no) ;; - - /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLE headers" >&5 -$as_echo_n "checking for GLE headers... " >&6; } - d=$with_gle/include - if test -d $d; then - X_CFLAGS="-I$d $X_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 -$as_echo "$d" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 -$as_echo "not found ($d: no such directory)" >&6; } - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLE libs" >&5 -$as_echo_n "checking for GLE libs... " >&6; } - d=$with_gle/lib - if test -d $d; then - X_LIBS="-L$d $X_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 -$as_echo "$d" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 -$as_echo "not found ($d: no such directory)" >&6; } fi - # replace the directory string with "yes". - with_gle_req="yes" - with_gle=$with_gle_req - ;; - - *) - echo "" - echo "error: argument to --with-gle must be \"yes\", \"no\", or a directory." - echo " If it is a directory, then \`DIR/include' will be added to" - echo " the -I list, and \`DIR/lib' will be added to the -L list." - exit 1 - ;; - esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5 +$as_echo "$ax_cv_PTHREAD_CLANG" >&6; } +ax_pthread_clang="$ax_cv_PTHREAD_CLANG" +# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) -GLE_LIBS="" +# Note that for GCC and Clang -pthread generally implies -lpthread, +# except when -nostdlib is passed. +# This is problematic using libtool to build C++ shared libraries with pthread: +# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460 +# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333 +# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555 +# To solve this, first try -pthread together with -lpthread for GCC -if test "$have_gl" = no ; then - true -elif test "$with_gle" = yes; then +if test "x$GCC" = "xyes"; then : + ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags" +fi +# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first - 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_fn_c_check_header_compile "$LINENO" "GL/gle.h" "ac_cv_header_GL_gle_h" "#include -" -if test "x$ac_cv_header_GL_gle_h" = xyes; then : - have_gle3=yes -else - have_gle3=no +if test "x$ax_pthread_clang" = "xyes"; then : + ax_pthread_flags="-pthread,-lpthread -pthread" fi +# The presence of a feature test macro requesting re-entrant function +# definitions is, on some systems, a strong hint that pthreads support is +# correctly enabled - CPPFLAGS="$ac_save_CPPFLAGS" - if test "$have_gle3" = yes ; then - have_gle=yes; - else +case $target_os in + darwin* | hpux* | linux* | osf* | solaris*) + ax_pthread_check_macro="_REENTRANT" + ;; - 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_fn_c_check_header_compile "$LINENO" "GL/gutil.h" "ac_cv_header_GL_gutil_h" "#include -" -if test "x$ac_cv_header_GL_gutil_h" = xyes; then : - have_gle=yes + aix*) + ax_pthread_check_macro="_THREAD_SAFE" + ;; + + *) + ax_pthread_check_macro="--" + ;; +esac +if test "x$ax_pthread_check_macro" = "x--"; then : + ax_pthread_check_cond=0 else - have_gle=no + ax_pthread_check_cond="!defined($ax_pthread_check_macro)" fi +if test "x$ax_pthread_ok" = "xno"; then +for ax_pthread_try_flag in $ax_pthread_flags; do - CPPFLAGS="$ac_save_CPPFLAGS" - if test "$have_gle" = yes ; then + case $ax_pthread_try_flag in + none) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 +$as_echo_n "checking whether pthreads work without any flags... " >&6; } + ;; - 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_fn_c_check_header_compile "$LINENO" "GL/tube.h" "ac_cv_header_GL_tube_h" "#include -" -if test "x$ac_cv_header_GL_tube_h" = xyes; then : - have_gle=yes -else - have_gle=no -fi + *,*) + PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"` + PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with \"$PTHREAD_CFLAGS\" and \"$PTHREAD_LIBS\"" >&5 +$as_echo_n "checking whether pthreads work with \"$PTHREAD_CFLAGS\" and \"$PTHREAD_LIBS\"... " >&6; } + ;; + -*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $ax_pthread_try_flag" >&5 +$as_echo_n "checking whether pthreads work with $ax_pthread_try_flag... " >&6; } + PTHREAD_CFLAGS="$ax_pthread_try_flag" + ;; - CPPFLAGS="$ac_save_CPPFLAGS" - fi + pthread-config) + # Extract the first word of "pthread-config", so it can be a program name with args. +set dummy pthread-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ax_pthread_config+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ax_pthread_config"; then + ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ax_pthread_config="yes" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done + done +IFS=$as_save_IFS - if test "$have_gle" = yes ; then - have_gle=no - gle_halfassed=yes + test -z "$ac_cv_prog_ax_pthread_config" && ac_cv_prog_ax_pthread_config="no" +fi +fi +ax_pthread_config=$ac_cv_prog_ax_pthread_config +if test -n "$ax_pthread_config"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5 +$as_echo "$ax_pthread_config" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - ac_save_CPPFLAGS="$CPPFLAGS" - ac_save_LDFLAGS="$LDFLAGS" -# ac_save_LIBS="$LIBS" + if test "x$ax_pthread_config" = "xno"; then : + continue +fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; - if test \! -z "$includedir" ; then - CPPFLAGS="$CPPFLAGS -I$includedir" - fi - # note: $X_CFLAGS includes $x_includes - CPPFLAGS="$CPPFLAGS $X_CFLAGS" + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$ax_pthread_try_flag" >&5 +$as_echo_n "checking for the pthreads library -l$ax_pthread_try_flag... " >&6; } + PTHREAD_LIBS="-l$ax_pthread_try_flag" + ;; + esac - if test \! -z "$libdir" ; then - LDFLAGS="$LDFLAGS -L$libdir" - fi - # note: $X_LIBS includes $x_libraries - LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $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` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gleCreateGC in -lgle" >&5 -$as_echo_n "checking for gleCreateGC in -lgle... " >&6; } -if ${ac_cv_lib_gle_gleCreateGC+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgle $GL_LIBS -lX11 -lXext -lm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gleCreateGC (); + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif + static void *some_global = NULL; + static void routine(void *a) + { + /* To avoid any unused-parameter or + unused-but-set-parameter warning. */ + some_global = a; + } + static void *start_routine(void *a) { return a; } int main () { -return gleCreateGC (); +pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */ ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gle_gleCreateGC=yes -else - ac_cv_lib_gle_gleCreateGC=no + ax_pthread_ok=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 +$as_echo "$ax_pthread_ok" >&6; } + if test "x$ax_pthread_ok" = "xyes"; then : + break fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gle_gleCreateGC" >&5 -$as_echo "$ac_cv_lib_gle_gleCreateGC" >&6; } -if test "x$ac_cv_lib_gle_gleCreateGC" = xyes; then : - have_gle=yes; gle_halfassed=no; GLE_LIBS="-lgle" + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done fi - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" -# LIBS="$ac_save_LIBS" +# Clang needs special handling, because older versions handle the -pthread +# option in a rather... idiosyncratic way - fi - if test "$have_gle" = yes ; then - have_gle=no - gle_halfassed=yes +if test "x$ax_pthread_clang" = "xyes"; then - # sometimes the libmatrix stuff is included in libgle. look there first. -# -# I don't get it. For some reason, this test passes on SGI, as if -# uview_direction_d() was in libgle -- but it's not, it's in libmatrix. -# Yet the link is succeeding. Why??? -# -# AC_CHECK_X_LIB(gle, uview_direction_d, -# [have_gle=yes; gle_halfassed=no], -# [], $GL_LIBS -lX11 -lXext -lm) + # Clang takes -pthread; it has never supported any other flag - # As of GLE 3 this is in libgle, and has changed name to uview_direction! - # *sigh* - if test "$have_gle3" = yes ; then + # (Note 1: This will need to be revisited if a system that Clang + # supports has POSIX threads in a separate library. This tends not + # to be the way of modern systems, but it's conceivable.) - ac_save_CPPFLAGS="$CPPFLAGS" - ac_save_LDFLAGS="$LDFLAGS" -# ac_save_LIBS="$LIBS" + # (Note 2: On some systems, notably Darwin, -pthread is not needed + # to get POSIX threads support; the API is always present and + # active. We could reasonably leave PTHREAD_CFLAGS empty. But + # -pthread does define _REENTRANT, and while the Darwin headers + # ignore this macro, third-party headers might not.) - if test \! -z "$includedir" ; then - CPPFLAGS="$CPPFLAGS -I$includedir" - fi - # note: $X_CFLAGS includes $x_includes - CPPFLAGS="$CPPFLAGS $X_CFLAGS" + # However, older versions of Clang make a point of warning the user + # that, in an invocation where only linking and no compilation is + # taking place, the -pthread option has no effect ("argument unused + # during compilation"). They expect -pthread to be passed in only + # when source code is being compiled. + # + # Problem is, this is at odds with the way Automake and most other + # C build frameworks function, which is that the same flags used in + # compilation (CFLAGS) are also used in linking. Many systems + # supported by AX_PTHREAD require exactly this for POSIX threads + # support, and in fact it is often not straightforward to specify a + # flag that is used only in the compilation phase and not in + # linking. Such a scenario is extremely rare in practice. + # + # Even though use of the -pthread flag in linking would only print + # a warning, this can be a nuisance for well-run software projects + # that build with -Werror. So if the active version of Clang has + # this misfeature, we search for an option to squash it. + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5 +$as_echo_n "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; } +if ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown + # Create an alternate version of $ac_link that compiles and + # links in two steps (.c -> .o, .o -> exe) instead of one + # (.c -> exe), because the warning occurs only in the second + # step + ax_pthread_save_ac_link="$ac_link" + ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' + ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` + ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" + ax_pthread_save_CFLAGS="$CFLAGS" + for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do + if test "x$ax_pthread_try" = "xunknown"; then : + break +fi + CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" + ac_link="$ax_pthread_save_ac_link" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void){return 0;} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_link="$ax_pthread_2step_ac_link" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(void){return 0;} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done + ac_link="$ax_pthread_save_ac_link" + CFLAGS="$ax_pthread_save_CFLAGS" + if test "x$ax_pthread_try" = "x"; then : + ax_pthread_try=no +fi + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5 +$as_echo "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; } + + case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in + no | unknown) ;; + *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; + esac - if test \! -z "$libdir" ; then - LDFLAGS="$LDFLAGS -L$libdir" - fi - # note: $X_LIBS includes $x_libraries - LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" +fi # $ax_pthread_clang = yes - CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uview_direction in -lgle" >&5 -$as_echo_n "checking for uview_direction in -lgle... " >&6; } -if ${ac_cv_lib_gle_uview_direction+:} false; then : +# Various other checks: +if test "x$ax_pthread_ok" = "xyes"; then + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 +$as_echo_n "checking for joinable pthread attribute... " >&6; } +if ${ax_cv_PTHREAD_JOINABLE_ATTR+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgle $GL_LIBS -lX11 -lXext -lm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ax_cv_PTHREAD_JOINABLE_ATTR=unknown + for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char uview_direction (); +#include int main () { -return uview_direction (); +int attr = $ax_pthread_attr; return attr /* ; */ ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gle_uview_direction=yes -else - ac_cv_lib_gle_uview_direction=no + ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gle_uview_direction" >&5 -$as_echo "$ac_cv_lib_gle_uview_direction" >&6; } -if test "x$ac_cv_lib_gle_uview_direction" = xyes; then : - have_gle=yes; gle_halfassed=no + done + fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5 +$as_echo "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; } + if test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ + test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ + test "x$ax_pthread_joinable_attr_defined" != "xyes"; then : - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" -# LIBS="$ac_save_LIBS" +cat >>confdefs.h <<_ACEOF +#define PTHREAD_CREATE_JOINABLE $ax_cv_PTHREAD_JOINABLE_ATTR +_ACEOF - fi - # if it wasn't in libgle, then look in libmatrix. - if test "$have_gle" = no ; then + ax_pthread_joinable_attr_defined=yes - ac_save_CPPFLAGS="$CPPFLAGS" - ac_save_LDFLAGS="$LDFLAGS" -# ac_save_LIBS="$LIBS" +fi - if test \! -z "$includedir" ; then - CPPFLAGS="$CPPFLAGS -I$includedir" - fi - # note: $X_CFLAGS includes $x_includes - CPPFLAGS="$CPPFLAGS $X_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether more special flags are required for pthreads" >&5 +$as_echo_n "checking whether more special flags are required for pthreads... " >&6; } +if ${ax_cv_PTHREAD_SPECIAL_FLAGS+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_PTHREAD_SPECIAL_FLAGS=no + case $target_os in + solaris*) + ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" + ;; + esac - if test \! -z "$libdir" ; then - LDFLAGS="$LDFLAGS -L$libdir" - fi - # note: $X_LIBS includes $x_libraries - LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5 +$as_echo "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; } + if test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ + test "x$ax_pthread_special_flags_added" != "xyes"; then : + PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" + ax_pthread_special_flags_added=yes +fi - CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uview_direction_d in -lmatrix" >&5 -$as_echo_n "checking for uview_direction_d in -lmatrix... " >&6; } -if ${ac_cv_lib_matrix_uview_direction_d+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 +$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; } +if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then : $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lmatrix $GL_LIBS -lX11 -lXext -lm $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char uview_direction_d (); +#include int main () { -return uview_direction_d (); +int i = PTHREAD_PRIO_INHERIT; + return i; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_matrix_uview_direction_d=yes + ax_cv_PTHREAD_PRIO_INHERIT=yes else - ac_cv_lib_matrix_uview_direction_d=no + ax_cv_PTHREAD_PRIO_INHERIT=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_matrix_uview_direction_d" >&5 -$as_echo "$ac_cv_lib_matrix_uview_direction_d" >&6; } -if test "x$ac_cv_lib_matrix_uview_direction_d" = xyes; then : - have_gle=yes; gle_halfassed=no; - GLE_LIBS="$GLE_LIBS -lmatrix" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 +$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } + if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ + test "x$ax_pthread_prio_inherit_defined" != "xyes"; then : + +$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h + + ax_pthread_prio_inherit_defined=yes + fi - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" -# LIBS="$ac_save_LIBS" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" - fi + # More AIX lossage: compile with *_r variant + if test "x$GCC" != "xyes"; then + case $target_os in + aix*) + case "x/$CC" in #( + x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) : + #handle absolute path differently from PATH based program lookup + case "x$CC" in #( + x/*) : + + if as_fn_executable_p ${CC}_r; then : + PTHREAD_CC="${CC}_r" +fi + if test "x${CXX}" != "x"; then : + if as_fn_executable_p ${CXX}_r; then : + PTHREAD_CXX="${CXX}_r" +fi +fi + ;; #( + *) : + + for ac_prog in ${CC}_r +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_PTHREAD_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$PTHREAD_CC"; then + ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_PTHREAD_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done + done +IFS=$as_save_IFS - if test "$have_gle" = yes ; then - $as_echo "#define HAVE_GLE 1" >>confdefs.h +fi +fi +PTHREAD_CC=$ac_cv_prog_PTHREAD_CC +if test -n "$PTHREAD_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 +$as_echo "$PTHREAD_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - if test "$have_gle3" = yes ; then - $as_echo "#define HAVE_GLE3 1" >>confdefs.h + test -n "$PTHREAD_CC" && break +done +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" - fi + if test "x${CXX}" != "x"; then : + for ac_prog in ${CXX}_r +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_PTHREAD_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$PTHREAD_CXX"; then + ac_cv_prog_PTHREAD_CXX="$PTHREAD_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_PTHREAD_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 fi +done + done +IFS=$as_save_IFS -elif test "$with_gle" != no; then - echo "error: must be yes or no: --with-gle=$with_gle" - exit 1 +fi +fi +PTHREAD_CXX=$ac_cv_prog_PTHREAD_CXX +if test -n "$PTHREAD_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CXX" >&5 +$as_echo "$PTHREAD_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + test -n "$PTHREAD_CXX" && break +done +test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" + +fi + + ;; +esac + ;; #( + *) : + ;; +esac + ;; + esac + fi +fi + +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" +test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test "x$ax_pthread_ok" = "xyes"; then + if test "$CC" = "$PTHREAD_CC" -o -z "$ac_original_cc"; then + have_pthread=yes + else + ac_prog_cc_no_pthread=yes + fi + + : +else + ax_pthread_ok=no fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + if test "$have_pthread" = yes; then + $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h + CC="$PTHREAD_CC" + fi +fi ############################################################################### # # Handle --with-gles +# Must come before --with-gl # ############################################################################### -with_gles_req=unspecified +with_jwzgles_req=unspecified +have_jwzgles=no # Check whether --with-gles was given. if test "${with_gles+set}" = set; then : - withval=$with_gles; with_gles="$withval"; with_gles_req="$withval" + withval=$with_gles; # This is documented after --with-gl + with_jwzgles="$withval"; with_jwzgles_req="$withval" else - with_gles=no + with_jwzgles=no fi - - - case "$with_gles" in + case "$with_jwzgles" in yes) ;; no) ;; /*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JWZGLES headers" >&5 $as_echo_n "checking for JWZGLES headers... " >&6; } - d=$with_gles/include + d=$with_jwzgles/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -13962,7 +14150,7 @@ $as_echo "not found ($d: no such directory)" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JWZGLES libs" >&5 $as_echo_n "checking for JWZGLES libs... " >&6; } - d=$with_gles/lib + d=$with_jwzgles/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -13973,8 +14161,8 @@ $as_echo "not found ($d: no such directory)" >&6; } fi # replace the directory string with "yes". - with_gles_req="yes" - with_gles=$with_gles_req + with_jwzgles_req="yes" + with_jwzgles=$with_jwzgles_req ;; *) @@ -13986,46 +14174,45 @@ $as_echo "not found ($d: no such directory)" >&6; } ;; esac - -if test "$with_gles" = yes; then - have_gles=yes - $as_echo "#define HAVE_JWZGLES 1" >>confdefs.h - +if test "$with_jwzgles" = yes; then + have_jwzgles=yes JWZGLES_OBJS='$(JWXYZ_BIN)/jwzgles.o' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using OpenGL ES compatiblity shim" >&5 -$as_echo "using OpenGL ES compatiblity shim" >&6; } -elif test "$with_gles" != no; then - echo "error: must be yes or no: --with-gles=$with_gles" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: emulating OpenGL 1.3 in terms of OpenGLES 1.x." >&5 +$as_echo "emulating OpenGL 1.3 in terms of OpenGLES 1.x." >&6; } +elif test "$with_jwzgles" != no; then + echo "error: must be yes or no: --with-gles=$with_jwzgles" exit 1 fi ############################################################################### # -# Check for -lpng +# Check for -lGL or -lMesaGL. # ############################################################################### -have_png=no -with_png_req=unspecified -png_halfassed=no +#### H1 -# Check whether --with-png was given. -if test "${with_png+set}" = set; then : - withval=$with_png; with_png="$withval"; with_png_req="$withval" +have_gl=no +ac_have_mesa_gl=no +with_gl_req=unspecified +gl_halfassed=no +have_glext=no + +# Check whether --with-gl was given. +if test "${with_gl+set}" = set; then : + withval=$with_gl; with_gl="$withval"; with_gl_req="$withval" else - with_png=yes + with_gl=yes fi - - - case "$with_png" in + case "$with_gl" in yes) ;; no) ;; - /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PNG headers" >&5 -$as_echo_n "checking for PNG headers... " >&6; } - d=$with_png/include + /*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GL headers" >&5 +$as_echo_n "checking for GL headers... " >&6; } + d=$with_gl/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -14035,9 +14222,9 @@ $as_echo "$d" >&6; } $as_echo "not found ($d: no such directory)" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PNG libs" >&5 -$as_echo_n "checking for PNG libs... " >&6; } - d=$with_png/lib + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GL libs" >&5 +$as_echo_n "checking for GL libs... " >&6; } + d=$with_gl/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -14048,28 +14235,44 @@ $as_echo "not found ($d: no such directory)" >&6; } fi # replace the directory string with "yes". - with_png_req="yes" - with_png=$with_png_req + with_gl_req="yes" + with_gl=$with_gl_req ;; *) echo "" - echo "error: argument to --with-png must be \"yes\", \"no\", or a directory." + echo "error: argument to --with-gl must be \"yes\", \"no\", or a directory." echo " If it is a directory, then \`DIR/include' will be added to" echo " the -I list, and \`DIR/lib' will be added to the -L list." exit 1 ;; esac +# Some GL libraries require pthreads, so use the pthreads flags when +# testing them, then set them back after. +# +ac_save_pthreads_CFLAGS="$CFLAGS" +ac_save_pthreads_LIBS="$LIBS" +CFLAGS="$PTHREAD_CFLAGS $CFLAGS" +LIBS="$PTHREAD_LIBS $LIBS" -if test "$with_png" != yes -a "$with_png" != no ; then - echo "error: must be yes or no: --with-png=$with_png" - exit 1 -fi +if test "$with_gl" = yes; then -if test "$with_png" = yes; then + 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_fn_c_check_header_mongrel "$LINENO" "GL/gl.h" "ac_cv_header_GL_gl_h" "$ac_includes_default" +if test "x$ac_cv_header_GL_gl_h" = xyes; then : + have_gl=yes +else + have_gl=no +fi - have_png=no + CPPFLAGS="$ac_save_CPPFLAGS"; + if test "$have_gl" = yes; then ac_save_CPPFLAGS="$CPPFLAGS" if test \! -z "$includedir" ; then @@ -14077,18 +14280,57 @@ if test "$with_png" = yes; then fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - ac_fn_c_check_header_mongrel "$LINENO" "png.h" "ac_cv_header_png_h" "$ac_includes_default" -if test "x$ac_cv_header_png_h" = xyes; then : - have_png=yes + ac_fn_c_check_header_mongrel "$LINENO" "GL/glu.h" "ac_cv_header_GL_glu_h" "$ac_includes_default" +if test "x$ac_cv_header_GL_glu_h" = xyes; then : + have_gl=yes +else + have_gl=no fi + CPPFLAGS="$ac_save_CPPFLAGS"; + fi +fi - CPPFLAGS="$ac_save_CPPFLAGS" +if test "$with_gl" = yes; then + # + # Since the OpenGL and GLES specifications are a complete dumpster fire, + # it's not easy to figure out how what libraries to use. + # + # OpenGLES library names: + # + # 1.x: libGLESv1_CM + # 2.x: libGLESv2 + # 3.x: libGLESv2 on Windows, libGLESv3 on Android + # + # On modern Linux systems, these libraries exist: + # + # libGL - a superset of everything up to and including OpenGL 4.6 + # libGLESv1_CM - OpenGLES 1.1, meaning it omits much of OpenGL 1.3 + # libGLESv2 - OpenGLES 2 and 3, meaning it omits even more of OpenGL 1.3 + # + # Since Linux systems support OpenGL 1.3, those link against only libGL. + # + # Unless we are using --with-gles on Linux, in which case we are attempting + # to simulate a system that does not natively support OpenGL 1.3. In that + # case, we use the v1 and/or v2 libraries instead. + # + # Common practice on Android seems to be to link against the v1, v2 and v3 + # libraries in order, and then do runtime checks to see which set of + # functions is actually supported by the runtime. Just because you linked + # against a GLES3 library doesn't mean that the hardware supports it: most + # of these functions are just syscall-like stubs. + # + # See the commentary atop jwxyz/jwzgles.c for discussion of OpenGL versions. + # + if test "$have_gl" = yes; then + have_gl=no - if test "$have_png" = yes; then - # we have the header, now check for the library - have_png=no - png_halfassed=yes + if test "$have_jwzgles" = yes; then + + # Only check for the v1/2/3 libraries on Linux when using --with-gles + # to emulate a system that does not natively support OpenGL 1.3. + + # Check for GLES 3.x ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -14108,13 +14350,13 @@ fi CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_create_read_struct in -lpng" >&5 -$as_echo_n "checking for png_create_read_struct in -lpng... " >&6; } -if ${ac_cv_lib_png_png_create_read_struct+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glDrawElements in -lGLESv3" >&5 +$as_echo_n "checking for glDrawElements in -lGLESv3... " >&6; } +if ${ac_cv_lib_GLESv3_glDrawElements+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lpng $LIBS" +LIBS="-lGLESv3 $GL_LIBS -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -14124,238 +14366,312 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char png_create_read_struct (); +char glDrawElements (); int main () { -return png_create_read_struct (); +return glDrawElements (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_png_png_create_read_struct=yes + ac_cv_lib_GLESv3_glDrawElements=yes else - ac_cv_lib_png_png_create_read_struct=no + ac_cv_lib_GLESv3_glDrawElements=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_create_read_struct" >&5 -$as_echo "$ac_cv_lib_png_png_create_read_struct" >&6; } -if test "x$ac_cv_lib_png_png_create_read_struct" = xyes; then : - have_png=yes - png_halfassed=no - PNG_LIBS="-lpng" - $as_echo "#define HAVE_LIBPNG 1" >>confdefs.h - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GLESv3_glDrawElements" >&5 +$as_echo "$ac_cv_lib_GLESv3_glDrawElements" >&6; } +if test "x$ac_cv_lib_GLESv3_glDrawElements" = xyes; then : + have_gl=yes + gl_lib_1="GLESv3" + GL_LIBS="-lGLESv3 $GL_LIBS" fi CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" - fi -fi + # Check for GLES 2.x + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" +# ac_save_LIBS="$LIBS" -############################################################################### -# -# Check for -lgdk_pixbuf. -# These tests are for gdk_pixbuf usage of the hacks, -# not xscreensaver-demo (thus we have to test again to get -# the libraries right: don't want to pull in all of GTK -# for the hacks.) -# -############################################################################### + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + # note: $X_CFLAGS includes $x_includes + CPPFLAGS="$CPPFLAGS $X_CFLAGS" -have_gdk_pixbuf=no -with_gdk_pixbuf_req=unspecified + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" + fi + # note: $X_LIBS includes $x_libraries + LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" -# Check whether --with-pixbuf was given. -if test "${with_pixbuf+set}" = set; then : - withval=$with_pixbuf; with_gdk_pixbuf="$withval"; with_gdk_pixbuf_req="$withval" + CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` + LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glDrawElements in -lGLESv2" >&5 +$as_echo_n "checking for glDrawElements in -lGLESv2... " >&6; } +if ${ac_cv_lib_GLESv2_glDrawElements+:} false; then : + $as_echo_n "(cached) " >&6 else - with_gdk_pixbuf=yes -fi - - -# if --with-pixbuf=/directory/ was specified, remember that directory so that -# we can also look for the `gdk-pixbuf-config' program in that directory. -case "$with_gdk_pixbuf" in - /*) - gdk_pixbuf_dir="$with_gdk_pixbuf" - ;; - *) - gdk_pixbuf_dir="" - ;; -esac - - - case "$with_gdk_pixbuf" in - yes) ;; - no) ;; - - /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GDK_PIXBUF headers" >&5 -$as_echo_n "checking for GDK_PIXBUF headers... " >&6; } - d=$with_gdk_pixbuf/include - if test -d $d; then - X_CFLAGS="-I$d $X_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 -$as_echo "$d" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 -$as_echo "not found ($d: no such directory)" >&6; } - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GDK_PIXBUF libs" >&5 -$as_echo_n "checking for GDK_PIXBUF libs... " >&6; } - d=$with_gdk_pixbuf/lib - if test -d $d; then - X_LIBS="-L$d $X_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 -$as_echo "$d" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 -$as_echo "not found ($d: no such directory)" >&6; } - fi - - # replace the directory string with "yes". - with_gdk_pixbuf_req="yes" - with_gdk_pixbuf=$with_gdk_pixbuf_req - ;; + ac_check_lib_save_LIBS=$LIBS +LIBS="-lGLESv2 $GL_LIBS -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - *) - echo "" - echo "error: argument to --with-pixbuf must be \"yes\", \"no\", or a directory." - echo " If it is a directory, then \`DIR/include' will be added to" - echo " the -I list, and \`DIR/lib' will be added to the -L list." - exit 1 - ;; - esac +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char glDrawElements (); +int +main () +{ +return glDrawElements (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_GLESv2_glDrawElements=yes +else + ac_cv_lib_GLESv2_glDrawElements=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GLESv2_glDrawElements" >&5 +$as_echo "$ac_cv_lib_GLESv2_glDrawElements" >&6; } +if test "x$ac_cv_lib_GLESv2_glDrawElements" = xyes; then : + have_gl=yes + gl_lib_1="GLESv2" + GL_LIBS="-lGLESv2 $GL_LIBS" +fi + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" -if test "$with_gdk_pixbuf" != yes -a "$with_gdk_pixbuf" != no ; then - echo "error: must be yes or no: --with-pixbuf=$with_gdk_pixbuf" - exit 1 -fi + # Check for GLES 1.x -if test "$with_gdk_pixbuf" = yes; then - have_gdk_pixbuf=no + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" +# ac_save_LIBS="$LIBS" - pkgs='' - ok="yes" + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + # note: $X_CFLAGS includes $x_includes + CPPFLAGS="$CPPFLAGS $X_CFLAGS" - pkg_check_version gdk-pixbuf-2.0 2.0.0 - pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0 - pkg_check_version gio-2.0 2.0.0 - have_gdk_pixbuf="$ok" + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" + fi + # note: $X_LIBS includes $x_libraries + LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" - if test "$have_gdk_pixbuf" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk-pixbuf includes" >&5 -$as_echo_n "checking for gdk-pixbuf includes... " >&6; } -if ${ac_cv_gdk_pixbuf_config_cflags+:} false; then : + CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` + LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glDrawElements in -lGLESv1_CM" >&5 +$as_echo_n "checking for glDrawElements in -lGLESv1_CM... " >&6; } +if ${ac_cv_lib_GLESv1_CM_glDrawElements+:} false; then : $as_echo_n "(cached) " >&6 else - ac_cv_gdk_pixbuf_config_cflags=`$pkg_config --cflags $pkgs` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gdk_pixbuf_config_cflags" >&5 -$as_echo "$ac_cv_gdk_pixbuf_config_cflags" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk-pixbuf libs" >&5 -$as_echo_n "checking for gdk-pixbuf libs... " >&6; } -if ${ac_cv_gdk_pixbuf_config_libs+:} false; then : - $as_echo_n "(cached) " >&6 + ac_check_lib_save_LIBS=$LIBS +LIBS="-lGLESv1_CM $GL_LIBS -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char glDrawElements (); +int +main () +{ +return glDrawElements (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_GLESv1_CM_glDrawElements=yes else - ac_cv_gdk_pixbuf_config_libs=`$pkg_config --libs $pkgs` + ac_cv_lib_GLESv1_CM_glDrawElements=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GLESv1_CM_glDrawElements" >&5 +$as_echo "$ac_cv_lib_GLESv1_CM_glDrawElements" >&6; } +if test "x$ac_cv_lib_GLESv1_CM_glDrawElements" = xyes; then : + have_gl=yes + gl_lib_1="GLESv1_CM" + GL_LIBS="-lGLESv1_CM $GL_LIBS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gdk_pixbuf_config_libs" >&5 -$as_echo "$ac_cv_gdk_pixbuf_config_libs" >&6; } - fi - - ac_gdk_pixbuf_config_cflags=$ac_cv_gdk_pixbuf_config_cflags - ac_gdk_pixbuf_config_libs=$ac_cv_gdk_pixbuf_config_libs - - if test "$have_gdk_pixbuf" = yes; then - # - # we appear to have pixbuf; check for headers/libs to be sure. - # - ac_save_gdk_pixbuf_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $ac_gdk_pixbuf_config_cflags" + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" - have_gdk_pixbuf=no + else # $have_jwzgles = no - # check for header A... + # Check for OpenGL 1.x and/or OpenGL 4.x 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" - CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - ac_fn_c_check_header_mongrel "$LINENO" "gdk-pixbuf/gdk-pixbuf.h" "ac_cv_header_gdk_pixbuf_gdk_pixbuf_h" "$ac_includes_default" -if test "x$ac_cv_header_gdk_pixbuf_gdk_pixbuf_h" = xyes; then : - have_gdk_pixbuf=yes -fi - - - CPPFLAGS="$ac_save_CPPFLAGS" - - # if that worked, check for header B... - if test "$have_gdk_pixbuf" = yes; then - have_gdk_pixbuf=no - gdk_pixbuf_halfassed=yes - ac_save_CPPFLAGS="$CPPFLAGS" - if test \! -z "$includedir" ; then - CPPFLAGS="$CPPFLAGS -I$includedir" + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" fi - CPPFLAGS="$CPPFLAGS $X_CFLAGS" + # 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` - ac_fn_c_check_header_mongrel "$LINENO" "gdk-pixbuf/gdk-pixbuf-xlib.h" "ac_cv_header_gdk_pixbuf_gdk_pixbuf_xlib_h" "$ac_includes_default" -if test "x$ac_cv_header_gdk_pixbuf_gdk_pixbuf_xlib_h" = xyes; then : - have_gdk_pixbuf=yes - gdk_pixbuf_halfassed=no -fi + LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glEnable in -lGL" >&5 +$as_echo_n "checking for glEnable in -lGL... " >&6; } +if ${ac_cv_lib_GL_glEnable+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lGL $GL_LIBS -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char glEnable (); +int +main () +{ +return glEnable (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_GL_glEnable=yes +else + ac_cv_lib_GL_glEnable=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GL_glEnable" >&5 +$as_echo "$ac_cv_lib_GL_glEnable" >&6; } +if test "x$ac_cv_lib_GL_glEnable" = xyes; then : + have_gl=yes + gl_lib_1="GL" + GL_LIBS="-lGL $GL_LIBS" +fi CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" - # yay, it has a new name in Gtk 2.x... - if test "$have_gdk_pixbuf" = no; then - have_gdk_pixbuf=no - gdk_pixbuf_halfassed=yes + # Check for MesaGL 1.x, but only if libGL doesn't exist. + if test "$have_gl" = no; then 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` - ac_fn_c_check_header_mongrel "$LINENO" "gdk-pixbuf-xlib/gdk-pixbuf-xlib.h" "ac_cv_header_gdk_pixbuf_xlib_gdk_pixbuf_xlib_h" "$ac_includes_default" -if test "x$ac_cv_header_gdk_pixbuf_xlib_gdk_pixbuf_xlib_h" = xyes; then : - have_gdk_pixbuf=yes - gdk_pixbuf_halfassed=no -fi + LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glEnable in -lMesaGL" >&5 +$as_echo_n "checking for glEnable in -lMesaGL... " >&6; } +if ${ac_cv_lib_MesaGL_glEnable+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lMesaGL $GL_LIBS -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char glEnable (); +int +main () +{ +return glEnable (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_MesaGL_glEnable=yes +else + ac_cv_lib_MesaGL_glEnable=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_MesaGL_glEnable" >&5 +$as_echo "$ac_cv_lib_MesaGL_glEnable" >&6; } +if test "x$ac_cv_lib_MesaGL_glEnable" = xyes; then : + have_gl=yes + gl_lib_1="MesaGL" + GL_LIBS="-lMesaGL $GL_LIBS" +fi CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + fi fi - CPPFLAGS="$ac_save_gdk_pixbuf_CPPFLAGS" fi - if test "$have_gdk_pixbuf" = yes; then - # we have the headers, now check for the libraries - have_gdk_pixbuf=no - gdk_pixbuf_halfassed=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for gdk_pixbuf usability..." >&5 -$as_echo "checking for gdk_pixbuf usability..." >&6; } - - # library A... + # Figure out whether the GLU functions are in the main GL libraries or + # in -lGLU. Since Android does not have GLU, we don't link against libGLU + # when using --with-gles on Linux. + # + if test "$have_gl" = yes -a "$have_jwzgles" = no; then ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -14375,13 +14691,14 @@ $as_echo "checking for gdk_pixbuf usability..." >&6; } CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk_pixbuf_new_from_file in -lc" >&5 -$as_echo_n "checking for gdk_pixbuf_new_from_file in -lc... " >&6; } -if ${ac_cv_lib_c_gdk_pixbuf_new_from_file+:} false; then : + as_ac_Lib=`$as_echo "ac_cv_lib_$gl_lib_1''_gluBuild2DMipmaps" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gluBuild2DMipmaps in -l$gl_lib_1" >&5 +$as_echo_n "checking for gluBuild2DMipmaps in -l$gl_lib_1... " >&6; } +if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm $LIBS" +LIBS="-l$gl_lib_1 $GL_LIBS -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -14391,37 +14708,43 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char gdk_pixbuf_new_from_file (); +char gluBuild2DMipmaps (); int main () { -return gdk_pixbuf_new_from_file (); +return gluBuild2DMipmaps (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_gdk_pixbuf_new_from_file=yes + eval "$as_ac_Lib=yes" else - ac_cv_lib_c_gdk_pixbuf_new_from_file=no + eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_gdk_pixbuf_new_from_file" >&5 -$as_echo "$ac_cv_lib_c_gdk_pixbuf_new_from_file" >&6; } -if test "x$ac_cv_lib_c_gdk_pixbuf_new_from_file" = xyes; then : - have_gdk_pixbuf=yes +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_LIB$gl_lib_1" | $as_tr_cpp` 1 +_ACEOF + + LIBS="-l$gl_lib_1 $LIBS" + +else + have_gl=no fi CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" - # library B... - if test "$have_gdk_pixbuf" = yes; then - have_gdk_pixbuf=no + if test "$have_gl" = no; then ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -14441,13 +14764,13 @@ fi CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk_pixbuf_xlib_init in -lc" >&5 -$as_echo_n "checking for gdk_pixbuf_xlib_init in -lc... " >&6; } -if ${ac_cv_lib_c_gdk_pixbuf_xlib_init+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gluBuild2DMipmaps in -lGLU" >&5 +$as_echo_n "checking for gluBuild2DMipmaps in -lGLU... " >&6; } +if ${ac_cv_lib_GLU_gluBuild2DMipmaps+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm $LIBS" +LIBS="-lGLU $GL_LIBS -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -14457,29 +14780,32 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char gdk_pixbuf_xlib_init (); +char gluBuild2DMipmaps (); int main () { -return gdk_pixbuf_xlib_init (); +return gluBuild2DMipmaps (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_gdk_pixbuf_xlib_init=yes + ac_cv_lib_GLU_gluBuild2DMipmaps=yes else - ac_cv_lib_c_gdk_pixbuf_xlib_init=no + ac_cv_lib_GLU_gluBuild2DMipmaps=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_gdk_pixbuf_xlib_init" >&5 -$as_echo "$ac_cv_lib_c_gdk_pixbuf_xlib_init" >&6; } -if test "x$ac_cv_lib_c_gdk_pixbuf_xlib_init" = xyes; then : - have_gdk_pixbuf=yes - gdk_pixbuf_halfassed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GLU_gluBuild2DMipmaps" >&5 +$as_echo "$ac_cv_lib_GLU_gluBuild2DMipmaps" >&6; } +if test "x$ac_cv_lib_GLU_gluBuild2DMipmaps" = xyes; then : + have_gl=yes + GL_LIBS="-lGLU $GL_LIBS" +else + have_gl=no + gl_halfassed=yes fi CPPFLAGS="$ac_save_CPPFLAGS" @@ -14489,17 +14815,80 @@ fi fi fi - if test "$have_gdk_pixbuf" = yes; then - INCLUDES="$INCLUDES $ac_gdk_pixbuf_config_cflags" - PNG_LIBS="$ac_gdk_pixbuf_config_libs" - $as_echo "#define HAVE_GDK_PIXBUF 1" >>confdefs.h + if test "$have_gl" = yes; then - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for gdk_pixbuf usability... no" >&5 -$as_echo "checking for gdk_pixbuf usability... no" >&6; } + $as_echo "#define HAVE_GL 1" >>confdefs.h + + # OpenGL 1.0 didn't have multiple textures. + + 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` + as_ac_Lib=`$as_echo "ac_cv_lib_$gl_lib_1''_glBindTexture" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glBindTexture in -l$gl_lib_1" >&5 +$as_echo_n "checking for glBindTexture in -l$gl_lib_1... " >&6; } +if eval \${$as_ac_Lib+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$gl_lib_1 $GL_LIBS -lX11 -lXext -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char glBindTexture (); +int +main () +{ +return glBindTexture (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + $as_echo "#define HAVE_GLBINDTEXTURE 1" >>confdefs.h + +else + true +fi - if test "$have_gdk_pixbuf" = yes; then + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + + # Check for native GLES1 ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -14519,13 +14908,14 @@ $as_echo "checking for gdk_pixbuf usability... no" >&6; } CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk_pixbuf_apply_embedded_orientation in -lc" >&5 -$as_echo_n "checking for gdk_pixbuf_apply_embedded_orientation in -lc... " >&6; } -if ${ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation+:} false; then : + as_ac_Lib=`$as_echo "ac_cv_lib_$gl_lib_1''_glBindBuffer" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glBindBuffer in -l$gl_lib_1" >&5 +$as_echo_n "checking for glBindBuffer in -l$gl_lib_1... " >&6; } +if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm $LIBS" +LIBS="-l$gl_lib_1 $GL_LIBS -lX11 -lXext -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -14535,110 +14925,39 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char gdk_pixbuf_apply_embedded_orientation (); +char glBindBuffer (); int main () { -return gdk_pixbuf_apply_embedded_orientation (); +return glBindBuffer (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation=yes + eval "$as_ac_Lib=yes" else - ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation=no + eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation" >&5 -$as_echo "$ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation" >&6; } -if test "x$ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation" = xyes; then : - $as_echo "#define HAVE_GDK_PIXBUF_APPLY_EMBEDDED_ORIENTATION 1" >>confdefs.h +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + $as_echo "#define HAVE_GLES 1" >>confdefs.h +else + true fi CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" - fi -fi - - -############################################################################### -# -# Check for -ljpeg -# -############################################################################### - -have_jpeg=no -with_jpeg_req=unspecified -jpeg_halfassed=no - -# Check whether --with-jpeg was given. -if test "${with_jpeg+set}" = set; then : - withval=$with_jpeg; with_jpeg="$withval"; with_jpeg_req="$withval" -else - with_jpeg=yes -fi - - - - case "$with_jpeg" in - yes) ;; - no) ;; - - /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JPEG headers" >&5 -$as_echo_n "checking for JPEG headers... " >&6; } - d=$with_jpeg/include - if test -d $d; then - X_CFLAGS="-I$d $X_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 -$as_echo "$d" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 -$as_echo "not found ($d: no such directory)" >&6; } - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JPEG libs" >&5 -$as_echo_n "checking for JPEG libs... " >&6; } - d=$with_jpeg/lib - if test -d $d; then - X_LIBS="-L$d $X_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 -$as_echo "$d" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 -$as_echo "not found ($d: no such directory)" >&6; } - fi - - # replace the directory string with "yes". - with_jpeg_req="yes" - with_jpeg=$with_jpeg_req - ;; - - *) - echo "" - echo "error: argument to --with-jpeg must be \"yes\", \"no\", or a directory." - echo " If it is a directory, then \`DIR/include' will be added to" - echo " the -I list, and \`DIR/lib' will be added to the -L list." - exit 1 - ;; - esac - - -if test "$with_jpeg" != yes -a "$with_jpeg" != no ; then - echo "error: must be yes or no: --with-jpeg=$with_jpeg" - exit 1 -fi - -if test "$with_jpeg" = yes; then - - have_jpeg=no + # Check for GLSL and GLES2 ac_save_CPPFLAGS="$CPPFLAGS" if test \! -z "$includedir" ; then @@ -14646,18 +14965,16 @@ if test "$with_jpeg" = yes; then fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - ac_fn_c_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default" -if test "x$ac_cv_header_jpeglib_h" = xyes; then : - have_jpeg=yes + ac_fn_c_check_header_compile "$LINENO" "GL/glext.h" "ac_cv_header_GL_glext_h" "#include +" +if test "x$ac_cv_header_GL_glext_h" = xyes; then : + have_glext=yes +else + have_glext=no fi - CPPFLAGS="$ac_save_CPPFLAGS" - - if test "$have_jpeg" = yes; then - # we have the header, now check for the library - have_jpeg=no - jpeg_halfassed=yes + if test "$have_glext" = yes ; then ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -14677,13 +14994,14 @@ fi CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_start_compress in -ljpeg" >&5 -$as_echo_n "checking for jpeg_start_compress in -ljpeg... " >&6; } -if ${ac_cv_lib_jpeg_jpeg_start_compress+:} false; then : + as_ac_Lib=`$as_echo "ac_cv_lib_$gl_lib_1''_glUseProgram" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glUseProgram in -l$gl_lib_1" >&5 +$as_echo_n "checking for glUseProgram in -l$gl_lib_1... " >&6; } +if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-ljpeg $LIBS" +LIBS="-l$gl_lib_1 $GL_LIBS -lX11 -lXext -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -14693,31 +15011,31 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char jpeg_start_compress (); +char glUseProgram (); int main () { -return jpeg_start_compress (); +return glUseProgram (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_jpeg_jpeg_start_compress=yes + eval "$as_ac_Lib=yes" else - ac_cv_lib_jpeg_jpeg_start_compress=no + eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_start_compress" >&5 -$as_echo "$ac_cv_lib_jpeg_jpeg_start_compress" >&6; } -if test "x$ac_cv_lib_jpeg_jpeg_start_compress" = xyes; then : - have_jpeg=yes - jpeg_halfassed=no - JPEG_LIBS="-ljpeg" - $as_echo "#define HAVE_JPEGLIB 1" >>confdefs.h +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + $as_echo "#define HAVE_GLSL 1" >>confdefs.h + + $as_echo "#define HAVE_GLES2 1" >>confdefs.h fi @@ -14725,17 +15043,9 @@ fi LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" - fi -fi - - -############################################################################### -# -# Check for -lXft -# -############################################################################### + fi -have_xutf8drawstring=no + # Check for GLES3 ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -14755,13 +15065,14 @@ have_xutf8drawstring=no CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xutf8DrawString in -lX11" >&5 -$as_echo_n "checking for Xutf8DrawString in -lX11... " >&6; } -if ${ac_cv_lib_X11_Xutf8DrawString+:} false; then : + as_ac_Lib=`$as_echo "ac_cv_lib_$gl_lib_1''_glBlitFramebuffer" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glBlitFramebuffer in -l$gl_lib_1" >&5 +$as_echo_n "checking for glBlitFramebuffer in -l$gl_lib_1... " >&6; } +if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lX11 -lX11 -lXext -lm $LIBS" +LIBS="-l$gl_lib_1 $GL_LIBS -lX11 -lXext -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -14771,63 +15082,75 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char Xutf8DrawString (); +char glBlitFramebuffer (); int main () { -return Xutf8DrawString (); +return glBlitFramebuffer (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_X11_Xutf8DrawString=yes + eval "$as_ac_Lib=yes" else - ac_cv_lib_X11_Xutf8DrawString=no + eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_X11_Xutf8DrawString" >&5 -$as_echo "$ac_cv_lib_X11_Xutf8DrawString" >&6; } -if test "x$ac_cv_lib_X11_Xutf8DrawString" = xyes; then : - have_xutf8drawstring=yes -else - true +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + $as_echo "#define HAVE_GLES3 1" >>confdefs.h + fi CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" -if test "$have_xutf8drawstring" = yes ; then - $as_echo "#define HAVE_XUTF8DRAWSTRING 1" >>confdefs.h + if test "$have_jwzgles" = yes; then + $as_echo "#define HAVE_JWZGLES 1" >>confdefs.h -fi + $as_echo "#define HAVE_GLES 1" >>confdefs.h + fi -have_xft=no -with_xft_req=unspecified -xft_halfassed=no + fi -# Check whether --with-xft was given. -if test "${with_xft+set}" = set; then : - withval=$with_xft; with_xft="$withval"; with_xft_req="$withval" -else - with_xft=yes +elif test "$with_gl" != no; then + echo "error: must be yes or no: --with-gl=$with_gl" + exit 1 fi +############################################################################### +# +# Handle --with-glx +# +############################################################################### + +have_glx=no +have_egl=no +with_egl_req=unspecified +# Check whether --with-glx was given. +if test "${with_glx+set}" = set; then : + withval=$with_glx; with_egl="$withval"; with_egl_req="$withval" +else + with_glx=no +fi - case "$with_xft" in + case "$with_glx" in yes) ;; no) ;; /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xft headers" >&5 -$as_echo_n "checking for Xft headers... " >&6; } - d=$with_xft/include + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLX headers" >&5 +$as_echo_n "checking for GLX headers... " >&6; } + d=$with_glx/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -14837,9 +15160,9 @@ $as_echo "$d" >&6; } $as_echo "not found ($d: no such directory)" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xft libs" >&5 -$as_echo_n "checking for Xft libs... " >&6; } - d=$with_xft/lib + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLX libs" >&5 +$as_echo_n "checking for GLX libs... " >&6; } + d=$with_glx/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -14850,89 +15173,181 @@ $as_echo "not found ($d: no such directory)" >&6; } fi # replace the directory string with "yes". - with_xft_req="yes" - with_xft=$with_xft_req + with_glx_req="yes" + with_glx=$with_glx_req ;; *) echo "" - echo "error: argument to --with-xft must be \"yes\", \"no\", or a directory." + echo "error: argument to --with-glx must be \"yes\", \"no\", or a directory." echo " If it is a directory, then \`DIR/include' will be added to" echo " the -I list, and \`DIR/lib' will be added to the -L list." exit 1 ;; esac +if test "$with_glx" = yes; then -if test "$with_xft" != yes -a "$with_xft" != no ; then - echo "error: must be yes or no: --with-xft=$with_xft" + 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_fn_c_check_header_mongrel "$LINENO" "GLX/glx.h" "ac_cv_header_GLX_glx_h" "$ac_includes_default" +if test "x$ac_cv_header_GLX_glx_h" = xyes; then : + have_glx=yes +else + have_glx=no +fi + + CPPFLAGS="$ac_save_CPPFLAGS" +elif test "$with_glx" != no; then + echo "error: must be yes or no: --with-glx=$with_glx" exit 1 fi -if test "$with_xft" = yes; then +if test "$have_gl" = yes; then - pkgs='' - ok="yes" - pkg_check_version xft 2.1.0 - have_xft="$ok" + # See if GLX functions are in -LGL. - if test "$have_xft" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xft includes" >&5 -$as_echo_n "checking for Xft includes... " >&6; } -if ${ac_cv_xft_config_cflags+:} false; then : + 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` + as_ac_Lib=`$as_echo "ac_cv_lib_$gl_lib_1''_glXCreateContext" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glXCreateContext in -l$gl_lib_1" >&5 +$as_echo_n "checking for glXCreateContext in -l$gl_lib_1... " >&6; } +if eval \${$as_ac_Lib+:} false; then : $as_echo_n "(cached) " >&6 else - ac_cv_xft_config_cflags=`$pkg_config --cflags $pkgs` + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$gl_lib_1 $GL_LIBS -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char glXCreateContext (); +int +main () +{ +return glXCreateContext (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_xft_config_cflags" >&5 -$as_echo "$ac_cv_xft_config_cflags" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xft libs" >&5 -$as_echo_n "checking for Xft libs... " >&6; } -if ${ac_cv_xft_config_libs+:} false; then : - $as_echo_n "(cached) " >&6 +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + have_glx=yes else - ac_cv_xft_config_libs=`$pkg_config --libs $pkgs` + have_glx=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_xft_config_libs" >&5 -$as_echo "$ac_cv_xft_config_libs" >&6; } - fi - - ac_xft_config_cflags=$ac_cv_xft_config_cflags - ac_xft_config_libs=$ac_cv_xft_config_libs - if test "$have_xft" = yes; then - # - # we appear to have Xft; check for headers/libs to be sure. - # - ac_save_xft_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $ac_xft_config_cflags" + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" - have_xft=no + # See if EGL functions are in -LGL. + egl_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" - CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - ac_fn_c_check_header_mongrel "$LINENO" "X11/Xft/Xft.h" "ac_cv_header_X11_Xft_Xft_h" "$ac_includes_default" -if test "x$ac_cv_header_X11_Xft_Xft_h" = xyes; then : - have_xft=yes -fi + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" + fi + # note: $X_LIBS includes $x_libraries + LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" - CPPFLAGS="$ac_save_CPPFLAGS" + CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` + LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` + as_ac_Lib=`$as_echo "ac_cv_lib_$gl_lib_1''_eglCreatePlatformWindowSurface" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for eglCreatePlatformWindowSurface in -l$gl_lib_1" >&5 +$as_echo_n "checking for eglCreatePlatformWindowSurface in -l$gl_lib_1... " >&6; } +if eval \${$as_ac_Lib+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$gl_lib_1 $GL_LIBS -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - CPPFLAGS="$ac_save_xft_CPPFLAGS" - fi +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char eglCreatePlatformWindowSurface (); +int +main () +{ +return eglCreatePlatformWindowSurface (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$as_ac_Lib=yes" +else + eval "$as_ac_Lib=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + have_egl=yes +else + have_egl=no +fi - if test "$have_xft" = yes; then - # we have the headers, now check for the libraries - have_xft=no - xft_halfassed=yes + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for Xft usability..." >&5 -$as_echo "checking for Xft usability..." >&6; } + if test "$have_egl" = no; then + # See if EGL functions are in -lEGL. ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -14952,13 +15367,13 @@ $as_echo "checking for Xft usability..." >&6; } CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XftDrawStringUtf8 in -lc" >&5 -$as_echo_n "checking for XftDrawStringUtf8 in -lc... " >&6; } -if ${ac_cv_lib_c_XftDrawStringUtf8+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for eglCreatePlatformWindowSurface in -lEGL" >&5 +$as_echo_n "checking for eglCreatePlatformWindowSurface in -lEGL... " >&6; } +if ${ac_cv_lib_EGL_eglCreatePlatformWindowSurface+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $ac_xft_config_libs -lX11 -lXext -lm $LIBS" +LIBS="-lEGL $GL_LIBS -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -14968,28 +15383,31 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char XftDrawStringUtf8 (); +char eglCreatePlatformWindowSurface (); int main () { -return XftDrawStringUtf8 (); +return eglCreatePlatformWindowSurface (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_XftDrawStringUtf8=yes + ac_cv_lib_EGL_eglCreatePlatformWindowSurface=yes else - ac_cv_lib_c_XftDrawStringUtf8=no + ac_cv_lib_EGL_eglCreatePlatformWindowSurface=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_XftDrawStringUtf8" >&5 -$as_echo "$ac_cv_lib_c_XftDrawStringUtf8" >&6; } -if test "x$ac_cv_lib_c_XftDrawStringUtf8" = xyes; then : - have_xft=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_EGL_eglCreatePlatformWindowSurface" >&5 +$as_echo "$ac_cv_lib_EGL_eglCreatePlatformWindowSurface" >&6; } +if test "x$ac_cv_lib_EGL_eglCreatePlatformWindowSurface" = xyes; then : + have_egl=yes + egl_lib="EGL" +else + have_egl=no fi CPPFLAGS="$ac_save_CPPFLAGS" @@ -14998,53 +15416,67 @@ fi fi - if test "$have_xft" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for Xft usability... no" >&5 -$as_echo "checking for Xft usability... no" >&6; } + # If both GLX and EGL exist, use GLX only if requested. + if test "$with_glx" = yes -a "$have_glx" = yes; then + have_egl=no fi -fi -if test "$have_xft" = yes; then - INCLUDES="$INCLUDES $ac_xft_config_cflags" - XFT_LIBS="$ac_xft_config_libs" - XFT_SRCS='' - XFT_OBJS='' - $as_echo "#define HAVE_XFT 1" >>confdefs.h + if test "$have_egl" = yes; then + $as_echo "#define HAVE_EGL 1" >>confdefs.h + + if test \! -z "$egl_lib"; then + GL_LIBS="-l$egl_lib $GL_LIBS" + fi + fi + + # One of them is required + if test "$have_egl" = no -a "$have_glx" = no; then + have_gl=no + gl_halfassed=yes + fi + + # --with-gles means that we are emulating a system that supports GLES but + # does not support OpenGL 1.3 (e.g., using Linux to simulate an Android-like + # environment). On such a system, GLE is required and GLX wouldn't exist. + # There is no way to request a GLES 3.0 runtime context using GLX. + # + if test "$have_jwzgles" = yes -a "$have_egl" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Using --with-glx and --with-gles together is a bad idea." >&5 +$as_echo "$as_me: WARNING: Using --with-glx and --with-gles together is a bad idea." >&2;} + fi -else - XFT_LIBS='' - XFT_SRCS='$(UTILS_SRC)/xft.c' - XFT_OBJS='$(UTILS_BIN)/xft.o' fi +# Restore flags after testing OpenGL libraries. +# +CFLAGS="$ac_save_pthreads_CFLAGS" +LIBS="$ac_save_pthreads_LIBS" ############################################################################### # -# Check for -lsystemd +# Check for -lgle. # ############################################################################### -have_systemd=no -with_systemd_req=unspecified -systemd_halfassed=no +have_gle=no +with_gle_req=unspecified +gle_halfassed=no -# Check whether --with-systemd was given. -if test "${with_systemd+set}" = set; then : - withval=$with_systemd; with_systemd="$withval"; with_systemd_req="$withval" +# Check whether --with-gle was given. +if test "${with_gle+set}" = set; then : + withval=$with_gle; with_gle="$withval"; with_gle_req="$withval" else - with_systemd=yes + with_gle=yes fi - - - case "$with_systemd" in + case "$with_gle" in yes) ;; no) ;; /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for systemd headers" >&5 -$as_echo_n "checking for systemd headers... " >&6; } - d=$with_systemd/include + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLE headers" >&5 +$as_echo_n "checking for GLE headers... " >&6; } + d=$with_gle/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -15054,9 +15486,9 @@ $as_echo "$d" >&6; } $as_echo "not found ($d: no such directory)" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for systemd libs" >&5 -$as_echo_n "checking for systemd libs... " >&6; } - d=$with_systemd/lib + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLE libs" >&5 +$as_echo_n "checking for GLE libs... " >&6; } + d=$with_gle/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -15067,89 +15499,229 @@ $as_echo "not found ($d: no such directory)" >&6; } fi # replace the directory string with "yes". - with_systemd_req="yes" - with_systemd=$with_systemd_req + with_gle_req="yes" + with_gle=$with_gle_req ;; *) echo "" - echo "error: argument to --with-systemd must be \"yes\", \"no\", or a directory." + echo "error: argument to --with-gle must be \"yes\", \"no\", or a directory." echo " If it is a directory, then \`DIR/include' will be added to" echo " the -I list, and \`DIR/lib' will be added to the -L list." exit 1 ;; esac +GLE_LIBS="" -if test "$with_systemd" != yes -a "$with_systemd" != no ; then - echo "error: must be yes or no: --with-systemd=$with_systemd" - exit 1 +if test "$have_gl" = no ; then + true +elif test "$with_gle" = yes; then + + 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_fn_c_check_header_compile "$LINENO" "GL/gle.h" "ac_cv_header_GL_gle_h" "#include +" +if test "x$ac_cv_header_GL_gle_h" = xyes; then : + have_gle3=yes +else + have_gle3=no fi -if test "$with_systemd" = yes; then + CPPFLAGS="$ac_save_CPPFLAGS" + if test "$have_gle3" = yes ; then + have_gle=yes; + else + + 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_fn_c_check_header_compile "$LINENO" "GL/gutil.h" "ac_cv_header_GL_gutil_h" "#include +" +if test "x$ac_cv_header_GL_gutil_h" = xyes; then : + have_gle=yes +else + have_gle=no +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + if test "$have_gle" = yes ; then + + 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_fn_c_check_header_compile "$LINENO" "GL/tube.h" "ac_cv_header_GL_tube_h" "#include +" +if test "x$ac_cv_header_GL_tube_h" = xyes; then : + have_gle=yes +else + have_gle=no +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + fi + fi + + if test "$have_gle" = yes ; then + have_gle=no + gle_halfassed=yes + + 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" - pkgs='' - ok="yes" - pkg_check_version libsystemd 221 - have_systemd="$ok" + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" + fi + # note: $X_LIBS includes $x_libraries + LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" - if test "$have_systemd" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libsystemd includes" >&5 -$as_echo_n "checking for libsystemd includes... " >&6; } -if ${ac_cv_systemd_config_cflags+:} false; then : + CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` + LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gleCreateGC in -lgle" >&5 +$as_echo_n "checking for gleCreateGC in -lgle... " >&6; } +if ${ac_cv_lib_gle_gleCreateGC+:} false; then : $as_echo_n "(cached) " >&6 else - ac_cv_systemd_config_cflags=`$pkg_config --cflags $pkgs` -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_systemd_config_cflags" >&5 -$as_echo "$ac_cv_systemd_config_cflags" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libsystemd libs" >&5 -$as_echo_n "checking for libsystemd libs... " >&6; } -if ${ac_cv_systemd_config_libs+:} false; then : - $as_echo_n "(cached) " >&6 + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgle $GL_LIBS -lX11 -lXext -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gleCreateGC (); +int +main () +{ +return gleCreateGC (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gle_gleCreateGC=yes else - ac_cv_systemd_config_libs=`$pkg_config --libs $pkgs` + ac_cv_lib_gle_gleCreateGC=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gle_gleCreateGC" >&5 +$as_echo "$ac_cv_lib_gle_gleCreateGC" >&6; } +if test "x$ac_cv_lib_gle_gleCreateGC" = xyes; then : + have_gle=yes; gle_halfassed=no; GLE_LIBS="-lgle" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_systemd_config_libs" >&5 -$as_echo "$ac_cv_systemd_config_libs" >&6; } - fi - ac_systemd_config_cflags=$ac_cv_systemd_config_cflags - ac_systemd_config_libs=$ac_cv_systemd_config_libs + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" - if test "$have_systemd" = yes; then - # - # we appear to have libsystemd; check for headers/libs to be sure. - # - ac_save_systemd_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $ac_systemd_config_cflags" + fi + if test "$have_gle" = yes ; then + have_gle=no + gle_halfassed=yes - have_systemd=no + # sometimes the libmatrix stuff is included in libgle. look there first. +# +# I don't get it. For some reason, this test passes on SGI, as if +# uview_direction_d() was in libgle -- but it's not, it's in libmatrix. +# Yet the link is succeeding. Why??? +# +# AC_CHECK_X_LIB(gle, uview_direction_d, +# [have_gle=yes; gle_halfassed=no], +# [], $GL_LIBS -lX11 -lXext -lm) + + # As of GLE 3 this is in libgle, and has changed name to uview_direction! + # *sigh* + if test "$have_gle3" = yes ; then 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" - CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - ac_fn_c_check_header_mongrel "$LINENO" "systemd/sd-bus.h" "ac_cv_header_systemd_sd_bus_h" "$ac_includes_default" -if test "x$ac_cv_header_systemd_sd_bus_h" = xyes; then : - have_systemd=yes -fi + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" + fi + # note: $X_LIBS includes $x_libraries + LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" - CPPFLAGS="$ac_save_CPPFLAGS" + CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` + LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uview_direction in -lgle" >&5 +$as_echo_n "checking for uview_direction in -lgle... " >&6; } +if ${ac_cv_lib_gle_uview_direction+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgle $GL_LIBS -lX11 -lXext -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - CPPFLAGS="$ac_save_systemd_CPPFLAGS" - fi +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char uview_direction (); +int +main () +{ +return uview_direction (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gle_uview_direction=yes +else + ac_cv_lib_gle_uview_direction=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gle_uview_direction" >&5 +$as_echo "$ac_cv_lib_gle_uview_direction" >&6; } +if test "x$ac_cv_lib_gle_uview_direction" = xyes; then : + have_gle=yes; gle_halfassed=no +fi - if test "$have_systemd" = yes; then - # we have the headers, now check for the libraries - have_systemd=no - systemd_halfassed=yes + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for libsystemd usability..." >&5 -$as_echo "checking for libsystemd usability..." >&6; } + fi + # if it wasn't in libgle, then look in libmatrix. + if test "$have_gle" = no ; then ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -15169,13 +15741,13 @@ $as_echo "checking for libsystemd usability..." >&6; } CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sd_bus_open_system in -lc" >&5 -$as_echo_n "checking for sd_bus_open_system in -lc... " >&6; } -if ${ac_cv_lib_c_sd_bus_open_system+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uview_direction_d in -lmatrix" >&5 +$as_echo_n "checking for uview_direction_d in -lmatrix... " >&6; } +if ${ac_cv_lib_matrix_uview_direction_d+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $ac_systemd_config_libs -lX11 -lXext -lm $LIBS" +LIBS="-lmatrix $GL_LIBS -lX11 -lXext -lm $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -15185,142 +15757,139 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char sd_bus_open_system (); +char uview_direction_d (); int main () { -return sd_bus_open_system (); +return uview_direction_d (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_sd_bus_open_system=yes + ac_cv_lib_matrix_uview_direction_d=yes else - ac_cv_lib_c_sd_bus_open_system=no + ac_cv_lib_matrix_uview_direction_d=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_sd_bus_open_system" >&5 -$as_echo "$ac_cv_lib_c_sd_bus_open_system" >&6; } -if test "x$ac_cv_lib_c_sd_bus_open_system" = xyes; then : - have_systemd=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_matrix_uview_direction_d" >&5 +$as_echo "$ac_cv_lib_matrix_uview_direction_d" >&6; } +if test "x$ac_cv_lib_matrix_uview_direction_d" = xyes; then : + have_gle=yes; gle_halfassed=no; + GLE_LIBS="$GLE_LIBS -lmatrix" fi CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" + fi fi - if test "$have_systemd" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for libsystemd usability... no" >&5 -$as_echo "checking for libsystemd usability... no" >&6; } + if test "$have_gle" = yes ; then + $as_echo "#define HAVE_GLE 1" >>confdefs.h + + if test "$have_gle3" = yes ; then + $as_echo "#define HAVE_GLE3 1" >>confdefs.h + + fi fi -fi -if test "$have_systemd" = yes; then - INCLUDES="$INCLUDES $ac_systemd_config_cflags" - EXES_SYSTEMD='$(EXES_SYSTEMD)' - $as_echo "#define HAVE_LIBSYSTEMD 1" >>confdefs.h +elif test "$with_gle" != no; then + echo "error: must be yes or no: --with-gle=$with_gle" + exit 1 -else - EXES_SYSTEMD='' fi - ############################################################################### # -# Check for pty support: this allows 'phosphor' and 'apple2' -# to run curses-based programs, or be used as terminal windows. +# Check for -ljpeg # ############################################################################### -PTY_LIBS= -for ac_header in pty.h util.h sys/termios.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +have_jpeg=no +with_jpeg_req=unspecified +jpeg_halfassed=no + +# Check whether --with-jpeg was given. +if test "${with_jpeg+set}" = set; then : + withval=$with_jpeg; with_jpeg="$withval"; with_jpeg_req="$withval" +else + with_jpeg=yes +fi + + case "$with_jpeg" in + yes) ;; + no) ;; + + /*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JPEG headers" >&5 +$as_echo_n "checking for JPEG headers... " >&6; } + d=$with_jpeg/include + if test -d $d; then + X_CFLAGS="-I$d $X_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JPEG libs" >&5 +$as_echo_n "checking for JPEG libs... " >&6; } + d=$with_jpeg/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + # replace the directory string with "yes". + with_jpeg_req="yes" + with_jpeg=$with_jpeg_req + ;; + + *) + echo "" + echo "error: argument to --with-jpeg must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac +if test "$with_jpeg" != yes -a "$with_jpeg" != no ; then + echo "error: must be yes or no: --with-jpeg=$with_jpeg" + exit 1 fi -done +if test "$with_jpeg" = yes; then + have_jpeg=no 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` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lutil" >&5 -$as_echo_n "checking for forkpty in -lutil... " >&6; } -if ${ac_cv_lib_util_forkpty+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lutil $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char forkpty (); -int -main () -{ -return forkpty (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_util_forkpty=yes -else - ac_cv_lib_util_forkpty=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_forkpty" >&5 -$as_echo "$ac_cv_lib_util_forkpty" >&6; } -if test "x$ac_cv_lib_util_forkpty" = xyes; then : - PTY_LIBS="-lutil" - ac_have_forkpty=yes - $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h - + ac_fn_c_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default" +if test "x$ac_cv_header_jpeglib_h" = xyes; then : + have_jpeg=yes fi CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" -# LIBS="$ac_save_LIBS" - -if test "$ac_have_forkpty" != yes ; then - # we don't need (or have) -lutil on MacOS 10.4.2... + if test "$have_jpeg" = yes; then + # we have the header, now check for the library + have_jpeg=no + jpeg_halfassed=yes ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -15340,13 +15909,13 @@ if test "$ac_have_forkpty" != yes ; then CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lc" >&5 -$as_echo_n "checking for forkpty in -lc... " >&6; } -if ${ac_cv_lib_c_forkpty+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_start_compress in -ljpeg" >&5 +$as_echo_n "checking for jpeg_start_compress in -ljpeg... " >&6; } +if ${ac_cv_lib_jpeg_jpeg_start_compress+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $LIBS" +LIBS="-ljpeg $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -15356,29 +15925,31 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char forkpty (); +char jpeg_start_compress (); int main () { -return forkpty (); +return jpeg_start_compress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_forkpty=yes + ac_cv_lib_jpeg_jpeg_start_compress=yes else - ac_cv_lib_c_forkpty=no + ac_cv_lib_jpeg_jpeg_start_compress=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_forkpty" >&5 -$as_echo "$ac_cv_lib_c_forkpty" >&6; } -if test "x$ac_cv_lib_c_forkpty" = xyes; then : - PTY_LIBS="" - $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_start_compress" >&5 +$as_echo "$ac_cv_lib_jpeg_jpeg_start_compress" >&6; } +if test "x$ac_cv_lib_jpeg_jpeg_start_compress" = xyes; then : + have_jpeg=yes + jpeg_halfassed=no + JPEG_LIBS="-ljpeg" + $as_echo "#define HAVE_JPEGLIB 1" >>confdefs.h fi @@ -15386,34 +15957,34 @@ fi LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" + fi fi ############################################################################### # -# Check for the XSHM server extension. +# Check for -lpng # ############################################################################### -have_xshm=no -with_xshm_req=unspecified +have_png=no +with_png_req=unspecified +png_halfassed=no -# Check whether --with-xshm-ext was given. -if test "${with_xshm_ext+set}" = set; then : - withval=$with_xshm_ext; with_xshm="$withval"; with_xshm_req="$withval" +# Check whether --with-png was given. +if test "${with_png+set}" = set; then : + withval=$with_png; with_png="$withval"; with_png_req="$withval" else - with_xshm=yes + with_png=yes fi - - - case "$with_xshm" in + case "$with_png" in yes) ;; no) ;; /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XSHM headers" >&5 -$as_echo_n "checking for XSHM headers... " >&6; } - d=$with_xshm/include + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PNG headers" >&5 +$as_echo_n "checking for PNG headers... " >&6; } + d=$with_png/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -15423,9 +15994,9 @@ $as_echo "$d" >&6; } $as_echo "not found ($d: no such directory)" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XSHM libs" >&5 -$as_echo_n "checking for XSHM libs... " >&6; } - d=$with_xshm/lib + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PNG libs" >&5 +$as_echo_n "checking for PNG libs... " >&6; } + d=$with_png/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -15436,61 +16007,27 @@ $as_echo "not found ($d: no such directory)" >&6; } fi # replace the directory string with "yes". - with_xshm_req="yes" - with_xshm=$with_xshm_req + with_png_req="yes" + with_png=$with_png_req ;; *) echo "" - echo "error: argument to --with-xshm-ext must be \"yes\", \"no\", or a directory." + echo "error: argument to --with-png must be \"yes\", \"no\", or a directory." echo " If it is a directory, then \`DIR/include' will be added to" echo " the -I list, and \`DIR/lib' will be added to the -L list." exit 1 ;; esac - -if test "$with_xshm" = yes; then - - # first check for Xshm.h. - - 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_fn_c_check_header_compile "$LINENO" "X11/extensions/XShm.h" "ac_cv_header_X11_extensions_XShm_h" "#include -" -if test "x$ac_cv_header_X11_extensions_XShm_h" = xyes; then : - have_xshm=yes -fi - - - CPPFLAGS="$ac_save_CPPFLAGS" - - # if that succeeded, then check for sys/ipc.h. - if test "$have_xshm" = yes; then - have_xshm=no - - 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_fn_c_check_header_mongrel "$LINENO" "sys/ipc.h" "ac_cv_header_sys_ipc_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_ipc_h" = xyes; then : - have_xshm=yes +if test "$with_png" != yes -a "$with_png" != no ; then + echo "error: must be yes or no: --with-png=$with_png" + exit 1 fi +if test "$with_png" = yes; then - CPPFLAGS="$ac_save_CPPFLAGS" - fi - - # if that succeeded, then check for sys/shm.h. - if test "$have_xshm" = yes; then - have_xshm=no + have_png=no ac_save_CPPFLAGS="$CPPFLAGS" if test \! -z "$includedir" ; then @@ -15498,25 +16035,17 @@ fi fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - ac_fn_c_check_header_mongrel "$LINENO" "sys/shm.h" "ac_cv_header_sys_shm_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_shm_h" = xyes; then : - have_xshm=yes + ac_fn_c_check_header_mongrel "$LINENO" "png.h" "ac_cv_header_png_h" "$ac_includes_default" +if test "x$ac_cv_header_png_h" = xyes; then : + have_png=yes fi - CPPFLAGS="$ac_save_CPPFLAGS" - fi - # AIX is pathological, as usual: apparently it's normal for the Xshm headers - # to exist, but the library code to not exist. And even better, the library - # code is in its own library: libXextSam.a. So, if we're on AIX, and that - # lib doesn't exist, give up. (This lib gets added to X_EXTRA_LIBS, and - # that's not quite right, but close enough.) - # - case "$host" in - *-aix*) - if `uname -v` -eq 3 ; then - have_xshm=no + if test "$have_png" = yes; then + # we have the header, now check for the library + have_png=no + png_halfassed=yes ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -15536,13 +16065,13 @@ fi CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XShmQueryExtension in -lXextSam" >&5 -$as_echo_n "checking for XShmQueryExtension in -lXextSam... " >&6; } -if ${ac_cv_lib_XextSam_XShmQueryExtension+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_create_read_struct in -lpng" >&5 +$as_echo_n "checking for png_create_read_struct in -lpng... " >&6; } +if ${ac_cv_lib_png_png_create_read_struct+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lXextSam -lX11 -lXext -lm $LIBS" +LIBS="-lpng $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -15552,78 +16081,80 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char XShmQueryExtension (); +char png_create_read_struct (); int main () { -return XShmQueryExtension (); +return png_create_read_struct (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_XextSam_XShmQueryExtension=yes + ac_cv_lib_png_png_create_read_struct=yes else - ac_cv_lib_XextSam_XShmQueryExtension=no + ac_cv_lib_png_png_create_read_struct=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_XextSam_XShmQueryExtension" >&5 -$as_echo "$ac_cv_lib_XextSam_XShmQueryExtension" >&6; } -if test "x$ac_cv_lib_XextSam_XShmQueryExtension" = xyes; then : - have_xshm=yes; X_EXTRA_LIBS="$X_EXTRA_LIBS -lXextSam" -else - true -fi - - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" -# LIBS="$ac_save_LIBS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_create_read_struct" >&5 +$as_echo "$ac_cv_lib_png_png_create_read_struct" >&6; } +if test "x$ac_cv_lib_png_png_create_read_struct" = xyes; then : + have_png=yes + png_halfassed=no + PNG_LIBS="-lpng" + $as_echo "#define HAVE_LIBPNG 1" >>confdefs.h - fi - ;; - esac +fi - # if that succeeded, then we've really got it. - if test "$have_xshm" = yes; then - $as_echo "#define HAVE_XSHM_EXTENSION 1" >>confdefs.h + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" fi - -elif test "$with_xshm" != no; then - echo "error: must be yes or no: --with-xshm-ext=$with_xshm" - exit 1 fi - ############################################################################### # -# Check for the DOUBLE-BUFFER server extension. +# Check for -lgdk_pixbuf. +# These tests are for gdk_pixbuf usage of the hacks, +# not xscreensaver-settings (thus we have to test again to get +# the libraries right: don't want to pull in all of GTK +# for the hacks.) # ############################################################################### -have_xdbe=no -with_xdbe_req=unspecified +have_gdk_pixbuf=no +with_gdk_pixbuf_req=unspecified -# Check whether --with-xdbe-ext was given. -if test "${with_xdbe_ext+set}" = set; then : - withval=$with_xdbe_ext; with_xdbe="$withval"; with_xdbe_req="$withval" +# Check whether --with-pixbuf was given. +if test "${with_pixbuf+set}" = set; then : + withval=$with_pixbuf; with_gdk_pixbuf="$withval"; with_gdk_pixbuf_req="$withval" else - with_xdbe=yes + with_gdk_pixbuf=yes fi +# if --with-pixbuf=/directory/ was specified, remember that directory so that +# we can also look for the `gdk-pixbuf-config' program in that directory. +case "$with_gdk_pixbuf" in + /*) + gdk_pixbuf_dir="$with_gdk_pixbuf" + ;; + *) + gdk_pixbuf_dir="" + ;; +esac - - case "$with_xdbe" in + case "$with_gdk_pixbuf" in yes) ;; no) ;; /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DOUBLE-BUFFER headers" >&5 -$as_echo_n "checking for DOUBLE-BUFFER headers... " >&6; } - d=$with_xdbe/include + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GDK_PIXBUF headers" >&5 +$as_echo_n "checking for GDK_PIXBUF headers... " >&6; } + d=$with_gdk_pixbuf/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -15633,9 +16164,9 @@ $as_echo "$d" >&6; } $as_echo "not found ($d: no such directory)" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DOUBLE-BUFFER libs" >&5 -$as_echo_n "checking for DOUBLE-BUFFER libs... " >&6; } - d=$with_xdbe/lib + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GDK_PIXBUF libs" >&5 +$as_echo_n "checking for GDK_PIXBUF libs... " >&6; } + d=$with_gdk_pixbuf/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -15646,22 +16177,69 @@ $as_echo "not found ($d: no such directory)" >&6; } fi # replace the directory string with "yes". - with_xdbe_req="yes" - with_xdbe=$with_xdbe_req + with_gdk_pixbuf_req="yes" + with_gdk_pixbuf=$with_gdk_pixbuf_req ;; *) echo "" - echo "error: argument to --with-xdbe-ext must be \"yes\", \"no\", or a directory." + echo "error: argument to --with-pixbuf must be \"yes\", \"no\", or a directory." echo " If it is a directory, then \`DIR/include' will be added to" echo " the -I list, and \`DIR/lib' will be added to the -L list." exit 1 ;; esac +if test "$with_gdk_pixbuf" != yes -a "$with_gdk_pixbuf" != no ; then + echo "error: must be yes or no: --with-pixbuf=$with_gdk_pixbuf" + exit 1 +fi -if test "$with_xdbe" = yes; then +if test "$with_gdk_pixbuf" = yes; then + have_gdk_pixbuf=no + + pkgs='' + ok="yes" + + pkg_check_version gdk-pixbuf-2.0 2.0.0 + pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0 + pkg_check_version gio-2.0 2.0.0 + have_gdk_pixbuf="$ok" + + if test "$have_gdk_pixbuf" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk-pixbuf includes" >&5 +$as_echo_n "checking for gdk-pixbuf includes... " >&6; } +if ${ac_cv_gdk_pixbuf_config_cflags+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_gdk_pixbuf_config_cflags=`$pkg_config --cflags $pkgs` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gdk_pixbuf_config_cflags" >&5 +$as_echo "$ac_cv_gdk_pixbuf_config_cflags" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk-pixbuf libs" >&5 +$as_echo_n "checking for gdk-pixbuf libs... " >&6; } +if ${ac_cv_gdk_pixbuf_config_libs+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_gdk_pixbuf_config_libs=`$pkg_config --libs $pkgs` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gdk_pixbuf_config_libs" >&5 +$as_echo "$ac_cv_gdk_pixbuf_config_libs" >&6; } + fi + + ac_gdk_pixbuf_config_cflags=$ac_cv_gdk_pixbuf_config_cflags + ac_gdk_pixbuf_config_libs=$ac_cv_gdk_pixbuf_config_libs + + if test "$have_gdk_pixbuf" = yes; then + # + # we appear to have pixbuf; check for headers/libs to be sure. + # + ac_save_gdk_pixbuf_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $ac_gdk_pixbuf_config_cflags" + + have_gdk_pixbuf=no + # check for header A... ac_save_CPPFLAGS="$CPPFLAGS" if test \! -z "$includedir" ; then @@ -15669,342 +16247,371 @@ if test "$with_xdbe" = yes; then fi CPPFLAGS="$CPPFLAGS $X_CFLAGS" CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xdbe.h" "ac_cv_header_X11_extensions_Xdbe_h" "#include -" -if test "x$ac_cv_header_X11_extensions_Xdbe_h" = xyes; then : - have_xdbe=yes + ac_fn_c_check_header_mongrel "$LINENO" "gdk-pixbuf/gdk-pixbuf.h" "ac_cv_header_gdk_pixbuf_gdk_pixbuf_h" "$ac_includes_default" +if test "x$ac_cv_header_gdk_pixbuf_gdk_pixbuf_h" = xyes; then : + have_gdk_pixbuf=yes fi - CPPFLAGS="$ac_save_CPPFLAGS" - if test "$have_xdbe" = yes; then - $as_echo "#define HAVE_DOUBLE_BUFFER_EXTENSION 1" >>confdefs.h - fi + # if that worked, check for header B... + if test "$have_gdk_pixbuf" = yes; then + have_gdk_pixbuf=no + gdk_pixbuf_halfassed=yes -elif test "$with_xdbe" != no; then - echo "error: must be yes or no: --with-xdbe-ext=$with_xshm" - exit 1 + 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_fn_c_check_header_mongrel "$LINENO" "gdk-pixbuf/gdk-pixbuf-xlib.h" "ac_cv_header_gdk_pixbuf_gdk_pixbuf_xlib_h" "$ac_includes_default" +if test "x$ac_cv_header_gdk_pixbuf_gdk_pixbuf_xlib_h" = xyes; then : + have_gdk_pixbuf=yes + gdk_pixbuf_halfassed=no fi + CPPFLAGS="$ac_save_CPPFLAGS" -############################################################################### -# -# Check for the SGI XReadDisplay server extension. -# -# Note: this has to be down here, rather than up with the other server -# extension tests, so that the output of `configure --help' is in the -# right order. Arrgh! -# -############################################################################### - -have_readdisplay=no -with_readdisplay_req=unspecified + # yay, it has a new name in Gtk 2.x... + if test "$have_gdk_pixbuf" = no; then + have_gdk_pixbuf=no + gdk_pixbuf_halfassed=yes -# Check whether --with-readdisplay was given. -if test "${with_readdisplay+set}" = set; then : - withval=$with_readdisplay; with_readdisplay="$withval"; with_readdisplay_req="$withval" -else - with_readdisplay=yes + 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_fn_c_check_header_mongrel "$LINENO" "gdk-pixbuf-xlib/gdk-pixbuf-xlib.h" "ac_cv_header_gdk_pixbuf_xlib_gdk_pixbuf_xlib_h" "$ac_includes_default" +if test "x$ac_cv_header_gdk_pixbuf_xlib_gdk_pixbuf_xlib_h" = xyes; then : + have_gdk_pixbuf=yes + gdk_pixbuf_halfassed=no fi + CPPFLAGS="$ac_save_CPPFLAGS" + fi + fi + CPPFLAGS="$ac_save_gdk_pixbuf_CPPFLAGS" + fi + if test "$have_gdk_pixbuf" = yes; then + # we have the headers, now check for the libraries + have_gdk_pixbuf=no + gdk_pixbuf_halfassed=yes - case "$with_readdisplay" in - yes) ;; - no) ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for gdk_pixbuf usability..." >&5 +$as_echo "checking for gdk_pixbuf usability..." >&6; } - /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XReadDisplay headers" >&5 -$as_echo_n "checking for XReadDisplay headers... " >&6; } - d=$with_readdisplay/include - if test -d $d; then - X_CFLAGS="-I$d $X_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 -$as_echo "$d" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 -$as_echo "not found ($d: no such directory)" >&6; } - fi + # library A... - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XReadDisplay libs" >&5 -$as_echo_n "checking for XReadDisplay libs... " >&6; } - d=$with_readdisplay/lib - if test -d $d; then - X_LIBS="-L$d $X_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 -$as_echo "$d" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 -$as_echo "not found ($d: no such directory)" >&6; } - fi + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" +# ac_save_LIBS="$LIBS" - # replace the directory string with "yes". - with_readdisplay_req="yes" - with_readdisplay=$with_readdisplay_req - ;; + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + # note: $X_CFLAGS includes $x_includes + CPPFLAGS="$CPPFLAGS $X_CFLAGS" - *) - echo "" - echo "error: argument to --with-readdisplay must be \"yes\", \"no\", or a directory." - echo " If it is a directory, then \`DIR/include' will be added to" - echo " the -I list, and \`DIR/lib' will be added to the -L list." - exit 1 - ;; - esac + 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` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk_pixbuf_new_from_file in -lc" >&5 +$as_echo_n "checking for gdk_pixbuf_new_from_file in -lc... " >&6; } +if ${ac_cv_lib_c_gdk_pixbuf_new_from_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gdk_pixbuf_new_from_file (); +int +main () +{ +return gdk_pixbuf_new_from_file (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_gdk_pixbuf_new_from_file=yes +else + ac_cv_lib_c_gdk_pixbuf_new_from_file=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_gdk_pixbuf_new_from_file" >&5 +$as_echo "$ac_cv_lib_c_gdk_pixbuf_new_from_file" >&6; } +if test "x$ac_cv_lib_c_gdk_pixbuf_new_from_file" = xyes; then : + have_gdk_pixbuf=yes +fi + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" -if test "$with_readdisplay" = yes; then + # library B... + if test "$have_gdk_pixbuf" = yes; then + have_gdk_pixbuf=no 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" - CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` - ac_fn_c_check_header_compile "$LINENO" "X11/extensions/readdisplay.h" "ac_cv_header_X11_extensions_readdisplay_h" "#include -" -if test "x$ac_cv_header_X11_extensions_readdisplay_h" = xyes; then : - $as_echo "#define HAVE_READ_DISPLAY_EXTENSION 1" >>confdefs.h - -fi - - CPPFLAGS="$ac_save_CPPFLAGS" -elif test "$with_readdisplay" != no; then - echo "error: must be yes or no: --with-readdisplay=$with_readdisplay" - exit 1 -fi - - -############################################################################### -# -# Check for a directory full of images to use as the default value -# of the "imageDirectory" preference. -# -############################################################################### - -have_imagedir=no -with_imagedir_req=unspecified + 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` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk_pixbuf_xlib_init in -lc" >&5 +$as_echo_n "checking for gdk_pixbuf_xlib_init in -lc... " >&6; } +if ${ac_cv_lib_c_gdk_pixbuf_xlib_init+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -# Check whether --with-image-directory was given. -if test "${with_image_directory+set}" = set; then : - withval=$with_image_directory; with_imagedir="$withval"; with_imagedir_req="$withval" +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gdk_pixbuf_xlib_init (); +int +main () +{ +return gdk_pixbuf_xlib_init (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_gdk_pixbuf_xlib_init=yes else - with_imagedir=yes + ac_cv_lib_c_gdk_pixbuf_xlib_init=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_gdk_pixbuf_xlib_init" >&5 +$as_echo "$ac_cv_lib_c_gdk_pixbuf_xlib_init" >&6; } +if test "x$ac_cv_lib_c_gdk_pixbuf_xlib_init" = xyes; then : + have_gdk_pixbuf=yes + gdk_pixbuf_halfassed=no fi -# no HANDLE_X_PATH_ARG for this one + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" -case "$with_imagedir" in - /*) - # absolute path - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for image directory $with_imagedir" >&5 -$as_echo_n "checking for image directory $with_imagedir... " >&6; } - if test -d "$with_imagedir" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - with_imagedir="" fi - ;; - yes) - with_imagedir="" - - #### Could use some more defaults here... - for dd in \ - "/usr/share/backgrounds/images/" \ - "/usr/share/wallpapers/" \ - "/Library/Desktop Pictures/" \ - ; do - if test -z "$with_imagedir"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for image directory $dd" >&5 -$as_echo_n "checking for image directory $dd... " >&6; } - if test -d "$dd" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - with_imagedir="$dd" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - fi - done - - ;; - no) - with_imagedir="" - ;; - - *) - echo "error: must be an absolute path: --with-image-directory=$with_imagedir_req" - exit 1 - ;; -esac -ac_cv_imagedir="$with_imagedir" + fi -DEFAULT_IMAGES_P='True' -DEFAULT_IMAGE_DIRECTORY="$ac_cv_imagedir" + if test "$have_gdk_pixbuf" = yes; then + INCLUDES="$INCLUDES $ac_gdk_pixbuf_config_cflags" + PNG_LIBS="$ac_gdk_pixbuf_config_libs" + $as_echo "#define HAVE_GDK_PIXBUF 1" >>confdefs.h -if test -z "$DEFAULT_IMAGE_DIRECTORY" ; then - DEFAULT_IMAGES_P='False' -fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for gdk_pixbuf usability... no" >&5 +$as_echo "checking for gdk_pixbuf usability... no" >&6; } + fi + if test "$have_gdk_pixbuf" = yes; then -############################################################################### -# -# Pick a text file to use as the default of the "textFile" preference. -# Any old file will do, but preferably one that will make interesting -# shapes when displayed by "starwars" and "fontglide". -# -############################################################################### + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" +# ac_save_LIBS="$LIBS" -have_textfile=no -with_textfile_req=unspecified + 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" -# Check whether --with-text-file was given. -if test "${with_text_file+set}" = set; then : - withval=$with_text_file; with_textfile="$withval"; with_textfile_req="$withval" + CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` + LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk_pixbuf_apply_embedded_orientation in -lc" >&5 +$as_echo_n "checking for gdk_pixbuf_apply_embedded_orientation in -lc... " >&6; } +if ${ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation+:} false; then : + $as_echo_n "(cached) " >&6 else - with_textfile=yes -fi - -# no HANDLE_X_PATH_ARG for this one - -case "$with_textfile" in - /*) - # absolute path - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for text file $with_textfile" >&5 -$as_echo_n "checking for text file $with_textfile... " >&6; } - if test -f "$with_textfile" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - with_textfile="" - fi - ;; - yes) - with_textfile="" - - #### Could use some more defaults here... - for f in \ - "/usr/X11R6/lib/X11/doc/README" \ - "/usr/share/doc/xserver-common/copyright" \ - "/usr/share/doc/xserver-xorg-core/copyright" \ - "/usr/X11R6/README" \ - "/usr/share/doc/libX11*/COPYING" \ - "/usr/X11/share/X11/doc/README*" \ - "/usr/share/doc/debian/debian-manifesto" \ - ; do - if test -z "$with_textfile"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for text file $f" >&5 -$as_echo_n "checking for text file $f... " >&6; } - f=`/bin/ls $f 2>&- | head -1` - if test -f "$f" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - with_textfile="$f" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - fi - done + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - ;; - no) - with_textfile="" - ;; +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gdk_pixbuf_apply_embedded_orientation (); +int +main () +{ +return gdk_pixbuf_apply_embedded_orientation (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation=yes +else + ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation" >&5 +$as_echo "$ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation" >&6; } +if test "x$ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation" = xyes; then : + $as_echo "#define HAVE_GDK_PIXBUF_APPLY_EMBEDDED_ORIENTATION 1" >>confdefs.h - *) - echo "error: must be an absolute path: --with-text-file=$with_textfile_req" - exit 1 - ;; -esac -ac_cv_textfile="$with_textfile" +fi -DEFAULT_TEXT_FILE="$ac_cv_textfile" + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + fi +fi ############################################################################### # -# Check the browser to see help URL +# Check for -lXft # ############################################################################### -have_browser=no -with_browser_req=unspecified +have_xutf8drawstring=no + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" +# ac_save_LIBS="$LIBS" -# Check whether --with-browser was given. -if test "${with_browser+set}" = set; then : - withval=$with_browser; with_browser="$withval"; with_browser_req="$withval" + 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` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xutf8DrawString in -lX11" >&5 +$as_echo_n "checking for Xutf8DrawString in -lX11... " >&6; } +if ${ac_cv_lib_X11_Xutf8DrawString+:} false; then : + $as_echo_n "(cached) " >&6 else - with_browser=no + ac_check_lib_save_LIBS=$LIBS +LIBS="-lX11 -lX11 -lXext -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char Xutf8DrawString (); +int +main () +{ +return Xutf8DrawString (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_X11_Xutf8DrawString=yes +else + ac_cv_lib_X11_Xutf8DrawString=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_X11_Xutf8DrawString" >&5 +$as_echo "$ac_cv_lib_X11_Xutf8DrawString" >&6; } +if test "x$ac_cv_lib_X11_Xutf8DrawString" = xyes; then : + have_xutf8drawstring=yes +else + true fi -# no HANDLE_X_PATH_ARG for this one + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" -case "$with_browser" in - no ) - ;; - * ) - WITH_BROWSER=$with_browser - gnome_open_program=$with_browser - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for browser $with_browser" >&5 -$as_echo_n "checking for browser $with_browser... " >&6; } - with_browser_fullpath=`which $with_browser 2>/dev/null` - case $with_browser_fullpath in - /* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_browser=yes - ;; - * ) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -# Only warning: we don't want to install all packages for the -# dependency of the browser in building stage... - echo "WARNING: browser not found: --with-browser=$with_browser" - ;; - esac - ;; -esac -ac_cv_browser="$with_browser" +if test "$have_xutf8drawstring" = yes ; then + $as_echo "#define HAVE_XUTF8DRAWSTRING 1" >>confdefs.h -############################################################################### -# -# Check whether it's ok to install some hacks as setuid (e.g., "sonar") -# This should be safe, but let's give people the option. -# -############################################################################### +fi -setuid_hacks_default=no -setuid_hacks="$setuid_hacks_default" +have_xft=no +with_xft_req=unspecified +xft_halfassed=no -# Check whether --with-setuid-hacks was given. -if test "${with_setuid_hacks+set}" = set; then : - withval=$with_setuid_hacks; setuid_hacks="$withval" +# Check whether --with-xft was given. +if test "${with_xft+set}" = set; then : + withval=$with_xft; with_xft="$withval"; with_xft_req="$withval" else - setuid_hacks="$setuid_hacks_default" + with_xft=yes fi - - - case "$setuid_hacks" in + case "$with_xft" in yes) ;; no) ;; /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setuid hacks headers" >&5 -$as_echo_n "checking for setuid hacks headers... " >&6; } - d=$setuid_hacks/include + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xft headers" >&5 +$as_echo_n "checking for Xft headers... " >&6; } + d=$with_xft/include if test -d $d; then X_CFLAGS="-I$d $X_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -16014,9 +16621,9 @@ $as_echo "$d" >&6; } $as_echo "not found ($d: no such directory)" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setuid hacks libs" >&5 -$as_echo_n "checking for setuid hacks libs... " >&6; } - d=$setuid_hacks/lib + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xft libs" >&5 +$as_echo_n "checking for Xft libs... " >&6; } + d=$with_xft/lib if test -d $d; then X_LIBS="-L$d $X_LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 @@ -16027,158 +16634,259 @@ $as_echo "not found ($d: no such directory)" >&6; } fi # replace the directory string with "yes". - setuid_hacks_req="yes" - setuid_hacks=$setuid_hacks_req + with_xft_req="yes" + with_xft=$with_xft_req ;; *) echo "" - echo "error: argument to --with-setuid-hacks must be \"yes\", \"no\", or a directory." + echo "error: argument to --with-xft must be \"yes\", \"no\", or a directory." echo " If it is a directory, then \`DIR/include' will be added to" echo " the -I list, and \`DIR/lib' will be added to the -L list." exit 1 ;; esac - -if test "$setuid_hacks" = yes; then - true -elif test "$setuid_hacks" != no; then - echo "error: must be yes or no: --with-setuid-hacks=$setuid_hacks" +if test "$with_xft" != yes -a "$with_xft" != no ; then + echo "error: must be yes or no: --with-xft=$with_xft" exit 1 fi +if test "$with_xft" = yes; then -############################################################################### -# -# Check for setcap, which is less worrying than setuid. -# -############################################################################### - -have_libcap=no -setcap_hacks_default=yes -setcap_hacks="$setcap_hacks_default" -setcap_hacks_req=unspecified + pkgs='' + ok="yes" + pkg_check_version xft 2.1.0 + have_xft="$ok" -# Check whether --with-setcap-hacks was given. -if test "${with_setcap_hacks+set}" = set; then : - withval=$with_setcap_hacks; setcap_hacks="$withval"; setcap_hacks_req="$withval" + if test "$have_xft" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xft includes" >&5 +$as_echo_n "checking for Xft includes... " >&6; } +if ${ac_cv_xft_config_cflags+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_xft_config_cflags=`$pkg_config --cflags $pkgs` +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_xft_config_cflags" >&5 +$as_echo "$ac_cv_xft_config_cflags" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xft libs" >&5 +$as_echo_n "checking for Xft libs... " >&6; } +if ${ac_cv_xft_config_libs+:} false; then : + $as_echo_n "(cached) " >&6 else - setcap_hacks=yes + ac_cv_xft_config_libs=`$pkg_config --libs $pkgs` fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_xft_config_libs" >&5 +$as_echo "$ac_cv_xft_config_libs" >&6; } + fi + ac_xft_config_cflags=$ac_cv_xft_config_cflags + ac_xft_config_libs=$ac_cv_xft_config_libs + if test "$have_xft" = yes; then + # + # we appear to have Xft; check for headers/libs to be sure. + # + ac_save_xft_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $ac_xft_config_cflags" - case "$setcap_hacks" in - yes) ;; - no) ;; + have_xft=no - /*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setcap hacks headers" >&5 -$as_echo_n "checking for setcap hacks headers... " >&6; } - d=$setcap_hacks/include - if test -d $d; then - X_CFLAGS="-I$d $X_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 -$as_echo "$d" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 -$as_echo "not found ($d: no such directory)" >&6; } - fi + 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_fn_c_check_header_mongrel "$LINENO" "X11/Xft/Xft.h" "ac_cv_header_X11_Xft_Xft_h" "$ac_includes_default" +if test "x$ac_cv_header_X11_Xft_Xft_h" = xyes; then : + have_xft=yes +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setcap hacks libs" >&5 -$as_echo_n "checking for setcap hacks libs... " >&6; } - d=$setcap_hacks/lib - if test -d $d; then - X_LIBS="-L$d $X_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 -$as_echo "$d" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 -$as_echo "not found ($d: no such directory)" >&6; } - fi + CPPFLAGS="$ac_save_CPPFLAGS" - # replace the directory string with "yes". - setcap_hacks_req="yes" - setcap_hacks=$setcap_hacks_req - ;; + CPPFLAGS="$ac_save_xft_CPPFLAGS" + fi - *) - echo "" - echo "error: argument to --with-setcap-hacks must be \"yes\", \"no\", or a directory." - echo " If it is a directory, then \`DIR/include' will be added to" - echo " the -I list, and \`DIR/lib' will be added to the -L list." - exit 1 - ;; - esac + if test "$have_xft" = yes; then + # we have the headers, now check for the libraries + have_xft=no + xft_halfassed=yes + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for Xft usability..." >&5 +$as_echo "checking for Xft usability..." >&6; } + ac_save_CPPFLAGS="$CPPFLAGS" + ac_save_LDFLAGS="$LDFLAGS" +# ac_save_LIBS="$LIBS" -if test "$setcap_hacks" != yes -a "$setcap_hacks" != no ; then - echo "error: must be yes or no: --with-setcap-hacks=$setcap_hacks" - exit 1 -fi + if test \! -z "$includedir" ; then + CPPFLAGS="$CPPFLAGS -I$includedir" + fi + # note: $X_CFLAGS includes $x_includes + CPPFLAGS="$CPPFLAGS $X_CFLAGS" -if test "$setcap_hacks" = yes; then + if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" + fi + # note: $X_LIBS includes $x_libraries + LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS" - for ac_prog in setcap -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_setcap_program+:} false; then : + CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` + LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XftDrawStringUtf8 in -lc" >&5 +$as_echo_n "checking for XftDrawStringUtf8 in -lc... " >&6; } +if ${ac_cv_lib_c_XftDrawStringUtf8+:} false; then : $as_echo_n "(cached) " >&6 else - if test -n "$setcap_program"; then - ac_cv_prog_setcap_program="$setcap_program" # Let the user override the test. + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $ac_xft_config_libs -lX11 -lXext -lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char XftDrawStringUtf8 (); +int +main () +{ +return XftDrawStringUtf8 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_XftDrawStringUtf8=yes else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_setcap_program="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 + ac_cv_lib_c_XftDrawStringUtf8=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_XftDrawStringUtf8" >&5 +$as_echo "$ac_cv_lib_c_XftDrawStringUtf8" >&6; } +if test "x$ac_cv_lib_c_XftDrawStringUtf8" = xyes; then : + have_xft=yes +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + fi -done - done -IFS=$as_save_IFS + if test "$have_xft" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for Xft usability... no" >&5 +$as_echo "checking for Xft usability... no" >&6; } + fi fi -fi -setcap_program=$ac_cv_prog_setcap_program -if test -n "$setcap_program"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $setcap_program" >&5 -$as_echo "$setcap_program" >&6; } + +if test "$have_xft" = yes; then + INCLUDES="$INCLUDES $ac_xft_config_cflags" + XFT_LIBS="$ac_xft_config_libs" + XFT_SRCS='' + XFT_OBJS='' + $as_echo "#define HAVE_XFT 1" >>confdefs.h + else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + XFT_LIBS='' + XFT_SRCS='$(UTILS_SRC)/xft.c' + XFT_OBJS='$(UTILS_BIN)/xft.o' fi +############################################################################### +# +# Check for pty support: this allows 'phosphor' and 'apple2' +# to run curses-based programs, or be used as terminal windows. +# +############################################################################### + +PTY_LIBS= +for ac_header in pty.h util.h sys/termios.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF - test -n "$setcap_program" && break -done +fi - if test "$setcap_program" != ''; then +done 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` - ac_fn_c_check_header_mongrel "$LINENO" "sys/capability.h" "ac_cv_header_sys_capability_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_capability_h" = xyes; then : - have_setcap=yes + LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lutil" >&5 +$as_echo_n "checking for forkpty in -lutil... " >&6; } +if ${ac_cv_lib_util_forkpty+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lutil $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char forkpty (); +int +main () +{ +return forkpty (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_util_forkpty=yes +else + ac_cv_lib_util_forkpty=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_forkpty" >&5 +$as_echo "$ac_cv_lib_util_forkpty" >&6; } +if test "x$ac_cv_lib_util_forkpty" = xyes; then : + PTY_LIBS="-lutil" + ac_have_forkpty=yes + $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h +fi CPPFLAGS="$ac_save_CPPFLAGS" - fi - if test "$have_setcap" = yes; then + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + +if test "$ac_have_forkpty" != yes ; then + # we don't need (or have) -lutil on macOS 10.4.2... ac_save_CPPFLAGS="$CPPFLAGS" ac_save_LDFLAGS="$LDFLAGS" @@ -16198,13 +16906,13 @@ fi CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS` LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cap_set_flag in -lcap" >&5 -$as_echo_n "checking for cap_set_flag in -lcap... " >&6; } -if ${ac_cv_lib_cap_cap_set_flag+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lc" >&5 +$as_echo_n "checking for forkpty in -lc... " >&6; } +if ${ac_cv_lib_c_forkpty+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lcap $LIBS" +LIBS="-lc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -16214,42 +16922,149 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char cap_set_flag (); +char forkpty (); int main () { -return cap_set_flag (); +return forkpty (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_cap_cap_set_flag=yes + ac_cv_lib_c_forkpty=yes else - ac_cv_lib_cap_cap_set_flag=no + ac_cv_lib_c_forkpty=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cap_cap_set_flag" >&5 -$as_echo "$ac_cv_lib_cap_cap_set_flag" >&6; } -if test "x$ac_cv_lib_cap_cap_set_flag" = xyes; then : - have_libcap=yes - PROG_SETCAP="$setcap_program" - LIBCAP_LIBS="-lcap" - $as_echo "#define HAVE_LIBCAP 1" >>confdefs.h +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_forkpty" >&5 +$as_echo "$ac_cv_lib_c_forkpty" >&6; } +if test "x$ac_cv_lib_c_forkpty" = xyes; then : + PTY_LIBS="" + $as_echo "#define HAVE_FORKPTY 1" >>confdefs.h + +fi + + CPPFLAGS="$ac_save_CPPFLAGS" + LDFLAGS="$ac_save_LDFLAGS" +# LIBS="$ac_save_LIBS" + +fi + +############################################################################### +# +# Check for libcap, which allows "sonar" to work without setuid. +# Except, nevermind, that's bad. See comments in sonar-icmp.c. +# +############################################################################### + +have_libcap=no +setcap_hacks_default=no +setcap_hacks="$setcap_hacks_default" +setcap_hacks_req=unspecified + +#AC_ARG_WITH(setcap-hacks, +#[ --with-setcap-hacks Build the "sonar" demo with libcap, which allows +# it to ping other hosts without being setuid.], +# [setcap_hacks="$withval"; setcap_hacks_req="$withval"], +# [setcap_hacks=yes]) +# +#HANDLE_X_PATH_ARG(setcap_hacks, --with-setcap-hacks, setcap hacks) +# +#if test "$setcap_hacks" != yes -a "$setcap_hacks" != no ; then +# echo "error: must be yes or no: --with-setcap-hacks=$setcap_hacks" +# exit 1 +#fi +# +#if test "$setcap_hacks" = yes; then +# +# AC_CHECK_PROGS(setcap_program, setcap) +# if test "$setcap_program" != ''; then +# AC_CHECK_X_HEADER(sys/capability.h, [have_setcap=yes]) +# fi +# if test "$have_setcap" = yes; then +# AC_CHECK_X_LIB(cap, cap_set_flag, +# [have_libcap=yes +# PROG_SETCAP="$setcap_program" +# LIBCAP_LIBS="-lcap" +# AC_DEFINE(HAVE_LIBCAP)]) +# fi +#fi + +############################################################################### +# +# Sonar must be setuid to be able to ping other hosts. +# +############################################################################### + +if test "$have_libcap" = yes; then + setuid_hacks_default=no +else + setuid_hacks_default=yes +fi + +setuid_hacks="$setuid_hacks_default" + +# Check whether --with-setuid-hacks was given. +if test "${with_setuid_hacks+set}" = set; then : + withval=$with_setuid_hacks; setuid_hacks="$withval" +else + setuid_hacks="$setuid_hacks_default" +fi + + case "$setuid_hacks" in + yes) ;; + no) ;; + + /*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setuid hacks headers" >&5 +$as_echo_n "checking for setuid hacks headers... " >&6; } + d=$setuid_hacks/include + if test -d $d; then + X_CFLAGS="-I$d $X_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setuid hacks libs" >&5 +$as_echo_n "checking for setuid hacks libs... " >&6; } + d=$setuid_hacks/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5 +$as_echo "$d" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5 +$as_echo "not found ($d: no such directory)" >&6; } + fi -fi + # replace the directory string with "yes". + setuid_hacks_req="yes" + setuid_hacks=$setuid_hacks_req + ;; - CPPFLAGS="$ac_save_CPPFLAGS" - LDFLAGS="$ac_save_LDFLAGS" -# LIBS="$ac_save_LIBS" + *) + echo "" + echo "error: argument to --with-setuid-hacks must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac - fi +if test "$setuid_hacks" = yes; then + true +elif test "$setuid_hacks" != no; then + echo "error: must be yes or no: --with-setuid-hacks=$setuid_hacks" + exit 1 fi - ############################################################################### # # Check for --with-record-animation @@ -16266,8 +17081,6 @@ else record_anim="$record_anim_default" fi - - case "$record_anim" in yes) ;; no) ;; @@ -16311,7 +17124,6 @@ $as_echo "not found ($d: no such directory)" >&6; } ;; esac - if test "$record_anim" = yes; then true elif test "$record_anim" != no; then @@ -16343,7 +17155,6 @@ DEPEND=makedepend DEPEND_FLAGS= DEPEND_DEFINES= - if test \! -z "$includedir" ; then INCLUDES="$INCLUDES -I$includedir" fi @@ -16352,19 +17163,17 @@ if test \! -z "$libdir" ; then LDFLAGS="$LDFLAGS -L$libdir" fi - PREFERRED_DEMO_PROGRAM='' ALL_DEMO_PROGRAMS= if test "$have_motif" = yes; then - PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Xm + PREFERRED_DEMO_PROGRAM=xscreensaver-settings-Xm ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS" fi if test "$have_gtk" = yes; then - PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Gtk + PREFERRED_DEMO_PROGRAM=xscreensaver-settings-Gtk ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS" fi - if test "$have_kerberos" = yes; then PASSWD_SRCS="$PASSWD_SRCS \$(KERBEROS_SRCS)" PASSWD_OBJS="$PASSWD_OBJS \$(KERBEROS_OBJS)" @@ -16379,14 +17188,13 @@ if test "$enable_pam_check_account_type" = yes; then else COMMENT_PAM_CHECK_ACCOUNT="#" fi -if test "$have_passwd_helper" = yes; then - PASSWD_SRCS="$PASSWD_SRCS \$(PWHELPER_SRCS)" - PASSWD_OBJS="$PASSWD_OBJS \$(PWHELPER_OBJS)" -fi +#if test "$have_passwd_helper" = yes; then +# PASSWD_SRCS="$PASSWD_SRCS \$(PWHELPER_SRCS)" +# PASSWD_OBJS="$PASSWD_OBJS \$(PWHELPER_OBJS)" +#fi PASSWD_SRCS="$PASSWD_SRCS \$(PWENT_SRCS)" PASSWD_OBJS="$PASSWD_OBJS \$(PWENT_OBJS)" - if test "$enable_locking" = yes; then LOCK_SRCS='$(LOCK_SRCS_1) $(PASSWD_SRCS)' LOCK_OBJS='$(LOCK_OBJS_1) $(PASSWD_OBJS)' @@ -16405,13 +17213,10 @@ else MEN_OSX= fi - -INSTALL_SETUID='$(INSTALL_PROGRAM) $(SUID_FLAGS)' - -if test "$need_setuid" = yes; then - NEED_SETUID=yes +if test "$setuid_auth" = yes; then + SETUID_AUTH=yes else - NEED_SETUID=no + SETUID_AUTH=no fi if test "$setuid_hacks" = yes; then @@ -16449,7 +17254,6 @@ if test "$have_jpeg" = yes -a "$have_gdk_pixbuf" = yes; then JPEG_EXES='$(JPEG_EXES)' fi - # Another substitution in the XScreenSaver.ad.in file: # if test "$gnome_open_program" != ''; then @@ -16466,7 +17270,6 @@ else NOGNOME='' fi - # Set PO_DATADIR to something sensible. # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for locale directory" >&5 @@ -16491,9 +17294,9 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PO_DATADIR/locale" >&5 $as_echo "$PO_DATADIR/locale" >&6; } - # canonicalize slashes. HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'` +FONT_DIR=`echo "${FONT_DIR}" | sed 's@/$@@;s@//*@/@g'` # gcc 3.0 likes to issue this warning for every file: # @@ -16505,101 +17308,15 @@ HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'` # INCLUDES=`echo "$INCLUDES" | sed 's@ -I${prefix}/include@@g;'` - ############################################################################### # # Perform substitutions and write Makefiles. # ############################################################################### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - APPDEFAULTS=$ac_x_app_defaults - - - - - - -ac_config_files="$ac_config_files Makefile utils/Makefile jwxyz/Makefile hacks/Makefile hacks/images/Makefile hacks/glx/Makefile po/Makefile.in driver/Makefile driver/xscreensaver.pam driver/xscreensaver-demo.glade2 driver/XScreenSaver.ad" +ac_config_files="$ac_config_files Makefile utils/Makefile jwxyz/Makefile hacks/Makefile hacks/fonts/Makefile hacks/images/Makefile hacks/glx/Makefile po/Makefile.in driver/Makefile driver/xscreensaver.pam driver/XScreenSaver.ad" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -16709,12 +17426,8 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs - - ac_config_commands="$ac_config_commands po/stamp-it" - - : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files @@ -16759,7 +17472,6 @@ else esac fi - as_nl=' ' export as_nl @@ -16807,7 +17519,6 @@ if test "${PATH_SEPARATOR+set}" != set; then } fi - # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. @@ -16861,7 +17572,6 @@ export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH - # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are @@ -16878,7 +17588,6 @@ as_fn_error () as_fn_exit $as_status } # as_fn_error - # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -16940,7 +17649,6 @@ else } fi # as_fn_arith - if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -17026,7 +17734,6 @@ fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null - # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. @@ -17072,7 +17779,6 @@ $as_echo X"$as_dir" | test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' @@ -17081,7 +17787,6 @@ else as_mkdir_p=false fi - # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. @@ -17098,7 +17803,6 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## @@ -17133,7 +17837,6 @@ case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac - cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" @@ -17295,7 +17998,6 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # INIT-COMMANDS # - _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 @@ -17310,12 +18012,12 @@ do "utils/Makefile") CONFIG_FILES="$CONFIG_FILES utils/Makefile" ;; "jwxyz/Makefile") CONFIG_FILES="$CONFIG_FILES jwxyz/Makefile" ;; "hacks/Makefile") CONFIG_FILES="$CONFIG_FILES hacks/Makefile" ;; + "hacks/fonts/Makefile") CONFIG_FILES="$CONFIG_FILES hacks/fonts/Makefile" ;; "hacks/images/Makefile") CONFIG_FILES="$CONFIG_FILES hacks/images/Makefile" ;; "hacks/glx/Makefile") CONFIG_FILES="$CONFIG_FILES hacks/glx/Makefile" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "driver/Makefile") CONFIG_FILES="$CONFIG_FILES driver/Makefile" ;; "driver/xscreensaver.pam") CONFIG_FILES="$CONFIG_FILES driver/xscreensaver.pam" ;; - "driver/xscreensaver-demo.glade2") CONFIG_FILES="$CONFIG_FILES driver/xscreensaver-demo.glade2" ;; "driver/XScreenSaver.ad") CONFIG_FILES="$CONFIG_FILES driver/XScreenSaver.ad" ;; "po/stamp-it") CONFIG_COMMANDS="$CONFIG_COMMANDS po/stamp-it" ;; @@ -17323,7 +18025,6 @@ do esac done - # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely @@ -17366,7 +18067,6 @@ ac_tmp=$tmp # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then - ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this @@ -17384,7 +18084,6 @@ fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF - { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && @@ -17627,7 +18326,6 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" - eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag @@ -17755,7 +18453,6 @@ case $srcdir in esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - case $ac_mode in :F) # @@ -17871,7 +18568,6 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac - case $ac_file$ac_mode in "default-1":C) case "$CONFIG_FILES" in *po/Makefile.in*) sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile @@ -17900,7 +18596,6 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} esac done # for ac_tag - as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save @@ -17908,7 +18603,6 @@ ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open @@ -17934,7 +18628,6 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi - ############################################################################### # # Print some warnings at the end. @@ -17990,7 +18683,6 @@ noteL() { warn_prefix="$warn_prefix_1" } - # ac_prog_cc_no_pthread normally only happens on AIX, because according # to AX_PTHREAD, AIX needs CC=xlc_r or CC=cc_r to do threads. # If CC is specified, it takes precedence over --with-pthread. @@ -18011,6 +18703,10 @@ if test "$with_xidle_req" = yes -a "$have_xidle" = no ; then warn 'The XIdle extension was requested, but was not found.' fi +if test "$with_mit_req" = yes -a "$have_mit" = no ; then + warn 'The MIT-SCREEN-SAVER extension was requested, but was not found.' +fi + if test "$with_xshm_req" = yes -a "$have_xshm" = no ; then warn 'The XSHM extension was requested, but was not found.' fi @@ -18019,6 +18715,14 @@ if test "$with_xdbe_req" = yes -a "$have_xdbe" = no ; then warn 'The DOUBLE-BUFFER extension was requested, but was not found.' fi +#if test "$with_xcomposite_req" = yes -a "$have_xcomposite" = no ; then +# warn 'The XCOMPOSITE extension was requested, but was not found.' +#fi + +if test "$with_xkb_req" = yes -a "$have_xkb" = no ; then + warn 'The X Keyboard extension was requested, but was not found.' +fi + if test "$with_sgivc_req" = yes -a "$have_sgivc" = no ; then warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.' fi @@ -18058,21 +18762,13 @@ else fi if test "$gtk_halfassed" != no ; then - warnL "GTK version $gtk_halfassed was found, but at least one supporting" - warn2 "library ($gtk_halfassed_lib) was not, so GTK can't be used." - warn2 "Perhaps some of the development packages are not installed?" - if test "$have_gtk" = yes ; then - v="$ac_gtk_version_string" - warn2 "GTK $v is also installed, so it will be used instead." - warn2 "Please read the above output and the \`config.log' file" - warn2 "for more details." - fi + warnL "GTK was found, but $gtk_halfassed_lib was not, so GTK can't be used." fi motif_warn2() { warn2 'Though the Motif front-end to xscreensaver is still' warn2 'maintained, it is no longer being updated with new' - warn2 'features: all new development on the xscreensaver-demo' + warn2 'features: all new development on the xscreensaver-settings' warn2 'program is happening in the GTK version, and not in the' warn2 'Motif version. It is recommended that you build against' warn2 'GTK instead of Motif. See .' @@ -18082,12 +18778,12 @@ if test "$have_motif" = no -a "$have_gtk" = no; then if test "$with_motif" = yes; then warnL "Neither the GTK nor Motif libraries were found; the" - warn2 "\`xscreensaver-demo' program requires one of these." + warn2 "\`xscreensaver-settings' program requires one of these." echo '' motif_warn2 else warnL "The GTK libraries do not seem to be available; the" - warn2 "\`xscreensaver-demo' program requires them." + warn2 "\`xscreensaver-settings' program requires them." # echo '' # warn2 'You can use Motif or Lesstif instead of GTK (use the' # warn2 "\`--with-motif' option) but that is NOT recommended." @@ -18098,25 +18794,13 @@ elif test "$with_motif_req" = yes -a "$have_motif" = no ; then warnL "Use of Motif was requested, but it wasn't found;" warn2 "Gtk will be used instead." -elif test "$jurassic_gtk" = yes ; then - - pref_gtk=2.0 - - v="$ac_gtk_version_string" - if test "$with_gtk_req" = yes -a "$ac_gtk_version" = "unknown" ; then - warnL "Use of Gtk was requested, but its version number is unknown;" - elif test "$with_gtk_req" = yes ; then - warnL "Use of Gtk was requested, but it is version $v;" - else - warnL "Gtk was found on this system, but it is version $v;" - fi - - warn2 "Gtk $pref_gtk or newer is required." - elif test "$with_gtk_req" = yes -a "$have_gtk" = no ; then warnL "Use of Gtk was requested, but it wasn't found." fi +if test "$ac_cv_libxt" != yes ; then + warnL 'The Xt library was not found. It is required.' +fi if test "$have_gtk" = yes -a "$have_gdk_pixbuf" = no ; then warn "GTK is being used, but the GDK-Pixbuf library and/or" @@ -18142,13 +18826,17 @@ if test "$have_motif" = yes -a "$have_lesstif" = yes ; then fi fi - if test "$have_motif" = yes -a "$have_gtk" = no ; then warn 'Motif is being used, and GTK is not.' echo '' motif_warn2 fi +halfassery() { + echo '' + warn2 "More specifically, we found the headers but not the" + warn2 "libraries. Possibly a 'devel' package is needed." +} if test "$with_gdk_pixbuf_req" = yes -a "$have_gdk_pixbuf" = no; then warnL 'Use of GDK-Pixbuf was requested, but it was not found.' @@ -18165,14 +18853,7 @@ if test "$have_gdk_pixbuf" = no -o "$gdk_pixbuf_halfassed" = yes || \ warnL 'The GDK-Pixbuf library was not found.' fi - if test "$gdk_pixbuf_halfassed" = yes ; then - echo '' - warn2 'More specifically, we found the headers, but not the' - warn2 'libraries; so either GDK-Pixbuf is half-installed on this' - warn2 "system, or something else went wrong. The \`config.log'" - warn2 'file might contain some clues.' - fi - + if test "$gdk_pixbuf_halfassed" = yes ; then halfassery ; fi if test "$have_png" = yes ; then echo '' warn2 'The PNG library is being used instead.' @@ -18184,26 +18865,18 @@ if test "$have_gdk_pixbuf" = no -o "$gdk_pixbuf_halfassed" = yes || \ warn2 'configure.' fi - if test "$have_jpeg" = no ; then if test "$with_jpeg_req" = yes ; then warnL 'Use of libjpeg was requested, but it was not found.' elif test "$with_jpeg_req" = no ; then - noteL 'The JPEG library is not being used.' + warnL 'The JPEG library is not being used.' else - noteL 'The JPEG library was not found.' - fi - - if test "$jpeg_halfassed" = yes ; then - echo '' - warn2 'More specifically, we found the headers, but not the' - warn2 'library; so either JPEG is half-installed on this' - warn2 "system, or something else went wrong. The \`config.log'" - warn2 'file might contain some clues.' - echo '' + warnL 'The JPEG library was not found.' fi + if test "$jpeg_halfassed" = yes ; then halfassery ; fi if test "$have_gdk_pixbuf" = no ; then + echo '' warn2 "This means that it won't be possible for the image-manipulating" warn2 "display modes to load files from disk; and it also means that" warn2 "the \`webcollage' program will be much slower." @@ -18212,101 +18885,58 @@ if test "$have_jpeg" = no ; then fi fi - if test "$have_png" = no ; then if test "$with_png_req" = yes ; then warnL 'Use of libpng was requested, but it was not found.' elif test "$with_png_req" = no ; then - noteL 'The PNG library is not being used.' + warnL 'The PNG library is not being used.' else - noteL 'The PNG library was not found.' - fi - - if test "$png_halfassed" = yes ; then - echo '' - warn2 'More specifically, we found the headers, but not the' - warn2 'library; so either PNG is half-installed on this' - warn2 "system, or something else went wrong. The \`config.log'" - warn2 'file might contain some clues.' - echo '' + warnL 'The PNG library was not found.' fi + if test "$png_halfassed" = yes ; then halfassery ; fi warn2 "Many things aren't going to work right." fi +if test "$have_xinput" = no ; then + warnL 'The XInput2 library was not found. It is required.' + if test "$xinput_halfassed" = yes ; then halfassery ; else echo '' ; fi +fi if test "$have_xft" = no ; then - if test "$with_xft_req" = yes ; then - warnL "Use of libXft was requested, but it was not found." - elif test "$with_xft_req" = no ; then - noteL 'The Xft library is not being used.' - else - noteL "The Xft library was not found." - fi - - if test "$xft_halfassed" = yes ; then - echo '' - warn2 'More specifically, we found the headers, but not the' - warn2 'libraries; so either Xft is half-installed on this' - warn2 "system, or something else went wrong. The \`config.log'" - warn2 'file might contain some clues.' - echo '' - fi - - warn2 "This means that fonts won't be anti-aliased." + warnL 'The XFreeType library was not found. It is required.' + if test "$xft_halfassed" = yes ; then halfassery ; else echo '' ; fi fi - if test "$have_systemd" = no ; then systemd_warned=no - if test "$with_systemd_req" = yes ; then + if test "$systemd_too_old" = yes ; then + warnL "The systemd library is too old." + systemd_warned=yes + elif test "$with_systemd_req" = yes ; then warnL "Use of systemd was requested, but it was not found." systemd_warned=yes - elif test "$with_systemd_req" = no ; then + elif test "$ac_macosx" = yes; then true - # noteL 'The systemd library is not being used.' - # systemd_warned=yes + elif test "$with_systemd_req" = no ; then + noteL 'The systemd library is not being used.' + systemd_warned=yes else - true - # noteL "The systemd library was not found." - # systemd_warned=yes + warnL "The systemd library was not found." + systemd_warned=yes fi if test "$systemd_halfassed" = yes ; then - echo '' - warn2 'More specifically, we found the headers, but not the' - warn2 'libraries; so either systemd is half-installed on this' - warn2 "system, or something else went wrong. The \`config.log'" - warn2 'file might contain some clues.' - echo '' + halfassery systemd_warned=yes fi if test "$systemd_warned" = yes; then + echo '' warn2 "This means that xscreensaver-systemd won't be built." - fi -fi - - -if test "$have_gl" = yes -a "$ac_have_mesa_gl" = yes ; then - preferred_mesagl=3.4 - mgv="$ac_mesagl_version_string" - pgl="$preferred_mesagl" - - if test "$ac_mesagl_version" = unknown; then - true - # warnL "Unable to determine the MesaGL version number!" - # warn2 "Make sure you are using version $preferred_mesagl or newer." - - elif test \! "$ac_mesagl_version" -gt 2006; then - warnL "MesaGL version number is $mgv --" - warn2 "MesaGL 2.6 and earlier have a security bug. It is strongly" - warn2 "recommended that you upgrade to at least version $preferred_mesagl." - - elif test \! "$ac_mesagl_version" -gt 3003; then - warnL "MesaGL version number is $mgv --" - warn2 "MesaGL 3.3 and earlier have some bugs; it is recommended" - warn2 "that you upgrade to $pgl or newer." + warn2 "Without that, xscreensaver will not be able to auto-lock" + warn2 "before the system is suspended (e.g., closing laptop lid)" + warn2 "and might activate while video playback is in progress." fi fi @@ -18320,11 +18950,11 @@ if test "$have_gl" = no ; then fi if test "$gl_halfassed" = yes ; then - echo '' - warn2 'More specifically, we found the headers, but not the' - warn2 'libraries; so either GL is half-installed on this' - warn2 "system, or something else went wrong. The \`config.log'" - warn2 'file might contain some clues.' + halfassery + if test "$have_glx" = no -a "$have_egl" = no; then + echo '' + warn2 'Neither EGL nor GLX were found.' + fi fi echo '' @@ -18334,7 +18964,6 @@ if test "$have_gl" = no ; then fi - if test "$have_gl" = yes -a "$have_gle" = no ; then # nobody cares about this; don't print the warning unless it was @@ -18353,13 +18982,7 @@ if test "$have_gl" = yes -a "$have_gle" = no ; then warn2 'library was not.' fi - if test "$gle_halfassed" = yes ; then - echo '' - warn2 'More specifically, we found the headers, but not the' - warn2 'libraries; so either GLE is half-installed on this' - warn2 "system, or something else went wrong. The \`config.log'" - warn2 'file might contain some clues.' - fi + if test "$gle_halfassed" = yes ; then halfassery ; fi echo '' warn2 'Some of the OpenGL (3D) demos (those that depend on GLE)' @@ -18370,7 +18993,6 @@ if test "$have_gl" = yes -a "$have_gle" = no ; then fi fi - if test "$with_readdisplay_req" = yes -a "$have_readdisplay" = no ; then warn 'Use of XReadDisplay was requested, but it was not found.' fi @@ -18381,6 +19003,12 @@ fi if test "$with_pam_req" = yes -a "$have_pam" = no ; then warn 'Use of PAM was requested, but it was not found.' +elif test "$have_pam" = no ; then + if test -d /etc/pam.d -o -f /etc/pam.conf ; then + warn "Your system seems to have PAM, but PAM is not being used." + warn2 "That is probably not going to work out well." + + fi fi if test "$with_shadow_req" = yes -a "$have_shadow" = no ; then @@ -18391,29 +19019,34 @@ if test "$setcap_hacks_req" = yes -a "$have_libcap" = no ; then warn 'Use of libcap was requested, but it was not found.' fi -if test "$ac_macosx" = yes ; then - if test "$enable_locking" = yes ; then - warn "You have specified --enable-locking on MacOS X." - warn2 "THIS DOES NOT WORK! Don't do this!" - fi +if test "$ac_macosx" = yes -a "$enable_locking" = yes ; then + warn "You have specified --enable-locking on macOS." + warn2 "THIS DOES NOT WORK! Don't do this!" fi - # You are in a twisty maze of namespaces and syntaxes, all alike. +# Expand all of these as the Makefile will probably expand them. # Fuck the skull of Unix. # bindir=`eval eval eval eval eval eval eval echo $bindir` HACKDIR=`eval eval eval eval eval eval eval echo $HACKDIR` HACK_CONF_DIR=`eval eval eval eval eval eval eval echo $HACK_CONF_DIR` +FONT_DIR=`eval eval eval eval eval eval eval echo $FONT_DIR` # canonicalize slashes. bindir=`echo "${bindir}" | sed 's@/$@@;s@//*@/@g'` HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'` HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'` +FONT_DIR=`echo "${FONT_DIR}" | sed 's@/$@@;s@//*@/@g'` +if test -z "$FONT_DIR" ; then + FONT_DIR='not installed'; +else + FONT_DIR="${FONT_DIR}/" +fi # Sanity check the hackdir -for bad_choice in xscreensaver xscreensaver-demo xscreensaver-command ; do +for bad_choice in xscreensaver xscreensaver-settings xscreensaver-command ; do if test "${HACKDIR}" = "${bindir}/${bad_choice}" ; then echo "" as_fn_error $? "\"--with-hackdir=${bindir}/${bad_choice}\" won't work. @@ -18423,107 +19056,108 @@ for bad_choice in xscreensaver xscreensaver-demo xscreensaver-command ; do fi done +# Warn if there's a previous RPM package installed. -do_dir_warning=no +rpm_vers= +if test -z "$RPM_PACKAGE_VERSION" ; then + # Don't bother with this test if we are currently *building* an RPM. + rpmnames="xscreensaver xscreensaver-base xscreensaver-extras + xscreensaver-data xscreensaver-data-extra" -# Now let's warn if there's a previous RPM version already installed. -# But don't bother with this test if we are currently *building* an RPM. + # M4 sucks!! -if test -z "$RPM_PACKAGE_VERSION" ; then + pkg_vers=`(rpm -qv $rpmnames) 2>&- | \ + sed -n 's/^[-a-z]*-\([0-9][0-9]*[.].*\)/\1/p' | head -1` + rpm_vers="$pkg_vers" - rpmnames="xscreensaver xscreensaver-base xscreensaver-extras" +fi - # M4 sucks!! +if test \! -z "$rpm_vers" ; then - rpmv=`(rpm -qv $rpmnames) 2>/dev/null | \ - sed -n 's/^[-a-z]*-\([0-9][0-9]*[.][0-9][0-9a-z]*\)-.*$/\1/p' | \ - head -1` + # M4 sucks!! + pkg_bindir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)xscreensaver-settings$@\1@p'` + pkg_bindir2=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)xscreensaver-demo$@\1@p'` + pkg_hackdir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)popsquares$@\1@p'` + pkg_confdir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)popsquares\.xml$@\1@p'` + pkg_fontdir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)\.ttf$@\1@p'` + pkg_addir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)XScreenSaver$@\1@p'` - if test \! -z "$rpmv" ; then - rpmbdir=`rpm -ql $rpmnames | sed -n 's@^\(.*\)/xscreensaver-demo$@\1@p'` - rpmhdir=`rpm -ql $rpmnames | sed -n 's@^\(.*\)/popsquares$@\1@p'` + if test -z "$pkg_bindir" ; then pkg_bindir="$pkg_bindir2" ; fi - warning=no - warnL "There is already an installed RPM of xscreensaver $rpmv" - warn2 'on this system. You might want to remove it ("rpm -ve")' - warn2 'before running "make install" in this directory.' - echo "" - warn2 "Alternately, you could build this version of xscreensaver" - warn2 'as an RPM, and then install that. An "xscreensaver.spec"' - warn2 'file is included. Try "rpmbuild -v -ba xscreensaver.spec".' - warn2 "See the RPM documentation for more info." - echo "" +fi - if test "$rpmbdir" = "$rpmhdir" ; then - warn2 "The RPM version was installed in $rpmbdir/." - do_dir_warning=yes - else - warn2 "The RPM version was installed in $rpmbdir/," - warn2 "with demos in $rpmhdir/." +# Warn if there's a previous Debian package installed. +# +deb_vers= +if test -z "$pkg_vers" ; then + debnames="xscreensaver xscreensaver-data xscreensaver-data-extra" + pkg_vers='' + for dpkg in $debnames ; do + if test -z "$pkg_vers"; then + pkg_vers=`dpkg -s $dpkg 2>/dev/null | sed -n 's/^Version: \(.*\)$/\1/p'` + deb_vers="$pkg_vers" fi - fi + done fi -# Also warn if there's a Debian package installed. -# -debnames="xscreensaver xscreensaver-data xscreensaver-data-extra" -debv='' -for dpkg in $debnames ; do - if test -z "$debv"; then - debv=`dpkg -s $dpkg 2>/dev/null | sed -n 's/^Version: \(.*\)$/\1/p'` - fi -done +if test \! -z "$deb_vers" ; then + + # M4 sucks!! -if test \! -z "$debv" ; then - debbdir=`dpkg -L $debnames 2>/dev/null | \ - sed -n 's@^\(.*/bin/\)xscreensaver$@\1@p'` - debhdir=`dpkg -L $debnames 2>/dev/null | \ - sed -n 's@^\(.*/\)popsquares$@\1@p'` - if test -z "$debbdir" ; then debbdir='???'; fi - if test -z "$debhdir" ; then debhdir='???'; fi + pkg_bindir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)xscreensaver-settings$@\1@p'` + pkg_bindir2=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)xscreensaver-demo$@\1@p'` + pkg_hackdir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)popsquares$@\1@p'` + pkg_confdir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)popsquares\.xml$@\1@p'` + pkg_fontdir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)\.ttf$@\1@p'` + pkg_addir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)XScreenSaver[^/]*$@\1@p'` - warning=no - warnL "There is already an installed dpkg of xscreensaver" - warn2 "version \"$debv\" on this system." - echo "" - warn2 "The dpkg was installed in $debbdir," - warn2 "with demos in $debhdir." + if test -z "$pkg_bindir" ; then pkg_bindir="$pkg_bindir2" ; fi fi +bindir_err= +hackdir_err= +confdir_err= +fontdir_err= +addir_err= +if ! test -z "$pkg_vers" ; then -if test "${bindir}" = "${HACKDIR}" ; then - do_dir_warning=yes -fi + err=" (DIFFERS)" -if test "$do_dir_warning" = yes; then - echo "" - echo "$warnsep" - echo "" - echo ' When you run "make install", the "xscreensaver",' - echo ' "xscreensaver-demo", and "xscreensaver-command" executables' - echo " will be installed in ${bindir}/." - echo "" - echo " The various graphics demos (200+ different executables) will" - echo " be installed in ${HACKDIR}/." - echo "" - echo " If you would prefer the demos to be installed elsewhere," - echo " you should re-run configure with the --with-hackdir=DIR" - echo " option. For more information, run \`./configure --help'." - warning=yes -fi + if test -z "$pkg_bindir" ; then pkg_bindir='???' + elif test "$pkg_bindir" != "${bindir}/" ; then bindir_err="$err" ; fi -if test "$warning" != no; then - echo '' ; echo "$warnsep" ; echo '' -fi + if test -z "$pkg_hackdir" ; then pkg_hackdir='???' + elif test "$pkg_hackdir" != "${HACKDIR}/" ; then hackdir_err="$err"; fi -if test "$do_dir_warning" = no; then - if test "$warning" = no; then - echo '' - fi - echo "User programs will be installed in ${bindir}/" - echo "Screen savers will be installed in ${HACKDIR}/" - echo "Configuration dialogs will be installed in ${HACK_CONF_DIR}/" - echo "System-wide default settings will be installed in ${APPDEFAULTS}/" - echo '' -fi + if test -z "$pkg_confdir" ; then pkg_confdir='???' + elif test "$pkg_confdir" != "${HACK_CONF_DIR}/" ; then confdir_err="$err"; fi + + if test -z "$pkg_fontdir" ; then pkg_fontdir='none' + elif test "$pkg_fontdir/" != "${FONT_DIR}" ; then fontdir_err="$err"; fi + + if test -z "$pkg_addir" ; then pkg_addir='???' + elif test "$pkg_addir" != "${APPDEFAULTS}/" ; then addir_err="$err" ; fi + + warning=no + warnL "There is already an installed package of xscreensaver" + warn2 "version \"$pkg_vers\", in these directories:" + echo "" + warn2 "User programs: $pkg_bindir$bindir_err" + warn2 "Screen savers: $pkg_hackdir$hackdir_err" + warn2 "Configuration: $pkg_confdir$confdir_err" + warn2 "Extra fonts: $pkg_fontdir$fontdir_err" + warn2 "App Defaults: $pkg_addir$addir_err" +fi + +echo "" +echo "$warnsep" +echo "" +echo " XScreenSaver will be installed in these directories:" +echo "" +echo " User programs: ${bindir}/$bindir_err" +echo " Screen savers: ${HACKDIR}/$hackdir_err" +echo " Configuration: ${HACK_CONF_DIR}/$confdir_err" +echo " Extra Fonts: ${FONT_DIR}$fontdir_err" +echo " App Defaults: ${APPDEFAULTS}/$addir_err" +echo "" diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..c3f0b5b --- /dev/null +++ b/configure.ac @@ -0,0 +1,4859 @@ +# configure.in --- xscreensaver, Copyright © 1997-2021 Jamie Zawinski. +# + +# Note: upgrading past 2.69_5 breaks the world. +AC_PREREQ([2.69]) + +AC_INIT +AC_CONFIG_SRCDIR([driver/subprocs.c]) +AC_CONFIG_HEADERS([config.h]) + +echo "current directory: `pwd`" +echo "command line was: $0 $@" + +############################################################################### +# +# Autoheader stuff +# +############################################################################### + +AH_TOP([ +/* xscreensaver, Copyright © 1991-2021 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_READ_DISPLAY_EXTENSION], + [Define this if you have the SGI XReadDisplay extension.]) + +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_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]) +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 Gtk 1.x Gnome Control Center.]) + +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 the XML library headers lack the + gnome-xml/libxml symlink.]) + +AH_TEMPLATE([HAVE_GDK_PIXBUF], + [Define this if you have GDK_Pixbuf.]) + +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_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([PASSWD_HELPER_PROGRAM], +# [Define this to use a third-party password helper program.]) + +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 + 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 +]) + + +############################################################################### +# +# 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 + + # 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. Well, these days various + # vendors have sloppily allowed non-ANSI syntax to slip into their + # library header files. GTK and OpenGL have been major offenders in this + # way. So... as of 2021, I guess we are forced to use "-std=gnu89", to + # allow those extensions, and hope that the warnings generated by + # "-pedantic" are heeded. + # + AC_CHECK_GCC_ARG(gnu89, -std=gnu89) + 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) + AC_CHECK_GCC_ARG(declaration_after, -Wdeclaration-after-statement) + # "string length is greater than ISO C89 compilers required to support" + AC_CHECK_GCC_ARG(no_overlength_strings, -Wno-overlength-strings) + # Ignore warnings about using "inline" + AC_CHECK_GCC_ARG(no_language_ext_token, -Wno-language-extension-token) + # Xlib headers use named variadic macros. + AC_CHECK_GCC_ARG(no_variadic_macros, -Wno-variadic-macros) + 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 + #include ], + [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 + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include ], + [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 + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include ], + [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 ], + [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 + #include ], + [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 : + # + # 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 + #include + #include + #include ], + [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 + #include ], + [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 or 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)) + fi + + AC_MSG_CHECKING([for [$3] libs]) + d=$[$1]/lib + if test -d $d; then + X_LIBS="-L$d $X_LIBS" + AC_MSG_RESULT($d) + else + AC_MSG_RESULT(not found ($d: no such directory)) + fi + + # replace the directory string with "yes". + [$1]_req="yes" + [$1]=$[$1]_req + ;; + + *) + echo "" + echo "error: argument to [$2] must be \"yes\", \"no\", or a directory." + echo " If it is a directory, then \`DIR/include' will be added to" + echo " the -I list, and \`DIR/lib' will be added to the -L list." + exit 1 + ;; + esac + ]) + + +############################################################################### +############################################################################### +# +# End of function definitions. Now start actually executing stuff. +# +############################################################################### +############################################################################### + +# Default $PATH might not contain /sbin and thus miss /sbin/setcap. +# +export PATH="$PATH:/usr/bin:/bin:/usr/sbin:/sbin" + + +# WTF! autoconf emits this *way* too late. Do it earlier. +test "x$prefix" = xNONE && prefix=$ac_default_prefix +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# random compiler setup +AC_CANONICAL_HOST + +ac_original_cc=$CC +AC_PROG_CC +AC_PROG_CC_ANSI +AC_PROG_CPP +AC_C_CONST +AC_C_INLINE +AC_EXEEXT + +# stuff for Makefiles +AC_PROG_INSTALL +AC_PROG_INSTALL_DIRS +AC_PROG_MAKE_SET + +# By default, autoconf sets INSTALL_SCRIPT to '${INSTALL_PROGRAM}'. +# That's wrong: it should be set to '${INSTALL}', so that one can +# implement the "install-strip" target properly (strip executables, +# but do not try to strip scripts.) +# +INSTALL_SCRIPT='${INSTALL}' + +# random libc stuff +AC_CHECK_HEADERS(unistd.h inttypes.h) +AC_TYPE_MODE_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[Return type of signal handlers]) +AC_HEADER_SYS_WAIT +AC_HEADER_DIRENT +AC_GETTIMEOFDAY_ARGS +AC_SYS_LARGEFILE +AC_CHECK_FUNCS(select fcntl uname nice setpriority getcwd getwd putenv sbrk) +AC_CHECK_FUNCS(sigaction syslog realpath setrlimit) +AC_CHECK_FUNCS(setlocale sqrtf) +AC_CHECK_FUNCS(getaddrinfo) +AC_CHECK_MEMBERS([struct sockaddr.sa_len],,, [#include ]) +AC_CHECK_ICMP +AC_CHECK_ICMPHDR +AC_CHECK_GETIFADDRS +AC_TYPE_SOCKLEN_T +AC_CHECK_HEADERS(crypt.h sys/select.h) +AC_PROG_PERL + +if test -z "$PERL" ; then + # don't let it be blank... + PERL=/usr/bin/perl +fi + +AC_PATH_XTRA + +if test "$have_x" != yes; then + AC_MSG_ERROR(Couldn't find X11 headers/libs. Try `$0 --help'.) +fi + +AC_X_RANDOM_PATHS +AC_XPOINTER +AC_XT + + +AC_MSG_CHECKING(whether this is macOS) + ac_macosx=no + ac_irix=no + case "$host" in + *-apple-darwin* ) + ac_macosx=yes + ;; + *-irix* ) + ac_irix=yes + ;; + esac +AC_MSG_RESULT($ac_macosx) + + +############################################################################### +# +# pkg-config +# +############################################################################### + +AC_PATH_TOOL(pkg_config, pkg-config) + +if test -z "$pkg_config" ; then + AC_MSG_WARN([pkg-config not found!]) + pkg_config="false" +fi + + +# Utility function for running pkg-config-based tests... +# +pkgs='' +pkg_check_version() { + if test "$ok" = yes ; then + req="$1" + min="$2" + AC_MSG_CHECKING(for $req) + if $pkg_config --exists "$req" ; then + vers=`$pkg_config --modversion "$req"` + if $pkg_config --exists "$req >= $min" ; then + AC_MSG_RESULT($vers) + pkgs="$pkgs $req" + return 1 + else + AC_MSG_RESULT($vers (wanted >= $min)) + ok=no + return 0 + fi + else + AC_MSG_RESULT(no) + ok=no + return 0 + fi + fi +} + + +############################################################################### +# +# Gettext support +# +############################################################################### + +# Wow, this is complete madness. Why does po/Makefile.in.in exist?? Why does +# aclocal.m4 exist?? Why can't I upgrade it without everything breaking?? +# This IT_PROG_INTLTOOL nonsense has so many self-modifying levels of insanity +# that it *must* have been written by RMS. Or an equally demented protégé. +# Won't someone please have mercy on us all and write a normal po/Makefile.in +# that uses wildcards, and write a sane set of rules to detect gettext(3) and +# msgfmt(1) and just do the obviously straightforward thing? + +IT_PROG_INTLTOOL +GETTEXT_PACKAGE=xscreensaver +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", + [This is the name of the gettext package to use.]) +AC_SUBST(GETTEXT_PACKAGE) + +ALL_LINGUAS="da de es et fi fr hu it ja ko nb nl pl pt pt_BR ru sk sv vi wa zh_CN zh_TW" +AM_GLIB_GNU_GETTEXT +MKINSTALLDIRS="$INSTALL_DIRS" + + +############################################################################### +# +# The --with-x-app-defaults option +# +############################################################################### + +#### H1 + +AC_ARG_WITH(app-defaults,[ +Installation Options: + + --prefix=PREFIX Install root of architecture-independent files. + --exec-prefix=EPREFIX Install root of architecture-dependent files. + --with-app-defaults=DIR Where to install the default settings file.], + [ac_cv_x_app_defaults="$withval"], + [eval ac_x_app_defaults="$withval"]) +AC_PATH_X_APP_DEFAULTS + + +############################################################################### +# +# Handle the --with-hackdir option +# +############################################################################### + +have_hackdir=yes +with_hackdir_req=unspecified +AC_ARG_WITH(hackdir, +[ --with-hackdir=DIR Where to install the hundreds of demo executables.], + [with_hackdir="$withval"; with_hackdir_req="$withval"],[with_hackdir=yes]) + +if test x"$with_hackdir" = xyes; then + HACKDIR='${libexecdir}/xscreensaver' +elif test x"$with_hackdir" = xno; then + HACKDIR='${bindir}' +else + HACKDIR=$with_hackdir +fi + +# canonicalize slashes. +HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'` + +# Expand HACKDIR as HACKDIR_FULL +HACKDIR_FULL=`eval eval eval eval eval eval eval eval eval echo $HACKDIR` + +# This option used to be called --enable-subdir; make sure that is no longer +# used, since configure brain-damagedly ignores unknown --enable options. + +obsolete_enable= +AC_ARG_ENABLE(subdir,,[obsolete_enable=yes]) +if test -n "$obsolete_enable"; then + echo "error: the --enable-subdir option has been replaced with" + echo " the new --with-hackdir option; see \`configure --help'" + echo " for more information." + exit 1 +fi + + +############################################################################### +# +# Handle the --with-configdir option +# +############################################################################### + +have_configdir=yes +with_configdir_req=unspecified +AC_ARG_WITH(configdir, +[ --with-configdir=DIR Where to install the GUI configuration files.], + [with_configdir="$withval"; with_configdir_req="$withval"], + [with_configdir=yes]) + +if test x"$with_configdir" = xyes; then + HACK_CONF_DIR='${datadir}/xscreensaver/config' +elif test x"$with_configdir" = xno; then + echo "error: must be yes, or a pathname: --with-configdir=$with_configdir" + exit 1 +else + # there must be a better way than this... + if test -z "`echo $with_configdir | sed 's@^/.*@@'`" ; then + # absolute path + HACK_CONF_DIR=$with_configdir + else + # relative path + HACK_CONF_DIR="\${exec_prefix}$with_configdir" + fi +fi + + + +############################################################################### +# +# Handle the --with-fontdir option +# +############################################################################### + +have_fontdir=yes +with_fontdir_req=unspecified +AC_ARG_WITH(fontdir, +[ --with-fontdir=DIR Where to install the extra font files.], + [with_fontdir="$withval"; with_fontdir_req="$withval"], + [with_fontdir=yes]) + +if test x"$with_fontdir" = xyes; then + FONT_DIR='${datarootdir}/fonts/xscreensaver' + if test "$ac_macosx" = yes; then + FONT_DIR='/Library/Fonts' + fi +elif test x"$with_fontdir" = xno; then + FONT_DIR='' +else + # there must be a better way than this... + if test -z "`echo $with_fontdir | sed 's@^/.*@@'`" ; then + # absolute path + FONT_DIR="$with_fontdir" + else + # relative path + FONT_DIR='${datarootdir}/fonts/'"$with_fontdir" + fi +fi + + + +############################################################################### +# +# Check for the DPMS server extension. +# +############################################################################### + +#### H1 + +have_dpms=no +with_dpms_req=unspecified +AC_ARG_WITH(dpms-ext, +[ +Server Extension Options: + + --with-dpms-ext Include support for power management.], + [with_dpms="$withval"; with_dpms_req="$withval"],[with_dpms=yes]) + +HANDLE_X_PATH_ARG(with_dpms, --with-dpms-ext, DPMS) + +if test "$with_dpms" = yes; then + + # first check for dpms.h + AC_CHECK_X_HEADER(X11/extensions/dpms.h, [have_dpms=yes],, + [#include + #include ]) + + # if that succeeded, then check for the DPMS code in the libraries + if test "$have_dpms" = yes; then + + # first look in -lXext (this is where it is with XFree86 4.0) + have_dpms=no + AC_CHECK_X_LIB(Xext, DPMSInfo, [have_dpms=yes], [true], -lXext -lX11) + + # if that failed, look in -lXdpms (this is where it was in XFree86 3.x) + if test "$have_dpms" = no; then + AC_CHECK_X_LIB(Xdpms, DPMSInfo, + [have_dpms=yes; XDPMS_LIBS="-lXdpms"], [true], + -lXext -lX11) + fi + fi + + + # if that succeeded, then we've really got it. + if test "$have_dpms" = yes; then + AC_DEFINE(HAVE_DPMS_EXTENSION) + fi + +elif test "$with_dpms" != no; then + echo "error: must be yes or no: --with-dpms-ext=$with_dpms" + exit 1 +fi + + +############################################################################### +# +# Check for the XF86VMODE server extension (for virtual screens.) +# +############################################################################### + +have_xf86vmode=no +with_xf86vmode_req=unspecified +AC_ARG_WITH(xf86vmode-ext, +[ --with-xf86vmode-ext Include support for virtual screens.], + [with_xf86vmode="$withval"; with_xf86vmode_req="$withval"], + [with_xf86vmode=yes]) + +HANDLE_X_PATH_ARG(with_xf86vmode, --with-xf86vmode-ext, xf86vmode) + +VIDMODE_LIBS="" + +if test "$with_xf86vmode" = yes; then + + # first check for xf86vmode.h + AC_CHECK_X_HEADER(X11/extensions/xf86vmode.h, [have_xf86vmode=yes],, + [#include ]) + + # if that succeeded, then check for the -lXxf86vm + if test "$have_xf86vmode" = yes; then + have_xf86vmode=no + AC_CHECK_X_LIB(Xxf86vm, XF86VidModeGetViewPort, + [have_xf86vmode=yes; + VIDMODE_LIBS="-lXxf86vm"; + SAVER_LIBS="$SAVER_LIBS $VIDMODE_LIBS"], + [true], -lXext -lX11) + fi + + # if that succeeded, then we've really got it. + if test "$have_xf86vmode" = yes; then + AC_DEFINE(HAVE_XF86VMODE) + fi + +elif test "$with_xf86vmode" != no; then + echo "error: must be yes or no: --with-xf86vmode-ext=$with_xf86vmode" + exit 1 +fi + + +############################################################################### +# +# Check for the XINERAMA server extension. +# +############################################################################### + +have_xinerama=no +with_xinerama_req=unspecified +AC_ARG_WITH(xinerama-ext, +[ --with-xinerama-ext Include support for multiple monitors.], + [with_xinerama="$withval"; with_xinerama_req="$withval"],[with_xinerama=yes]) + +HANDLE_X_PATH_ARG(with_xinerama, --with-xinerama-ext, XINERAMA) + +if test "$with_xinerama" = yes; then + + # first check for Xinerama.h + AC_CHECK_X_HEADER(X11/extensions/Xinerama.h, [have_xinerama=yes],, + [#include ]) + + # if that succeeded, then check for the XINERAMA code in the libraries + if test "$have_xinerama" = yes; then + + # first look in -lXext + have_xinerama=no + AC_CHECK_X_LIB(Xext, XineramaQueryScreens, [have_xinerama=yes], [true], + -lXext -lX11) + + # if that failed, look in -lXinerama (this is where it is in XFree86 4.1.) + if test "$have_xinerama" = no; then + AC_CHECK_X_LIB(Xinerama, XineramaQueryScreens, + [have_xinerama=yes; XINERAMA_LIBS="-lXinerama"], + [true], -lXext -lX11) + fi + fi + + # if that succeeded, then we've really got it. + if test "$have_xinerama" = yes; then + AC_DEFINE(HAVE_XINERAMA) + fi + +elif test "$with_xinerama" != no; then + echo "error: must be yes or no: --with-xinerama-ext=$with_xinerama" + exit 1 +fi + + +############################################################################### +# +# Check for the RANDR (Resize and Rotate) server extension. +# +# We need this to detect when the resolution of the desktop +# has changed out from under us (this is a newer, different +# mechanism than the XF86VMODE virtual viewports.) +# +############################################################################### + +have_randr=no +with_randr_req=unspecified +AC_ARG_WITH(randr-ext, +[ --with-randr-ext Include support for multiple monitors.], + [with_randr="$withval"; with_randr_req="$withval"],[with_randr=yes]) + +HANDLE_X_PATH_ARG(with_randr, --with-randr-ext, RANDR) + +if test "$with_randr" = yes; then + + # first check for Xrandr.h + AC_CHECK_X_HEADER(X11/extensions/Xrandr.h, [have_randr=yes],, + [#include ]) + + # if that succeeded, then check for the XRR code in the libraries + if test "$have_randr" = yes; then + + # RANDR probably needs -lXrender + xrender_libs= + AC_CHECK_X_LIB(Xrender, XRenderSetSubpixelOrder, + [xrender_libs="-lXrender"], [true], -lXext -lX11) + + # first look for RANDR in -lXext + have_randr=no + AC_CHECK_X_LIB(Xext, XRRGetScreenInfo, + [have_randr=yes; SAVER_LIBS="$SAVER_LIBS $xrender_libs"], + [true], $xrender_libs -lXext -lX11) + + # if that failed, look in -lXrandr + if test "$have_randr" = no; then + AC_CHECK_X_LIB(Xrandr, XRRGetScreenInfo, + [have_randr=yes; SAVER_LIBS="$SAVER_LIBS -lXrandr $xrender_libs"], + [true], $xrender_libs -lXext -lX11) + fi + fi + + # if that succeeded, then we've really got it. + if test "$have_randr" = yes; then + AC_DEFINE(HAVE_RANDR) + + # Now check for version 1.2 in the same libs. + # Try to compile, since on macOS 10.5.7, headers are older than libs! + AC_CACHE_CHECK([for XRRGetScreenResources], ac_cv_randr_12, + [ac_cv_randr_12=no + AC_TRY_X_COMPILE([#include + #include + #include ], + [XRRScreenResources *res = + XRRGetScreenResources (0, 0);], + [ac_cv_randr_12=yes], + [ac_cv_randr_12=no])]) + if test "$ac_cv_randr_12" = yes ; then + AC_DEFINE(HAVE_RANDR_12) + fi +# AC_CHECK_X_LIB(c, XRRGetOutputInfo, [AC_DEFINE(HAVE_RANDR_12)], +# [true], $SAVER_LIBS) + fi + + +elif test "$with_randr" != no; then + echo "error: must be yes or no: --with-randr-ext=$with_randr" + exit 1 +fi + + +############################################################################### +# +# Check for the XINPUT server extension. +# +############################################################################### + +have_xinput=no +with_xinput_req=unspecified +xinput_halfassed=no +AC_ARG_WITH(xinput-ext, +[ --with-xinput-ext Include support for the XInput2 extension.], + [with_xinput="$withval"; with_xinput_req="$withval"], [with_xinput=yes]) + +HANDLE_X_PATH_ARG(with_xinput, --with-xinput-ext, XINPUT) + +if test "$with_xinput" = yes; then + + # first check for Xinput2.h + AC_CHECK_X_HEADER(X11/extensions/XInput2.h, [have_xinput=yes],, + [#include ]) + + # if that succeeded, then check for libXi + if test "$have_xinput" = yes; then + have_xinput=no + xinput_halfassed=yes + AC_CHECK_X_LIB(Xi, XISelectEvents, + [have_xinput=yes; xinput_halfassed=no; + SAVER_LIBS="$SAVER_LIBS -lXi"], + [true], -lXext -lX11) + fi + + # if that succeeded, then we've really got it. + if test "$have_xinput" = yes; then + AC_DEFINE(HAVE_XINPUT) + fi + +elif test "$with_xinput" != no; then + echo "error: must be yes or no: --with-xinput-ext=$with_xinput" + exit 1 +fi + + +############################################################################### +# +# Check for the XF86VMODE server extension (for gamma fading.) +# +############################################################################### + +have_xf86gamma=no +have_xf86gamma_ramp=no +with_xf86gamma_req=unspecified +AC_ARG_WITH(xf86gamma-ext, +[ --with-xf86gamma-ext Include support for XFree86 gamma fading.], + [with_xf86gamma="$withval"; with_xf86gamma_req="$withval"], + [with_xf86gamma=yes]) + +HANDLE_X_PATH_ARG(with_xf86gamma, --with-xf86gamma-ext, xf86gamma) + +if test "$with_xf86gamma" = yes; then + + # first check for xf86vmode.h, if we haven't already + if test "$have_xf86vmode" = yes; then + have_xf86gamma=yes + else + AC_CHECK_X_HEADER(X11/extensions/xf86vmode.h, [have_xf86gamma=yes],, + [#include ]) + fi + + # if that succeeded, then check for the -lXxf86vm + if test "$have_xf86gamma" = yes; then + have_xf86gamma=no + AC_CHECK_X_LIB(Xxf86vm, XF86VidModeSetGamma, + [have_xf86gamma=yes], + [true], -lXext -lX11) + fi + + # check for the Ramp versions of the functions too. + if test "$have_xf86gamma" = yes; then + have_xf86gamma_ramp=no + AC_CHECK_X_LIB(Xxf86vm, XF86VidModeSetGammaRamp, + [have_xf86gamma_ramp=yes], + [true], -lXext -lX11) + fi + + # if those tests succeeded, then we've really got the functions. + if test "$have_xf86gamma" = yes; then + AC_DEFINE(HAVE_XF86VMODE_GAMMA) + fi + + if test "$have_xf86gamma_ramp" = yes; then + AC_DEFINE(HAVE_XF86VMODE_GAMMA_RAMP) + fi + + # pull in the lib, if we haven't already + if test "$have_xf86gamma" = yes -a "$have_xf86vmode" = no; then + SAVER_LIBS="$SAVER_LIBS -lXxf86vm" + fi + +elif test "$with_xf86gamma" != no; then + echo "error: must be yes or no: --with-xf86gamma-ext=$with_xf86vmode" + exit 1 +fi + + +############################################################################### +# +# Check for the XIDLE server extension. +# +############################################################################### + +have_xidle=no +with_xidle_req=unspecified +AC_ARG_WITH(xidle-ext, +[ --with-xidle-ext Include support for the X11R5 XIDLE extension.], + [with_xidle="$withval"; with_xidle_req="$withval"],[with_xidle=yes]) + +HANDLE_X_PATH_ARG(with_xidle, --with-xidle-ext, XIDLE) + +if test "$with_xidle" = yes; then + AC_CHECK_X_HEADER(X11/extensions/xidle.h, + [have_xidle=yes + AC_DEFINE(HAVE_XIDLE_EXTENSION)],, + [#include ]) +elif test "$with_xidle" != no; then + echo "error: must be yes or no: --with-xidle-ext=$with_xidle" + exit 1 +fi + + +############################################################################### +# +# Check for the MIT-SCREEN-SAVER server extension. +# +############################################################################### + +have_mit=no +with_mit=no +with_mit_req=unspecified +#AC_ARG_WITH(mit-ext, +#[ --with-mit-ext Include support for the MIT-SCREEN-SAVER extension.], +# [with_mit="$withval"; with_mit_req="$withval"],[with_mit=no]) +#HANDLE_X_PATH_ARG(with_mit, --with-mit-ext, MIT-SCREEN-SAVER) + +if test "$with_mit" = yes; then + AC_CHECK_X_HEADER(X11/extensions/scrnsaver.h, [have_mit=yes],, + [#include ]) + + # Now check to see if it's really in the library; XF86Free-3.3 ships + # scrnsaver.h, but doesn't include the code in libXext.a, the idiots! + # + if test "$have_mit" = yes; then + AC_CHECK_X_LIB(Xext, XScreenSaverRegister, [true], [have_mit=no], -lm) + + if test "$have_mit" = no; then + # Fuck! Looks like XF86Free-3.3 actually puts it in XExExt instead + # of in Xext. Thank you master, may I have another. + AC_CHECK_X_LIB(XExExt, XScreenSaverRegister, + [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXExExt"], + [true], -lX11 -lXext -lm) + fi + + if test "$have_mit" = no; then + # Double fuck! Looks like some versions of XFree86 (whichever version + # it is that comes with RedHat Linux 2.0 -- I can't find a version + # number) put this garbage in Xss instead of Xext. Thank you master, + # may I have another. + AC_CHECK_X_LIB(Xss, XScreenSaverRegister, + [have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXss"], + [true], -lX11 -lXext -lm) + fi + + if test "$have_mit" = yes; then +# AC_DEFINE(HAVE_MIT_SAVER_EXTENSION) + echo "Using the MIT-SCREEN-SAVER extension will crash your server. Don't." + exit 1 + fi + + fi + +elif test "$with_mit" != no; then + echo "error: must be yes or no: --with-mit-ext=$with_mit" + exit 1 +fi + + +############################################################################### +# +# Check for the SGI SCREEN_SAVER server extension. +# +############################################################################### + +have_sgi=no +with_sgi_req=unspecified +AC_ARG_WITH(sgi-ext, +[ --with-sgi-ext Include support for the SGI SCREEN_SAVER extension.], + [with_sgi="$withval"; with_sgi_req="$withval"],[with_sgi=$ac_irix]) + +HANDLE_X_PATH_ARG(with_sgi, --with-sgi-ext, SGI SCREEN_SAVER) + +if test "$with_sgi" = yes; then + AC_CHECK_X_HEADER(X11/extensions/XScreenSaver.h, + [have_sgi=yes + AC_DEFINE(HAVE_SGI_SAVER_EXTENSION)],, + [#include ]) + +elif test "$with_sgi" != no; then + echo "error: must be yes or no: --with-sgi-ext=$with_sgi" + exit 1 +fi + + +############################################################################### +# +# Check for the SGI-VIDEO-CONTROL server extension. +# +############################################################################### + +have_sgivc=no +with_sgivc_req=unspecified +AC_ARG_WITH(sgivc-ext, +[ --with-sgivc-ext Include support for the SGI-VIDEO-CONTROL extension.], + [with_sgivc="$withval"; with_sgivc_req="$withval"],[with_sgivc=$ac_irix]) + +HANDLE_X_PATH_ARG(with_sgivc, --with-sgivc-ext, SGI-VIDEO-CONTROL) + +if test "$with_sgivc" = yes; then + + # first check for XSGIvc.h + AC_CHECK_X_HEADER(X11/extensions/XSGIvc.h, [have_sgivc=yes],, + [#include ]) + + # if that succeeded, then check for the -lXsgivc + if test "$have_sgivc" = yes; then + have_sgivc=no + AC_CHECK_X_LIB(Xsgivc, XSGIvcQueryGammaMap, + [have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"], [true], + -lXext -lX11) + fi + + # if that succeeded, then we've really got it. + if test "$have_sgivc" = yes; then + AC_DEFINE(HAVE_SGI_VC_EXTENSION) + fi + +elif test "$with_sgivc" != no; then + echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc" + exit 1 +fi + + +############################################################################### +# +# Check for the SGI XReadDisplay server extension. +# +############################################################################### + +have_readdisplay=no +with_readdisplay_req=unspecified +AC_ARG_WITH(readdisplay, +[ --with-readdisplay Include support for the SGI XReadDisplay extension.], + [with_readdisplay="$withval"; with_readdisplay_req="$withval"], + [with_readdisplay=$ac_irix]) + +HANDLE_X_PATH_ARG(with_readdisplay, --with-readdisplay, XReadDisplay) + +if test "$with_readdisplay" = yes; then + AC_CHECK_X_HEADER(X11/extensions/readdisplay.h, + AC_DEFINE(HAVE_READ_DISPLAY_EXTENSION),, + [#include ]) +elif test "$with_readdisplay" != no; then + echo "error: must be yes or no: --with-readdisplay=$with_readdisplay" + exit 1 +fi + + +############################################################################### +# +# Check for the XSHM server extension. +# +############################################################################### + +have_xshm=no +with_xshm_req=unspecified +AC_ARG_WITH(xshm-ext, +[ --with-xshm-ext Include support for the Shared Memory extension.], + [with_xshm="$withval"; with_xshm_req="$withval"],[with_xshm=yes]) + +HANDLE_X_PATH_ARG(with_xshm, --with-xshm-ext, XSHM) + +if test "$with_xshm" = yes; then + + # first check for Xshm.h. + AC_CHECK_X_HEADER(X11/extensions/XShm.h, [have_xshm=yes],, + [#include ]) + + # if that succeeded, then check for sys/ipc.h. + if test "$have_xshm" = yes; then + have_xshm=no + AC_CHECK_X_HEADER(sys/ipc.h, [have_xshm=yes]) + fi + + # if that succeeded, then check for sys/shm.h. + if test "$have_xshm" = yes; then + have_xshm=no + AC_CHECK_X_HEADER(sys/shm.h, [have_xshm=yes]) + fi + + # AIX is pathological, as usual: apparently it's normal for the Xshm headers + # to exist, but the library code to not exist. And even better, the library + # code is in its own library: libXextSam.a. So, if we're on AIX, and that + # lib doesn't exist, give up. (This lib gets added to X_EXTRA_LIBS, and + # that's not quite right, but close enough.) + # + case "$host" in + *-aix*) + if [ `uname -v` -eq 3 ]; then + have_xshm=no + AC_CHECK_X_LIB(XextSam, XShmQueryExtension, + [have_xshm=yes; X_EXTRA_LIBS="$X_EXTRA_LIBS -lXextSam"], + [true], -lX11 -lXext -lm) + fi + ;; + esac + + # if that succeeded, then we've really got it. + if test "$have_xshm" = yes; then + AC_DEFINE(HAVE_XSHM_EXTENSION) + fi + +elif test "$with_xshm" != no; then + echo "error: must be yes or no: --with-xshm-ext=$with_xshm" + exit 1 +fi + + +############################################################################### +# +# Check for the DOUBLE-BUFFER server extension. +# +############################################################################### + +have_xdbe=no +with_xdbe_req=unspecified +AC_ARG_WITH(xdbe-ext, +[ --with-xdbe-ext Include support for the DOUBLE-BUFFER extension.], + [with_xdbe="$withval"; with_xdbe_req="$withval"],[with_xdbe=yes]) + +HANDLE_X_PATH_ARG(with_xdbe, --with-xdbe-ext, DOUBLE-BUFFER) + +if test "$with_xdbe" = yes; then + + AC_CHECK_X_HEADER(X11/extensions/Xdbe.h, [have_xdbe=yes],, + [#include ]) + if test "$have_xdbe" = yes; then + AC_DEFINE(HAVE_DOUBLE_BUFFER_EXTENSION) + fi + +elif test "$with_xdbe" != no; then + echo "error: must be yes or no: --with-xdbe-ext=$with_xshm" + exit 1 +fi + + +############################################################################### +# +# Check for the COMPOSITE server extension. +# +############################################################################### + +#have_xcomposite=no +#with_xcomposite_req=unspecified +#AC_ARG_WITH(xcomposite-ext, +#[ --with-xcomposite-ext Include support for the XCOMPOSITE extension.], +# [with_xcomposite="$withval"; with_xcomposite_req="$withval"], +# [with_xcomposite=yes]) +# +#HANDLE_X_PATH_ARG(with_xcomposite, --with-xcomposite-ext, XCOMPOSITE) +# +#if test "$with_xcomposite" = yes; then +# +# AC_CHECK_X_HEADER(X11/extensions/Xcomposite.h, [have_xcomposite=yes],, +# [#include ]) +# if test "$have_xcomposite" = yes; then +# AC_DEFINE(HAVE_XCOMPOSITE_EXTENSION) +# SAVER_LIBS="-lXcomposite $SAVER_LIBS" +# fi +# +#elif test "$with_xcomposite" != no; then +# echo "error: must be yes or no: --with-xcomposite-ext=$with_xshm" +# exit 1 +#fi + + +############################################################################### +# +# Check for the XKB server extension. +# +############################################################################### + +have_xkb=no +with_xkb_req=unspecified +AC_ARG_WITH(xkb-ext, +[ --with-xkb-ext Include support for the X Keyboard extension.], + [with_xkb="$withval"; with_xkb_req="$withval"], + [with_xkb=yes]) + +HANDLE_X_PATH_ARG(with_xkb, --with-xkb-ext, XKB) + +if test "$with_xkb" = yes; then + + AC_CHECK_X_HEADER(X11/XKBlib.h, [have_xkb=yes],, + [#include ]) + if test "$have_xkb" = yes; then + AC_DEFINE(HAVE_XKB) + fi + +elif test "$with_xkb" != no; then + echo "error: must be yes or no: --with-xkb-ext=$with_xshm" + exit 1 +fi + + +############################################################################### +# +# Check for HP XHPDisableReset and XHPEnableReset. +# +############################################################################### + +AC_MSG_CHECKING([for XHPDisableReset in X11/XHPlib.h]) +AC_EGREP_X_HEADER(XHPDisableReset, X11/XHPlib.h, + [AC_DEFINE(HAVE_XHPDISABLERESET) + SAVER_LIBS="-lXhp11 $SAVER_LIBS" + AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no)]) + + +############################################################################### +# +# Check for /proc/interrupts. +# +############################################################################### + +have_proc_interrupts=no +with_proc_interrupts_req=unspecified +AC_ARG_WITH(proc-interrupts, +[ --with-proc-interrupts Include support for consulting /proc/interrupts to + notice activity on PS/2 keyboards and mice.], + [with_proc_interrupts="$withval"; with_proc_interrupts_req="$withval"], + [with_proc_interrupts=no]) + +if test "$with_proc_interrupts" = yes; then + + # Note that we may be building in an environment (e.g. Debian buildd chroot) + # without a proper /proc filesystem. If /proc/interrupts exists, then we'll + # check that it has the bits we need, but otherwise we'll just go on faith. + # + have_proc_interrupts=yes + + if test -f /proc/interrupts; then + AC_CACHE_CHECK([whether /proc/interrupts contains keyboard data], + ac_cv_have_proc_interrupts, + [ac_cv_have_proc_interrupts=no + if grep 'keyboard\|i8042' /proc/interrupts >/dev/null 2>&1 ; then + ac_cv_have_proc_interrupts=yes + fi + ]) + have_proc_interrupts=$ac_cv_have_proc_interrupts + fi + + if test "$have_proc_interrupts" = yes; then + AC_DEFINE(HAVE_PROC_INTERRUPTS) + fi + +elif test "$with_proc_interrupts" != no; then + echo "error: must be yes or no: --with-proc-interrupts=$with_proc_interrupts" + exit 1 +fi + + +############################################################################### +# +# Check for /proc/*/oom_score_adj. +# +############################################################################### + +setuid_auth=no +have_proc_oom=no +with_proc_oom_req=unspecified +AC_ARG_WITH(proc-oom, +[ --with-proc-oom Include support to duck the out-of-memory killer.], + [with_proc_oom="$withval"; with_proc_oom_req="$withval"], + [with_proc_oom=yes]) + +if test "$with_proc_oom_req" = yes; then + + # Note that we may be building in an environment (e.g. Debian buildd chroot) + # without a proper /proc filesystem. + # + have_proc_oom=yes + AC_DEFINE(HAVE_PROC_OOM) + +elif test "$with_proc_oom_req" = unspecified; then + + have_proc_oom=no + AC_CACHE_CHECK([whether /proc/$$/oom_score_adj exists], + ac_cv_have_proc_oom, + [ac_cv_have_proc_oom=no + if test -f /proc/$$/oom_score_adj; then + ac_cv_have_proc_oom=yes + fi + ]) + have_proc_oom=$ac_cv_have_proc_oom + + if test "$have_proc_oom" = yes; then + AC_DEFINE(HAVE_PROC_OOM) + # Only root can write to /proc/$$/oom_score_adj, even though it's us. + AC_MSG_RESULT(enabling setuid to opt out of OOM-killer.) + setuid_auth=yes + fi + +elif test "$with_proc_oom" != no; then + echo "error: must be yes or no: --with-proc-oom=$with_proc_oom" + exit 1 +fi + + +############################################################################### +# +# Check for -lsystemd +# +############################################################################### + +have_systemd=no +with_systemd_req=unspecified +systemd_halfassed=no +systemd_too_old=no +AC_ARG_WITH(systemd, +[ --with-systemd Support systemd requests to lock on suspend, and to + allow video players to inhibit the screen saver.], + [with_systemd="$withval"; with_systemd_req="$withval"], + [with_systemd=yes]) + +HANDLE_X_PATH_ARG(with_systemd, --with-systemd, systemd) + +if test "$with_systemd" != yes -a "$with_systemd" != no ; then + echo "error: must be yes or no: --with-systemd=$with_systemd" + exit 1 +fi + +if test "$with_systemd" = yes; then + + pkgs='' + ok="yes" + pkg_check_version libsystemd 221 + have_systemd="$ok" + + if test "$have_systemd" = no; then + if $pkg_config --exists libsystemd ; then + systemd_too_old=yes + fi + fi + + if test "$have_systemd" = yes; then + AC_CACHE_CHECK([for libsystemd includes], ac_cv_systemd_config_cflags, + [ac_cv_systemd_config_cflags=`$pkg_config --cflags $pkgs`]) + AC_CACHE_CHECK([for libsystemd libs], ac_cv_systemd_config_libs, + [ac_cv_systemd_config_libs=`$pkg_config --libs $pkgs`]) + fi + + ac_systemd_config_cflags=$ac_cv_systemd_config_cflags + ac_systemd_config_libs=$ac_cv_systemd_config_libs + + if test "$have_systemd" = yes; then + # + # we appear to have libsystemd; check for headers/libs to be sure. + # + ac_save_systemd_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $ac_systemd_config_cflags" + + have_systemd=no + AC_CHECK_X_HEADER(systemd/sd-bus.h, [have_systemd=yes]) + + CPPFLAGS="$ac_save_systemd_CPPFLAGS" + fi + + if test "$have_systemd" = yes; then + # we have the headers, now check for the libraries + have_systemd=no + systemd_halfassed=yes + AC_MSG_RESULT(checking for libsystemd usability...) + AC_CHECK_X_LIB(c, sd_bus_open_system, + [have_systemd=yes; systemd_halfassed=no],, + $ac_systemd_config_libs -lX11 -lXext -lm) + fi + + if test "$have_systemd" = no; then + AC_MSG_RESULT(checking for libsystemd usability... no) + fi +fi + +if test "$have_systemd" = yes; then + INCLUDES="$INCLUDES $ac_systemd_config_cflags" + EXES_SYSTEMD='$(EXES_SYSTEMD)' + SYSTEMD_LIBS="$ac_systemd_config_libs" + AC_DEFINE(HAVE_LIBSYSTEMD) +else + EXES_SYSTEMD='' + SYSTEMD_LIBS='' +fi + + +############################################################################### +# +# The --enable-locking option +# +# Note: "configure --help" list all "--enable" options before any +# "--with" options, so we document the --enable options inline with +# the --with options where it looks better, instead of in AC_ARG_ENABLE +# where it would make sense, sigh... +# +############################################################################### + +AC_ARG_ENABLE(locking, +[], # This is documented elsewhere because of --enable/--with option sorting. + [enable_locking="$enableval"], + [if test "$ac_macosx" = yes; then + # We can't lock on macOS, so default to not compiling in support for it. + # But allow --enable-locking to override that, so I can debug Linux locking + # under macOS X11. + enable_locking=no + else + enable_locking=yes + fi]) +if test "$enable_locking" = yes; then + true +elif test "$enable_locking" = no; then + AC_DEFINE(NO_LOCKING) +else + echo "error: must be yes or no: --enable-locking=$enable_locking" + exit 1 +fi + + +############################################################################## +# +# Whether to allow root password to unblank. +# +############################################################################### + +AC_ARG_ENABLE(root-passwd, +[], # This is documented elsewhere because of --enable/--with option sorting. + [enable_root_passwd="$enableval"],[enable_root_passwd=no]) +if test "$enable_root_passwd" = yes; then + AC_DEFINE(ALLOW_ROOT_PASSWD) + true +elif test "$enable_root_passwd" != no; then + echo "error: must be yes or no: --enable-root-passwd=$enable_root_passwd" + exit 1 +fi + + +############################################################################### +# +# Check for PAM. +# +############################################################################### + +case "$host" in + *-solaris*) + # Solaris systems tend to have the PAM runtime misconfigured and unusable. + with_pam_default=no + ;; + *-freebsd* ) + # FreeBSD's PAM implementation requires the calling process to be setuid + # the whole time, which is unacceptable. + with_pam_default=no + ;; + *) + # Default to building PAM support on all other systems, if it exists. + with_pam_default=yes + ;; +esac + +#### H1 + +have_pam=no +with_pam_req=unspecified + +AC_ARG_WITH(pam,[ +Screen Locking Options: + + --disable-locking Do not allow locking of the display at all. + --with-pam Include support for PAM (Pluggable Auth Modules).], + [with_pam="$withval"; with_pam_req="$withval"],[with_pam=$with_pam_default]) + +AC_ARG_WITH([pam_service_name], +[ --with-pam-service-name Set the name of the xscreensaver PAM service. + --enable-pam-account Whether PAM should check the result of account + modules when authenticating. Only do this if you + have "account" modules configured on your system. + --enable-root-passwd Allow the root passwd to unlock, if not using PAM.], + [pam_service_name="$withval"],[pam_service_name="xscreensaver"]) + +AC_ARG_ENABLE(pam-check-account-type, +[], # This is documented elsewhere because of --enable/--with option sorting. + [enable_pam_check_account_type="$enableval"],[enable_pam_check_account_type=no]) +if test "$enable_pam_check_account_type" = yes ; then + AC_DEFINE(PAM_CHECK_ACCOUNT_TYPE) + true +elif test "$enable_pam_check_account_type" != no ; then + echo "error: must be yes or no: --enable-pam-check-account-type=$enable_pam_check_account_type" + exit 1 +fi + +HANDLE_X_PATH_ARG(with_pam, --with-pam, PAM) + +if test "$enable_locking" = yes -a "$with_pam" = yes; then + AC_CACHE_CHECK([for PAM], ac_cv_pam, + [AC_TRY_X_COMPILE([#include ],, + [ac_cv_pam=yes], + [ac_cv_pam=no])]) + if test "$ac_cv_pam" = yes ; then + have_pam=yes + AC_DEFINE(HAVE_PAM) + AC_DEFINE_UNQUOTED(PAM_SERVICE_NAME,"$pam_service_name") + + PASSWD_LIBS="${PASSWD_LIBS} -lpam" + + # libpam typically requires dlopen and dlsym. On FreeBSD, + # those are in libc. On Linux and Solaris, they're in libdl. + AC_CHECK_LIB(dl, dlopen, [PASSWD_LIBS="${PASSWD_LIBS} -ldl"]) + + # On Linux, sigtimedwait() is in libc; on Solaris, it's in librt. + have_timedwait=no + AC_CHECK_LIB(c, sigtimedwait, + [have_timedwait=yes + AC_DEFINE(HAVE_SIGTIMEDWAIT)]) + if test "$have_timedwait" = no ; then + AC_CHECK_LIB(rt, sigtimedwait, [have_timedwait=yes + AC_DEFINE(HAVE_SIGTIMEDWAIT) + PASSWD_LIBS="${PASSWD_LIBS} -lrt"]) + fi + + AC_MSG_CHECKING(how to call pam_strerror) + AC_CACHE_VAL(ac_cv_pam_strerror_args, + [AC_TRY_X_COMPILE([#include + #include + #include ], + [pam_handle_t *pamh = 0; + char *s = pam_strerror(pamh, PAM_SUCCESS);], + [ac_pam_strerror_args=2], + [AC_TRY_X_COMPILE([#include + #include + #include ], + [char *s = + pam_strerror(PAM_SUCCESS);], + [ac_pam_strerror_args=1], + [ac_pam_strerror_args=0])]) + ac_cv_pam_strerror_args=$ac_pam_strerror_args]) + ac_pam_strerror_args=$ac_cv_pam_strerror_args + if test "$ac_pam_strerror_args" = 1 ; then + AC_MSG_RESULT(one argument) + elif test "$ac_pam_strerror_args" = 2 ; then + AC_DEFINE(PAM_STRERROR_TWO_ARGS) + AC_MSG_RESULT(two arguments) + else + AC_MSG_RESULT(unknown) + fi + +# Check pam_fail_delay + AC_MSG_CHECKING(pam_fail_delay in -lpam) + AC_CACHE_VAL(ac_cv_pam_fail_delay, + [ac_save_LDFLAGS="$LDFLAGS" + LDFLAGS="-lpam" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([#include ], + [pam_handle_t *pamh = 0; + unsigned int usec = 1; + int status = pam_fail_delay (pamh, usec);])], + [ac_pam_fail_delay=yes], + [ac_pam_fail_delay=no]) + ac_cv_pam_fail_delay=$ac_pam_fail_delay, + LDFLAGS=$ac_save_LDFLAGS]) + + if test "$ac_pam_fail_delay" = yes ; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PAM_FAIL_DELAY) + else + AC_MSG_RESULT(no) + fi + + fi +fi + + +############################################################################### +# +# Check for Kerberos. +# +############################################################################### + +have_kerberos=no +have_kerberos5=no +with_kerberos_req=unspecified + +AC_ARG_WITH(kerberos, +[ --with-kerberos Include support for Kerberos authentication.], + [with_kerberos="$withval"; with_kerberos_req="$withval"],[with_kerberos=yes]) + +HANDLE_X_PATH_ARG(with_kerberos, --with-kerberos, Kerberos) + +if test "$enable_locking" = yes -a "$with_kerberos" = yes; then + AC_CACHE_CHECK([for Kerberos 4], ac_cv_kerberos, + [AC_TRY_X_COMPILE([#include ],, + [ac_cv_kerberos=yes], + [ac_cv_kerberos=no])]) + AC_CACHE_CHECK([for Kerberos 5], ac_cv_kerberos5, + [AC_TRY_X_COMPILE([#include ],, + [ac_cv_kerberos5=yes], + [ac_cv_kerberos5=no])]) + + if test "$ac_cv_kerberos" = yes ; then + have_kerberos=yes + AC_DEFINE(HAVE_KERBEROS) + fi + + if test "$ac_cv_kerberos5" = yes ; then + + # Andrew Snare wrote: + # + # You were assuming that if kerberosV (krb5) was found, then kerberosIV + # (krb4) was also available. This turns out not to be the case with + # mit-krb-1.2.7; apparently backwards-compatibility with KerberosIV + # is optional. + # + # So, disable kerberosV support if libkrb4 can't be found. + # This is not the best solution, but it makes the compile not fail. + # + AC_CHECK_X_LIB(krb4, krb_get_tf_realm, + [have_kerberos=yes], + [have_kerberos=no]) + if test "$have_kerberos" = yes ; then + have_kerberos5=yes + AC_DEFINE(HAVE_KERBEROS) + AC_DEFINE(HAVE_KERBEROS5) + else + have_kerberos5=no + AC_MSG_WARN([Cannot find compat lib (libkrb4) needed to use Kerberos 5]) + fi + + fi + + if test "$have_kerberos5" = yes ; then + # from Matt Knopp + # (who got it from amu@mit.edu) + + PASSWD_LIBS="$PASSWD_LIBS -lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err" + + # jwz: macOS uses -lkrb5, but not -lcrypt + AC_CHECK_X_LIB(crypt, crypt, [PASSWD_LIBS="$PASSWD_LIBS -lcrypt"]) + + elif test "$have_kerberos" = yes ; then + # from Tim Showalter for FreeBSD 4.2 + PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes -lcom_err" + fi + + if test "$have_kerberos" = yes ; then + AC_CHECK_FUNC(res_search,, + AC_CHECK_LIB(resolv,res_search,PASSWD_LIBS="${PASSWD_LIBS} -lresolv", + AC_MSG_WARN([Can't find DNS resolver libraries needed for Kerberos]) + )) + fi +fi + + +############################################################################### +# +# Check for the nine billion variants of shadow passwords... +# +############################################################################### + +have_shadow=no +with_shadow_req=unspecified + +AC_ARG_WITH(shadow, +[ --with-shadow Include support for shadow password authentication.], + [with_shadow="$withval"; with_shadow_req="$withval"],[with_shadow=yes]) + +HANDLE_X_PATH_ARG(with_shadow, --with-shadow, shadow password) + +if test "$enable_locking" = no ; then + with_shadow_req=no + with_shadow=no +fi + + +############################################################################### +# +# Check for Sun "adjunct" passwords. +# +############################################################################### + +if test "$with_shadow" = yes ; then + AC_CACHE_CHECK([for Sun-style shadow passwords], ac_cv_sun_adjunct, + [AC_TRY_X_COMPILE([#include + #include + #include + #include + #include + #include ], + [struct passwd_adjunct *p = getpwanam("nobody"); + const char *pw = p->pwa_passwd;], + [ac_cv_sun_adjunct=yes], + [ac_cv_sun_adjunct=no])]) + if test "$ac_cv_sun_adjunct" = yes; then + have_shadow_adjunct=yes + have_shadow=yes + setuid_auth=yes + fi +fi + + +############################################################################### +# +# Check for DEC and SCO so-called "enhanced" security. +# +############################################################################### + +if test "$with_shadow" = yes ; then + AC_CACHE_CHECK([for DEC-style shadow passwords], ac_cv_enhanced_passwd, + [AC_TRY_X_COMPILE([#include + #include + #include + #include + #include + #include ], + [struct pr_passwd *p; + const char *pw; + set_auth_parameters(0, 0); + check_auth_parameters(); + p = getprpwnam("nobody"); + pw = p->ufld.fd_encrypt;], + [ac_cv_enhanced_passwd=yes], + [ac_cv_enhanced_passwd=no])]) + if test $ac_cv_enhanced_passwd = yes; then + have_shadow_enhanced=yes + have_shadow=yes + setuid_auth=yes + + # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx) + # (I'm told it needs -lcurses too, but I don't understand why.) + # But on DEC, it's in -lsecurity. + # + AC_CHECK_LIB(prot, getprpwnam, + [PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx"], + [AC_CHECK_LIB(security, getprpwnam, + [PASSWD_LIBS="$PASSWD_LIBS -lsecurity"])], + [-lx]) + fi +fi + +############################################################################### +# +# Check for HP's entry in the "Not Invented Here" Sweepstakes. +# +############################################################################### + +if test "$with_shadow" = yes ; then + AC_CACHE_CHECK([for HP-style shadow passwords], ac_cv_hpux_passwd, + [AC_TRY_X_COMPILE([#include + #include + #include + #include + #include + #include ], + [struct s_passwd *p = getspwnam("nobody"); + const char *pw = p->pw_passwd;], + [ac_cv_hpux_passwd=yes], + [ac_cv_hpux_passwd=no])]) + if test "$ac_cv_hpux_passwd" = yes; then + have_shadow_hpux=yes + have_shadow=yes + setuid_auth=yes + + # on HPUX, bigcrypt is in -lsec + AC_CHECK_LIB(sec, bigcrypt, [PASSWD_LIBS="$PASSWD_LIBS -lsec"]) + fi +fi + + +############################################################################### +# +# Check for FreeBSD-style shadow passwords. +# +# On FreeBSD, getpwnam() and friends work just like on non-shadow- +# password systems -- except you only get stuff in the pw_passwd field +# if the running program is setuid. So, guess that we've got this +# lossage to contend with if /etc/master.passwd exists, and default to +# a setuid installation. +# +############################################################################### + +if test "$with_shadow" = yes ; then + AC_CACHE_CHECK([for FreeBSD-style shadow passwords], ac_cv_master_passwd, + [if test -f /etc/master.passwd ; then + ac_cv_master_passwd=yes + else + ac_cv_master_passwd=no + fi]) + if test "$ac_cv_master_passwd" = yes; then + setuid_auth=yes + fi +fi + + +############################################################################### +# +# Check for OpenBSD-style shadow passwords. +# It's getpwnam_shadow instead of getpwnam, and it only works as root. +# +############################################################################### + +if test "$with_shadow" = yes ; then + AC_CACHE_CHECK([for OpenBSD-style shadow passwords], ac_cv_pwnam_shadow, + [AC_TRY_X_COMPILE([#include + #include + #include + #include ], + [struct spwd *p = getspnam_shadow("nobody"); + const char *pw = p->pw_passwd;], + [ac_cv_pwnam_shadow=yes], + [ac_cv_pwnam_shadow=no])]) + if test "$ac_cv_pwnam_shadow" = yes; then + have_pwnam_shadow=yes + + # If we also have PAM, assume that we don't need to be setuid. + if test $have_pam != yes; then + setuid_auth=yes + fi + fi +fi + + +############################################################################### +# +# Check for traditional (ha!) shadow passwords. +# +############################################################################### + +if test "$with_shadow" = yes ; then + AC_CACHE_CHECK([for generic shadow passwords], ac_cv_shadow, + [AC_TRY_X_COMPILE([#include + #include + #include + #include + #include ], + [struct spwd *p = getspnam("nobody"); + const char *pw = p->sp_pwdp;], + [ac_cv_shadow=yes], + [ac_cv_shadow=no])]) + if test "$ac_cv_shadow" = yes; then + have_shadow=yes + + # If we also have PAM, assume that we don't need to be setuid. + if test $have_pam != yes; then + setuid_auth=yes + fi + + # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc. + have_getspnam=no + AC_CHECK_LIB(c, getspnam, [have_getspnam=yes]) + if test "$have_getspnam" = no ; then + AC_CHECK_LIB(gen, getspnam, + [have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen"]) + fi + fi +fi + + +############################################################################### +# +# Check for other libraries needed for non-shadow passwords. +# +############################################################################### + +if test "$enable_locking" = yes ; then + + # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc. + have_crypt=no + AC_CHECK_LIB(c, crypt, [have_crypt=yes]) + if test "$have_crypt" = no ; then + AC_CHECK_LIB(crypt, crypt, + [have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt"]) + fi +fi + + +############################################################################### +# +# Strongly suspect that this hasn't been used in years. Also, the same +# goal is achieved by xscreensaver-auth in XScreenSaver 6. -- jwz, 2021 +# +# Check for external password helper +# On SuSE in 1993, instead of having xscreensaver be a setuid program, +# they fork an external program that takes the password on stdin, and +# returns true if that password is a valid one. Then only that smaller +# program needs to be setuid. +# +# (Note that this external program is not a GUI: the GUI is still +# all in xscreensaver itself; the external program just does auth.) +# +############################################################################### + +#have_passwd_helper=no +#with_passwd_helper_req=unspecified +# +#AC_ARG_WITH(passwd-helper, +#[ --with-passwd-helper Include support for external password verification.], +# [with_passwd_helper="$withval"; with_passwd_helper_req="$withval"],[with_passwd_helper=no]) +## no HANDLE_X_PATH_ARG for this one +# +#if test "$enable_locking" = no ; then +# with_passwd_helper_req=no +# with_passwd_helper=no +#fi +# +#case "$with_passwd_helper" in +# ""|no) : ;; +# /*) +# AC_DEFINE_UNQUOTED(PASSWD_HELPER_PROGRAM, "$with_passwd_helper") +# have_passwd_helper=yes;; +# *) +# echo "error: --with-passwd-helper needs full pathname of helper (not '$with_passwd_helper')." >&2 +# exit 1 +#esac + + + +# Most of the above shadow mechanisms will have set setuid_auth to yes, +# if they were found. But, on some systems, we need setuid even when +# using plain old vanilla passwords. +# +if test "$enable_locking" = yes -a "$have_pam" = no ; then + case "$host" in + *-hpux* | *-aix* | *-netbsd* | *-freebsd* ) + setuid_auth=yes + ;; + esac +fi + + +if test "$have_shadow_adjunct" = yes ; then + AC_DEFINE(HAVE_ADJUNCT_PASSWD) +elif test "$have_shadow_enhanced" = yes ; then + AC_DEFINE(HAVE_ENHANCED_PASSWD) +elif test "$have_shadow_hpux" = yes ; then + AC_DEFINE(HAVE_HPUX_PASSWD) +elif test "$have_shadow" = yes ; then + AC_DEFINE(HAVE_SHADOW_PASSWD) +elif test "$have_pwnam_shadow" = yes ; then + AC_DEFINE(HAVE_PWNAM_SHADOW_PASSWD) +fi + + +############################################################################### +# +# Check for -lgtk (and Gnome stuff) +# +############################################################################### + +#### H1 + +have_gtk=no +with_gtk_req=unspecified +AC_ARG_WITH(gtk, +[ +User Interface Options: + + --with-gtk Use the Gtk toolkit for the user interface.], + [with_gtk="$withval"; with_gtk_req="$withval"],[with_gtk=yes]) + +# if --with-gtk=/directory/ was specified, remember that directory so that +# we can also look for the `gtk-config' program in that directory. +case "$with_gtk" in + /*) + gtk_dir="$with_gtk" + ;; + *) + gtk_dir="" + ;; +esac + +HANDLE_X_PATH_ARG(with_gtk, --with-gtk, Gtk) + +if test "$with_gtk" != yes -a "$with_gtk" != no ; then + echo "error: must be yes or no: --with-gtk=$with_gtk" + exit 1 +fi + + +gtk_halfassed=no + +if test "$with_gtk" = yes; then + have_gtk=no + + ok="yes" + pkg_check_version gtk+-2.0 2.22.0 ; ac_gtk_version_string="$vers" + pkg_check_version gmodule-2.0 2.0.0 + pkg_check_version libxml-2.0 2.4.6 + pkg_check_version gdk-pixbuf-2.0 2.0.0 + pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0 + have_gtk="$ok" + + if test "$have_gtk" = no; then + if test -n "$ac_gtk_version_string" ; then + gtk_halfassed=yes + gtk_halfassed_lib="$req" + fi + fi + + if test "$have_gtk" = yes; then + AC_CACHE_CHECK([for Gtk includes], ac_cv_gtk_config_cflags, + [ac_cv_gtk_config_cflags=`$pkg_config --cflags $pkgs`]) + AC_CACHE_CHECK([for Gtk libs], ac_cv_gtk_config_libs, + [ac_cv_gtk_config_libs=`$pkg_config --libs $pkgs`]) + fi + + ac_gtk_config_cflags=$ac_cv_gtk_config_cflags + ac_gtk_config_libs=$ac_cv_gtk_config_libs + + GTK_DATADIR="" + if test "$have_gtk" = yes; then + GTK_DATADIR=`$pkg_config --variable=prefix gtk+-2.0` + GTK_DATADIR="$GTK_DATADIR/share" + fi + + if test "$have_gtk" = yes; then + INCLUDES="$INCLUDES $ac_gtk_config_cflags" + GTK_LIBS="$GTK_LIBS $ac_gtk_config_libs" + AC_DEFINE(HAVE_GTK) + AC_DEFINE(HAVE_GTK2) + AC_DEFINE(HAVE_XML) + fi +fi + + +# Check for the various Gnome help and URL loading programs. +# +WITH_BROWSER=gnome-open +if test "$have_gtk" = yes; then + AC_CHECK_PROGS(gnome_open_program, gnome-open) + AC_CHECK_PROGS(gnome_url_show_program, gnome-url-show) +fi + + +############################################################################### +# +# Check for -lXm. +# +############################################################################### + +have_motif=no +with_motif_req=unspecified +AC_ARG_WITH(motif, +[ --with-motif Use the Motif toolkit for the user interface.], + [with_motif="$withval"; with_motif_req="$withval"],[with_motif=no]) + +HANDLE_X_PATH_ARG(with_motif, --with-motif, Motif) + +if test "$with_motif" != yes -a "$with_motif" != no ; then + echo "error: must be yes or no: --with-motif=$with_motif" + exit 1 +fi + +if test "$with_motif" = yes; then + have_motif=no + AC_CHECK_X_HEADER(Xm/Xm.h, + [have_motif=yes + AC_DEFINE(HAVE_MOTIF) + MOTIF_LIBS="$MOTIF_LIBS -lXm"],, + [#include + #include + #include ]) +fi + + +if test "$have_motif" = yes; then + AC_CHECK_X_HEADER(Xm/ComboBox.h, [AC_DEFINE(HAVE_XMCOMBOBOX)],, + [#include + #include + #include ]) +fi + + +############################################################################### +# +# Checking whether Motif is really Lesstif. +# +############################################################################### + +have_lesstif=no +if test "$have_motif" = yes ; then + AC_CACHE_CHECK([whether Motif is really LessTif], + ac_cv_have_lesstif, + [AC_TRY_X_COMPILE([#include ], + [long vers = LesstifVersion;], + [ac_cv_have_lesstif=yes], + [ac_cv_have_lesstif=no])]) + have_lesstif=$ac_cv_have_lesstif +fi + + +lesstif_version=unknown +lesstif_version_string=unknown + +if test "$have_lesstif" = yes ; then + ltv=unknown + echo unknown > conftest-lt + AC_CACHE_CHECK([LessTif version number], + ac_cv_lesstif_version_string, + [AC_TRY_X_RUN([#include + #include + int main() { + FILE *f = fopen("conftest-lt", "w"); + if (!f) exit(1); + fprintf(f, "%d %d.%d\n", LesstifVersion, + LESSTIF_VERSION, LESSTIF_REVISION); + fclose(f); + exit(0); + }], + [ltv=`cat conftest-lt` + ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'` + ac_cv_lesstif_version_string=`echo $ltv | sed 's/.* //'`], + [ac_cv_lesstif_version=unknown + ac_cv_lesstif_version_string=unknown], + [ac_cv_lesstif_version=unknown + ac_cv_lesstif_version_string=unknown])]) + rm -f conftest-lt + lesstif_version=$ac_cv_lesstif_version + lesstif_version_string=$ac_cv_lesstif_version_string + +fi + + +if test "$have_motif" = yes ; then + mtv=unknown + echo unknown > conftest-mt + AC_CACHE_CHECK([Motif version number], + ac_cv_motif_version_string, + [AC_TRY_X_RUN([#include + #include + int main() { + FILE *f = fopen("conftest-mt", "w"); + if (!f) exit(1); + fprintf(f, "%d %d.%d\n", XmVersion, + XmVERSION, XmREVISION); + fclose(f); + exit(0); + }], + [mtv=`cat conftest-mt` + ac_cv_motif_version=`echo $mtv | sed 's/ .*//'` + ac_cv_motif_version_string=`echo $mtv | sed 's/.* //'`], + [ac_cv_motif_version=unknown + ac_cv_motif_version_string=unknown], + [ac_cv_motif_version=unknown + ac_cv_motif_version_string=unknown])]) + rm -f conftest-mt + motif_version=$ac_cv_motif_version + motif_version_string=$ac_cv_motif_version_string + +fi + + +############################################################################### +# +# Checking whether Motif requires -lXp. +# +# Some versions of Motif (2.1.0, at least) require -lXp, the "X Printing +# Extension". Why this extension isn't in -lXext with all the others, +# I have no idea. +# +############################################################################### + +have_xp_ext=no +if test "$have_motif" = yes ; then + have_xp_ext=no + AC_CHECK_X_LIB(Xp, XpQueryExtension, + [have_xp_ext=yes; MOTIF_LIBS="$MOTIF_LIBS -lXp"], + [true], -lX11 -lXext -lm) +fi + + +############################################################################### +# +# Checking whether Motif requires -lXintl (for _Xsetlocale.) +# +############################################################################### + +have_xintl=no +if test "$have_motif" = yes ; then + AC_CHECK_X_LIB(Xintl, _Xsetlocale, [have_xintl=yes], [have_xintl=no], + -lX11 -lXext -lm) + if test "$have_xintl" = yes; then + MOTIF_LIBS="$MOTIF_LIBS -lXintl" + fi +fi + + +############################################################################### +# +# Check for a login manager for a "New Login" button on the lock dialog. +# Usually this will be "/usr/bin/gdmflexiserver". +# +############################################################################### + +with_login_manager_req=unspecified +default_login_manager_1='gdmflexiserver -ls' +default_login_manager_2='kdmctl reserve' +default_login_manager_3='lxdm -c USER_SWITCH' +default_login_manager_4='dm-tool switch-to-greeter' + +AC_ARG_WITH(login-manager, +[ --with-login-manager Put a "New Login" button on the unlock dialog that + runs a login manager like gdmflexiserver or kdmctl.], + [with_login_manager="$withval"; with_login_manager_req="$withval"], + [with_login_manager=yes]) +# no HANDLE_X_PATH_ARG for this one + +if test "$enable_locking" = no ; then + with_login_manager_req=no + with_login_manager=no +fi + +case "$with_login_manager_req" in + no) + with_login_manager="" + ;; + + yes|unspecified) + # Try various defaults, use the first one that exists. + + with_login_manager="" + + if test -z "$with_login_manager" ; then + set dummy $default_login_manager_1 ; login_manager_tmp=$2 + unset ac_cv_path_login_manager_tmp # don't cache + AC_PATH_PROG(login_manager_tmp, $login_manager_tmp, []) + if test ! -z "$login_manager_tmp" ; then + with_login_manager="$default_login_manager_1" + fi + fi + + if test -z "$with_login_manager" ; then + set dummy $default_login_manager_2 ; login_manager_tmp=$2 + unset ac_cv_path_login_manager_tmp # don't cache + AC_PATH_PROG(login_manager_tmp, $login_manager_tmp, []) + if test ! -z "$login_manager_tmp" ; then + with_login_manager="$default_login_manager_2" + fi + fi + + if test -z "$with_login_manager" ; then + set dummy $default_login_manager_3 ; login_manager_tmp=$2 + unset ac_cv_path_login_manager_tmp # don't cache + AC_PATH_PROG(login_manager_tmp, $login_manager_tmp, []) + if test ! -z "$login_manager_tmp" ; then + with_login_manager="$default_login_manager_3" + fi + fi + + if test -z "$with_login_manager" ; then + set dummy $default_login_manager_4 ; login_manager_tmp=$2 + unset ac_cv_path_login_manager_tmp # don't cache + AC_PATH_PROG(login_manager_tmp, $login_manager_tmp, []) + if test ! -z "$login_manager_tmp" ; then + with_login_manager="$default_login_manager_4" + fi + fi + + ;; + + *) + # Just believe whatever command was specified. + with_login_manager="$with_login_manager_req" + ;; +esac +ac_cv_login_manager_program="$with_login_manager" + +NEW_LOGIN_COMMAND_P='' +NEW_LOGIN_COMMAND="$ac_cv_login_manager_program" + +AC_MSG_CHECKING(for login manager) +if test -z "$NEW_LOGIN_COMMAND" ; then + NEW_LOGIN_COMMAND="$default_login_manager_1" + NEW_LOGIN_COMMAND_P='! ' + AC_MSG_RESULT($NEW_LOGIN_COMMAND (disabled)) +else + AC_MSG_RESULT($NEW_LOGIN_COMMAND) +fi + + + +############################################################################### +# +# Check for a directory full of images to use as the default value +# of the "imageDirectory" preference. +# +############################################################################### + +have_imagedir=no +with_imagedir_req=unspecified + +AC_ARG_WITH(image-directory, +[ --with-image-directory Some demos will display random images from here.], + [with_imagedir="$withval"; with_imagedir_req="$withval"], + [with_imagedir=yes]) +# no HANDLE_X_PATH_ARG for this one + +case "$with_imagedir" in + /*) + # absolute path + AC_MSG_CHECKING([for image directory $with_imagedir]) + if test -d "$with_imagedir" ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + with_imagedir="" + fi + ;; + yes) + with_imagedir="" + + fallback_imgdir="" + for dd in \ + "/usr/share/rpd-wallpaper/" \ + "/usr/share/backgrounds/images/" \ + "/usr/share/wallpapers/" \ + "/usr/share/backgrounds/" \ + "/usr/share/pixmaps/backgrounds/" \ + "/usr/share/lxde/wallpapers/" \ + "/Library/Desktop Pictures/" \ + ; do + if test -z "$with_imagedir"; then + AC_MSG_CHECKING([for image directory $dd]) + if test -d "$dd"; then + if ( ls "$dd" | grep -q ... ) >&- 2>&- ; then + AC_MSG_RESULT(yes) + with_imagedir="$dd" + else + AC_MSG_RESULT(empty) + if test -z "$fallback_imgdir"; then + fallback_imgdir="$dd" + fi + fi + else + AC_MSG_RESULT(no) + fi + fi + done + if test -z "$with_imagedir"; then + with_imagedir="$fallback_imgdir" + fi +;; + no) + with_imagedir="" + ;; + + *) + echo "error: must be an absolute path: --with-image-directory=$with_imagedir_req" + exit 1 + ;; +esac +ac_cv_imagedir="$with_imagedir" + +DEFAULT_IMAGES_P='True' +DEFAULT_IMAGE_DIRECTORY="$ac_cv_imagedir" + +if test -z "$DEFAULT_IMAGE_DIRECTORY" ; then + DEFAULT_IMAGES_P='False' +fi + + +############################################################################### +# +# Pick a text file to use as the default of the "textFile" preference. +# Any old file will do, but preferably one that will make interesting +# shapes when displayed by "starwars" and "fontglide". +# +############################################################################### + +have_textfile=no +with_textfile_req=unspecified + +AC_ARG_WITH(text-file, +[ --with-text-file=FILE Some demos will use this as a source of text.], + [with_textfile="$withval"; with_textfile_req="$withval"], + [with_textfile=yes]) +# no HANDLE_X_PATH_ARG for this one + +case "$with_textfile" in + /*) + # absolute path + AC_MSG_CHECKING([for text file $with_textfile]) + if test -f "$with_textfile" ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + with_textfile="" + fi + ;; + yes) + with_textfile="" + + #### Could use some more defaults here... + for f in \ + "/usr/X11R6/lib/X11/doc/README" \ + "/usr/share/doc/xserver-common/copyright" \ + "/usr/share/doc/xserver-xorg-core/copyright" \ + "/usr/X11R6/README" \ + "/usr/share/doc/libX11*/COPYING" \ + "/usr/X11/share/X11/doc/README*" \ + "/usr/share/doc/debian/debian-manifesto" \ + ; do + if test -z "$with_textfile"; then + AC_MSG_CHECKING([for text file $f]) + f=`/bin/ls $f 2>&- | head -1` + if test -f "$f" ; then + AC_MSG_RESULT(yes) + with_textfile="$f" + else + AC_MSG_RESULT(no) + fi + fi + done + + ;; + no) + with_textfile="" + ;; + + *) + echo "error: must be an absolute path: --with-text-file=$with_textfile_req" + exit 1 + ;; +esac +ac_cv_textfile="$with_textfile" + +DEFAULT_TEXT_FILE="$ac_cv_textfile" + + +############################################################################### +# +# Check the browser to see help URL +# +############################################################################### + +have_browser=no +with_browser_req=unspecified + +AC_ARG_WITH(browser, +[ --with-browser=BROWSER The web browser used to open the "Help" URL.], + [with_browser="$withval"; with_browser_req="$withval"], + [with_browser=no ]) +# no HANDLE_X_PATH_ARG for this one + +case "$with_browser" in + no ) + ;; + * ) + WITH_BROWSER=$with_browser + gnome_open_program=$with_browser + AC_MSG_CHECKING([for browser $with_browser]) + with_browser_fullpath=`which $with_browser 2>/dev/null` + case $with_browser_fullpath in + /* ) + AC_MSG_RESULT(yes) + have_browser=yes + ;; + * ) + AC_MSG_RESULT(no) +# Only warning: we don't want to install all packages for the +# dependency of the browser in building stage... + echo "WARNING: browser not found: --with-browser=$with_browser" + ;; + esac + ;; +esac +ac_cv_browser="$with_browser" + + +############################################################################### +# +# Check for pthreads. Must come before checking for OpenGL, +# since some versions of OpenGL require it. +# +############################################################################### + +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) + +AC_ARG_WITH([pthread], +[], # This is documented after --with-gl in --with-xft. + [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 + + +############################################################################### +# +# Handle --with-gles +# Must come before --with-gl +# +############################################################################### + +with_jwzgles_req=unspecified +have_jwzgles=no +AC_ARG_WITH(gles, +[], # This is documented after --with-gl + [with_jwzgles="$withval"; with_jwzgles_req="$withval"],[with_jwzgles=no]) + +HANDLE_X_PATH_ARG(with_jwzgles, --with-gles, JWZGLES) + +if test "$with_jwzgles" = yes; then + have_jwzgles=yes + JWZGLES_OBJS='$(JWXYZ_BIN)/jwzgles.o' + AC_MSG_RESULT(emulating OpenGL 1.3 in terms of OpenGLES 1.x.) +elif test "$with_jwzgles" != no; then + echo "error: must be yes or no: --with-gles=$with_jwzgles" + exit 1 +fi + + +############################################################################### +# +# Check for -lGL or -lMesaGL. +# +############################################################################### + +#### H1 + +have_gl=no +ac_have_mesa_gl=no +with_gl_req=unspecified +gl_halfassed=no +have_glext=no +AC_ARG_WITH(gl, +[ +Graphics Options: + + --with-gl Build those demos which depend on OpenGL. + --with-gles Emulate OpenGL 1.3 in terms of OpenGL ES 1.x.], + [with_gl="$withval"; with_gl_req="$withval"],[with_gl=yes]) + +HANDLE_X_PATH_ARG(with_gl, --with-gl, GL) + +# Some GL libraries require pthreads, so use the pthreads flags when +# testing them, then set them back after. +# +ac_save_pthreads_CFLAGS="$CFLAGS" +ac_save_pthreads_LIBS="$LIBS" +CFLAGS="$PTHREAD_CFLAGS $CFLAGS" +LIBS="$PTHREAD_LIBS $LIBS" + +if test "$with_gl" = yes; then + AC_CHECK_X_HEADER(GL/gl.h, have_gl=yes, have_gl=no); + if test "$have_gl" = yes; then + AC_CHECK_X_HEADER(GL/glu.h, have_gl=yes, have_gl=no); + fi +fi + +if test "$with_gl" = yes; then + # + # Since the OpenGL and GLES specifications are a complete dumpster fire, + # it's not easy to figure out how what libraries to use. + # + # OpenGLES library names: + # + # 1.x: libGLESv1_CM + # 2.x: libGLESv2 + # 3.x: libGLESv2 on Windows, libGLESv3 on Android + # + # On modern Linux systems, these libraries exist: + # + # libGL - a superset of everything up to and including OpenGL 4.6 + # libGLESv1_CM - OpenGLES 1.1, meaning it omits much of OpenGL 1.3 + # libGLESv2 - OpenGLES 2 and 3, meaning it omits even more of OpenGL 1.3 + # + # Since Linux systems support OpenGL 1.3, those link against only libGL. + # + # Unless we are using --with-gles on Linux, in which case we are attempting + # to simulate a system that does not natively support OpenGL 1.3. In that + # case, we use the v1 and/or v2 libraries instead. + # + # Common practice on Android seems to be to link against the v1, v2 and v3 + # libraries in order, and then do runtime checks to see which set of + # functions is actually supported by the runtime. Just because you linked + # against a GLES3 library doesn't mean that the hardware supports it: most + # of these functions are just syscall-like stubs. + # + # See the commentary atop jwxyz/jwzgles.c for discussion of OpenGL versions. + # + if test "$have_gl" = yes; then + have_gl=no + + if test "$have_jwzgles" = yes; then + + # Only check for the v1/2/3 libraries on Linux when using --with-gles + # to emulate a system that does not natively support OpenGL 1.3. + + # Check for GLES 3.x + AC_CHECK_X_LIB(GLESv3, glDrawElements, + [have_gl=yes + gl_lib_1="GLESv3" + GL_LIBS="-lGLESv3 $GL_LIBS"], + [], $GL_LIBS -lm) + + # Check for GLES 2.x + AC_CHECK_X_LIB(GLESv2, glDrawElements, + [have_gl=yes + gl_lib_1="GLESv2" + GL_LIBS="-lGLESv2 $GL_LIBS"], + [], $GL_LIBS -lm) + + # Check for GLES 1.x + AC_CHECK_X_LIB(GLESv1_CM, glDrawElements, + [have_gl=yes + gl_lib_1="GLESv1_CM" + GL_LIBS="-lGLESv1_CM $GL_LIBS"], + [], $GL_LIBS -lm) + + else # $have_jwzgles = no + + # Check for OpenGL 1.x and/or OpenGL 4.x + AC_CHECK_X_LIB(GL, glEnable, + [have_gl=yes + gl_lib_1="GL" + GL_LIBS="-lGL $GL_LIBS"], + [], $GL_LIBS -lm) + + # Check for MesaGL 1.x, but only if libGL doesn't exist. + if test "$have_gl" = no; then + AC_CHECK_X_LIB(MesaGL, glEnable, + [have_gl=yes + gl_lib_1="MesaGL" + GL_LIBS="-lMesaGL $GL_LIBS"], + [], $GL_LIBS -lm) + fi + fi + fi + + # Figure out whether the GLU functions are in the main GL libraries or + # in -lGLU. Since Android does not have GLU, we don't link against libGLU + # when using --with-gles on Linux. + # + if test "$have_gl" = yes -a "$have_jwzgles" = no; then + AC_CHECK_X_LIB($gl_lib_1, gluBuild2DMipmaps, + [], + [have_gl=no], $GL_LIBS -lm) + if test "$have_gl" = no; then + AC_CHECK_X_LIB(GLU, gluBuild2DMipmaps, + [have_gl=yes + GL_LIBS="-lGLU $GL_LIBS"], + [have_gl=no + gl_halfassed=yes], + $GL_LIBS -lm) + fi + fi + + if test "$have_gl" = yes; then + + AC_DEFINE(HAVE_GL) + + # OpenGL 1.0 didn't have multiple textures. + AC_CHECK_X_LIB($gl_lib_1, glBindTexture, [AC_DEFINE(HAVE_GLBINDTEXTURE)], + [true], $GL_LIBS -lX11 -lXext -lm) + + # Check for native GLES1 + AC_CHECK_X_LIB($gl_lib_1, glBindBuffer, + [AC_DEFINE(HAVE_GLES)], + [true], $GL_LIBS -lX11 -lXext -lm) + + # Check for GLSL and GLES2 + AC_CHECK_X_HEADER(GL/glext.h, have_glext=yes, have_glext=no, + [#include ]) + if test "$have_glext" = yes ; then + AC_CHECK_X_LIB($gl_lib_1, glUseProgram, + [AC_DEFINE(HAVE_GLSL) + AC_DEFINE(HAVE_GLES2)], + [], + $GL_LIBS -lX11 -lXext -lm) + fi + + # Check for GLES3 + AC_CHECK_X_LIB($gl_lib_1, glBlitFramebuffer, + [AC_DEFINE(HAVE_GLES3)], + [], + $GL_LIBS -lX11 -lXext -lm) + + if test "$have_jwzgles" = yes; then + AC_DEFINE(HAVE_JWZGLES) + AC_DEFINE(HAVE_GLES) + fi + + fi + + +elif test "$with_gl" != no; then + echo "error: must be yes or no: --with-gl=$with_gl" + exit 1 +fi + + +############################################################################### +# +# Handle --with-glx +# +############################################################################### + +have_glx=no +have_egl=no +with_egl_req=unspecified +AC_ARG_WITH(glx, +[ --with-glx Use GLX to interface OpenGL and X11 instead of EGL.], + [with_egl="$withval"; with_egl_req="$withval"], + [with_glx=no]) + +HANDLE_X_PATH_ARG(with_glx, --with-glx, GLX) + +if test "$with_glx" = yes; then + AC_CHECK_X_HEADER(GLX/glx.h, have_glx=yes, have_glx=no) +elif test "$with_glx" != no; then + echo "error: must be yes or no: --with-glx=$with_glx" + exit 1 +fi + +if test "$have_gl" = yes; then + + # See if GLX functions are in -LGL. + AC_CHECK_X_LIB($gl_lib_1, glXCreateContext, + [have_glx=yes], + [have_glx=no], + $GL_LIBS -lm) + + # See if EGL functions are in -LGL. + egl_lib="" + AC_CHECK_X_LIB($gl_lib_1, eglCreatePlatformWindowSurface, + [have_egl=yes], + [have_egl=no], + $GL_LIBS -lm) + if test "$have_egl" = no; then + # See if EGL functions are in -lEGL. + AC_CHECK_X_LIB(EGL, eglCreatePlatformWindowSurface, + [have_egl=yes + egl_lib="EGL"], + [have_egl=no], + $GL_LIBS -lm) + fi + + # If both GLX and EGL exist, use GLX only if requested. + if test "$with_glx" = yes -a "$have_glx" = yes; then + have_egl=no + fi + + if test "$have_egl" = yes; then + AC_DEFINE(HAVE_EGL) + if test \! -z "$egl_lib"; then + GL_LIBS="-l$egl_lib $GL_LIBS" + fi + fi + + # One of them is required + if test "$have_egl" = no -a "$have_glx" = no; then + have_gl=no + gl_halfassed=yes + fi + + # --with-gles means that we are emulating a system that supports GLES but + # does not support OpenGL 1.3 (e.g., using Linux to simulate an Android-like + # environment). On such a system, GLE is required and GLX wouldn't exist. + # There is no way to request a GLES 3.0 runtime context using GLX. + # + if test "$have_jwzgles" = yes -a "$have_egl" = no; then + AC_MSG_WARN([Using --with-glx and --with-gles together is a bad idea.]) + fi + +fi + + +# Restore flags after testing OpenGL libraries. +# +CFLAGS="$ac_save_pthreads_CFLAGS" +LIBS="$ac_save_pthreads_LIBS" + + +############################################################################### +# +# Check for -lgle. +# +############################################################################### + +have_gle=no +with_gle_req=unspecified +gle_halfassed=no +AC_ARG_WITH(gle, +[ --with-gle Include support for the GL Extrusion library.], + [with_gle="$withval"; with_gle_req="$withval"],[with_gle=yes]) + +HANDLE_X_PATH_ARG(with_gle, --with-gle, GLE) + +GLE_LIBS="" + +if test "$have_gl" = no ; then + true +elif test "$with_gle" = yes; then + + AC_CHECK_X_HEADER(GL/gle.h, have_gle3=yes, have_gle3=no, + [#include ]) + if test "$have_gle3" = yes ; then + have_gle=yes; + else + AC_CHECK_X_HEADER(GL/gutil.h, have_gle=yes, have_gle=no, + [#include ]) + if test "$have_gle" = yes ; then + AC_CHECK_X_HEADER(GL/tube.h, have_gle=yes, have_gle=no, + [#include ]) + fi + fi + + if test "$have_gle" = yes ; then + have_gle=no + gle_halfassed=yes + AC_CHECK_X_LIB(gle, gleCreateGC, + [have_gle=yes; gle_halfassed=no; GLE_LIBS="-lgle"], + [], $GL_LIBS -lX11 -lXext -lm) + fi + if test "$have_gle" = yes ; then + have_gle=no + gle_halfassed=yes + + # sometimes the libmatrix stuff is included in libgle. look there first. +# +# I don't get it. For some reason, this test passes on SGI, as if +# uview_direction_d() was in libgle -- but it's not, it's in libmatrix. +# Yet the link is succeeding. Why??? +# +# AC_CHECK_X_LIB(gle, uview_direction_d, +# [have_gle=yes; gle_halfassed=no], +# [], $GL_LIBS -lX11 -lXext -lm) + + # As of GLE 3 this is in libgle, and has changed name to uview_direction! + # *sigh* + if test "$have_gle3" = yes ; then + AC_CHECK_X_LIB(gle, uview_direction, + [have_gle=yes; gle_halfassed=no], + [], $GL_LIBS -lX11 -lXext -lm) + fi + # if it wasn't in libgle, then look in libmatrix. + if test "$have_gle" = no ; then + AC_CHECK_X_LIB(matrix, uview_direction_d, + [have_gle=yes; gle_halfassed=no; + GLE_LIBS="$GLE_LIBS -lmatrix"], + [], $GL_LIBS -lX11 -lXext -lm) + fi + fi + + if test "$have_gle" = yes ; then + AC_DEFINE(HAVE_GLE) + if test "$have_gle3" = yes ; then + AC_DEFINE(HAVE_GLE3) + fi + fi + +elif test "$with_gle" != no; then + echo "error: must be yes or no: --with-gle=$with_gle" + exit 1 + +fi + + +############################################################################### +# +# Check for -ljpeg +# +############################################################################### + +have_jpeg=no +with_jpeg_req=unspecified +jpeg_halfassed=no +AC_ARG_WITH(jpeg, +[ --with-jpeg Include support for the JPEG library.], + [with_jpeg="$withval"; with_jpeg_req="$withval"], + [with_jpeg=yes]) + +HANDLE_X_PATH_ARG(with_jpeg, --with-jpeg, JPEG) + +if test "$with_jpeg" != yes -a "$with_jpeg" != no ; then + echo "error: must be yes or no: --with-jpeg=$with_jpeg" + exit 1 +fi + +if test "$with_jpeg" = yes; then + + have_jpeg=no + AC_CHECK_X_HEADER(jpeglib.h, [have_jpeg=yes]) + + if test "$have_jpeg" = yes; then + # we have the header, now check for the library + have_jpeg=no + jpeg_halfassed=yes + AC_CHECK_X_LIB(jpeg, jpeg_start_compress, + [have_jpeg=yes + jpeg_halfassed=no + JPEG_LIBS="-ljpeg" + AC_DEFINE(HAVE_JPEGLIB)]) + fi +fi + + +############################################################################### +# +# Check for -lpng +# +############################################################################### + +have_png=no +with_png_req=unspecified +png_halfassed=no +AC_ARG_WITH(png, +[ --with-png Include support for the PNG library.], + [with_png="$withval"; with_png_req="$withval"], + [with_png=yes]) + +HANDLE_X_PATH_ARG(with_png, --with-png, PNG) + +if test "$with_png" != yes -a "$with_png" != no ; then + echo "error: must be yes or no: --with-png=$with_png" + exit 1 +fi + +if test "$with_png" = yes; then + + have_png=no + AC_CHECK_X_HEADER(png.h, [have_png=yes]) + + if test "$have_png" = yes; then + # we have the header, now check for the library + have_png=no + png_halfassed=yes + AC_CHECK_X_LIB(png, png_create_read_struct, + [have_png=yes + png_halfassed=no + PNG_LIBS="-lpng" + AC_DEFINE(HAVE_LIBPNG)]) + fi +fi + + +############################################################################### +# +# Check for -lgdk_pixbuf. +# These tests are for gdk_pixbuf usage of the hacks, +# not xscreensaver-settings (thus we have to test again to get +# the libraries right: don't want to pull in all of GTK +# for the hacks.) +# +############################################################################### + +have_gdk_pixbuf=no +with_gdk_pixbuf_req=unspecified +AC_ARG_WITH(pixbuf, +[ --with-pixbuf Include support for the GDK-Pixbuf library, which + allows the display of JPEG, PNG, GIF and SVG images.], + [with_gdk_pixbuf="$withval"; with_gdk_pixbuf_req="$withval"], + [with_gdk_pixbuf=yes]) + +# if --with-pixbuf=/directory/ was specified, remember that directory so that +# we can also look for the `gdk-pixbuf-config' program in that directory. +case "$with_gdk_pixbuf" in + /*) + gdk_pixbuf_dir="$with_gdk_pixbuf" + ;; + *) + gdk_pixbuf_dir="" + ;; +esac + +HANDLE_X_PATH_ARG(with_gdk_pixbuf, --with-pixbuf, GDK_PIXBUF) + +if test "$with_gdk_pixbuf" != yes -a "$with_gdk_pixbuf" != no ; then + echo "error: must be yes or no: --with-pixbuf=$with_gdk_pixbuf" + exit 1 +fi + +if test "$with_gdk_pixbuf" = yes; then + have_gdk_pixbuf=no + + pkgs='' + ok="yes" + + pkg_check_version gdk-pixbuf-2.0 2.0.0 + pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0 + pkg_check_version gio-2.0 2.0.0 + have_gdk_pixbuf="$ok" + + if test "$have_gdk_pixbuf" = yes; then + AC_CACHE_CHECK([for gdk-pixbuf includes], ac_cv_gdk_pixbuf_config_cflags, + [ac_cv_gdk_pixbuf_config_cflags=`$pkg_config --cflags $pkgs`]) + AC_CACHE_CHECK([for gdk-pixbuf libs], ac_cv_gdk_pixbuf_config_libs, + [ac_cv_gdk_pixbuf_config_libs=`$pkg_config --libs $pkgs`]) + fi + + ac_gdk_pixbuf_config_cflags=$ac_cv_gdk_pixbuf_config_cflags + ac_gdk_pixbuf_config_libs=$ac_cv_gdk_pixbuf_config_libs + + + if test "$have_gdk_pixbuf" = yes; then + # + # we appear to have pixbuf; check for headers/libs to be sure. + # + ac_save_gdk_pixbuf_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $ac_gdk_pixbuf_config_cflags" + + have_gdk_pixbuf=no + + # check for header A... + AC_CHECK_X_HEADER(gdk-pixbuf/gdk-pixbuf.h, [have_gdk_pixbuf=yes]) + + # if that worked, check for header B... + if test "$have_gdk_pixbuf" = yes; then + have_gdk_pixbuf=no + gdk_pixbuf_halfassed=yes + AC_CHECK_X_HEADER(gdk-pixbuf/gdk-pixbuf-xlib.h, + [have_gdk_pixbuf=yes + gdk_pixbuf_halfassed=no]) + + # yay, it has a new name in Gtk 2.x... + if test "$have_gdk_pixbuf" = no; then + have_gdk_pixbuf=no + gdk_pixbuf_halfassed=yes + AC_CHECK_X_HEADER(gdk-pixbuf-xlib/gdk-pixbuf-xlib.h, + [have_gdk_pixbuf=yes + gdk_pixbuf_halfassed=no]) + fi + fi + CPPFLAGS="$ac_save_gdk_pixbuf_CPPFLAGS" + fi + + if test "$have_gdk_pixbuf" = yes; then + # we have the headers, now check for the libraries + have_gdk_pixbuf=no + gdk_pixbuf_halfassed=yes + + AC_MSG_RESULT(checking for gdk_pixbuf usability...) + + # library A... + AC_CHECK_X_LIB(c, gdk_pixbuf_new_from_file, [have_gdk_pixbuf=yes],, + $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm) + # library B... + if test "$have_gdk_pixbuf" = yes; then + have_gdk_pixbuf=no + AC_CHECK_X_LIB(c, gdk_pixbuf_xlib_init, + [have_gdk_pixbuf=yes + gdk_pixbuf_halfassed=no],, + $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm) + fi + fi + + if test "$have_gdk_pixbuf" = yes; then + INCLUDES="$INCLUDES $ac_gdk_pixbuf_config_cflags" + PNG_LIBS="$ac_gdk_pixbuf_config_libs" + AC_DEFINE(HAVE_GDK_PIXBUF) + else + AC_MSG_RESULT(checking for gdk_pixbuf usability... no) + fi + + if test "$have_gdk_pixbuf" = yes; then + AC_CHECK_X_LIB(c, gdk_pixbuf_apply_embedded_orientation, + [AC_DEFINE(HAVE_GDK_PIXBUF_APPLY_EMBEDDED_ORIENTATION)],, + $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm) + fi +fi + + +############################################################################### +# +# Check for -lXft +# +############################################################################### + +have_xutf8drawstring=no +AC_CHECK_X_LIB(X11, Xutf8DrawString, + [have_xutf8drawstring=yes], + [true], -lX11 -lXext -lm) +if test "$have_xutf8drawstring" = yes ; then + AC_DEFINE(HAVE_XUTF8DRAWSTRING) +fi + + +have_xft=no +with_xft_req=unspecified +xft_halfassed=no +AC_ARG_WITH(xft, +[ --with-xft Include support for the X Freetype library. + --with-pthread Enables POSIX threads, for SMP support.], + [with_xft="$withval"; with_xft_req="$withval"], + [with_xft=yes]) + +HANDLE_X_PATH_ARG(with_xft, --with-xft, Xft) + +if test "$with_xft" != yes -a "$with_xft" != no ; then + echo "error: must be yes or no: --with-xft=$with_xft" + exit 1 +fi + +if test "$with_xft" = yes; then + + pkgs='' + ok="yes" + pkg_check_version xft 2.1.0 + have_xft="$ok" + + if test "$have_xft" = yes; then + AC_CACHE_CHECK([for Xft includes], ac_cv_xft_config_cflags, + [ac_cv_xft_config_cflags=`$pkg_config --cflags $pkgs`]) + AC_CACHE_CHECK([for Xft libs], ac_cv_xft_config_libs, + [ac_cv_xft_config_libs=`$pkg_config --libs $pkgs`]) + fi + + ac_xft_config_cflags=$ac_cv_xft_config_cflags + ac_xft_config_libs=$ac_cv_xft_config_libs + + if test "$have_xft" = yes; then + # + # we appear to have Xft; check for headers/libs to be sure. + # + ac_save_xft_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $ac_xft_config_cflags" + + have_xft=no + AC_CHECK_X_HEADER(X11/Xft/Xft.h, [have_xft=yes]) + + CPPFLAGS="$ac_save_xft_CPPFLAGS" + fi + + if test "$have_xft" = yes; then + # we have the headers, now check for the libraries + have_xft=no + xft_halfassed=yes + + AC_MSG_RESULT(checking for Xft usability...) + AC_CHECK_X_LIB(c, XftDrawStringUtf8, [have_xft=yes],, + $ac_xft_config_libs -lX11 -lXext -lm) + fi + + if test "$have_xft" = no; then + AC_MSG_RESULT(checking for Xft usability... no) + fi +fi + +if test "$have_xft" = yes; then + INCLUDES="$INCLUDES $ac_xft_config_cflags" + XFT_LIBS="$ac_xft_config_libs" + XFT_SRCS='' + XFT_OBJS='' + AC_DEFINE(HAVE_XFT) +else + XFT_LIBS='' + XFT_SRCS='$(UTILS_SRC)/xft.c' + XFT_OBJS='$(UTILS_BIN)/xft.o' +fi + + +############################################################################### +# +# Check for pty support: this allows 'phosphor' and 'apple2' +# to run curses-based programs, or be used as terminal windows. +# +############################################################################### + +PTY_LIBS= +AC_CHECK_HEADERS(pty.h util.h sys/termios.h) +AC_CHECK_X_LIB(util, forkpty, + [PTY_LIBS="-lutil" + ac_have_forkpty=yes + AC_DEFINE(HAVE_FORKPTY)]) + +if test "$ac_have_forkpty" != yes ; then + # we don't need (or have) -lutil on macOS 10.4.2... + AC_CHECK_X_LIB(c, forkpty, + [PTY_LIBS="" + AC_DEFINE(HAVE_FORKPTY)]) +fi + + +############################################################################### +# +# Check for libcap, which allows "sonar" to work without setuid. +# Except, nevermind, that's bad. See comments in sonar-icmp.c. +# +############################################################################### + +have_libcap=no +setcap_hacks_default=no +setcap_hacks="$setcap_hacks_default" +setcap_hacks_req=unspecified + +#AC_ARG_WITH(setcap-hacks, +#[ --with-setcap-hacks Build the "sonar" demo with libcap, which allows +# it to ping other hosts without being setuid.], +# [setcap_hacks="$withval"; setcap_hacks_req="$withval"], +# [setcap_hacks=yes]) +# +#HANDLE_X_PATH_ARG(setcap_hacks, --with-setcap-hacks, setcap hacks) +# +#if test "$setcap_hacks" != yes -a "$setcap_hacks" != no ; then +# echo "error: must be yes or no: --with-setcap-hacks=$setcap_hacks" +# exit 1 +#fi +# +#if test "$setcap_hacks" = yes; then +# +# AC_CHECK_PROGS(setcap_program, setcap) +# if test "$setcap_program" != ''; then +# AC_CHECK_X_HEADER(sys/capability.h, [have_setcap=yes]) +# fi +# if test "$have_setcap" = yes; then +# AC_CHECK_X_LIB(cap, cap_set_flag, +# [have_libcap=yes +# PROG_SETCAP="$setcap_program" +# LIBCAP_LIBS="-lcap" +# AC_DEFINE(HAVE_LIBCAP)]) +# fi +#fi + + +############################################################################### +# +# Sonar must be setuid to be able to ping other hosts. +# +############################################################################### + +if test "$have_libcap" = yes; then + setuid_hacks_default=no +else + setuid_hacks_default=yes +fi + +setuid_hacks="$setuid_hacks_default" +AC_ARG_WITH(setuid-hacks, +[ --with-setuid-hacks Install the "sonar" demo as setuid root, which is + needed in order to ping other hosts.], + [setuid_hacks="$withval"], [setuid_hacks="$setuid_hacks_default"]) + +HANDLE_X_PATH_ARG(setuid_hacks, --with-setuid-hacks, setuid hacks) + +if test "$setuid_hacks" = yes; then + true +elif test "$setuid_hacks" != no; then + echo "error: must be yes or no: --with-setuid-hacks=$setuid_hacks" + exit 1 +fi + + +############################################################################### +# +# Check for --with-record-animation +# +############################################################################### + +record_anim_default=no +record_anim="$record_anim_default" +AC_ARG_WITH(record-animation, +[ --with-record-animation Include code for generating MP4 videos.], + [record_anim="$withval"], [record_anim="$record_anim_default"]) + +HANDLE_X_PATH_ARG(record_anim, --with-record-animation, record animation) + +if test "$record_anim" = yes; then + true +elif test "$record_anim" != no; then + echo "error: must be yes or no: --with-record-animation=$record_anim" + exit 1 +fi + +if test "$record_anim" = yes; then + if test "$have_gdk_pixbuf" != yes; then + AC_MSG_ERROR(--with-record-animation requires GDK-Pixbuf) + else + AC_MSG_RESULT(enabling --with-record-animation) + AC_DEFINE(HAVE_RECORD_ANIM) + ANIM_OBJS='$(ANIM_OBJS)' + ANIM_LIBS='$(ANIM_LIBS)' + fi +fi + + +############################################################################### +# +# Done testing. Now, set up the various -I and -L variables, +# and decide which GUI program to build by default. +# +############################################################################### + +DEPEND=makedepend +DEPEND_FLAGS= +DEPEND_DEFINES= + + +if test \! -z "$includedir" ; then + INCLUDES="$INCLUDES -I$includedir" +fi + +if test \! -z "$libdir" ; then + LDFLAGS="$LDFLAGS -L$libdir" +fi + + +PREFERRED_DEMO_PROGRAM='' +ALL_DEMO_PROGRAMS= +if test "$have_motif" = yes; then + PREFERRED_DEMO_PROGRAM=xscreensaver-settings-Xm + ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS" +fi +if test "$have_gtk" = yes; then + PREFERRED_DEMO_PROGRAM=xscreensaver-settings-Gtk + ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS" +fi + + +if test "$have_kerberos" = yes; then + PASSWD_SRCS="$PASSWD_SRCS \$(KERBEROS_SRCS)" + PASSWD_OBJS="$PASSWD_OBJS \$(KERBEROS_OBJS)" +fi +if test "$have_pam" = yes; then + PASSWD_SRCS="$PASSWD_SRCS \$(PAM_SRCS)" + PASSWD_OBJS="$PASSWD_OBJS \$(PAM_OBJS)" + INSTALL_PAM="install-pam" +fi +if test "$enable_pam_check_account_type" = yes; then + COMMENT_PAM_CHECK_ACCOUNT="" +else + COMMENT_PAM_CHECK_ACCOUNT="#" +fi +#if test "$have_passwd_helper" = yes; then +# PASSWD_SRCS="$PASSWD_SRCS \$(PWHELPER_SRCS)" +# PASSWD_OBJS="$PASSWD_OBJS \$(PWHELPER_OBJS)" +#fi + PASSWD_SRCS="$PASSWD_SRCS \$(PWENT_SRCS)" + PASSWD_OBJS="$PASSWD_OBJS \$(PWENT_OBJS)" + + +if test "$enable_locking" = yes; then + LOCK_SRCS='$(LOCK_SRCS_1) $(PASSWD_SRCS)' + LOCK_OBJS='$(LOCK_OBJS_1) $(PASSWD_OBJS)' +else + LOCK_SRCS='$(NOLOCK_SRCS_1)' + LOCK_OBJS='$(NOLOCK_OBJS_1)' +fi + +if test "$ac_macosx" = yes; then + EXES_OSX='$(EXES_OSX)' + SCRIPTS_OSX='$(SCRIPTS_OSX)' + MEN_OSX='$(MEN_OSX)' +else + EXES_OSX= + SCRIPTS_OSX= + MEN_OSX= +fi + + +if test "$setuid_auth" = yes; then + SETUID_AUTH=yes +else + SETUID_AUTH=no +fi + +if test "$setuid_hacks" = yes; then + SETUID_HACKS=yes +else + SETUID_HACKS=no +fi + +if test "$have_libcap" = yes; then + SETCAP_HACKS=yes +else + SETCAP_HACKS=no +fi + +tab=' ' +if test "$have_gl" = yes; then + GL_EXES='$(GL_EXES)' + SUID_EXES='$(SUID_EXES)' + RETIRED_GL_EXES='$(RETIRED_GL_EXES)' + GL_UTIL_EXES='$(GL_UTIL_EXES)' + GL_MEN='$(GL_MEN)' + GL_KLUDGE=" " +else + GL_KLUDGE="-" +fi + +if test "$have_gle" = yes; then + GLE_EXES='$(GLE_EXES)' + GLE_KLUDGE=" " +else + GLE_KLUDGE="-" +fi + +if test "$have_jpeg" = yes -a "$have_gdk_pixbuf" = yes; then + JPEG_EXES='$(JPEG_EXES)' +fi + + +# Another substitution in the XScreenSaver.ad.in file: +# +if test "$gnome_open_program" != ''; then + GNOME24='' + GNOME22='! ' + NOGNOME='! ' +elif test "$gnome_url_show_program" != ''; then + GNOME24='! ' + GNOME22='' + NOGNOME='! ' +else + GNOME24='! ' + GNOME22='! ' + NOGNOME='' +fi + + +# Set PO_DATADIR to something sensible. +# +AC_MSG_CHECKING([for locale directory]) +if test -n "$GTK_DATADIR" ; then + PO_DATADIR="$GTK_DATADIR" +elif test "$have_gtk" = yes; then + PO_DATADIR=`$pkg_config --variable=prefix gtk+-2.0` + PO_DATADIR="$PO_DATADIR/share" +fi + +if test -z "$PO_DATADIR" ; then + # + # #### Total fucking kludge -- + # Map /build/prefix/usr/X11R6/share/ to /build/prefix/usr/share/ + # but of course we need to expand all the nested variables to do that... + # + dd=`eval eval eval eval eval eval eval eval eval eval eval echo $datadir` + PO_DATADIR=`echo $dd | sed 's@/X11R6/@/@'` +fi + +AC_MSG_RESULT($PO_DATADIR/locale) + + +# canonicalize slashes. +HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'` +FONT_DIR=`echo "${FONT_DIR}" | sed 's@/$@@;s@//*@/@g'` + +# gcc 3.0 likes to issue this warning for every file: +# +# cc1: warning: changing search order for system directory "/usr/local/include" +# cc1: warning: as it has already been specified as a non-system directory +# +# Yay. We can only avoid that by deleting "-I${prefix}/include" from the list. +# Which *should* be totally redundant, and thus an ok thing to delete? +# +INCLUDES=`echo "$INCLUDES" | sed 's@ -I${prefix}/include@@g;'` + + +############################################################################### +# +# Perform substitutions and write Makefiles. +# +############################################################################### + +AC_SUBST(INCLUDES) + +AC_SUBST(PREFERRED_DEMO_PROGRAM) +AC_SUBST(ALL_DEMO_PROGRAMS) +AC_SUBST(SAVER_LIBS) +AC_SUBST(MOTIF_LIBS) +AC_SUBST(GTK_LIBS) +AC_SUBST(XML_LIBS) +AC_SUBST(PNG_LIBS) +AC_SUBST(JPEG_LIBS) +AC_SUBST(HACK_LIBS) +AC_SUBST(PTY_LIBS) +AC_SUBST(GL_LIBS) +AC_SUBST(GLE_LIBS) +AC_SUBST(XDPMS_LIBS) +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(XINERAMA_LIBS) +AC_SUBST(PASSWD_LIBS) +AC_SUBST(LIBCAP_CFLAGS) +AC_SUBST(LIBCAP_LIBS) +AC_SUBST(PROG_SETCAP) +AC_SUBST(SETUID_AUTH) +AC_SUBST(SETUID_HACKS) +AC_SUBST(SETCAP_HACKS) +AC_SUBST(INSTALL_DIRS) +AC_SUBST(INSTALL_PAM) +AC_SUBST(HAVE_PAM_FAIL_DELAY) +AC_SUBST(COMMENT_PAM_CHECK_ACCOUNT) +AC_SUBST(NEW_LOGIN_COMMAND) +AC_SUBST(NEW_LOGIN_COMMAND_P) +AC_SUBST(DEFAULT_IMAGES_P) +AC_SUBST(DEFAULT_IMAGE_DIRECTORY) +AC_SUBST(DEFAULT_TEXT_FILE) +AC_SUBST(WITH_BROWSER) + +AC_SUBST(EXES_OSX) +AC_SUBST(EXES_SYSTEMD) +AC_SUBST(SYSTEMD_LIBS) +AC_SUBST(SCRIPTS_OSX) +AC_SUBST(MEN_OSX) + +AC_SUBST(PASSWD_SRCS) +AC_SUBST(PASSWD_OBJS) +AC_SUBST(XFT_SRCS) +AC_SUBST(XFT_OBJS) +AC_SUBST(XFT_LIBS) +AC_SUBST(LOCK_SRCS) +AC_SUBST(LOCK_OBJS) +AC_SUBST(JPEG_EXES) +AC_SUBST(GL_EXES) +AC_SUBST(RETIRED_GL_EXES) +AC_SUBST(SUID_EXES) +AC_SUBST(GL_UTIL_EXES) +AC_SUBST(GL_MEN) +AC_SUBST(GL_KLUDGE) +AC_SUBST(GLE_EXES) +AC_SUBST(GLE_KLUDGE) +AC_SUBST(JWZGLES_OBJS) +AC_SUBST(GNOME24) +AC_SUBST(GNOME22) +AC_SUBST(NOGNOME) +AC_SUBST(HACKDIR) +AC_SUBST(HACKDIR_FULL) +AC_SUBST(GTK_DATADIR) +AC_SUBST(PO_DATADIR) +AC_SUBST(HACK_CONF_DIR) +AC_SUBST(FONT_DIR) +AC_SUBST(ANIM_OBJS) +AC_SUBST(ANIM_LIBS) + +APPDEFAULTS=$ac_x_app_defaults +AC_SUBST(APPDEFAULTS) + +AC_SUBST(DEPEND) +AC_SUBST(DEPEND_FLAGS) +AC_SUBST(DEPEND_DEFINES) +AC_SUBST(PERL) + +AC_CONFIG_FILES([Makefile + utils/Makefile + jwxyz/Makefile + hacks/Makefile + hacks/fonts/Makefile + hacks/images/Makefile + hacks/glx/Makefile + po/Makefile.in + driver/Makefile + driver/xscreensaver.pam + driver/XScreenSaver.ad]) +AC_OUTPUT + +############################################################################### +# +# Print some warnings at the end. +# +############################################################################### + +warn_prefix_1=" Warning:" +warn_prefix_2=" Note:" +warn_prefix="$warn_prefix_1" + +warning=no +warnsep=' #################################################################' + +warnpre() { + if test "$warning" = no ; then + echo '' ; echo "$warnsep" ; echo '' + warning=yes + fi +} + +warn() { + warnpre + if test "$warning" = long ; then echo '' ; fi + warning=yes + rest="$@" + echo "$warn_prefix $rest" +} + +warnL() { + was=$warning + warnpre + warning=yes + if test "$was" != no ; then echo '' ; fi + rest="$@" + echo "$warn_prefix $rest" +} + +warn2() { + rest="$@" + echo " $rest" + warning=long +} + +note() { + warn_prefix="$warn_prefix_2" + warn $@ + warn_prefix="$warn_prefix_1" +} + +noteL() { + warn_prefix="$warn_prefix_2" + warnL $@ + warn_prefix="$warn_prefix_1" +} + + +# ac_prog_cc_no_pthread normally only happens on AIX, because according +# to AX_PTHREAD, AIX needs CC=xlc_r or CC=cc_r to do threads. +# If CC is specified, it takes precedence over --with-pthread. +if test "$ac_prog_cc_no_pthread" ; then + warnL "You requested $ac_original_cc for the C compiler, but it doesn't" + warn2 "support POSIX threads." + echo "" + warn2 "If you have multiple CPU cores, try CC=$PTHREAD_CC." +elif test "$with_pthread_req" = yes -a "$have_pthread" = no ; then + warn 'POSIX threads were requested, but were not found.' +fi + +if test "$with_sgi_req" = yes -a "$have_sgi" = no ; then + warn 'The SGI saver extension was requested, but was not found.' +fi + +if test "$with_xidle_req" = yes -a "$have_xidle" = no ; then + warn 'The XIdle extension was requested, but was not found.' +fi + +if test "$with_mit_req" = yes -a "$have_mit" = no ; then + warn 'The MIT-SCREEN-SAVER extension was requested, but was not found.' +fi + +if test "$with_xshm_req" = yes -a "$have_xshm" = no ; then + warn 'The XSHM extension was requested, but was not found.' +fi + +if test "$with_xdbe_req" = yes -a "$have_xdbe" = no ; then + warn 'The DOUBLE-BUFFER extension was requested, but was not found.' +fi + +#if test "$with_xcomposite_req" = yes -a "$have_xcomposite" = no ; then +# warn 'The XCOMPOSITE extension was requested, but was not found.' +#fi + +if test "$with_xkb_req" = yes -a "$have_xkb" = no ; then + warn 'The X Keyboard extension was requested, but was not found.' +fi + +if test "$with_sgivc_req" = yes -a "$have_sgivc" = no ; then + warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.' +fi + +if test "$with_dpms_req" = yes -a "$have_dpms" = no ; then + warn 'The DPMS extension was requested, but was not found.' +fi + +if test "$with_xinerama_req" = yes -a "$have_xinerama" = no ; then + warn 'The Xinerama extension was requested, but was not found.' +fi + +if test "$with_xf86vmode_req" = yes -a "$have_xf86vmode" = no ; then + warn 'The XF86VMODE extension was requested, but was not found.' +fi + +if test "$with_randr_req" = yes -a "$have_randr" = no ; then + warn 'The RANDR extension was requested, but was not found.' +fi + +if test "$with_proc_interrupts_req" = yes -a "$have_proc_interrupts" = no; then + warn "Checking of /proc/interrupts was requested, but it's bogus." +fi + +if test "$pkg_config" = false ; then + warnL 'The "pkg-config" program was not found. Without that,' + warn2 "detection of the various GTK libraries won't work." +else + pkgerr=`$pkg_config --list-all 2>&1 >/dev/null` + if test "x$pkgerr" != "x" ; then + warnL 'The "pkg-config" program produces errors. This often causes' + warn2 "detection of the various GTK libraries to malfunction." + warn2 "The errors are:" + echo '' + echo "$pkgerr" | sed 's/^/ > /g' + fi +fi + +if test "$gtk_halfassed" != no ; then + warnL "GTK was found, but $gtk_halfassed_lib was not, so GTK can't be used." +fi + +motif_warn2() { + warn2 'Though the Motif front-end to xscreensaver is still' + warn2 'maintained, it is no longer being updated with new' + warn2 'features: all new development on the xscreensaver-settings' + warn2 'program is happening in the GTK version, and not in the' + warn2 'Motif version. It is recommended that you build against' + warn2 'GTK instead of Motif. See .' +} + +if test "$have_motif" = no -a "$have_gtk" = no; then + + if test "$with_motif" = yes; then + warnL "Neither the GTK nor Motif libraries were found; the" + warn2 "\`xscreensaver-settings' program requires one of these." + echo '' + motif_warn2 + else + warnL "The GTK libraries do not seem to be available; the" + warn2 "\`xscreensaver-settings' program requires them." +# echo '' +# warn2 'You can use Motif or Lesstif instead of GTK (use the' +# warn2 "\`--with-motif' option) but that is NOT recommended." +# motif_warn2 + fi + +elif test "$with_motif_req" = yes -a "$have_motif" = no ; then + warnL "Use of Motif was requested, but it wasn't found;" + warn2 "Gtk will be used instead." + +elif test "$with_gtk_req" = yes -a "$have_gtk" = no ; then + warnL "Use of Gtk was requested, but it wasn't found." +fi + + +if test "$ac_cv_libxt" != yes ; then + warnL 'The Xt library was not found. It is required.' +fi + +if test "$have_gtk" = yes -a "$have_gdk_pixbuf" = no ; then + warn "GTK is being used, but the GDK-Pixbuf library and/or" + warn2 "headers were not found. That can't be good. Please" + warn2 "install the GDK-Pixbuf development kit and re-configure." +fi + +if test "$have_motif" = yes -a "$have_lesstif" = yes ; then + + preferred_lesstif=0.92 + + if test "$lesstif_version" = unknown; then + warnL "Unable to determine the LessTif version number!" + warn2 "Make sure you are using version $preferred_lesstif or newer." + warn2 "See ." + + elif test \! $lesstif_version -gt 82; then + warnL "LessTif version $lesstif_version_string is being used." + warn2 "LessTif versions 0.82 and earlier are too buggy to" + warn2 "use with XScreenSaver; it is strongly recommended" + warn2 "that you upgrade to at least version $preferred_lesstif!" + warn2 "See ." + fi +fi + + +if test "$have_motif" = yes -a "$have_gtk" = no ; then + warn 'Motif is being used, and GTK is not.' + echo '' + motif_warn2 +fi + +halfassery() { + echo '' + warn2 "More specifically, we found the headers but not the" + warn2 "libraries. Possibly a 'devel' package is needed." +} + +if test "$with_gdk_pixbuf_req" = yes -a "$have_gdk_pixbuf" = no; then + warnL 'Use of GDK-Pixbuf was requested, but it was not found.' +fi + +if test "$have_gdk_pixbuf" = no -o "$gdk_pixbuf_halfassed" = yes || \ + test "$have_gdk_pixbuf" = no ; then + + if test "$with_gdk_pixbuf_req" = yes ; then + true + elif test "$with_gdk_pixbuf_req" = no ; then + warnL 'The GDK-Pixbuf library is not being used.' + else + warnL 'The GDK-Pixbuf library was not found.' + fi + + if test "$gdk_pixbuf_halfassed" = yes ; then halfassery ; fi + if test "$have_png" = yes ; then + echo '' + warn2 'The PNG library is being used instead.' + fi + + echo '' + warn2 'Some of the demos will not use images as much as they could.' + warn2 'You should consider installing GDK-Pixbuf and re-running' + warn2 'configure.' +fi + + +if test "$have_jpeg" = no ; then + if test "$with_jpeg_req" = yes ; then + warnL 'Use of libjpeg was requested, but it was not found.' + elif test "$with_jpeg_req" = no ; then + warnL 'The JPEG library is not being used.' + else + warnL 'The JPEG library was not found.' + fi + + if test "$jpeg_halfassed" = yes ; then halfassery ; fi + if test "$have_gdk_pixbuf" = no ; then + echo '' + warn2 "This means that it won't be possible for the image-manipulating" + warn2 "display modes to load files from disk; and it also means that" + warn2 "the \`webcollage' program will be much slower." + else + warn2 "This means the \`webcollage' program will be much slower." + fi +fi + + +if test "$have_png" = no ; then + if test "$with_png_req" = yes ; then + warnL 'Use of libpng was requested, but it was not found.' + elif test "$with_png_req" = no ; then + warnL 'The PNG library is not being used.' + else + warnL 'The PNG library was not found.' + fi + + if test "$png_halfassed" = yes ; then halfassery ; fi + warn2 "Many things aren't going to work right." +fi + + +if test "$have_xinput" = no ; then + warnL 'The XInput2 library was not found. It is required.' + if test "$xinput_halfassed" = yes ; then halfassery ; else echo '' ; fi +fi + + +if test "$have_xft" = no ; then + warnL 'The XFreeType library was not found. It is required.' + if test "$xft_halfassed" = yes ; then halfassery ; else echo '' ; fi +fi + + +if test "$have_systemd" = no ; then + systemd_warned=no + if test "$systemd_too_old" = yes ; then + warnL "The systemd library is too old." + systemd_warned=yes + elif test "$with_systemd_req" = yes ; then + warnL "Use of systemd was requested, but it was not found." + systemd_warned=yes + elif test "$ac_macosx" = yes; then + true + elif test "$with_systemd_req" = no ; then + noteL 'The systemd library is not being used.' + systemd_warned=yes + else + warnL "The systemd library was not found." + systemd_warned=yes + fi + + if test "$systemd_halfassed" = yes ; then + halfassery + systemd_warned=yes + fi + + if test "$systemd_warned" = yes; then + echo '' + warn2 "This means that xscreensaver-systemd won't be built." + warn2 "Without that, xscreensaver will not be able to auto-lock" + warn2 "before the system is suspended (e.g., closing laptop lid)" + warn2 "and might activate while video playback is in progress." + fi +fi + + +if test "$have_gl" = no ; then + if test "$with_gl_req" = yes ; then + warnL 'Use of GL was requested, but it was not found.' + elif test "$with_gl_req" = no ; then + noteL 'The OpenGL 3D library is not being used.' + else + noteL 'The OpenGL 3D library was not found.' + fi + + if test "$gl_halfassed" = yes ; then + halfassery + if test "$have_glx" = no -a "$have_egl" = no; then + echo '' + warn2 'Neither EGL nor GLX were found.' + fi + fi + + echo '' + warn2 'Those demos which use 3D will not be built or installed.' + warn2 'You might want to consider installing OpenGL and' + warn2 're-running configure.' + +fi + +if test "$have_gl" = yes -a "$have_gle" = no ; then + + # nobody cares about this; don't print the warning unless it was + # requested and not found, or halfway-found. + if test "$with_gle_req" = yes -o "$gle_halfassed" = yes ; then + + if test "$with_gle_req" = yes ; then + noteL 'Use of the GLE (GL Extrusion) library was requested, but' + warn2 'it was not found (though the OpenGL library was found, and' + warn2 'is being used.)' + elif test "$with_gle_req" = no ; then + noteL 'The OpenGL Library is being used, but the GLE (GL Extrusion)' + warn2 'library is not.' + else + noteL 'The OpenGL Library was found, but the GLE (GL Extrusion)' + warn2 'library was not.' + fi + + if test "$gle_halfassed" = yes ; then halfassery ; fi + + echo '' + warn2 'Some of the OpenGL (3D) demos (those that depend on GLE)' + warn2 'will not be built or installed. You might want to consider' + warn2 'installing GLE and re-running configure. You can find the' + warn2 'GLE library at ' + + fi +fi + + +if test "$with_readdisplay_req" = yes -a "$have_readdisplay" = no ; then + warn 'Use of XReadDisplay was requested, but it was not found.' +fi + +if test "$with_kerberos_req" = yes -a "$have_kerberos" = no ; then + warn 'Use of Kerberos was requested, but it was not found.' +fi + +if test "$with_pam_req" = yes -a "$have_pam" = no ; then + warn 'Use of PAM was requested, but it was not found.' +elif test "$have_pam" = no ; then + if test -d /etc/pam.d -o -f /etc/pam.conf ; then + warn "Your system seems to have PAM, but PAM is not being used." + warn2 "That is probably not going to work out well." + + fi +fi + +if test "$with_shadow_req" = yes -a "$have_shadow" = no ; then + warn 'Use of shadow passwords was requested, but they were not found.' +fi + +if test "$setcap_hacks_req" = yes -a "$have_libcap" = no ; then + warn 'Use of libcap was requested, but it was not found.' +fi + +if test "$ac_macosx" = yes -a "$enable_locking" = yes ; then + warn "You have specified --enable-locking on macOS." + warn2 "THIS DOES NOT WORK! Don't do this!" +fi + + +# You are in a twisty maze of namespaces and syntaxes, all alike. +# Expand all of these as the Makefile will probably expand them. +# Fuck the skull of Unix. +# +bindir=`eval eval eval eval eval eval eval echo $bindir` +HACKDIR=`eval eval eval eval eval eval eval echo $HACKDIR` +HACK_CONF_DIR=`eval eval eval eval eval eval eval echo $HACK_CONF_DIR` +FONT_DIR=`eval eval eval eval eval eval eval echo $FONT_DIR` + +# canonicalize slashes. +bindir=`echo "${bindir}" | sed 's@/$@@;s@//*@/@g'` +HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'` +HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'` +FONT_DIR=`echo "${FONT_DIR}" | sed 's@/$@@;s@//*@/@g'` + +if test -z "$FONT_DIR" ; then + FONT_DIR='not installed'; +else + FONT_DIR="${FONT_DIR}/" +fi + +# Sanity check the hackdir +for bad_choice in xscreensaver xscreensaver-settings xscreensaver-command ; do + if test "${HACKDIR}" = "${bindir}/${bad_choice}" ; then + echo "" + AC_MSG_ERROR(["--with-hackdir=${bindir}/${bad_choice}" won't work. + There will be an executable installed with that name, so + that can't be the name of a directory as well. Please + re-configure with a different directory name.]) + fi +done + + +# Warn if there's a previous RPM package installed. + +rpm_vers= +if test -z "$RPM_PACKAGE_VERSION" ; then + # Don't bother with this test if we are currently *building* an RPM. + rpmnames="xscreensaver xscreensaver-base xscreensaver-extras + xscreensaver-data xscreensaver-data-extra" + + # M4 sucks!! + changequote(X,Y) + pkg_vers=`(rpm -qv $rpmnames) 2>&- | \ + sed -n 's/^[-a-z]*-\([0-9][0-9]*[.].*\)/\1/p' | head -1` + rpm_vers="$pkg_vers" + changequote([,]) +fi + +if test \! -z "$rpm_vers" ; then + + # M4 sucks!! + changequote(A,B) + pkg_bindir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)xscreensaver-settings$@\1@p'` + pkg_bindir2=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)xscreensaver-demo$@\1@p'` + pkg_hackdir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)popsquares$@\1@p'` + pkg_confdir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)popsquares\.xml$@\1@p'` + pkg_fontdir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)\.ttf$@\1@p'` + pkg_addir=`rpm -ql $rpmnames | sed -n 's@^\(.*/\)XScreenSaver$@\1@p'` + + if test -z "$pkg_bindir" ; then pkg_bindir="$pkg_bindir2" ; fi + changequote([,]) +fi + + +# Warn if there's a previous Debian package installed. +# +deb_vers= +if test -z "$pkg_vers" ; then + debnames="xscreensaver xscreensaver-data xscreensaver-data-extra" + pkg_vers='' + for dpkg in $debnames ; do + if test -z "$pkg_vers"; then + pkg_vers=`dpkg -s $dpkg 2>/dev/null | sed -n 's/^Version: \(.*\)$/\1/p'` + deb_vers="$pkg_vers" + fi + done +fi + +if test \! -z "$deb_vers" ; then + + # M4 sucks!! + changequote(A,B) + pkg_bindir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)xscreensaver-settings$@\1@p'` + pkg_bindir2=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)xscreensaver-demo$@\1@p'` + pkg_hackdir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)popsquares$@\1@p'` + pkg_confdir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)popsquares\.xml$@\1@p'` + pkg_fontdir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)\.ttf$@\1@p'` + pkg_addir=`dpkg -L $debnames 2>&- | sed -n 's@^\(.*/\)XScreenSaver[^/]*$@\1@p'` + changequote([,]) + + if test -z "$pkg_bindir" ; then pkg_bindir="$pkg_bindir2" ; fi +fi + +bindir_err= +hackdir_err= +confdir_err= +fontdir_err= +addir_err= +if ! test -z "$pkg_vers" ; then + + err=" (DIFFERS)" + + if test -z "$pkg_bindir" ; then pkg_bindir='???' + elif test "$pkg_bindir" != "${bindir}/" ; then bindir_err="$err" ; fi + + if test -z "$pkg_hackdir" ; then pkg_hackdir='???' + elif test "$pkg_hackdir" != "${HACKDIR}/" ; then hackdir_err="$err"; fi + + if test -z "$pkg_confdir" ; then pkg_confdir='???' + elif test "$pkg_confdir" != "${HACK_CONF_DIR}/" ; then confdir_err="$err"; fi + + if test -z "$pkg_fontdir" ; then pkg_fontdir='none' + elif test "$pkg_fontdir/" != "${FONT_DIR}" ; then fontdir_err="$err"; fi + + if test -z "$pkg_addir" ; then pkg_addir='???' + elif test "$pkg_addir" != "${APPDEFAULTS}/" ; then addir_err="$err" ; fi + + warning=no + warnL "There is already an installed package of xscreensaver" + warn2 "version \"$pkg_vers\", in these directories:" + echo "" + warn2 "User programs: $pkg_bindir$bindir_err" + warn2 "Screen savers: $pkg_hackdir$hackdir_err" + warn2 "Configuration: $pkg_confdir$confdir_err" + warn2 "Extra fonts: $pkg_fontdir$fontdir_err" + warn2 "App Defaults: $pkg_addir$addir_err" +fi + +echo "" +echo "$warnsep" +echo "" +echo " XScreenSaver will be installed in these directories:" +echo "" +echo " User programs: ${bindir}/$bindir_err" +echo " Screen savers: ${HACKDIR}/$hackdir_err" +echo " Configuration: ${HACK_CONF_DIR}/$confdir_err" +echo " Extra Fonts: ${FONT_DIR}$fontdir_err" +echo " App Defaults: ${APPDEFAULTS}/$addir_err" +echo "" diff --git a/configure.in b/configure.in deleted file mode 100644 index 20fb0f7..0000000 --- a/configure.in +++ /dev/null @@ -1,4924 +0,0 @@ -# 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 - .) 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_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 - .]) - -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_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_LIBPNG], - [Define this if the Portable Network Graphics library is installed. - It is basically required, but many things will more-or-less limp - along without it.]) - -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_LIBSYSTEMD], - [Define this if you have libsystemd.]) - -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// 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_LIBCAP], - [Define this if your system has libcap.]) - -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" - - # This test makes cross-compiling fail, so let's just assume that nobody - # is using a K&R compiler any more... - # -# 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 - #include ], - [struct timeval tv; struct timezone tzp; - gettimeofday(&tv, &tzp);], - [ac_gettimeofday_args=2], - [AC_TRY_COMPILE([#include - #include ], - [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 - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include ], - [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 - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include ], - [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 ], - [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 : - # - # 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*) - - # On MacOS X (10.x with "fink"), many things are under /sw/. - # - if test -d /sw/include ; then - X_CFLAGS="-I/sw/include $X_CFLAGS" - X_LIBS="-L/sw/lib $X_LIBS" - fi - ;; - esac]) - -AC_DEFUN([AC_CHECK_GETIFADDRS], - [AC_CACHE_CHECK([for getifaddrs], ac_cv_have_getifaddrs, - [AC_TRY_COMPILE([#include - #include - #include - #include ], - [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 - #include ]], [[ - 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 or 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_TRY_COMPILE, 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_TRY_COMPILE([$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_TRY_RUN, 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_TRY_RUN([$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)) - fi - - AC_MSG_CHECKING([for [$3] libs]) - d=$[$1]/lib - if test -d $d; then - X_LIBS="-L$d $X_LIBS" - AC_MSG_RESULT($d) - else - AC_MSG_RESULT(not found ($d: no such directory)) - fi - - # replace the directory string with "yes". - [$1]_req="yes" - [$1]=$[$1]_req - ;; - - *) - echo "" - echo "error: argument to [$2] must be \"yes\", \"no\", or a directory." - echo " If it is a directory, then \`DIR/include' will be added to" - echo " the -I list, and \`DIR/lib' will be added to the -L list." - exit 1 - ;; - esac - ]) - - - -############################################################################### -############################################################################### -# -# End of function definitions. Now start actually executing stuff. -# -############################################################################### -############################################################################### - -# WTF! autoconf emits this *way* too late. Do it earlier. -test "x$prefix" = xNONE && prefix=$ac_default_prefix -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - - -# random compiler setup -AC_CANONICAL_HOST - -ac_original_cc=$CC -AC_PROG_CC -AC_PROG_CC_PTHREAD # Needs ac_original_cc. - -AC_PROG_CC_ANSI -AC_NO_LONG_STRING_WARNINGS -AC_NO_MISPLACED_DECLARATIONS -AC_NO_OBJECTIVE_C -AC_NO_CPLUSPLUS_COMMENTS_IN_C_CODE -AC_PROG_CPP -AC_C_CONST -AC_C_INLINE -AC_EXEEXT -AC_DEMAND_BC - -# stuff for Makefiles -AC_PROG_INSTALL -AC_PROG_INSTALL_DIRS -AC_PROG_MAKE_SET - -# By default, autoconf sets INSTALL_SCRIPT to '${INSTALL_PROGRAM}'. -# That's wrong: it should be set to '${INSTALL}', so that one can -# implement the "install-strip" target properly (strip executables, -# but do not try to strip scripts.) -# -INSTALL_SCRIPT='${INSTALL}' - -# random libc stuff -AC_HEADER_STDC -AC_CHECK_HEADERS(unistd.h inttypes.h) -AC_TYPE_MODE_T -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_TYPE_SIGNAL -AC_HEADER_TIME -AC_HEADER_SYS_WAIT -AC_HEADER_DIRENT -AC_GETTIMEOFDAY_ARGS -AC_SYS_LARGEFILE -AC_CHECK_FUNCS(select fcntl uname nice setpriority getcwd getwd putenv sbrk) -AC_CHECK_FUNCS(sigaction syslog realpath setrlimit) -AC_CHECK_FUNCS(setlocale sqrtf) -AC_CHECK_FUNCS(getaddrinfo) -AC_CHECK_MEMBERS([struct sockaddr.sa_len],,, [[#include ]]) -AC_CHECK_ICMP -AC_CHECK_ICMPHDR -AC_CHECK_GETIFADDRS -AC_TYPE_SOCKLEN_T -AC_CHECK_HEADERS(crypt.h sys/select.h) -AC_PROG_PERL - -if test -z "$PERL" ; then - # don't let it be blank... - PERL=/usr/bin/perl -fi - -AC_PATH_XTRA - -if test "$have_x" != yes; then - AC_MSG_ERROR(Couldn't find X11 headers/libs. Try `$0 --help'.) -fi - -AC_PATH_X_APP_DEFAULTS -AC_X_RANDOM_PATHS -AC_XPOINTER - -AC_MSG_CHECKING(whether this is MacOS X) - ac_macosx=no - case "$host" in - *-apple-darwin* ) - ac_macosx=yes - ;; - esac -AC_MSG_RESULT($ac_macosx) - - -############################################################################### -# -# Gettext support -# -############################################################################### - -IT_PROG_INTLTOOL -GETTEXT_PACKAGE=xscreensaver -AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", - [This is the name of the gettext package to use.]) -AC_DEFINE_UNQUOTED(PACKAGE, "$GETTEXT_PACKAGE", - [This is the same as GETTEXT_PACKAGE, but for the glade - generated code.]) -AC_SUBST(GETTEXT_PACKAGE) - -ALL_LINGUAS="da de es et fi fr hu it ja ko nb nl pl pt pt_BR ru sk sv vi wa zh_CN zh_TW" -AM_GLIB_GNU_GETTEXT -MKINSTALLDIRS="$INSTALL_DIRS" - - -############################################################################### -# -# Check for -lXmu (some fucked up vendors don't ship it...) -# -############################################################################### - -have_xmu=no -AC_CHECK_X_HEADER(X11/Xmu/Error.h, [have_xmu=yes],, - [#include - #include - #include ]) -if test "$have_xmu" = no ; then - XMU_SRCS='$(UTILS_SRC)/xmu.c' - XMU_OBJS='$(UTILS_BIN)/xmu.o' - XMU_LIBS='' -else - XMU_SRCS='' - XMU_OBJS='' - XMU_LIBS='-lXmu' - AC_DEFINE(HAVE_XMU) -fi - - -############################################################################### -# -# Check for the SunOS 4.1.x _get_wmShellWidgetClass bug. -# See comp.windows.x FAQ question 124. The right fix is to -# get OpenWindows 3.0 patches 100512-02 and 100573-03. -# -############################################################################### - -if test "$have_xmu" = yes ; then - case "$host" in - *-sunos4*) - AC_CACHE_CHECK([for the SunOS 4.1.x _get_wmShellWidgetClass bug], - ac_cv_sunos_xmu_bug, - [ac_save_LDFLAGS="$LDFLAGS" - if test \! -z "$x_libraries" ; then - LDFLAGS="$LDFLAGS -L$x_libraries" - fi - # Note: this trick never works! (Generally.) - # We're only getting away with using AC_TRY_LINK - # with X libraries because we know it's SunOS. - LDFLAGS="$LDFLAGS -lXmu -lXt -lX11 -lXext -lm" - AC_TRY_LINK(,, - [ac_cv_sunos_xmu_bug=no], - [ac_cv_sunos_xmu_bug=yes]) - LDFLAGS="$ac_save_LDFLAGS"]) - if test "$ac_cv_sunos_xmu_bug" = yes ; then - AC_CACHE_CHECK([whether the compiler understands -static], - ac_cv_ld_static, - [ac_save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -static" - AC_TRY_LINK(,,[ac_cv_ld_static=yes],[ac_cv_ld_static=no]) - LDFLAGS="$ac_save_LDFLAGS"]) - if test "$ac_cv_ld_static" = yes ; then - LDFLAGS="$LDFLAGS -static" - else - LDFLAGS="$LDFLAGS -Bstatic" - fi - fi - ;; - esac -fi - - -############################################################################### -# -# Handle the --with-hackdir option -# -############################################################################### - -have_hackdir=yes -with_hackdir_req=unspecified -AC_ARG_WITH(hackdir,[ - -Installation options: - --with-hackdir=DIR Where to install the hundreds of demo executables. - Default: `PREFIX/libexec/xscreensaver/'], - [with_hackdir="$withval"; with_hackdir_req="$withval"],[with_hackdir=yes]) - -if test x"$with_hackdir" = xyes; then - HACKDIR='${libexecdir}/xscreensaver' -elif test x"$with_hackdir" = xno; then - HACKDIR='${bindir}' -else - HACKDIR=$with_hackdir -fi - -# canonicalize slashes. -HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'` - -# Expand HACKDIR as HACKDIR_FULL -HACKDIR_FULL=`eval eval eval eval eval eval eval eval eval echo $HACKDIR` - -# This option used to be called --enable-subdir; make sure that is no longer -# used, since configure brain-damagedly ignores unknown --enable options. - -obsolete_enable= -AC_ARG_ENABLE(subdir,,[obsolete_enable=yes]) -if test -n "$obsolete_enable"; then - echo "error: the --enable-subdir option has been replaced with" - echo " the new --with-hackdir option; see \`configure --help'" - echo " for more information." - exit 1 -fi - - -############################################################################### -# -# Handle the --with-configdir option -# Help for --with-x-app-defaults option added. -# -############################################################################### - -have_configdir=yes -with_configdir_req=unspecified -AC_ARG_WITH(configdir, -[ --with-configdir=DIR Where to install the data files that describe each - of the display modes to the GUI. - Default: `PREFIX/share/xscreensaver/config/' - --with-x-app-defaults=DIR - Where to install xscreensaver configuration file. -], - [with_configdir="$withval"; with_configdir_req="$withval"], - [with_configdir=yes]) - -if test x"$with_configdir" = xyes; then - HACK_CONF_DIR='${datadir}/xscreensaver/config' -elif test x"$with_configdir" = xno; then - echo "error: must be yes, or a pathname: --with-configdir=$with_configdir" - exit 1 -else - # there must be a better way than this... - if test -z "`echo $with_configdir | sed 's@^/.*@@'`" ; then - # absolute path - HACK_CONF_DIR=$with_configdir - else - # relative path - HACK_CONF_DIR="\${exec_prefix}$with_configdir" - fi -fi - - - - -############################################################################### -# -# Check for the SGI SCREEN_SAVER server extension. -# -############################################################################### - -#have_sgi=no -#with_sgi_req=unspecified -#AC_ARG_WITH(sgi-ext, -#[Except where noted, all of the --with options below can also take a -#directory argument: for example, `--with-motif=/opt/Motif'. That would -#cause /opt/Motif/include/ to be added to the -I list, and /opt/Motif/lib/ -#to be added to the -L list, assuming those directories exist. -# -#By default, support for each of these options will be built in, if the -#relevant library routines exist. At run time, they will then be used -#only if the X server being used supports them. Each --with option has -#a corresponding --without option, to override building support for them -#at all. -# -#Screen blanking and idle-detection options: -# -# --with-sgi-ext Include support for the SGI SCREEN_SAVER extension.], -# [with_sgi="$withval"; with_sgi_req="$withval"],[with_sgi=yes]) -# -#HANDLE_X_PATH_ARG(with_sgi, --with-sgi-ext, SGI SCREEN_SAVER) -# -#if test "$with_sgi" = yes; then -# AC_CHECK_X_HEADER(X11/extensions/XScreenSaver.h, -# [have_sgi=yes -# AC_DEFINE(HAVE_SGI_SAVER_EXTENSION)],, -# [#include ]) -# -#elif test "$with_sgi" != no; then -# echo "error: must be yes or no: --with-sgi-ext=$with_sgi" -# exit 1 -#fi - - -############################################################################### -# -# Check for the XIDLE server extension. -# -############################################################################### - -#have_xidle=no -#with_xidle_req=unspecified -#AC_ARG_WITH(xidle-ext, -#[ --with-xidle-ext Include support for the XIDLE extension.], -# [with_xidle="$withval"; with_xidle_req="$withval"],[with_xidle=yes]) -# -#HANDLE_X_PATH_ARG(with_xidle, --with-xidle-ext, XIDLE) -# -#if test "$with_xidle" = yes; then -# AC_CHECK_X_HEADER(X11/extensions/xidle.h, -# [have_xidle=yes -# AC_DEFINE(HAVE_XIDLE_EXTENSION)],, -# [#include ]) -#elif test "$with_xidle" != no; then -# echo "error: must be yes or no: --with-xidle-ext=$with_xidle" -# exit 1 -#fi - - -############################################################################### -# -# Check for the SGI-VIDEO-CONTROL server extension. -# -############################################################################### - -#have_sgivc=no -#with_sgivc_req=unspecified -#AC_ARG_WITH(sgivc-ext, -#[ --with-sgivc-ext Include support for the SGI-VIDEO-CONTROL extension.], -# [with_sgivc="$withval"; with_sgivc_req="$withval"],[with_sgivc=yes]) -# -#HANDLE_X_PATH_ARG(with_sgivc, --with-sgivc-ext, SGI-VIDEO-CONTROL) -# -#if test "$with_sgivc" = yes; then -# -# # first check for XSGIvc.h -# AC_CHECK_X_HEADER(X11/extensions/XSGIvc.h, [have_sgivc=yes],, -# [#include ]) -# -# # if that succeeded, then check for the -lXsgivc -# if test "$have_sgivc" = yes; then -# have_sgivc=no -# AC_CHECK_X_LIB(Xsgivc, XSGIvcQueryGammaMap, -# [have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"], [true], -# -lXext -lX11) -# fi -# -# # if that succeeded, then we've really got it. -# if test "$have_sgivc" = yes; then -# AC_DEFINE(HAVE_SGI_VC_EXTENSION) -# fi -# -#elif test "$with_sgivc" != no; then -# echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc" -# exit 1 -#fi - - -############################################################################### -# -# Check for the DPMS server extension. -# -############################################################################### - -have_dpms=no -with_dpms_req=unspecified -AC_ARG_WITH(dpms-ext, -[ --with-dpms-ext Include support for the DPMS extension.], - [with_dpms="$withval"; with_dpms_req="$withval"],[with_dpms=yes]) - -HANDLE_X_PATH_ARG(with_dpms, --with-dpms-ext, DPMS) - -if test "$with_dpms" = yes; then - - # first check for dpms.h - AC_CHECK_X_HEADER(X11/extensions/dpms.h, [have_dpms=yes],, - [#include - #include ]) - - # if that succeeded, then check for the DPMS code in the libraries - if test "$have_dpms" = yes; then - - # first look in -lXext (this is where it is with XFree86 4.0) - have_dpms=no - AC_CHECK_X_LIB(Xext, DPMSInfo, [have_dpms=yes], [true], -lXext -lX11) - - # if that failed, look in -lXdpms (this is where it was in XFree86 3.x) - if test "$have_dpms" = no; then - AC_CHECK_X_LIB(Xdpms, DPMSInfo, - [have_dpms=yes; XDPMS_LIBS="-lXdpms"], [true], - -lXext -lX11) - fi - fi - - - # if that succeeded, then we've really got it. - if test "$have_dpms" = yes; then - AC_DEFINE(HAVE_DPMS_EXTENSION) - fi - -elif test "$with_dpms" != no; then - echo "error: must be yes or no: --with-dpms-ext=$with_dpms" - exit 1 -fi - - -############################################################################### -# -# Check for the XINERAMA server extension. -# -############################################################################### - -have_xinerama=no -with_xinerama_req=unspecified -AC_ARG_WITH(xinerama-ext, -[ --with-xinerama-ext Include support for the XINERAMA extension.], - [with_xinerama="$withval"; with_xinerama_req="$withval"],[with_xinerama=yes]) - -HANDLE_X_PATH_ARG(with_xinerama, --with-xinerama-ext, XINERAMA) - -if test "$with_xinerama" = yes; then - - # first check for Xinerama.h - AC_CHECK_X_HEADER(X11/extensions/Xinerama.h, [have_xinerama=yes],, - [#include ]) - - # if that succeeded, then check for the XINERAMA code in the libraries - if test "$have_xinerama" = yes; then - - # first look in -lXext - have_xinerama=no - AC_CHECK_X_LIB(Xext, XineramaQueryScreens, [have_xinerama=yes], [true], - -lXext -lX11) - - # if that failed, look in -lXinerama (this is where it is in XFree86 4.1.) - if test "$have_xinerama" = no; then - AC_CHECK_X_LIB(Xinerama, XineramaQueryScreens, - [have_xinerama=yes; XINERAMA_LIBS="-lXinerama"], - [true], -lXext -lX11) - fi - fi - - # if that succeeded, then we've really got it. - if test "$have_xinerama" = yes; then - AC_DEFINE(HAVE_XINERAMA) - fi - -elif test "$with_xinerama" != no; then - echo "error: must be yes or no: --with-xinerama-ext=$with_xinerama" - exit 1 -fi - - -############################################################################### -# -# Check for the XINPUT server extension. -# -############################################################################### - -have_xinput=no -with_xinput_req=unspecified -AC_ARG_WITH(xinput-ext, -[ --with-xinput-ext Include support for the XInput extension.], - [with_xinput="$withval"; with_xinput_req="$withval"], [with_xinput=yes]) - -HANDLE_X_PATH_ARG(with_xinput, --with-xinput-ext, XINPUT) - -if test "$with_xinput" = yes; then - - # first check for Xinput.h - AC_CHECK_X_HEADER(X11/extensions/XInput.h, [have_xinput=yes],, - [#include ]) - - # if that succeeded, then check for libXi - if test "$have_xinput" = yes; then - have_xinput=no - AC_CHECK_X_LIB(Xi, XListInputDevices, - [have_xinput=yes; SAVER_LIBS="$SAVER_LIBS -lXi"], - [true], -lXext -lX11) - fi - - # if that succeeded, then we've really got it. - if test "$have_xinput" = yes; then - AC_DEFINE(HAVE_XINPUT) - fi - -elif test "$with_xinput" != no; then - echo "error: must be yes or no: --with-xinput-ext=$with_xinput" - exit 1 -fi - - -############################################################################### -# -# Check for the XF86VMODE server extension (for virtual screens.) -# -############################################################################### - -have_xf86vmode=no -with_xf86vmode_req=unspecified -AC_ARG_WITH(xf86vmode-ext, -[ --with-xf86vmode-ext Include support for XFree86 virtual screens.], - [with_xf86vmode="$withval"; with_xf86vmode_req="$withval"], - [with_xf86vmode=yes]) - -HANDLE_X_PATH_ARG(with_xf86vmode, --with-xf86vmode-ext, xf86vmode) - -VIDMODE_LIBS="" - -if test "$with_xf86vmode" = yes; then - - # first check for xf86vmode.h - AC_CHECK_X_HEADER(X11/extensions/xf86vmode.h, [have_xf86vmode=yes],, - [#include ]) - - # if that succeeded, then check for the -lXxf86vm - if test "$have_xf86vmode" = yes; then - have_xf86vmode=no - AC_CHECK_X_LIB(Xxf86vm, XF86VidModeGetViewPort, - [have_xf86vmode=yes; - VIDMODE_LIBS="-lXxf86vm"; - SAVER_LIBS="$SAVER_LIBS $VIDMODE_LIBS"], - [true], -lXext -lX11) - fi - - # if that succeeded, then we've really got it. - if test "$have_xf86vmode" = yes; then - AC_DEFINE(HAVE_XF86VMODE) - fi - -elif test "$with_xf86vmode" != no; then - echo "error: must be yes or no: --with-xf86vmode-ext=$with_xf86vmode" - exit 1 -fi - - -############################################################################### -# -# Check for the XF86VMODE server extension (for gamma fading.) -# -############################################################################### - -have_xf86gamma=no -have_xf86gamma_ramp=no -with_xf86gamma_req=unspecified -AC_ARG_WITH(xf86gamma-ext, -[ --with-xf86gamma-ext Include support for XFree86 gamma fading.], - [with_xf86gamma="$withval"; with_xf86gamma_req="$withval"], - [with_xf86gamma=yes]) - -HANDLE_X_PATH_ARG(with_xf86gamma, --with-xf86gamma-ext, xf86gamma) - -if test "$with_xf86gamma" = yes; then - - # first check for xf86vmode.h, if we haven't already - if test "$have_xf86vmode" = yes; then - have_xf86gamma=yes - else - AC_CHECK_X_HEADER(X11/extensions/xf86vmode.h, [have_xf86gamma=yes],, - [#include ]) - fi - - # if that succeeded, then check for the -lXxf86vm - if test "$have_xf86gamma" = yes; then - have_xf86gamma=no - AC_CHECK_X_LIB(Xxf86vm, XF86VidModeSetGamma, - [have_xf86gamma=yes], - [true], -lXext -lX11) - fi - - # check for the Ramp versions of the functions too. - if test "$have_xf86gamma" = yes; then - have_xf86gamma_ramp=no - AC_CHECK_X_LIB(Xxf86vm, XF86VidModeSetGammaRamp, - [have_xf86gamma_ramp=yes], - [true], -lXext -lX11) - fi - - # if those tests succeeded, then we've really got the functions. - if test "$have_xf86gamma" = yes; then - AC_DEFINE(HAVE_XF86VMODE_GAMMA) - fi - - if test "$have_xf86gamma_ramp" = yes; then - AC_DEFINE(HAVE_XF86VMODE_GAMMA_RAMP) - fi - - # pull in the lib, if we haven't already - if test "$have_xf86gamma" = yes -a "$have_xf86vmode" = no; then - SAVER_LIBS="$SAVER_LIBS -lXxf86vm" - fi - -elif test "$with_xf86gamma" != no; then - echo "error: must be yes or no: --with-xf86gamma-ext=$with_xf86vmode" - exit 1 -fi - - -############################################################################### -# -# Check for the RANDR (Resize and Rotate) server extension. -# -# We need this to detect when the resolution of the desktop -# has changed out from under us (this is a newer, different -# mechanism than the XF86VMODE virtual viewports.) -# -############################################################################### - -have_randr=no -with_randr_req=unspecified -AC_ARG_WITH(randr-ext, -[ --with-randr-ext Include support for the X Resize+Rotate extension.], - [with_randr="$withval"; with_randr_req="$withval"],[with_randr=yes]) - -HANDLE_X_PATH_ARG(with_randr, --with-randr-ext, RANDR) - -if test "$with_randr" = yes; then - - # first check for Xrandr.h - AC_CHECK_X_HEADER(X11/extensions/Xrandr.h, [have_randr=yes],, - [#include ]) - - # if that succeeded, then check for the XRR code in the libraries - if test "$have_randr" = yes; then - - # RANDR probably needs -lXrender - xrender_libs= - AC_CHECK_X_LIB(Xrender, XRenderSetSubpixelOrder, - [xrender_libs="-lXrender"], [true], -lXext -lX11) - - # first look for RANDR in -lXext - have_randr=no - AC_CHECK_X_LIB(Xext, XRRGetScreenInfo, - [have_randr=yes; SAVER_LIBS="$SAVER_LIBS $xrender_libs"], - [true], $xrender_libs -lXext -lX11) - - # if that failed, look in -lXrandr - if test "$have_randr" = no; then - AC_CHECK_X_LIB(Xrandr, XRRGetScreenInfo, - [have_randr=yes; SAVER_LIBS="$SAVER_LIBS -lXrandr $xrender_libs"], - [true], $xrender_libs -lXext -lX11) - fi - fi - - # if that succeeded, then we've really got it. - if test "$have_randr" = yes; then - AC_DEFINE(HAVE_RANDR) - - # Now check for version 1.2 in the same libs. - # Try to compile, since on MacOS 10.5.7, headers are older than libs! - AC_CACHE_CHECK([for XRRGetScreenResources], ac_cv_randr_12, - [ac_cv_randr_12=no - AC_TRY_X_COMPILE([#include - #include - #include ], - [XRRScreenResources *res = - XRRGetScreenResources (0, 0);], - [ac_cv_randr_12=yes], - [ac_cv_randr_12=no])]) - if test "$ac_cv_randr_12" = yes ; then - AC_DEFINE(HAVE_RANDR_12) - fi -# AC_CHECK_X_LIB(c, XRRGetOutputInfo, [AC_DEFINE(HAVE_RANDR_12)], -# [true], $SAVER_LIBS) - fi - - -elif test "$with_randr" != no; then - echo "error: must be yes or no: --with-randr-ext=$with_randr" - exit 1 -fi - - -############################################################################### -# -# Check for XF86MiscSetGrabKeysState (but only bother if we are already -# using other XF86 stuff.) -# -############################################################################### - -have_xf86miscsetgrabkeysstate=no -if test "$have_xf86gamma" = yes -o "$have_xf86vmode" = yes; then - AC_CHECK_X_LIB(Xxf86misc, XF86MiscSetGrabKeysState, - [have_xf86miscsetgrabkeysstate=yes], - [true], -lXext -lX11) - if test "$have_xf86miscsetgrabkeysstate" = yes ; then - SAVER_LIBS="$SAVER_LIBS -lXxf86misc" - AC_DEFINE(HAVE_XF86MISCSETGRABKEYSSTATE) - fi -fi - - -############################################################################### -# -# Check for HP XHPDisableReset and XHPEnableReset. -# -############################################################################### - -AC_MSG_CHECKING([for XHPDisableReset in X11/XHPlib.h]) -AC_EGREP_X_HEADER(XHPDisableReset, X11/XHPlib.h, - [AC_DEFINE(HAVE_XHPDISABLERESET) - SAVER_LIBS="-lXhp11 $SAVER_LIBS" - AC_MSG_RESULT(yes)], - [AC_MSG_RESULT(no)]) - - -############################################################################### -# -# Check for /proc/interrupts. -# -############################################################################### - -have_proc_interrupts=no -with_proc_interrupts_req=unspecified -AC_ARG_WITH(proc-interrupts, -[ --with-proc-interrupts Include support for consulting the /proc/interrupts - file to notice keyboard activity.], - [with_proc_interrupts="$withval"; with_proc_interrupts_req="$withval"], - [with_proc_interrupts=yes]) - -if test "$with_proc_interrupts" = yes; then - - # Note that we may be building in an environment (e.g. Debian buildd chroot) - # without a proper /proc filesystem. If /proc/interrupts exists, then we'll - # check that it has the bits we need, but otherwise we'll just go on faith. - # - have_proc_interrupts=yes - - if test -f /proc/interrupts; then - AC_CACHE_CHECK([whether /proc/interrupts contains keyboard data], - ac_cv_have_proc_interrupts, - [ac_cv_have_proc_interrupts=no - if grep 'keyboard\|i8042' /proc/interrupts >/dev/null 2>&1 ; then - ac_cv_have_proc_interrupts=yes - fi - ]) - have_proc_interrupts=$ac_cv_have_proc_interrupts - fi - - if test "$have_proc_interrupts" = yes; then - AC_DEFINE(HAVE_PROC_INTERRUPTS) - fi - -elif test "$with_proc_interrupts" != no; then - echo "error: must be yes or no: --with-proc-interrupts=$with_proc_interrupts" - exit 1 -fi - - -############################################################################### -# -# Check for /proc/*/oom_score_adj. -# -############################################################################### - -have_proc_oom=no -with_proc_oom_req=unspecified -AC_ARG_WITH(proc-oom, -[ --with-proc-oom Include support for disabling the OOM-killer.], - [with_proc_oom="$withval"; with_proc_oom_req="$withval"], - [with_proc_oom=yes]) - -if test "$with_proc_oom_req" = yes; then - - # Note that we may be building in an environment (e.g. Debian buildd chroot) - # without a proper /proc filesystem. - # - have_proc_oom=yes - AC_DEFINE(HAVE_PROC_OOM) - -elif test "$with_proc_oom_req" = unspecified; then - - have_proc_oom=no - AC_CACHE_CHECK([whether /proc/$$/oom_score_adj exists], - ac_cv_have_proc_oom, - [ac_cv_have_proc_oom=no - if test -f /proc/$$/oom_score_adj; then - ac_cv_have_proc_oom=yes - fi - ]) - have_proc_oom=$ac_cv_have_proc_oom - - if test "$have_proc_oom" = yes; then - AC_DEFINE(HAVE_PROC_OOM) - fi - -elif test "$with_proc_oom" != no; then - echo "error: must be yes or no: --with-proc-oom=$with_proc_oom" - exit 1 -fi - - -############################################################################### -# -# The --enable-locking option -# -############################################################################### - -AC_ARG_ENABLE(locking,[Screen locking options: - --enable-locking Compile in support for locking the display. - --disable-locking Do not allow locking at all.], - [enable_locking="$enableval"], - [if test "$ac_macosx" = yes; then - # We can't lock on MacOS X, so default to not compiling in support for it. - # But allow --enable-locking to override that, so I can debug Linux locking - # under MacOS X11. - enable_locking=no - else - enable_locking=yes - fi]) -if test "$enable_locking" = yes; then - true -elif test "$enable_locking" = no; then - AC_DEFINE(NO_LOCKING) -else - echo "error: must be yes or no: --enable-locking=$enable_locking" - exit 1 -fi - - -############################################################################### -# -# Whether to allow root password to unblank. -# -############################################################################### -AC_ARG_ENABLE(root-passwd, [ - --enable-root-passwd Allow root passwd to unlock screen. - --disable-root-passwd Do not allow that.], - [enable_root_passwd="$enableval"],[enable_root_passwd=yes]) -if test "$enable_root_passwd" = yes; then - AC_DEFINE(ALLOW_ROOT_PASSWD) - true -elif test "$enable_root_passwd" != no; then - echo "error: must be yes or no: --enable-root-passwd=$enable_root_passwd" - exit 1 -fi - -############################################################################### -# -# Check for PAM. -# -############################################################################### - -case "$host" in - *-solaris*) - # Solaris systems tend to come with PAM misconfigured. - # Don't build it by default, even if the headers exist. - with_pam_default=no - ;; - *) - # Default to building PAM support on all other systems, if it exists. - with_pam_default=yes - ;; -esac - -have_pam=no -with_pam_req=unspecified - -AC_ARG_WITH(pam, -[ --with-pam Include support for PAM (Pluggable Auth Modules.)], - [with_pam="$withval"; with_pam_req="$withval"],[with_pam=$with_pam_default]) - -AC_ARG_WITH([pam_service_name], - AC_HELP_STRING([--with-pam-service-name], - [NAME arg is the name of the PAM service that - xscreensaver will authenticate as.]), - [pam_service_name="$withval"],[pam_service_name="xscreensaver"]) - -AC_ARG_ENABLE(pam-check-account-type, - [AC_HELP_STRING([--enable-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.])], - [enable_pam_check_account_type="$enableval"],[enable_pam_check_account_type=no]) -if test "$enable_pam_check_account_type" = yes ; then - AC_DEFINE(PAM_CHECK_ACCOUNT_TYPE) - true -elif test "$enable_pam_check_account_type" != no ; then - echo "error: must be yes or no: --enable-pam-check-account-type=$enable_pam_check_account_type" - exit 1 -fi - -HANDLE_X_PATH_ARG(with_pam, --with-pam, PAM) - -if test "$enable_locking" = yes -a "$with_pam" = yes; then - AC_CACHE_CHECK([for PAM], ac_cv_pam, - [AC_TRY_X_COMPILE([#include ],, - [ac_cv_pam=yes], - [ac_cv_pam=no])]) - if test "$ac_cv_pam" = yes ; then - have_pam=yes - AC_DEFINE(HAVE_PAM) - AC_DEFINE_UNQUOTED(PAM_SERVICE_NAME,"$pam_service_name") - - PASSWD_LIBS="${PASSWD_LIBS} -lpam" - - # libpam typically requires dlopen and dlsym. On FreeBSD, - # those are in libc. On Linux and Solaris, they're in libdl. - AC_CHECK_LIB(dl, dlopen, [PASSWD_LIBS="${PASSWD_LIBS} -ldl"]) - - # On Linux, sigtimedwait() is in libc; on Solaris, it's in librt. - have_timedwait=no - AC_CHECK_LIB(c, sigtimedwait, - [have_timedwait=yes - AC_DEFINE(HAVE_SIGTIMEDWAIT)]) - if test "$have_timedwait" = no ; then - AC_CHECK_LIB(rt, sigtimedwait, [have_timedwait=yes - AC_DEFINE(HAVE_SIGTIMEDWAIT) - PASSWD_LIBS="${PASSWD_LIBS} -lrt"]) - fi - - AC_MSG_CHECKING(how to call pam_strerror) - AC_CACHE_VAL(ac_cv_pam_strerror_args, - [AC_TRY_X_COMPILE([#include - #include - #include ], - [pam_handle_t *pamh = 0; - char *s = pam_strerror(pamh, PAM_SUCCESS);], - [ac_pam_strerror_args=2], - [AC_TRY_X_COMPILE([#include - #include - #include ], - [char *s = - pam_strerror(PAM_SUCCESS);], - [ac_pam_strerror_args=1], - [ac_pam_strerror_args=0])]) - ac_cv_pam_strerror_args=$ac_pam_strerror_args]) - ac_pam_strerror_args=$ac_cv_pam_strerror_args - if test "$ac_pam_strerror_args" = 1 ; then - AC_MSG_RESULT(one argument) - elif test "$ac_pam_strerror_args" = 2 ; then - AC_DEFINE(PAM_STRERROR_TWO_ARGS) - AC_MSG_RESULT(two arguments) - else - AC_MSG_RESULT(unknown) - fi - -# Check pam_fail_delay - AC_MSG_CHECKING(pam_fail_delay in -lpam) - AC_CACHE_VAL(ac_cv_pam_fail_delay, - [ac_save_LDFLAGS="$LDFLAGS" - LDFLAGS="-lpam" - AC_TRY_LINK([#include ], - [pam_handle_t *pamh = 0; - unsigned int usec = 1; - int status = pam_fail_delay (pamh, usec);], - [ac_pam_fail_delay=yes], - [ac_pam_fail_delay=no]) - ac_cv_pam_fail_delay=$ac_pam_fail_delay, - LDFLAGS=$ac_save_LDFLAGS]) - - if test "$ac_pam_fail_delay" = yes ; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_PAM_FAIL_DELAY) - else - AC_MSG_RESULT(no) - fi - - fi -fi - - -############################################################################### -# -# Check for Kerberos. -# -############################################################################### - -have_kerberos=no -have_kerberos5=no -with_kerberos_req=unspecified - -AC_ARG_WITH(kerberos, -[ --with-kerberos Include support for Kerberos authentication.], - [with_kerberos="$withval"; with_kerberos_req="$withval"],[with_kerberos=yes]) - -HANDLE_X_PATH_ARG(with_kerberos, --with-kerberos, Kerberos) - -if test "$enable_locking" = yes -a "$with_kerberos" = yes; then - AC_CACHE_CHECK([for Kerberos 4], ac_cv_kerberos, - [AC_TRY_X_COMPILE([#include ],, - [ac_cv_kerberos=yes], - [ac_cv_kerberos=no])]) - AC_CACHE_CHECK([for Kerberos 5], ac_cv_kerberos5, - [AC_TRY_X_COMPILE([#include ],, - [ac_cv_kerberos5=yes], - [ac_cv_kerberos5=no])]) - - if test "$ac_cv_kerberos" = yes ; then - have_kerberos=yes - AC_DEFINE(HAVE_KERBEROS) - fi - - if test "$ac_cv_kerberos5" = yes ; then - - # Andrew Snare wrote: - # - # You were assuming that if kerberosV (krb5) was found, then kerberosIV - # (krb4) was also available. This turns out not to be the case with - # mit-krb-1.2.7; apparently backwards-compatibility with KerberosIV - # is optional. - # - # So, disable kerberosV support if libkrb4 can't be found. - # This is not the best solution, but it makes the compile not fail. - # - AC_CHECK_X_LIB(krb4, krb_get_tf_realm, - [have_kerberos=yes], - [have_kerberos=no]) - if test "$have_kerberos" = yes ; then - have_kerberos5=yes - AC_DEFINE(HAVE_KERBEROS) - AC_DEFINE(HAVE_KERBEROS5) - else - have_kerberos5=no - AC_MSG_WARN([Cannot find compat lib (libkrb4) needed to use Kerberos 5]) - fi - - fi - - if test "$have_kerberos5" = yes ; then - # from Matt Knopp - # (who got it from amu@mit.edu) - - PASSWD_LIBS="$PASSWD_LIBS -lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err" - - # jwz: MacOS X uses -lkrb5, but not -lcrypt - AC_CHECK_X_LIB(crypt, crypt, [PASSWD_LIBS="$PASSWD_LIBS -lcrypt"]) - - elif test "$have_kerberos" = yes ; then - # from Tim Showalter for FreeBSD 4.2 - PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes -lcom_err" - fi - - if test "$have_kerberos" = yes ; then - AC_CHECK_FUNC(res_search,, - AC_CHECK_LIB(resolv,res_search,PASSWD_LIBS="${PASSWD_LIBS} -lresolv", - AC_MSG_WARN([Can't find DNS resolver libraries needed for Kerberos]) - )) - fi -fi - - -############################################################################### -# -# Check for the nine billion variants of shadow passwords... -# -############################################################################### - -need_setuid=no - -have_shadow=no -with_shadow_req=unspecified - -AC_ARG_WITH(shadow, -[ --with-shadow Include support for shadow password authentication.], - [with_shadow="$withval"; with_shadow_req="$withval"],[with_shadow=yes]) - -HANDLE_X_PATH_ARG(with_shadow, --with-shadow, shadow password) - -if test "$enable_locking" = no ; then - with_shadow_req=no - with_shadow=no -fi - - -############################################################################### -# -# Check for Sun "adjunct" passwords. -# -############################################################################### - -if test "$with_shadow" = yes ; then - AC_CACHE_CHECK([for Sun-style shadow passwords], ac_cv_sun_adjunct, - [AC_TRY_X_COMPILE([#include - #include - #include - #include - #include - #include ], - [struct passwd_adjunct *p = getpwanam("nobody"); - const char *pw = p->pwa_passwd;], - [ac_cv_sun_adjunct=yes], - [ac_cv_sun_adjunct=no])]) - if test "$ac_cv_sun_adjunct" = yes; then - have_shadow_adjunct=yes - have_shadow=yes - need_setuid=yes - fi -fi - - -############################################################################### -# -# Check for DEC and SCO so-called "enhanced" security. -# -############################################################################### - -if test "$with_shadow" = yes ; then - AC_CACHE_CHECK([for DEC-style shadow passwords], ac_cv_enhanced_passwd, - [AC_TRY_X_COMPILE([#include - #include - #include - #include - #include - #include ], - [struct pr_passwd *p; - const char *pw; - set_auth_parameters(0, 0); - check_auth_parameters(); - p = getprpwnam("nobody"); - pw = p->ufld.fd_encrypt;], - [ac_cv_enhanced_passwd=yes], - [ac_cv_enhanced_passwd=no])]) - if test $ac_cv_enhanced_passwd = yes; then - have_shadow_enhanced=yes - have_shadow=yes - need_setuid=yes - - # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx) - # (I'm told it needs -lcurses too, but I don't understand why.) - # But on DEC, it's in -lsecurity. - # - AC_CHECK_LIB(prot, getprpwnam, - [PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx"], - [AC_CHECK_LIB(security, getprpwnam, - [PASSWD_LIBS="$PASSWD_LIBS -lsecurity"])], - [-lx]) - fi -fi - -############################################################################### -# -# Check for HP's entry in the "Not Invented Here" Sweepstakes. -# -############################################################################### - -if test "$with_shadow" = yes ; then - AC_CACHE_CHECK([for HP-style shadow passwords], ac_cv_hpux_passwd, - [AC_TRY_X_COMPILE([#include - #include - #include - #include - #include - #include ], - [struct s_passwd *p = getspwnam("nobody"); - const char *pw = p->pw_passwd;], - [ac_cv_hpux_passwd=yes], - [ac_cv_hpux_passwd=no])]) - if test "$ac_cv_hpux_passwd" = yes; then - have_shadow_hpux=yes - have_shadow=yes - need_setuid=yes - - # on HPUX, bigcrypt is in -lsec - AC_CHECK_LIB(sec, bigcrypt, [PASSWD_LIBS="$PASSWD_LIBS -lsec"]) - fi -fi - - -############################################################################### -# -# Check for FreeBSD-style shadow passwords. -# -# On FreeBSD, getpwnam() and friends work just like on non-shadow- -# password systems -- except you only get stuff in the pw_passwd field -# if the running program is setuid. So, guess that we've got this -# lossage to contend with if /etc/master.passwd exists, and default to -# a setuid installation. -# -############################################################################### - -if test "$with_shadow" = yes ; then - AC_CACHE_CHECK([for FreeBSD-style shadow passwords], ac_cv_master_passwd, - [if test -f /etc/master.passwd ; then - ac_cv_master_passwd=yes - else - ac_cv_master_passwd=no - fi]) - if test "$ac_cv_master_passwd" = yes; then - need_setuid=yes - fi -fi - - -############################################################################### -# -# Check for traditional (ha!) shadow passwords. -# -############################################################################### - -if test "$with_shadow" = yes ; then - AC_CACHE_CHECK([for generic shadow passwords], ac_cv_shadow, - [AC_TRY_X_COMPILE([#include - #include - #include - #include - #include ], - [struct spwd *p = getspnam("nobody"); - const char *pw = p->sp_pwdp;], - [ac_cv_shadow=yes], - [ac_cv_shadow=no])]) - if test "$ac_cv_shadow" = yes; then - have_shadow=yes - need_setuid=yes - - # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc. - have_getspnam=no - AC_CHECK_LIB(c, getspnam, [have_getspnam=yes]) - if test "$have_getspnam" = no ; then - AC_CHECK_LIB(gen, getspnam, - [have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen"]) - fi - fi -fi - - -############################################################################### -# -# Check for other libraries needed for non-shadow passwords. -# -############################################################################### - -if test "$enable_locking" = yes ; then - - # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc. - have_crypt=no - AC_CHECK_LIB(c, crypt, [have_crypt=yes]) - if test "$have_crypt" = no ; then - AC_CHECK_LIB(crypt, crypt, - [have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt"]) - fi -fi - - -# Most of the above shadow mechanisms will have set need_setuid to yes, -# if they were found. But, on some systems, we need setuid even when -# using plain old vanilla passwords. -# -if test "$enable_locking" = yes ; then - case "$host" in - *-hpux* | *-aix* | *-netbsd* | *-freebsd* | *-openbsd* ) - need_setuid=yes - ;; - esac -fi - - -if test "$have_shadow_adjunct" = yes ; then - AC_DEFINE(HAVE_ADJUNCT_PASSWD) -elif test "$have_shadow_enhanced" = yes ; then - AC_DEFINE(HAVE_ENHANCED_PASSWD) -elif test "$have_shadow_hpux" = yes ; then - AC_DEFINE(HAVE_HPUX_PASSWD) -elif test "$have_shadow" = yes ; then - AC_DEFINE(HAVE_SHADOW_PASSWD) -fi - - -############################################################################### -# -# Check for external password helper -# On SuSE, instead of having xscreensaver be a setuid program, they -# fork an external program that takes the password on stdin, and -# returns true if that password is a valid one. Then only that -# smaller program needs to be setuid. -# -# (Note that this external program is not a GUI: the GUI is still -# all in xscreensaver itself; the external program just does auth.) -# -############################################################################### - -have_passwd_helper=no -with_passwd_helper_req=unspecified - -AC_ARG_WITH(passwd-helper, -[ --with-passwd-helper Include support for an external password - verification helper program.], - [with_passwd_helper="$withval"; with_passwd_helper_req="$withval"],[with_passwd_helper=no]) -# no HANDLE_X_PATH_ARG for this one - -if test "$enable_locking" = no ; then - with_passwd_helper_req=no - with_passwd_helper=no -fi - -case "$with_passwd_helper" in - ""|no) : ;; - /*) - AC_DEFINE_UNQUOTED(PASSWD_HELPER_PROGRAM, "$with_passwd_helper") - have_passwd_helper=yes;; - *) - echo "error: --with-passwd-helper needs full pathname of helper (not '$with_passwd_helper')." >&2 - exit 1 -esac - - -############################################################################### -# -# Check for a login manager for a "New Login" button on the lock dialog. -# Usually this will be "/usr/bin/gdmflexiserver". -# -############################################################################### - -with_login_manager_req=unspecified -default_login_manager_1='gdmflexiserver -ls' -default_login_manager_2='kdmctl reserve' -default_login_manager_3='lxdm -c USER_SWITCH' -default_login_manager_4='dm-tool switch-to-greeter' - -AC_ARG_WITH(login-manager, -[ --with-login-manager Put a "New Login" button on the unlock dialog that - runs a login manager like gdmflexiserver or kdmctl.], - [with_login_manager="$withval"; with_login_manager_req="$withval"], - [with_login_manager=yes]) -# no HANDLE_X_PATH_ARG for this one - -if test "$enable_locking" = no ; then - with_login_manager_req=no - with_login_manager=no -fi - -case "$with_login_manager_req" in - no) - with_login_manager="" - ;; - - yes|unspecified) - # Try various defaults, use the first one that exists. - - with_login_manager="" - - if test -z "$with_login_manager" ; then - set dummy $default_login_manager_1 ; login_manager_tmp=$2 - unset ac_cv_path_login_manager_tmp # don't cache - AC_PATH_PROG(login_manager_tmp, $login_manager_tmp, []) - if test ! -z "$login_manager_tmp" ; then - with_login_manager="$default_login_manager_1" - fi - fi - - if test -z "$with_login_manager" ; then - set dummy $default_login_manager_2 ; login_manager_tmp=$2 - unset ac_cv_path_login_manager_tmp # don't cache - AC_PATH_PROG(login_manager_tmp, $login_manager_tmp, []) - if test ! -z "$login_manager_tmp" ; then - with_login_manager="$default_login_manager_2" - fi - fi - - if test -z "$with_login_manager" ; then - set dummy $default_login_manager_3 ; login_manager_tmp=$2 - unset ac_cv_path_login_manager_tmp # don't cache - AC_PATH_PROG(login_manager_tmp, $login_manager_tmp, []) - if test ! -z "$login_manager_tmp" ; then - with_login_manager="$default_login_manager_3" - fi - fi - - if test -z "$with_login_manager" ; then - set dummy $default_login_manager_4 ; login_manager_tmp=$2 - unset ac_cv_path_login_manager_tmp # don't cache - AC_PATH_PROG(login_manager_tmp, $login_manager_tmp, []) - if test ! -z "$login_manager_tmp" ; then - with_login_manager="$default_login_manager_4" - fi - fi - - ;; - - /*) - # absolute path specified on cmd line - set dummy $with_login_manager_req ; login_manager_tmp=$2 - AC_MSG_CHECKING([for $login_manager_tmp]) - if test -x "$login_manager_tmp" ; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - with_login_manager="" - fi - ;; - - *) - # relative path specified on cmd line - set dummy $with_login_manager_req ; login_manager_tmp=$2 - unset ac_cv_path_login_manager_tmp # don't cache - AC_PATH_PROG(login_manager_tmp, $login_manager_tmp, []) - if test -z "$login_manager_tmp" ; then - with_login_manager="" - else - with_login_manager="$login_manager_tmp" - fi - ;; -esac -ac_cv_login_manager_program="$with_login_manager" - -NEW_LOGIN_COMMAND_P='' -NEW_LOGIN_COMMAND="$ac_cv_login_manager_program" - -AC_MSG_CHECKING(for login manager) -if test -z "$NEW_LOGIN_COMMAND" ; then - NEW_LOGIN_COMMAND="$default_login_manager_1" - NEW_LOGIN_COMMAND_P='! ' - AC_MSG_RESULT($NEW_LOGIN_COMMAND (disabled)) -else - AC_MSG_RESULT($NEW_LOGIN_COMMAND) -fi - - -############################################################################### -# -# Check for -lgtk (and Gnome stuff) -# -############################################################################### - -have_gtk=no -with_gtk_req=unspecified -AC_ARG_WITH(gtk,[ -User interface options: - - --with-gtk Use the Gtk toolkit for the user interface.], - [with_gtk="$withval"; with_gtk_req="$withval"],[with_gtk=yes]) - -# if --with-gtk=/directory/ was specified, remember that directory so that -# we can also look for the `gtk-config' program in that directory. -case "$with_gtk" in - /*) - gtk_dir="$with_gtk" - ;; - *) - gtk_dir="" - ;; -esac - -HANDLE_X_PATH_ARG(with_gtk, --with-gtk, Gtk) - -if test "$with_gtk" != yes -a "$with_gtk" != no ; then - echo "error: must be yes or no: --with-gtk=$with_gtk" - exit 1 -fi - - -parse_gtk_version_string() { - # M4 sucks!! - changequote(X,Y) - maj=`echo $ac_gtk_version_string | sed -n 's/\..*//p'` - min=`echo $ac_gtk_version_string | sed -n 's/[^.]*\.\([^.]*\).*/\1/p'` - changequote([,]) - ac_gtk_version=`echo "$maj * 1000 + $min" | bc` - if test -z "$ac_gtk_version"; then - ac_gtk_version=unknown - ac_gtk_version_string=unknown - fi -} - -# Find pkg-config... (need this for both gtk and gdk_pixbuf.) -# if the user specified --with-gtk=/foo/ then look there. -# -gtk_path="$PATH" -if test ! -z "$gtk_dir"; then - # canonicalize slashes. - foo=`echo "${gtk_dir}/bin" | sed 's@//*@/@g'` - gtk_path="$foo:$gtk_path" -fi - -AC_PATH_PROGS(pkg_config, pkg-config,, $gtk_path) - -if test -z "$pkg_config" ; then - AC_MSG_WARN([pkg-config not found!]) - pkg_config="false" -fi - - -# Utility function for running pkg-config-based tests... -# -pkgs='' -pkg_check_version() { - if test "$ok" = yes ; then - req="$1" - min="$2" - AC_MSG_CHECKING(for $req) - if $pkg_config --exists "$req" ; then - vers=`$pkg_config --modversion "$req"` - if $pkg_config --exists "$req >= $min" ; then - AC_MSG_RESULT($vers) - pkgs="$pkgs $req" - return 1 - else - AC_MSG_RESULT($vers (wanted >= $min)) - ok=no - return 0 - fi - else - AC_MSG_RESULT(no) - ok=no - return 0 - fi - fi -} - - -jurassic_gtk=no -gtk_halfassed=no -have_gtk_2_22_or_higher=no -COMMENT_DEMO_GLADE2_GTK_2_22_HEAD="" -COMMENT_DEMO_GLADE2_GTK_2_22_TAIL="" - -if test "$with_gtk" = yes; then - have_gtk=no - - ok="yes" - pkg_check_version gtk+-2.0 2.0.1 ; ac_gtk_version_string="$vers" - pkg_check_version gmodule-2.0 2.0.0 - pkg_check_version libxml-2.0 2.4.6 - pkg_check_version libglade-2.0 1.99.0 - pkg_check_version gdk-pixbuf-2.0 2.0.0 - pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0 - have_gtk="$ok" - - if test "$have_gtk" = no; then - if test -n "$ac_gtk_version_string" ; then - gtk_halfassed="$ac_gtk_version_string" - gtk_halfassed_lib="$req" - fi - fi - - if test "$have_gtk" = yes; then - parse_gtk_version_string - jurassic_gtk=no - fi - - if test "$have_gtk" = yes; then - AC_CACHE_CHECK([for Gtk includes], ac_cv_gtk_config_cflags, - [ac_cv_gtk_config_cflags=`$pkg_config --cflags $pkgs`]) - AC_CACHE_CHECK([for Gtk libs], ac_cv_gtk_config_libs, - [ac_cv_gtk_config_libs=`$pkg_config --libs $pkgs`]) - fi - - ac_gtk_config_cflags=$ac_cv_gtk_config_cflags - ac_gtk_config_libs=$ac_cv_gtk_config_libs - - GTK_EXTRA_OBJS="" - GTK_DATADIR="" - if test "$have_gtk" = yes; then - GTK_DATADIR=`$pkg_config --variable=prefix gtk+-2.0` - GTK_DATADIR="$GTK_DATADIR/share" - fi - - if test "$have_gtk" = yes; then - INCLUDES="$INCLUDES $ac_gtk_config_cflags" - GTK_LIBS="$GTK_LIBS $ac_gtk_config_libs" - AC_DEFINE(HAVE_GTK) - AC_DEFINE(HAVE_GTK2) - AC_DEFINE(HAVE_XML) - fi - - if test "$have_gtk" = yes; then - ok="yes" - pkg_check_version gtk+-2.0 2.22 - have_gtk_2_22_or_higher="$ok" - if test "$have_gtk_2_22_or_higher" = yes; then - COMMENT_DEMO_GLADE2_GTK_2_22_HEAD="" - fi - fi -fi - - -# Check for the various Gnome help and URL loading programs. -# -WITH_BROWSER=gnome-open -if test "$have_gtk" = yes; then - AC_CHECK_PROGS(gnome_open_program, gnome-open) - AC_CHECK_PROGS(gnome_url_show_program, gnome-url-show) -fi - - -############################################################################### -# -# Check for -lXm. -# -############################################################################### - -have_motif=no -with_motif_req=unspecified -AC_ARG_WITH(motif,[ --with-motif Use the Motif toolkit for the user interface - (no longer supported.)], - [with_motif="$withval"; with_motif_req="$withval"],[with_motif=no]) - -HANDLE_X_PATH_ARG(with_motif, --with-motif, Motif) - -if test "$with_motif" != yes -a "$with_motif" != no ; then - echo "error: must be yes or no: --with-motif=$with_motif" - exit 1 -fi - -if test "$with_motif" = yes; then - have_motif=no - AC_CHECK_X_HEADER(Xm/Xm.h, - [have_motif=yes - AC_DEFINE(HAVE_MOTIF) - MOTIF_LIBS="$MOTIF_LIBS -lXm"],, - [#include - #include - #include ]) -fi - - -if test "$have_motif" = yes; then - AC_CHECK_X_HEADER(Xm/ComboBox.h, [AC_DEFINE(HAVE_XMCOMBOBOX)],, - [#include - #include - #include ]) -fi - - -############################################################################### -# -# Checking whether Motif is really Lesstif. -# -############################################################################### - -have_lesstif=no -if test "$have_motif" = yes ; then - AC_CACHE_CHECK([whether Motif is really LessTif], - ac_cv_have_lesstif, - [AC_TRY_X_COMPILE([#include ], - [long vers = LesstifVersion;], - [ac_cv_have_lesstif=yes], - [ac_cv_have_lesstif=no])]) - have_lesstif=$ac_cv_have_lesstif -fi - - -lesstif_version=unknown -lesstif_version_string=unknown - -if test "$have_lesstif" = yes ; then - ltv=unknown - echo unknown > conftest-lt - AC_CACHE_CHECK([LessTif version number], - ac_cv_lesstif_version_string, - [AC_TRY_X_RUN([#include - #include - int main() { - FILE *f = fopen("conftest-lt", "w"); - if (!f) exit(1); - fprintf(f, "%d %d.%d\n", LesstifVersion, - LESSTIF_VERSION, LESSTIF_REVISION); - fclose(f); - exit(0); - }], - [ltv=`cat conftest-lt` - ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'` - ac_cv_lesstif_version_string=`echo $ltv | sed 's/.* //'`], - [ac_cv_lesstif_version=unknown - ac_cv_lesstif_version_string=unknown], - [ac_cv_lesstif_version=unknown - ac_cv_lesstif_version_string=unknown])]) - rm -f conftest-lt - lesstif_version=$ac_cv_lesstif_version - lesstif_version_string=$ac_cv_lesstif_version_string - -fi - - -if test "$have_motif" = yes ; then - mtv=unknown - echo unknown > conftest-mt - AC_CACHE_CHECK([Motif version number], - ac_cv_motif_version_string, - [AC_TRY_X_RUN([#include - #include - int main() { - FILE *f = fopen("conftest-mt", "w"); - if (!f) exit(1); - fprintf(f, "%d %d.%d\n", XmVersion, - XmVERSION, XmREVISION); - fclose(f); - exit(0); - }], - [mtv=`cat conftest-mt` - ac_cv_motif_version=`echo $mtv | sed 's/ .*//'` - ac_cv_motif_version_string=`echo $mtv | sed 's/.* //'`], - [ac_cv_motif_version=unknown - ac_cv_motif_version_string=unknown], - [ac_cv_motif_version=unknown - ac_cv_motif_version_string=unknown])]) - rm -f conftest-mt - motif_version=$ac_cv_motif_version - motif_version_string=$ac_cv_motif_version_string - -fi - - -############################################################################### -# -# Checking whether Motif requires -lXp. -# -# Some versions of Motif (2.1.0, at least) require -lXp, the "X Printing -# Extension". Why this extension isn't in -lXext with all the others, -# I have no idea. -# -############################################################################### - -have_xp_ext=no -if test "$have_motif" = yes ; then - have_xp_ext=no - AC_CHECK_X_LIB(Xp, XpQueryExtension, - [have_xp_ext=yes; MOTIF_LIBS="$MOTIF_LIBS -lXp"], - [true], -lX11 -lXext -lm) -fi - - -############################################################################### -# -# Checking whether Motif requires -lXintl (for _Xsetlocale.) -# -############################################################################### - -have_xintl=no -if test "$have_motif" = yes ; then - AC_CHECK_X_LIB(Xintl, _Xsetlocale, [have_xintl=yes], [have_xintl=no], - -lX11 -lXext -lm) - if test "$have_xintl" = yes; then - MOTIF_LIBS="$MOTIF_LIBS -lXintl" - fi -fi - - -############################################################################### -# -# Check for -lGL or -lMesaGL. -# -############################################################################### - -have_gl=no -ac_have_mesa_gl=no -with_gl_req=unspecified -gl_halfassed=no -AC_ARG_WITH(gl,[ -Graphics options: - - --with-gl Build those demos which depend on OpenGL.], - [with_gl="$withval"; with_gl_req="$withval"],[with_gl=yes]) - -HANDLE_X_PATH_ARG(with_gl, --with-gl, GL) - -ac_mesagl_version=unknown -ac_mesagl_version_string=unknown - -if test "$with_gl" = yes; then - AC_CHECK_X_HEADER(GL/gl.h, have_gl=yes, have_gl=no) - if test "$have_gl" = yes ; then - AC_CHECK_X_HEADER(GL/glx.h, have_gl=yes, have_gl=no, - [#include ]) - fi - - # If we have the headers, try and figure out which vendor it's from. - # - if test "$have_gl" = yes ; then - - # We need to know whether it's MesaGL so that we know which libraries - # to link against. - # - AC_CACHE_CHECK([whether GL is really MesaGL], ac_cv_have_mesa_gl, - [ac_cv_have_mesa_gl=no - if test "$ac_macosx" = no; then - # WTF! MacOS 10.5.0 ships the Mesa GL headers! - # It's not really Mesa, is it? - AC_EGREP_X_HEADER(Mesa|MESA, GL/glx.h, [ac_cv_have_mesa_gl=yes]) - fi]) - ac_have_mesa_gl=$ac_cv_have_mesa_gl - - gl_lib_1="" - GL_LIBS="" - - if test "$ac_macosx" = yes; then - - # Without these, every link against libGL gets a bunch of useless - # warnings. - # - osx_crud="-bind_at_load -multiply_defined suppress" - AC_MSG_RESULT(adding "$osx_crud" to GL_LIBS) - GL_LIBS="$GL_LIBS $osx_crud" - unset osx_crud - - # New lossage in 10.5.0: without this, we get: - # ld: cycle in dylib re-exports with /usr/X11/lib/libGL.dylib - # - osx_crud="/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib" - osx_crud="-Wl,-dylib_file,${osx_crud}:${osx_crud}" - - AC_MSG_RESULT(adding "$osx_crud" to GL_LIBS) - GL_LIBS="$GL_LIBS $osx_crud" - unset osx_crud - - # New lossage in 10.6.8: we can't allow -L/opt/local/lib to be in the - # link line, or at runtime XQueryExtension gets a segv due to some kind - # of library version skew. Libs must come from /usr/X11/lib even if - # $prefix and/or $exec_prefix are set to /opt/local/. - # - AC_MSG_RESULT(omitting "$libdir" from LDFLAGS) - libdir='' - - # Looks like as of OSX 10.12, gcc can't do ObjC. - OBJCC="clang -Wall" - - fi - - - # Some versions of MesaGL are compiled to require -lpthread. - # So if the Mesa headers exist, and -lpthread exists, then always - # link -lpthread after the Mesa libs (be they named -lGL or -lMesaGL.) - # - # Oftentimes, AX_PTHREAD will bring in -lpthread as well; but that ends - # up before -l(Mesa)GL, instead of after where it would belong. - # - if test "$ac_have_mesa_gl" = yes; then - AC_CHECK_LIB(pthread, pthread_create, [GL_LIBS="-lpthread"], [],) - fi - - - # If we have Mesa headers, check to see if we can link against -lMesaGL. - # If we don't have Mesa headers, or we don't have -lMesaGL, try -lGL. - # Else, warn that GL is busted. (We have the headers, but no libs.) - # - - if test "$ac_have_mesa_gl" = yes ; then - AC_CHECK_X_LIB(MesaGL, glXCreateContext, - [gl_lib_1="MesaGL" - GL_LIBS="-lMesaGL -lMesaGLU $VIDMODE_LIBS $GL_LIBS"], - [], -lMesaGLU $GL_LIBS -lX11 -lXext $VIDMODE_LIBS -lm) - fi - - if test "$gl_lib_1" = "" ; then - AC_CHECK_X_LIB(GL, glXCreateContext, - [gl_lib_1="GL" - GL_LIBS="-lGL -lGLU $VIDMODE_LIBS $GL_LIBS"], - [], -lGLU $GL_LIBS -lX11 -lXext $VIDMODE_LIBS -lm) - fi - - if test "$gl_lib_1" = "" ; then - # we have headers, but no libs -- bail. - have_gl=no - ac_have_mesa_gl=no - gl_halfassed=yes - else - # linking works -- we can build the GL hacks. - AC_DEFINE(HAVE_GL) - if test "$ac_have_mesa_gl" = yes ; then - AC_DEFINE(HAVE_MESA_GL) - fi - fi - fi - - - # Now that we know we have GL headers and libs, do some more GL testing. - # - - if test "$have_gl" = yes ; then - # If it's MesaGL, we'd like to issue a warning if the version number - # is less than or equal to 2.6, because that version had a security bug. - # - if test "$ac_have_mesa_gl" = yes; then - - AC_CACHE_CHECK([MesaGL version number], ac_cv_mesagl_version_string, - [cat > conftest.$ac_ext < -#ifndef MESA_MAJOR_VERSION -# include -# ifdef XMESA_MAJOR_VERSION - /* Around Mesa 3.2, they took out the Mesa version number, so instead, - we have to check the XMesa version number (the number of the X protocol - support, which seems to be the same as the Mesa version number.) - */ -# define MESA_MAJOR_VERSION XMESA_MAJOR_VERSION -# define MESA_MINOR_VERSION XMESA_MINOR_VERSION -# else - /* Oh great. Some time after 3.4, they took out the xmesa.h header file, - so we have no way of telling what version of Mesa this is at all. - So, we'll guess that the osmesa version (the "offscreen protocol") - is less than or equal to the real mesa version number. Except that - if OSmesa is 3.3, assume at least Mesa 3.4, since OSmesa was 3.3 in - Mesa 3.4. And Mesa 3.3 had xmesa.h. What a complete load of shit! - */ -# include -# define MESA_MAJOR_VERSION OSMESA_MAJOR_VERSION -# define MESA_MINOR_VERSION OSMESA_MINOR_VERSION or newer, probably? -# if OSMESA_MAJOR_VERSION == 3 && OSMESA_MINOR_VERSION == 3 -# undef MESA_MINOR_VERSION -# define MESA_MINOR_VERSION 4 or newer, probably? -# endif -# endif -#endif -configure: MESA_MAJOR_VERSION MESA_MINOR_VERSION -EOF - - ac_save_CPPFLAGS="$CPPFLAGS" - if test \! -z "$includedir" ; then - CPPFLAGS="$CPPFLAGS -I$includedir" - fi - CPPFLAGS="$CPPFLAGS $X_CFLAGS" - - mglv=`(eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC | grep configure:` - - # M4 sucks!! - changequote(X,Y) - mglv=`echo "$mglv" | sed -n \ - 's/^configure: *\([0-9][0-9]*\) *\([0-9].*\)$/\1.\2/p'` - changequote([,]) - - rm -f conftest.$ac_ext - - CPPFLAGS="$ac_save_CPPFLAGS" - - if test "$mglv" = ""; then - ac_mesagl_version=unknown - ac_mesagl_version_string=unknown - else - ac_mesagl_version_string="$mglv" - # M4 sucks!! - changequote(X,Y) - maj=`echo "$mglv" | sed -n 's/^\([0-9][0-9]*\)\..*$/\1/p'` - min=`echo "$mglv" | sed -n 's/^.*\.\([0-9][0-9]*\).*$/\1/p'` - changequote([,]) - ac_mesagl_version=`echo "$maj * 1000 + $min" | bc` - if test -z "$ac_mesagl_version"; then - ac_mesagl_version=unknown - ac_mesagl_version_string=unknown - fi - fi - ac_cv_mesagl_version=$ac_mesagl_version - ac_cv_mesagl_version_string=$ac_mesagl_version_string - ]) - ac_mesagl_version=$ac_cv_mesagl_version - ac_mesagl_version_string=$ac_cv_mesagl_version_string - fi - - - # Check for OpenGL 1.1 features. - # - AC_CHECK_X_LIB($gl_lib_1, glBindTexture, [AC_DEFINE(HAVE_GLBINDTEXTURE)], - [true], $GL_LIBS -lX11 -lXext -lm) - fi - -elif test "$with_gl" != no; then - echo "error: must be yes or no: --with-gl=$with_gl" - exit 1 -fi - - -############################################################################### -# -# Check for -lgle. -# -############################################################################### - -have_gle=no -with_gle_req=unspecified -gle_halfassed=no -AC_ARG_WITH(gle, -[ --with-gle Build those demos which depend on GLE - (the OpenGL "extrusion" library.)], - [with_gle="$withval"; with_gle_req="$withval"],[with_gle=yes]) - -HANDLE_X_PATH_ARG(with_gle, --with-gle, GLE) - -GLE_LIBS="" - -if test "$have_gl" = no ; then - true -elif test "$with_gle" = yes; then - - AC_CHECK_X_HEADER(GL/gle.h, have_gle3=yes, have_gle3=no, - [#include ]) - if test "$have_gle3" = yes ; then - have_gle=yes; - else - AC_CHECK_X_HEADER(GL/gutil.h, have_gle=yes, have_gle=no, - [#include ]) - if test "$have_gle" = yes ; then - AC_CHECK_X_HEADER(GL/tube.h, have_gle=yes, have_gle=no, - [#include ]) - fi - fi - - if test "$have_gle" = yes ; then - have_gle=no - gle_halfassed=yes - AC_CHECK_X_LIB(gle, gleCreateGC, - [have_gle=yes; gle_halfassed=no; GLE_LIBS="-lgle"], - [], $GL_LIBS -lX11 -lXext -lm) - fi - if test "$have_gle" = yes ; then - have_gle=no - gle_halfassed=yes - - # sometimes the libmatrix stuff is included in libgle. look there first. -# -# I don't get it. For some reason, this test passes on SGI, as if -# uview_direction_d() was in libgle -- but it's not, it's in libmatrix. -# Yet the link is succeeding. Why??? -# -# AC_CHECK_X_LIB(gle, uview_direction_d, -# [have_gle=yes; gle_halfassed=no], -# [], $GL_LIBS -lX11 -lXext -lm) - - # As of GLE 3 this is in libgle, and has changed name to uview_direction! - # *sigh* - if test "$have_gle3" = yes ; then - AC_CHECK_X_LIB(gle, uview_direction, - [have_gle=yes; gle_halfassed=no], - [], $GL_LIBS -lX11 -lXext -lm) - fi - # if it wasn't in libgle, then look in libmatrix. - if test "$have_gle" = no ; then - AC_CHECK_X_LIB(matrix, uview_direction_d, - [have_gle=yes; gle_halfassed=no; - GLE_LIBS="$GLE_LIBS -lmatrix"], - [], $GL_LIBS -lX11 -lXext -lm) - fi - fi - - if test "$have_gle" = yes ; then - AC_DEFINE(HAVE_GLE) - if test "$have_gle3" = yes ; then - AC_DEFINE(HAVE_GLE3) - fi - fi - -elif test "$with_gle" != no; then - echo "error: must be yes or no: --with-gle=$with_gle" - exit 1 - -fi - - -############################################################################### -# -# Handle --with-gles -# -############################################################################### - -with_gles_req=unspecified -AC_ARG_WITH(gles, -[ --with-gles Target OpenGL ES 1.x API instead of OpenGL 1.3.], - [with_gles="$withval"; with_gles_req="$withval"],[with_gles=no]) - -HANDLE_X_PATH_ARG(with_gles, --with-gles, JWZGLES) - -if test "$with_gles" = yes; then - have_gles=yes - AC_DEFINE(HAVE_JWZGLES) - JWZGLES_OBJS='$(JWXYZ_BIN)/jwzgles.o' - AC_MSG_RESULT(using OpenGL ES compatiblity shim) -elif test "$with_gles" != no; then - echo "error: must be yes or no: --with-gles=$with_gles" - exit 1 -fi - -############################################################################### -# -# Check for -lpng -# -############################################################################### - -have_png=no -with_png_req=unspecified -png_halfassed=no -AC_ARG_WITH(png, -[ --with-png Include support for the PNG library.], - [with_png="$withval"; with_png_req="$withval"], - [with_png=yes]) - -HANDLE_X_PATH_ARG(with_png, --with-png, PNG) - -if test "$with_png" != yes -a "$with_png" != no ; then - echo "error: must be yes or no: --with-png=$with_png" - exit 1 -fi - -if test "$with_png" = yes; then - - have_png=no - AC_CHECK_X_HEADER(png.h, [have_png=yes]) - - if test "$have_png" = yes; then - # we have the header, now check for the library - have_png=no - png_halfassed=yes - AC_CHECK_X_LIB(png, png_create_read_struct, - [have_png=yes - png_halfassed=no - PNG_LIBS="-lpng" - AC_DEFINE(HAVE_LIBPNG)]) - fi -fi - - -############################################################################### -# -# Check for -lgdk_pixbuf. -# These tests are for gdk_pixbuf usage of the hacks, -# not xscreensaver-demo (thus we have to test again to get -# the libraries right: don't want to pull in all of GTK -# for the hacks.) -# -############################################################################### - -have_gdk_pixbuf=no -with_gdk_pixbuf_req=unspecified -AC_ARG_WITH(pixbuf, -[ --with-pixbuf Include support for the GDK-Pixbuf library in some - demos, which will make it possible for them to read - GIF, JPEG, and PNG files as well.], - [with_gdk_pixbuf="$withval"; with_gdk_pixbuf_req="$withval"], - [with_gdk_pixbuf=yes]) - -# if --with-pixbuf=/directory/ was specified, remember that directory so that -# we can also look for the `gdk-pixbuf-config' program in that directory. -case "$with_gdk_pixbuf" in - /*) - gdk_pixbuf_dir="$with_gdk_pixbuf" - ;; - *) - gdk_pixbuf_dir="" - ;; -esac - -HANDLE_X_PATH_ARG(with_gdk_pixbuf, --with-pixbuf, GDK_PIXBUF) - -if test "$with_gdk_pixbuf" != yes -a "$with_gdk_pixbuf" != no ; then - echo "error: must be yes or no: --with-pixbuf=$with_gdk_pixbuf" - exit 1 -fi - -if test "$with_gdk_pixbuf" = yes; then - have_gdk_pixbuf=no - - pkgs='' - ok="yes" - - pkg_check_version gdk-pixbuf-2.0 2.0.0 - pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0 - pkg_check_version gio-2.0 2.0.0 - have_gdk_pixbuf="$ok" - - if test "$have_gdk_pixbuf" = yes; then - AC_CACHE_CHECK([for gdk-pixbuf includes], ac_cv_gdk_pixbuf_config_cflags, - [ac_cv_gdk_pixbuf_config_cflags=`$pkg_config --cflags $pkgs`]) - AC_CACHE_CHECK([for gdk-pixbuf libs], ac_cv_gdk_pixbuf_config_libs, - [ac_cv_gdk_pixbuf_config_libs=`$pkg_config --libs $pkgs`]) - fi - - ac_gdk_pixbuf_config_cflags=$ac_cv_gdk_pixbuf_config_cflags - ac_gdk_pixbuf_config_libs=$ac_cv_gdk_pixbuf_config_libs - - - if test "$have_gdk_pixbuf" = yes; then - # - # we appear to have pixbuf; check for headers/libs to be sure. - # - ac_save_gdk_pixbuf_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $ac_gdk_pixbuf_config_cflags" - - have_gdk_pixbuf=no - - # check for header A... - AC_CHECK_X_HEADER(gdk-pixbuf/gdk-pixbuf.h, [have_gdk_pixbuf=yes]) - - # if that worked, check for header B... - if test "$have_gdk_pixbuf" = yes; then - have_gdk_pixbuf=no - gdk_pixbuf_halfassed=yes - AC_CHECK_X_HEADER(gdk-pixbuf/gdk-pixbuf-xlib.h, - [have_gdk_pixbuf=yes - gdk_pixbuf_halfassed=no]) - - # yay, it has a new name in Gtk 2.x... - if test "$have_gdk_pixbuf" = no; then - have_gdk_pixbuf=no - gdk_pixbuf_halfassed=yes - AC_CHECK_X_HEADER(gdk-pixbuf-xlib/gdk-pixbuf-xlib.h, - [have_gdk_pixbuf=yes - gdk_pixbuf_halfassed=no]) - fi - fi - CPPFLAGS="$ac_save_gdk_pixbuf_CPPFLAGS" - fi - - if test "$have_gdk_pixbuf" = yes; then - # we have the headers, now check for the libraries - have_gdk_pixbuf=no - gdk_pixbuf_halfassed=yes - - AC_MSG_RESULT(checking for gdk_pixbuf usability...) - - # library A... - AC_CHECK_X_LIB(c, gdk_pixbuf_new_from_file, [have_gdk_pixbuf=yes],, - $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm) - # library B... - if test "$have_gdk_pixbuf" = yes; then - have_gdk_pixbuf=no - AC_CHECK_X_LIB(c, gdk_pixbuf_xlib_init, - [have_gdk_pixbuf=yes - gdk_pixbuf_halfassed=no],, - $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm) - fi - fi - - if test "$have_gdk_pixbuf" = yes; then - INCLUDES="$INCLUDES $ac_gdk_pixbuf_config_cflags" - PNG_LIBS="$ac_gdk_pixbuf_config_libs" - AC_DEFINE(HAVE_GDK_PIXBUF) - else - AC_MSG_RESULT(checking for gdk_pixbuf usability... no) - fi - - if test "$have_gdk_pixbuf" = yes; then - AC_CHECK_X_LIB(c, gdk_pixbuf_apply_embedded_orientation, - [AC_DEFINE(HAVE_GDK_PIXBUF_APPLY_EMBEDDED_ORIENTATION)],, - $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm) - fi -fi - - -############################################################################### -# -# Check for -ljpeg -# -############################################################################### - -have_jpeg=no -with_jpeg_req=unspecified -jpeg_halfassed=no -AC_ARG_WITH(jpeg, -[ --with-jpeg Include support for the JPEG library.], - [with_jpeg="$withval"; with_jpeg_req="$withval"], - [with_jpeg=yes]) - -HANDLE_X_PATH_ARG(with_jpeg, --with-jpeg, JPEG) - -if test "$with_jpeg" != yes -a "$with_jpeg" != no ; then - echo "error: must be yes or no: --with-jpeg=$with_jpeg" - exit 1 -fi - -if test "$with_jpeg" = yes; then - - have_jpeg=no - AC_CHECK_X_HEADER(jpeglib.h, [have_jpeg=yes]) - - if test "$have_jpeg" = yes; then - # we have the header, now check for the library - have_jpeg=no - jpeg_halfassed=yes - AC_CHECK_X_LIB(jpeg, jpeg_start_compress, - [have_jpeg=yes - jpeg_halfassed=no - JPEG_LIBS="-ljpeg" - AC_DEFINE(HAVE_JPEGLIB)]) - fi -fi - - -############################################################################### -# -# Check for -lXft -# -############################################################################### - -have_xutf8drawstring=no -AC_CHECK_X_LIB(X11, Xutf8DrawString, - [have_xutf8drawstring=yes], - [true], -lX11 -lXext -lm) -if test "$have_xutf8drawstring" = yes ; then - AC_DEFINE(HAVE_XUTF8DRAWSTRING) -fi - - -have_xft=no -with_xft_req=unspecified -xft_halfassed=no -AC_ARG_WITH(xft, -[ --with-xft Include support for the X Freetype library.], - [with_xft="$withval"; with_xft_req="$withval"], - [with_xft=yes]) - -HANDLE_X_PATH_ARG(with_xft, --with-xft, Xft) - -if test "$with_xft" != yes -a "$with_xft" != no ; then - echo "error: must be yes or no: --with-xft=$with_xft" - exit 1 -fi - -if test "$with_xft" = yes; then - - pkgs='' - ok="yes" - pkg_check_version xft 2.1.0 - have_xft="$ok" - - if test "$have_xft" = yes; then - AC_CACHE_CHECK([for Xft includes], ac_cv_xft_config_cflags, - [ac_cv_xft_config_cflags=`$pkg_config --cflags $pkgs`]) - AC_CACHE_CHECK([for Xft libs], ac_cv_xft_config_libs, - [ac_cv_xft_config_libs=`$pkg_config --libs $pkgs`]) - fi - - ac_xft_config_cflags=$ac_cv_xft_config_cflags - ac_xft_config_libs=$ac_cv_xft_config_libs - - if test "$have_xft" = yes; then - # - # we appear to have Xft; check for headers/libs to be sure. - # - ac_save_xft_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $ac_xft_config_cflags" - - have_xft=no - AC_CHECK_X_HEADER(X11/Xft/Xft.h, [have_xft=yes]) - - CPPFLAGS="$ac_save_xft_CPPFLAGS" - fi - - if test "$have_xft" = yes; then - # we have the headers, now check for the libraries - have_xft=no - xft_halfassed=yes - - AC_MSG_RESULT(checking for Xft usability...) - AC_CHECK_X_LIB(c, XftDrawStringUtf8, [have_xft=yes],, - $ac_xft_config_libs -lX11 -lXext -lm) - fi - - if test "$have_xft" = no; then - AC_MSG_RESULT(checking for Xft usability... no) - fi -fi - -if test "$have_xft" = yes; then - INCLUDES="$INCLUDES $ac_xft_config_cflags" - XFT_LIBS="$ac_xft_config_libs" - XFT_SRCS='' - XFT_OBJS='' - AC_DEFINE(HAVE_XFT) -else - XFT_LIBS='' - XFT_SRCS='$(UTILS_SRC)/xft.c' - XFT_OBJS='$(UTILS_BIN)/xft.o' -fi - - -############################################################################### -# -# Check for -lsystemd -# -############################################################################### - -have_systemd=no -with_systemd_req=unspecified -systemd_halfassed=no -AC_ARG_WITH(systemd, -[ --with-systemd Build xscreensaver-systemd to lock on suspend.], - [with_systemd="$withval"; with_systemd_req="$withval"], - [with_systemd=yes]) - -HANDLE_X_PATH_ARG(with_systemd, --with-systemd, systemd) - -if test "$with_systemd" != yes -a "$with_systemd" != no ; then - echo "error: must be yes or no: --with-systemd=$with_systemd" - exit 1 -fi - -if test "$with_systemd" = yes; then - - pkgs='' - ok="yes" - pkg_check_version libsystemd 221 - have_systemd="$ok" - - if test "$have_systemd" = yes; then - AC_CACHE_CHECK([for libsystemd includes], ac_cv_systemd_config_cflags, - [ac_cv_systemd_config_cflags=`$pkg_config --cflags $pkgs`]) - AC_CACHE_CHECK([for libsystemd libs], ac_cv_systemd_config_libs, - [ac_cv_systemd_config_libs=`$pkg_config --libs $pkgs`]) - fi - - ac_systemd_config_cflags=$ac_cv_systemd_config_cflags - ac_systemd_config_libs=$ac_cv_systemd_config_libs - - if test "$have_systemd" = yes; then - # - # we appear to have libsystemd; check for headers/libs to be sure. - # - ac_save_systemd_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $ac_systemd_config_cflags" - - have_systemd=no - AC_CHECK_X_HEADER(systemd/sd-bus.h, [have_systemd=yes]) - - CPPFLAGS="$ac_save_systemd_CPPFLAGS" - fi - - if test "$have_systemd" = yes; then - # we have the headers, now check for the libraries - have_systemd=no - systemd_halfassed=yes - - AC_MSG_RESULT(checking for libsystemd usability...) - AC_CHECK_X_LIB(c, sd_bus_open_system, [have_systemd=yes],, - $ac_systemd_config_libs -lX11 -lXext -lm) - fi - - if test "$have_systemd" = no; then - AC_MSG_RESULT(checking for libsystemd usability... no) - fi -fi - -if test "$have_systemd" = yes; then - INCLUDES="$INCLUDES $ac_systemd_config_cflags" - EXES_SYSTEMD='$(EXES_SYSTEMD)' - AC_DEFINE(HAVE_LIBSYSTEMD) -else - EXES_SYSTEMD='' -fi - - -############################################################################### -# -# Check for pty support: this allows 'phosphor' and 'apple2' -# to run curses-based programs, or be used as terminal windows. -# -############################################################################### - -PTY_LIBS= -AC_CHECK_HEADERS(pty.h util.h sys/termios.h) -AC_CHECK_X_LIB(util, forkpty, - [PTY_LIBS="-lutil" - ac_have_forkpty=yes - AC_DEFINE(HAVE_FORKPTY)]) - -if test "$ac_have_forkpty" != yes ; then - # we don't need (or have) -lutil on MacOS 10.4.2... - AC_CHECK_X_LIB(c, forkpty, - [PTY_LIBS="" - AC_DEFINE(HAVE_FORKPTY)]) -fi - -############################################################################### -# -# Check for the XSHM server extension. -# -############################################################################### - -have_xshm=no -with_xshm_req=unspecified -AC_ARG_WITH(xshm-ext, -[ --with-xshm-ext Include support for the Shared Memory extension.], - [with_xshm="$withval"; with_xshm_req="$withval"],[with_xshm=yes]) - -HANDLE_X_PATH_ARG(with_xshm, --with-xshm-ext, XSHM) - -if test "$with_xshm" = yes; then - - # first check for Xshm.h. - AC_CHECK_X_HEADER(X11/extensions/XShm.h, [have_xshm=yes],, - [#include ]) - - # if that succeeded, then check for sys/ipc.h. - if test "$have_xshm" = yes; then - have_xshm=no - AC_CHECK_X_HEADER(sys/ipc.h, [have_xshm=yes]) - fi - - # if that succeeded, then check for sys/shm.h. - if test "$have_xshm" = yes; then - have_xshm=no - AC_CHECK_X_HEADER(sys/shm.h, [have_xshm=yes]) - fi - - # AIX is pathological, as usual: apparently it's normal for the Xshm headers - # to exist, but the library code to not exist. And even better, the library - # code is in its own library: libXextSam.a. So, if we're on AIX, and that - # lib doesn't exist, give up. (This lib gets added to X_EXTRA_LIBS, and - # that's not quite right, but close enough.) - # - case "$host" in - *-aix*) - if [ `uname -v` -eq 3 ]; then - have_xshm=no - AC_CHECK_X_LIB(XextSam, XShmQueryExtension, - [have_xshm=yes; X_EXTRA_LIBS="$X_EXTRA_LIBS -lXextSam"], - [true], -lX11 -lXext -lm) - fi - ;; - esac - - # if that succeeded, then we've really got it. - if test "$have_xshm" = yes; then - AC_DEFINE(HAVE_XSHM_EXTENSION) - fi - -elif test "$with_xshm" != no; then - echo "error: must be yes or no: --with-xshm-ext=$with_xshm" - exit 1 -fi - - -############################################################################### -# -# Check for the DOUBLE-BUFFER server extension. -# -############################################################################### - -have_xdbe=no -with_xdbe_req=unspecified -AC_ARG_WITH(xdbe-ext, -[ --with-xdbe-ext Include support for the DOUBLE-BUFFER extension.], - [with_xdbe="$withval"; with_xdbe_req="$withval"],[with_xdbe=yes]) - -HANDLE_X_PATH_ARG(with_xdbe, --with-xdbe-ext, DOUBLE-BUFFER) - -if test "$with_xdbe" = yes; then - - AC_CHECK_X_HEADER(X11/extensions/Xdbe.h, [have_xdbe=yes],, - [#include ]) - if test "$have_xdbe" = yes; then - AC_DEFINE(HAVE_DOUBLE_BUFFER_EXTENSION) - fi - -elif test "$with_xdbe" != no; then - echo "error: must be yes or no: --with-xdbe-ext=$with_xshm" - exit 1 -fi - - -############################################################################### -# -# Check for the SGI XReadDisplay server extension. -# -# Note: this has to be down here, rather than up with the other server -# extension tests, so that the output of `configure --help' is in the -# right order. Arrgh! -# -############################################################################### - -have_readdisplay=no -with_readdisplay_req=unspecified -AC_ARG_WITH(readdisplay, -[ --with-readdisplay Include support for the XReadDisplay extension.], - [with_readdisplay="$withval"; with_readdisplay_req="$withval"], - [with_readdisplay=yes]) - -HANDLE_X_PATH_ARG(with_readdisplay, --with-readdisplay, XReadDisplay) - -if test "$with_readdisplay" = yes; then - AC_CHECK_X_HEADER(X11/extensions/readdisplay.h, - AC_DEFINE(HAVE_READ_DISPLAY_EXTENSION),, - [#include ]) -elif test "$with_readdisplay" != no; then - echo "error: must be yes or no: --with-readdisplay=$with_readdisplay" - exit 1 -fi - - -############################################################################### -# -# Check for a directory full of images to use as the default value -# of the "imageDirectory" preference. -# -############################################################################### - -have_imagedir=no -with_imagedir_req=unspecified - -AC_ARG_WITH(image-directory, -[ --with-image-directory Arg is the default directory from which some demos - will choose random images to display.], - [with_imagedir="$withval"; with_imagedir_req="$withval"], - [with_imagedir=yes]) -# no HANDLE_X_PATH_ARG for this one - -case "$with_imagedir" in - /*) - # absolute path - AC_MSG_CHECKING([for image directory $with_imagedir]) - if test -d "$with_imagedir" ; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - with_imagedir="" - fi - ;; - yes) - with_imagedir="" - - #### Could use some more defaults here... - for dd in \ - "/usr/share/backgrounds/images/" \ - "/usr/share/wallpapers/" \ - "/Library/Desktop Pictures/" \ - ; do - if test -z "$with_imagedir"; then - AC_MSG_CHECKING([for image directory $dd]) - if test -d "$dd" ; then - AC_MSG_RESULT(yes) - with_imagedir="$dd" - else - AC_MSG_RESULT(no) - fi - fi - done - - ;; - no) - with_imagedir="" - ;; - - *) - echo "error: must be an absolute path: --with-image-directory=$with_imagedir_req" - exit 1 - ;; -esac -ac_cv_imagedir="$with_imagedir" - -DEFAULT_IMAGES_P='True' -DEFAULT_IMAGE_DIRECTORY="$ac_cv_imagedir" - -if test -z "$DEFAULT_IMAGE_DIRECTORY" ; then - DEFAULT_IMAGES_P='False' -fi - - -############################################################################### -# -# Pick a text file to use as the default of the "textFile" preference. -# Any old file will do, but preferably one that will make interesting -# shapes when displayed by "starwars" and "fontglide". -# -############################################################################### - -have_textfile=no -with_textfile_req=unspecified - -AC_ARG_WITH(text-file, -[ --with-text-file=FILE By default, some demos may display this file.], - [with_textfile="$withval"; with_textfile_req="$withval"], - [with_textfile=yes]) -# no HANDLE_X_PATH_ARG for this one - -case "$with_textfile" in - /*) - # absolute path - AC_MSG_CHECKING([for text file $with_textfile]) - if test -f "$with_textfile" ; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - with_textfile="" - fi - ;; - yes) - with_textfile="" - - #### Could use some more defaults here... - for f in \ - "/usr/X11R6/lib/X11/doc/README" \ - "/usr/share/doc/xserver-common/copyright" \ - "/usr/share/doc/xserver-xorg-core/copyright" \ - "/usr/X11R6/README" \ - "/usr/share/doc/libX11*/COPYING" \ - "/usr/X11/share/X11/doc/README*" \ - "/usr/share/doc/debian/debian-manifesto" \ - ; do - if test -z "$with_textfile"; then - AC_MSG_CHECKING([for text file $f]) - f=`/bin/ls $f 2>&- | head -1` - if test -f "$f" ; then - AC_MSG_RESULT(yes) - with_textfile="$f" - else - AC_MSG_RESULT(no) - fi - fi - done - - ;; - no) - with_textfile="" - ;; - - *) - echo "error: must be an absolute path: --with-text-file=$with_textfile_req" - exit 1 - ;; -esac -ac_cv_textfile="$with_textfile" - -DEFAULT_TEXT_FILE="$ac_cv_textfile" - - -############################################################################### -# -# Check the browser to see help URL -# -############################################################################### - -have_browser=no -with_browser_req=unspecified - -AC_ARG_WITH(browser, -[ --with-browser=BROWSER Specify the web browser used to show the help URL.], - [with_browser="$withval"; with_browser_req="$withval"], - [with_browser=no ]) -# no HANDLE_X_PATH_ARG for this one - -case "$with_browser" in - no ) - ;; - * ) - WITH_BROWSER=$with_browser - gnome_open_program=$with_browser - AC_MSG_CHECKING([for browser $with_browser]) - with_browser_fullpath=`which $with_browser 2>/dev/null` - case $with_browser_fullpath in - /* ) - AC_MSG_RESULT(yes) - have_browser=yes - ;; - * ) - AC_MSG_RESULT(no) -# Only warning: we don't want to install all packages for the -# dependency of the browser in building stage... - echo "WARNING: browser not found: --with-browser=$with_browser" - ;; - esac - ;; -esac -ac_cv_browser="$with_browser" - -############################################################################### -# -# Check whether it's ok to install some hacks as setuid (e.g., "sonar") -# This should be safe, but let's give people the option. -# -############################################################################### - -setuid_hacks_default=no -setuid_hacks="$setuid_hacks_default" -AC_ARG_WITH(setuid-hacks, -[ --with-setuid-hacks Allow some demos to be installed `setuid root' - (which is needed in order to ping other hosts.)], - [setuid_hacks="$withval"], [setuid_hacks="$setuid_hacks_default"]) - -HANDLE_X_PATH_ARG(setuid_hacks, --with-setuid-hacks, setuid hacks) - -if test "$setuid_hacks" = yes; then - true -elif test "$setuid_hacks" != no; then - echo "error: must be yes or no: --with-setuid-hacks=$setuid_hacks" - exit 1 -fi - - -############################################################################### -# -# Check for setcap, which is less worrying than setuid. -# -############################################################################### - -have_libcap=no -setcap_hacks_default=yes -setcap_hacks="$setcap_hacks_default" -setcap_hacks_req=unspecified -AC_ARG_WITH(setcap-hacks, -[ --with-setcap-hacks Allow some demos to be installed with setcap - (which is needed in order to ping other hosts.)], - [setcap_hacks="$withval"; setcap_hacks_req="$withval"], - [setcap_hacks=yes]) - -HANDLE_X_PATH_ARG(setcap_hacks, --with-setcap-hacks, setcap hacks) - -if test "$setcap_hacks" != yes -a "$setcap_hacks" != no ; then - echo "error: must be yes or no: --with-setcap-hacks=$setcap_hacks" - exit 1 -fi - -if test "$setcap_hacks" = yes; then - - AC_CHECK_PROGS(setcap_program, setcap) - if test "$setcap_program" != ''; then - AC_CHECK_X_HEADER(sys/capability.h, [have_setcap=yes]) - fi - if test "$have_setcap" = yes; then - AC_CHECK_X_LIB(cap, cap_set_flag, - [have_libcap=yes - PROG_SETCAP="$setcap_program" - LIBCAP_LIBS="-lcap" - AC_DEFINE(HAVE_LIBCAP)]) - fi -fi - - -############################################################################### -# -# Check for --with-record-animation -# -############################################################################### - -record_anim_default=no -record_anim="$record_anim_default" -AC_ARG_WITH(record-animation, -[ --with-record-animation Include code for generating MP4 videos.], - [record_anim="$withval"], [record_anim="$record_anim_default"]) - -HANDLE_X_PATH_ARG(record_anim, --with-record-animation, record animation) - -if test "$record_anim" = yes; then - true -elif test "$record_anim" != no; then - echo "error: must be yes or no: --with-record-animation=$record_anim" - exit 1 -fi - -if test "$record_anim" = yes; then - if test "$have_gdk_pixbuf" != yes; then - AC_MSG_ERROR(--with-record-animation requires GDK-Pixbuf) - else - AC_MSG_RESULT(enabling --with-record-animation) - AC_DEFINE(HAVE_RECORD_ANIM) - ANIM_OBJS='$(ANIM_OBJS)' - ANIM_LIBS='$(ANIM_LIBS)' - fi -fi - -############################################################################### -# -# Done testing. Now, set up the various -I and -L variables, -# and decide which GUI program to build by default. -# -############################################################################### - -DEPEND=makedepend -DEPEND_FLAGS= -DEPEND_DEFINES= - - -if test \! -z "$includedir" ; then - INCLUDES="$INCLUDES -I$includedir" -fi - -if test \! -z "$libdir" ; then - LDFLAGS="$LDFLAGS -L$libdir" -fi - - -PREFERRED_DEMO_PROGRAM='' -ALL_DEMO_PROGRAMS= -if test "$have_motif" = yes; then - PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Xm - ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS" -fi -if test "$have_gtk" = yes; then - PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Gtk - ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS" -fi - - -if test "$have_kerberos" = yes; then - PASSWD_SRCS="$PASSWD_SRCS \$(KERBEROS_SRCS)" - PASSWD_OBJS="$PASSWD_OBJS \$(KERBEROS_OBJS)" -fi -if test "$have_pam" = yes; then - PASSWD_SRCS="$PASSWD_SRCS \$(PAM_SRCS)" - PASSWD_OBJS="$PASSWD_OBJS \$(PAM_OBJS)" - INSTALL_PAM="install-pam" -fi -if test "$enable_pam_check_account_type" = yes; then - COMMENT_PAM_CHECK_ACCOUNT="" -else - COMMENT_PAM_CHECK_ACCOUNT="#" -fi -if test "$have_passwd_helper" = yes; then - PASSWD_SRCS="$PASSWD_SRCS \$(PWHELPER_SRCS)" - PASSWD_OBJS="$PASSWD_OBJS \$(PWHELPER_OBJS)" -fi - PASSWD_SRCS="$PASSWD_SRCS \$(PWENT_SRCS)" - PASSWD_OBJS="$PASSWD_OBJS \$(PWENT_OBJS)" - - -if test "$enable_locking" = yes; then - LOCK_SRCS='$(LOCK_SRCS_1) $(PASSWD_SRCS)' - LOCK_OBJS='$(LOCK_OBJS_1) $(PASSWD_OBJS)' -else - LOCK_SRCS='$(NOLOCK_SRCS_1)' - LOCK_OBJS='$(NOLOCK_OBJS_1)' -fi - -if test "$ac_macosx" = yes; then - EXES_OSX='$(EXES_OSX)' - SCRIPTS_OSX='$(SCRIPTS_OSX)' - MEN_OSX='$(MEN_OSX)' -else - EXES_OSX= - SCRIPTS_OSX= - MEN_OSX= -fi - - -INSTALL_SETUID='$(INSTALL_PROGRAM) $(SUID_FLAGS)' - -if test "$need_setuid" = yes; then - NEED_SETUID=yes -else - NEED_SETUID=no -fi - -if test "$setuid_hacks" = yes; then - SETUID_HACKS=yes -else - SETUID_HACKS=no -fi - -if test "$have_libcap" = yes; then - SETCAP_HACKS=yes -else - SETCAP_HACKS=no -fi - -tab=' ' -if test "$have_gl" = yes; then - GL_EXES='$(GL_EXES)' - SUID_EXES='$(SUID_EXES)' - RETIRED_GL_EXES='$(RETIRED_GL_EXES)' - GL_UTIL_EXES='$(GL_UTIL_EXES)' - GL_MEN='$(GL_MEN)' - GL_KLUDGE=" " -else - GL_KLUDGE="-" -fi - -if test "$have_gle" = yes; then - GLE_EXES='$(GLE_EXES)' - GLE_KLUDGE=" " -else - GLE_KLUDGE="-" -fi - -if test "$have_jpeg" = yes -a "$have_gdk_pixbuf" = yes; then - JPEG_EXES='$(JPEG_EXES)' -fi - - -# Another substitution in the XScreenSaver.ad.in file: -# -if test "$gnome_open_program" != ''; then - GNOME24='' - GNOME22='! ' - NOGNOME='! ' -elif test "$gnome_url_show_program" != ''; then - GNOME24='! ' - GNOME22='' - NOGNOME='! ' -else - GNOME24='! ' - GNOME22='! ' - NOGNOME='' -fi - - -# Set PO_DATADIR to something sensible. -# -AC_MSG_CHECKING([for locale directory]) -if test -n "$GTK_DATADIR" ; then - PO_DATADIR="$GTK_DATADIR" -elif test "$have_gtk" = yes; then - PO_DATADIR=`$pkg_config --variable=prefix gtk+-2.0` - PO_DATADIR="$PO_DATADIR/share" -fi - -if test -z "$PO_DATADIR" ; then - # - # #### Total fucking kludge -- - # Map /build/prefix/usr/X11R6/share/ to /build/prefix/usr/share/ - # but of course we need to expand all the nested variables to do that... - # - dd=`eval eval eval eval eval eval eval eval eval eval eval echo $datadir` - PO_DATADIR=`echo $dd | sed 's@/X11R6/@/@'` -fi - -AC_MSG_RESULT($PO_DATADIR/locale) - - -# canonicalize slashes. -HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'` - -# gcc 3.0 likes to issue this warning for every file: -# -# cc1: warning: changing search order for system directory "/usr/local/include" -# cc1: warning: as it has already been specified as a non-system directory -# -# Yay. We can only avoid that by deleting "-I${prefix}/include" from the list. -# Which *should* be totally redundant, and thus an ok thing to delete? -# -INCLUDES=`echo "$INCLUDES" | sed 's@ -I${prefix}/include@@g;'` - - -############################################################################### -# -# Perform substitutions and write Makefiles. -# -############################################################################### - -AC_SUBST(INCLUDES) - -AC_SUBST(PREFERRED_DEMO_PROGRAM) -AC_SUBST(ALL_DEMO_PROGRAMS) -AC_SUBST(SAVER_LIBS) -AC_SUBST(MOTIF_LIBS) -AC_SUBST(GTK_LIBS) -AC_SUBST(XML_LIBS) -AC_SUBST(PNG_LIBS) -AC_SUBST(JPEG_LIBS) -AC_SUBST(HACK_LIBS) -AC_SUBST(PTY_LIBS) -AC_SUBST(GL_LIBS) -AC_SUBST(GLE_LIBS) -AC_SUBST(XDPMS_LIBS) -AC_SUBST(XINERAMA_LIBS) -AC_SUBST(PASSWD_LIBS) -AC_SUBST(LIBCAP_CFLAGS) -AC_SUBST(LIBCAP_LIBS) -AC_SUBST(PROG_SETCAP) -AC_SUBST(INSTALL_SETUID) -AC_SUBST(SETUID_HACKS) -AC_SUBST(SETCAP_HACKS) -AC_SUBST(INSTALL_DIRS) -AC_SUBST(NEED_SETUID) -AC_SUBST(INSTALL_PAM) -AC_SUBST(HAVE_PAM_FAIL_DELAY) -AC_SUBST(COMMENT_PAM_CHECK_ACCOUNT) -AC_SUBST(NEW_LOGIN_COMMAND) -AC_SUBST(NEW_LOGIN_COMMAND_P) -AC_SUBST(DEFAULT_IMAGES_P) -AC_SUBST(DEFAULT_IMAGE_DIRECTORY) -AC_SUBST(DEFAULT_TEXT_FILE) -AC_SUBST(WITH_BROWSER) -AC_SUBST(COMMENT_DEMO_GLADE2_GTK_2_22_HEAD) -AC_SUBST(COMMENT_DEMO_GLADE2_GTK_2_22_TAIL) - - -AC_SUBST(OBJCC) -AC_SUBST(EXES_OSX) -AC_SUBST(EXES_SYSTEMD) -AC_SUBST(SCRIPTS_OSX) -AC_SUBST(MEN_OSX) - -AC_SUBST(PASSWD_SRCS) -AC_SUBST(PASSWD_OBJS) -AC_SUBST(XMU_SRCS) -AC_SUBST(XMU_OBJS) -AC_SUBST(XMU_LIBS) -AC_SUBST(XFT_SRCS) -AC_SUBST(XFT_OBJS) -AC_SUBST(XFT_LIBS) -AC_SUBST(SAVER_GL_SRCS) -AC_SUBST(SAVER_GL_OBJS) -AC_SUBST(SAVER_GL_LIBS) -AC_SUBST(LOCK_SRCS) -AC_SUBST(LOCK_OBJS) -AC_SUBST(JPEG_EXES) -AC_SUBST(GL_EXES) -AC_SUBST(RETIRED_GL_EXES) -AC_SUBST(SUID_EXES) -AC_SUBST(GL_UTIL_EXES) -AC_SUBST(GL_MEN) -AC_SUBST(GL_KLUDGE) -AC_SUBST(GLE_EXES) -AC_SUBST(GLE_KLUDGE) -AC_SUBST(JWZGLES_OBJS) -AC_SUBST(GNOME24) -AC_SUBST(GNOME22) -AC_SUBST(NOGNOME) -AC_SUBST(HACKDIR) -AC_SUBST(HACKDIR_FULL) -AC_SUBST(GTK_DATADIR) -AC_SUBST(PO_DATADIR) -AC_SUBST(HACK_CONF_DIR) -AC_SUBST(GTK_EXTRA_OBJS) -AC_SUBST(ANIM_OBJS) -AC_SUBST(ANIM_LIBS) - -APPDEFAULTS=$ac_x_app_defaults -AC_SUBST(APPDEFAULTS) - -AC_SUBST(DEPEND) -AC_SUBST(DEPEND_FLAGS) -AC_SUBST(DEPEND_DEFINES) -AC_SUBST(PERL) - -AC_OUTPUT(Makefile - utils/Makefile - jwxyz/Makefile - hacks/Makefile - hacks/images/Makefile - hacks/glx/Makefile - po/Makefile.in - driver/Makefile - driver/xscreensaver.pam - driver/xscreensaver-demo.glade2 - driver/XScreenSaver.ad) - -############################################################################### -# -# Print some warnings at the end. -# -############################################################################### - -warn_prefix_1=" Warning:" -warn_prefix_2=" Note:" -warn_prefix="$warn_prefix_1" - -warning=no -warnsep=' #################################################################' - -warnpre() { - if test "$warning" = no ; then - echo '' ; echo "$warnsep" ; echo '' - warning=yes - fi -} - -warn() { - warnpre - if test "$warning" = long ; then echo '' ; fi - warning=yes - rest="$@" - echo "$warn_prefix $rest" -} - -warnL() { - was=$warning - warnpre - warning=yes - if test "$was" != no ; then echo '' ; fi - rest="$@" - echo "$warn_prefix $rest" -} - -warn2() { - rest="$@" - echo " $rest" - warning=long -} - -note() { - warn_prefix="$warn_prefix_2" - warn $@ - warn_prefix="$warn_prefix_1" -} - -noteL() { - warn_prefix="$warn_prefix_2" - warnL $@ - warn_prefix="$warn_prefix_1" -} - - -# ac_prog_cc_no_pthread normally only happens on AIX, because according -# to AX_PTHREAD, AIX needs CC=xlc_r or CC=cc_r to do threads. -# If CC is specified, it takes precedence over --with-pthread. -if test "$ac_prog_cc_no_pthread" ; then - warnL "You requested $ac_original_cc for the C compiler, but it doesn't" - warn2 "support POSIX threads." - echo "" - warn2 "If you have multiple CPU cores, try CC=$PTHREAD_CC." -elif test "$with_pthread_req" = yes -a "$have_pthread" = no ; then - warn 'POSIX threads were requested, but were not found.' -fi - -if test "$with_sgi_req" = yes -a "$have_sgi" = no ; then - warn 'The SGI saver extension was requested, but was not found.' -fi - -if test "$with_xidle_req" = yes -a "$have_xidle" = no ; then - warn 'The XIdle extension was requested, but was not found.' -fi - -if test "$with_xshm_req" = yes -a "$have_xshm" = no ; then - warn 'The XSHM extension was requested, but was not found.' -fi - -if test "$with_xdbe_req" = yes -a "$have_xdbe" = no ; then - warn 'The DOUBLE-BUFFER extension was requested, but was not found.' -fi - -if test "$with_sgivc_req" = yes -a "$have_sgivc" = no ; then - warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.' -fi - -if test "$with_dpms_req" = yes -a "$have_dpms" = no ; then - warn 'The DPMS extension was requested, but was not found.' -fi - -if test "$with_xinerama_req" = yes -a "$have_xinerama" = no ; then - warn 'The Xinerama extension was requested, but was not found.' -fi - -if test "$with_xf86vmode_req" = yes -a "$have_xf86vmode" = no ; then - warn 'The XF86VMODE extension was requested, but was not found.' -fi - -if test "$with_randr_req" = yes -a "$have_randr" = no ; then - warn 'The RANDR extension was requested, but was not found.' -fi - -if test "$with_proc_interrupts_req" = yes -a "$have_proc_interrupts" = no; then - warn "Checking of /proc/interrupts was requested, but it's bogus." -fi - -if test "$pkg_config" = false ; then - warnL 'The "pkg-config" program was not found. Without that,' - warn2 "detection of the various GTK libraries won't work." -else - pkgerr=`$pkg_config --list-all 2>&1 >/dev/null` - if test "x$pkgerr" != "x" ; then - warnL 'The "pkg-config" program produces errors. This often causes' - warn2 "detection of the various GTK libraries to malfunction." - warn2 "The errors are:" - echo '' - echo "$pkgerr" | sed 's/^/ > /g' - fi -fi - -if test "$gtk_halfassed" != no ; then - warnL "GTK version $gtk_halfassed was found, but at least one supporting" - warn2 "library ($gtk_halfassed_lib) was not, so GTK can't be used." - warn2 "Perhaps some of the development packages are not installed?" - if test "$have_gtk" = yes ; then - v="$ac_gtk_version_string" - warn2 "GTK $v is also installed, so it will be used instead." - warn2 "Please read the above output and the \`config.log' file" - warn2 "for more details." - fi -fi - -motif_warn2() { - warn2 'Though the Motif front-end to xscreensaver is still' - warn2 'maintained, it is no longer being updated with new' - warn2 'features: all new development on the xscreensaver-demo' - warn2 'program is happening in the GTK version, and not in the' - warn2 'Motif version. It is recommended that you build against' - warn2 'GTK instead of Motif. See .' -} - -if test "$have_motif" = no -a "$have_gtk" = no; then - - if test "$with_motif" = yes; then - warnL "Neither the GTK nor Motif libraries were found; the" - warn2 "\`xscreensaver-demo' program requires one of these." - echo '' - motif_warn2 - else - warnL "The GTK libraries do not seem to be available; the" - warn2 "\`xscreensaver-demo' program requires them." -# echo '' -# warn2 'You can use Motif or Lesstif instead of GTK (use the' -# warn2 "\`--with-motif' option) but that is NOT recommended." -# motif_warn2 - fi - -elif test "$with_motif_req" = yes -a "$have_motif" = no ; then - warnL "Use of Motif was requested, but it wasn't found;" - warn2 "Gtk will be used instead." - -elif test "$jurassic_gtk" = yes ; then - - pref_gtk=2.0 - - v="$ac_gtk_version_string" - if test "$with_gtk_req" = yes -a "$ac_gtk_version" = "unknown" ; then - warnL "Use of Gtk was requested, but its version number is unknown;" - elif test "$with_gtk_req" = yes ; then - warnL "Use of Gtk was requested, but it is version $v;" - else - warnL "Gtk was found on this system, but it is version $v;" - fi - - warn2 "Gtk $pref_gtk or newer is required." - -elif test "$with_gtk_req" = yes -a "$have_gtk" = no ; then - warnL "Use of Gtk was requested, but it wasn't found." -fi - - -if test "$have_gtk" = yes -a "$have_gdk_pixbuf" = no ; then - warn "GTK is being used, but the GDK-Pixbuf library and/or" - warn2 "headers were not found. That can't be good. Please" - warn2 "install the GDK-Pixbuf development kit and re-configure." -fi - -if test "$have_motif" = yes -a "$have_lesstif" = yes ; then - - preferred_lesstif=0.92 - - if test "$lesstif_version" = unknown; then - warnL "Unable to determine the LessTif version number!" - warn2 "Make sure you are using version $preferred_lesstif or newer." - warn2 "See ." - - elif test \! $lesstif_version -gt 82; then - warnL "LessTif version $lesstif_version_string is being used." - warn2 "LessTif versions 0.82 and earlier are too buggy to" - warn2 "use with XScreenSaver; it is strongly recommended" - warn2 "that you upgrade to at least version $preferred_lesstif!" - warn2 "See ." - fi -fi - - -if test "$have_motif" = yes -a "$have_gtk" = no ; then - warn 'Motif is being used, and GTK is not.' - echo '' - motif_warn2 -fi - - -if test "$with_gdk_pixbuf_req" = yes -a "$have_gdk_pixbuf" = no; then - warnL 'Use of GDK-Pixbuf was requested, but it was not found.' -fi - -if test "$have_gdk_pixbuf" = no -o "$gdk_pixbuf_halfassed" = yes || \ - test "$have_gdk_pixbuf" = no ; then - - if test "$with_gdk_pixbuf_req" = yes ; then - true - elif test "$with_gdk_pixbuf_req" = no ; then - warnL 'The GDK-Pixbuf library is not being used.' - else - warnL 'The GDK-Pixbuf library was not found.' - fi - - if test "$gdk_pixbuf_halfassed" = yes ; then - echo '' - warn2 'More specifically, we found the headers, but not the' - warn2 'libraries; so either GDK-Pixbuf is half-installed on this' - warn2 "system, or something else went wrong. The \`config.log'" - warn2 'file might contain some clues.' - fi - - if test "$have_png" = yes ; then - echo '' - warn2 'The PNG library is being used instead.' - fi - - echo '' - warn2 'Some of the demos will not use images as much as they could.' - warn2 'You should consider installing GDK-Pixbuf and re-running' - warn2 'configure.' -fi - - -if test "$have_jpeg" = no ; then - if test "$with_jpeg_req" = yes ; then - warnL 'Use of libjpeg was requested, but it was not found.' - elif test "$with_jpeg_req" = no ; then - noteL 'The JPEG library is not being used.' - else - noteL 'The JPEG library was not found.' - fi - - if test "$jpeg_halfassed" = yes ; then - echo '' - warn2 'More specifically, we found the headers, but not the' - warn2 'library; so either JPEG is half-installed on this' - warn2 "system, or something else went wrong. The \`config.log'" - warn2 'file might contain some clues.' - echo '' - fi - - if test "$have_gdk_pixbuf" = no ; then - warn2 "This means that it won't be possible for the image-manipulating" - warn2 "display modes to load files from disk; and it also means that" - warn2 "the \`webcollage' program will be much slower." - else - warn2 "This means the \`webcollage' program will be much slower." - fi -fi - - -if test "$have_png" = no ; then - if test "$with_png_req" = yes ; then - warnL 'Use of libpng was requested, but it was not found.' - elif test "$with_png_req" = no ; then - noteL 'The PNG library is not being used.' - else - noteL 'The PNG library was not found.' - fi - - if test "$png_halfassed" = yes ; then - echo '' - warn2 'More specifically, we found the headers, but not the' - warn2 'library; so either PNG is half-installed on this' - warn2 "system, or something else went wrong. The \`config.log'" - warn2 'file might contain some clues.' - echo '' - fi - - warn2 "Many things aren't going to work right." -fi - - -if test "$have_xft" = no ; then - if test "$with_xft_req" = yes ; then - warnL "Use of libXft was requested, but it was not found." - elif test "$with_xft_req" = no ; then - noteL 'The Xft library is not being used.' - else - noteL "The Xft library was not found." - fi - - if test "$xft_halfassed" = yes ; then - echo '' - warn2 'More specifically, we found the headers, but not the' - warn2 'libraries; so either Xft is half-installed on this' - warn2 "system, or something else went wrong. The \`config.log'" - warn2 'file might contain some clues.' - echo '' - fi - - warn2 "This means that fonts won't be anti-aliased." -fi - - -if test "$have_systemd" = no ; then - systemd_warned=no - if test "$with_systemd_req" = yes ; then - warnL "Use of systemd was requested, but it was not found." - systemd_warned=yes - elif test "$with_systemd_req" = no ; then - true - # noteL 'The systemd library is not being used.' - # systemd_warned=yes - else - true - # noteL "The systemd library was not found." - # systemd_warned=yes - fi - - if test "$systemd_halfassed" = yes ; then - echo '' - warn2 'More specifically, we found the headers, but not the' - warn2 'libraries; so either systemd is half-installed on this' - warn2 "system, or something else went wrong. The \`config.log'" - warn2 'file might contain some clues.' - echo '' - systemd_warned=yes - fi - - if test "$systemd_warned" = yes; then - warn2 "This means that xscreensaver-systemd won't be built." - fi -fi - - -if test "$have_gl" = yes -a "$ac_have_mesa_gl" = yes ; then - preferred_mesagl=3.4 - mgv="$ac_mesagl_version_string" - pgl="$preferred_mesagl" - - if test "$ac_mesagl_version" = unknown; then - true - # warnL "Unable to determine the MesaGL version number!" - # warn2 "Make sure you are using version $preferred_mesagl or newer." - - elif test \! "$ac_mesagl_version" -gt 2006; then - warnL "MesaGL version number is $mgv --" - warn2 "MesaGL 2.6 and earlier have a security bug. It is strongly" - warn2 "recommended that you upgrade to at least version $preferred_mesagl." - - elif test \! "$ac_mesagl_version" -gt 3003; then - warnL "MesaGL version number is $mgv --" - warn2 "MesaGL 3.3 and earlier have some bugs; it is recommended" - warn2 "that you upgrade to $pgl or newer." - fi -fi - -if test "$have_gl" = no ; then - if test "$with_gl_req" = yes ; then - warnL 'Use of GL was requested, but it was not found.' - elif test "$with_gl_req" = no ; then - noteL 'The OpenGL 3D library is not being used.' - else - noteL 'The OpenGL 3D library was not found.' - fi - - if test "$gl_halfassed" = yes ; then - echo '' - warn2 'More specifically, we found the headers, but not the' - warn2 'libraries; so either GL is half-installed on this' - warn2 "system, or something else went wrong. The \`config.log'" - warn2 'file might contain some clues.' - fi - - echo '' - warn2 'Those demos which use 3D will not be built or installed.' - warn2 'You might want to consider installing OpenGL and' - warn2 're-running configure.' - -fi - - -if test "$have_gl" = yes -a "$have_gle" = no ; then - - # nobody cares about this; don't print the warning unless it was - # requested and not found, or halfway-found. - if test "$with_gle_req" = yes -o "$gle_halfassed" = yes ; then - - if test "$with_gle_req" = yes ; then - noteL 'Use of the GLE (GL Extrusion) library was requested, but' - warn2 'it was not found (though the OpenGL library was found, and' - warn2 'is being used.)' - elif test "$with_gle_req" = no ; then - noteL 'The OpenGL Library is being used, but the GLE (GL Extrusion)' - warn2 'library is not.' - else - noteL 'The OpenGL Library was found, but the GLE (GL Extrusion)' - warn2 'library was not.' - fi - - if test "$gle_halfassed" = yes ; then - echo '' - warn2 'More specifically, we found the headers, but not the' - warn2 'libraries; so either GLE is half-installed on this' - warn2 "system, or something else went wrong. The \`config.log'" - warn2 'file might contain some clues.' - fi - - echo '' - warn2 'Some of the OpenGL (3D) demos (those that depend on GLE)' - warn2 'will not be built or installed. You might want to consider' - warn2 'installing GLE and re-running configure. You can find the' - warn2 'GLE library at ' - - fi -fi - - -if test "$with_readdisplay_req" = yes -a "$have_readdisplay" = no ; then - warn 'Use of XReadDisplay was requested, but it was not found.' -fi - -if test "$with_kerberos_req" = yes -a "$have_kerberos" = no ; then - warn 'Use of Kerberos was requested, but it was not found.' -fi - -if test "$with_pam_req" = yes -a "$have_pam" = no ; then - warn 'Use of PAM was requested, but it was not found.' -fi - -if test "$with_shadow_req" = yes -a "$have_shadow" = no ; then - warn 'Use of shadow passwords was requested, but they were not found.' -fi - -if test "$setcap_hacks_req" = yes -a "$have_libcap" = no ; then - warn 'Use of libcap was requested, but it was not found.' -fi - -if test "$ac_macosx" = yes ; then - if test "$enable_locking" = yes ; then - warn "You have specified --enable-locking on MacOS X." - warn2 "THIS DOES NOT WORK! Don't do this!" - fi -fi - - -# You are in a twisty maze of namespaces and syntaxes, all alike. -# Fuck the skull of Unix. -# -bindir=`eval eval eval eval eval eval eval echo $bindir` -HACKDIR=`eval eval eval eval eval eval eval echo $HACKDIR` -HACK_CONF_DIR=`eval eval eval eval eval eval eval echo $HACK_CONF_DIR` - -# canonicalize slashes. -bindir=`echo "${bindir}" | sed 's@/$@@;s@//*@/@g'` -HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'` -HACK_CONF_DIR=`echo "${HACK_CONF_DIR}" | sed 's@/$@@;s@//*@/@g'` - - -# Sanity check the hackdir -for bad_choice in xscreensaver xscreensaver-demo xscreensaver-command ; do - if test "${HACKDIR}" = "${bindir}/${bad_choice}" ; then - echo "" - AC_MSG_ERROR([\"--with-hackdir=${bindir}/${bad_choice}\" won't work. - There will be an executable installed with that name, so - that can't be the name of a directory as well. Please - re-configure with a different directory name.]) - fi -done - - -do_dir_warning=no - -# Now let's warn if there's a previous RPM version already installed. -# But don't bother with this test if we are currently *building* an RPM. - -if test -z "$RPM_PACKAGE_VERSION" ; then - - rpmnames="xscreensaver xscreensaver-base xscreensaver-extras" - - # M4 sucks!! - changequote(X,Y) - rpmv=`(rpm -qv $rpmnames) 2>/dev/null | \ - sed -n 's/^[-a-z]*-\([0-9][0-9]*[.][0-9][0-9a-z]*\)-.*$/\1/p' | \ - head -1` - changequote([,]) - - if test \! -z "$rpmv" ; then - rpmbdir=`rpm -ql $rpmnames | sed -n 's@^\(.*\)/xscreensaver-demo$@\1@p'` - rpmhdir=`rpm -ql $rpmnames | sed -n 's@^\(.*\)/popsquares$@\1@p'` - - warning=no - warnL "There is already an installed RPM of xscreensaver $rpmv" - warn2 'on this system. You might want to remove it ("rpm -ve")' - warn2 'before running "make install" in this directory.' - echo "" - warn2 "Alternately, you could build this version of xscreensaver" - warn2 'as an RPM, and then install that. An "xscreensaver.spec"' - warn2 'file is included. Try "rpmbuild -v -ba xscreensaver.spec".' - warn2 "See the RPM documentation for more info." - echo "" - - if test "$rpmbdir" = "$rpmhdir" ; then - warn2 "The RPM version was installed in $rpmbdir/." - do_dir_warning=yes - else - warn2 "The RPM version was installed in $rpmbdir/," - warn2 "with demos in $rpmhdir/." - fi - fi -fi - -# Also warn if there's a Debian package installed. -# -debnames="xscreensaver xscreensaver-data xscreensaver-data-extra" -debv='' -for dpkg in $debnames ; do - if test -z "$debv"; then - debv=`dpkg -s $dpkg 2>/dev/null | sed -n 's/^Version: \(.*\)$/\1/p'` - fi -done - -if test \! -z "$debv" ; then - debbdir=`dpkg -L $debnames 2>/dev/null | \ - sed -n 's@^\(.*/bin/\)xscreensaver$@\1@p'` - debhdir=`dpkg -L $debnames 2>/dev/null | \ - sed -n 's@^\(.*/\)popsquares$@\1@p'` - if test -z "$debbdir" ; then debbdir='???'; fi - if test -z "$debhdir" ; then debhdir='???'; fi - - warning=no - warnL "There is already an installed dpkg of xscreensaver" - warn2 "version \"$debv\" on this system." - echo "" - warn2 "The dpkg was installed in $debbdir," - warn2 "with demos in $debhdir." -fi - - -if test "${bindir}" = "${HACKDIR}" ; then - do_dir_warning=yes -fi - -if test "$do_dir_warning" = yes; then - echo "" - echo "$warnsep" - echo "" - echo ' When you run "make install", the "xscreensaver",' - echo ' "xscreensaver-demo", and "xscreensaver-command" executables' - echo " will be installed in ${bindir}/." - echo "" - echo " The various graphics demos (200+ different executables) will" - echo " be installed in ${HACKDIR}/." - echo "" - echo " If you would prefer the demos to be installed elsewhere," - echo " you should re-run configure with the --with-hackdir=DIR" - echo " option. For more information, run \`./configure --help'." - warning=yes -fi - -if test "$warning" != no; then - echo '' ; echo "$warnsep" ; echo '' -fi - -if test "$do_dir_warning" = no; then - if test "$warning" = no; then - echo '' - fi - echo "User programs will be installed in ${bindir}/" - echo "Screen savers will be installed in ${HACKDIR}/" - echo "Configuration dialogs will be installed in ${HACK_CONF_DIR}/" - echo "System-wide default settings will be installed in ${APPDEFAULTS}/" - echo '' -fi diff --git a/driver/Makefile.in b/driver/Makefile.in index 7baf504..0e986a9 100644 --- a/driver/Makefile.in +++ b/driver/Makefile.in @@ -1,9 +1,9 @@ -# driver/Makefile.in --- xscreensaver, Copyright (c) 1997-2010 Jamie Zawinski. +# driver/Makefile.in --- xscreensaver, Copyright © 1997-2021 Jamie Zawinski. # the `../configure' script generates `driver/Makefile' from this file. @SET_MAKE@ .SUFFIXES: -.SUFFIXES: .c .m .o +.SUFFIXES: .c .m .o .desktop .desktop.in srcdir = @srcdir@ VPATH = @srcdir@ @@ -19,42 +19,36 @@ datadir = @datadir@ localedir = @PO_DATADIR@/locale mandir = @mandir@ libexecdir = @libexecdir@ -mansuffix = 1 -manNdir = $(mandir)/man$(mansuffix) +sysconfdir = @sysconfdir@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ +# A = suffix for user commands in /usr/bin/ +# B = suffix for helper programs in /usr/libexec/xscreensaver/ +mansuffixA = 1 +mansuffixB = 6 GTK_DATADIR = @GTK_DATADIR@ GTK_APPDIR = $(GTK_DATADIR)/applications GTK_ICONDIR = $(GTK_DATADIR)/pixmaps -GTK_GLADEDIR = $(GTK_DATADIR)/xscreensaver/glade +GTK_UIDIR = $(GTK_DATADIR)/xscreensaver/ui + +HACKDIR = @HACKDIR@ HACK_CONF_DIR = @HACK_CONF_DIR@ CC = @CC@ -OBJCC = @OBJCC@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ DEFS = @DEFS@ -INTL_DEFS = -DLOCALEDIR=\"$(localedir)\" -SUBP_DEFS = $(DEFS) -DDEFAULT_PATH_PREFIX='"@HACKDIR@"' -GTK_DEFS = $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"' -CONF_DEFS = -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"' LIBS = @LIBS@ -INTL_LIBS = @INTLLIBS@ -JPEG_LIBS = @JPEG_LIBS@ -PERL = @PERL@ DEPEND = @DEPEND@ DEPEND_FLAGS = @DEPEND_FLAGS@ DEPEND_DEFINES = @DEPEND_DEFINES@ -SHELL = /bin/sh INSTALL = @INSTALL@ SUID_FLAGS = -o root -m 4755 INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_SETUID = @INSTALL_SETUID@ +INSTALL_SETUID = $(INSTALL_PROGRAM) $(SUID_FLAGS) INSTALL_DATA = @INSTALL_DATA@ INSTALL_DIRS = @INSTALL_DIRS@ @@ -62,8 +56,11 @@ X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ -XMU_LIBS = @XMU_LIBS@ PNG_LIBS = @PNG_LIBS@ +XFT_LIBS = @XFT_LIBS@ + +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTL_LIBS = @INTLLIBS@ # Note: # @@ -74,15 +71,18 @@ PNG_LIBS = @PNG_LIBS@ # (e.g., -lsocket, -lnsl, etc.) # # I think (but am not totally sure) that LIBS is also really "LDFLAGS". -# -# SAVER_LIBS is the link line for "xscreensaver", and -# CMD_LIBS is the link line for "xscreensaver-command". -# GETIMG_LIBS is the link line for "xscreensaver-getimage". AD_DIR = @APPDEFAULTS@ -PAM_DIR = /etc/pam.d -PAM_CONF = /etc/pam.conf + +# $(sysconfdir) is either /usr/local/etc or /usr/etc but this must be /etc. +PAM_ROOT = /etc +PAM_DIR = $(PAM_ROOT)/pam.d +PAM_CONF = $(PAM_ROOT)/pam.conf + +ICON_SRC = $(UTILS_SRC)/images +LOGO = $(ICON_SRC)/logo-50.xpm +GTK_ICONS = $(ICON_SRC)/screensaver-*.png UTILS_SRC = $(srcdir)/../utils UTILS_BIN = ../utils @@ -90,11 +90,40 @@ UTILS_BIN = ../utils INCLUDES_1 = -I. -I$(srcdir) -I$(UTILS_SRC) -I.. INCLUDES = $(INCLUDES_1) @INCLUDES@ -MOTIF_SRCS = demo-Xm.c demo-Xm-widgets.c -MOTIF_OBJS = demo-Xm.o demo-Xm-widgets.o +LIBS_PRE = $(LIBS) $(X_LIBS) $(X_PRE_LIBS) +LIBS_POST = $(X_EXTRA_LIBS) -GTK_SRCS = demo-Gtk.c demo-Gtk-conf.c -GTK_OBJS = demo-Gtk.o demo-Gtk-conf.o @GTK_EXTRA_OBJS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ $(FIXME) +XINPUT_LIBS = -lXi +XML_LIBS = @XML_LIBS@ + +DAEMON_DEFS = -DDEFAULT_PATH_PREFIX='"@HACKDIR@"' -DAD_DIR='"$(AD_DIR)"' +DAEMON_SRCS = xscreensaver.c blurb.c atoms.c clientmsg.c xinput.c prefs.c +DAEMON_OBJS = xscreensaver.o blurb.o atoms.o clientmsg.o xinput.o prefs.o \ + $(UTILS_BIN)/xmu.o +DAEMON_LIBS = $(LIBS_PRE) $(XINPUT_LIBS) -lX11 $(LIBS_POST) + +GFX_DEFS = -DLOCALEDIR=\"$(localedir)\" +GFX_SRCS = xscreensaver-gfx.c screens.c windows.c subprocs.c \ + exec.c prefsw.c dpms.c fade.c exts.c atomswm.c +GFX_OBJS = xscreensaver-gfx.o screens.o windows.o subprocs.o \ + exec.o prefsw.o dpms.o fade.o exts.o atomswm.o \ + prefs.o blurb.o atoms.o clientmsg.o xinput.o \ + $(UTILS_BIN)/xmu.o \ + $(UTILS_BIN)/yarandom.o \ + $(UTILS_BIN)/resources.o \ + $(UTILS_BIN)/visual.o \ + $(UTILS_BIN)/usleep.o \ + $(UTILS_BIN)/font-retry.o \ + $(UTILS_BIN)/logo.o \ + $(UTILS_BIN)/minixpm.o \ + $(UTILS_BIN)/xft.o \ + $(UTILS_BIN)/utf8wc.o \ + $(UTILS_BIN)/xshm.o \ + $(UTILS_BIN)/aligned_malloc.o +GFX_LIBS = $(LIBS_PRE) $(XFT_LIBS) $(XDPMS_LIBS) $(XINERAMA_LIBS) \ + @SAVER_LIBS@ -lXt -lX11 -lXext -lXi $(LIBS_POST) $(INTL_LIBS) PWENT_SRCS = passwd-pwent.c PWENT_OBJS = passwd-pwent.o @@ -108,209 +137,186 @@ PAM_OBJS = passwd-pam.o PWHELPER_SRCS = passwd-helper.c PWHELPER_OBJS = passwd-helper.o -LOCK_SRCS_1 = lock.c passwd.c -LOCK_OBJS_1 = lock.o passwd.o -NOLOCK_SRCS_1 = lock.c -NOLOCK_OBJS_1 = lock.o - -SYSTEMD_SRCS = xscreensaver-systemd.c -SYSTEMD_OBJS = xscreensaver-systemd.o -SYSTEMD_LIBS = -lsystemd - -TEST_SRCS = test-passwd.c test-uid.c test-xdpms.c test-grab.c \ - test-apm.c test-fade.c test-xinerama.c test-vp.c \ - test-randr.c xdpyinfo.c test-mlstring.c test-screens.c \ - test-yarandom.c -TEST_EXES = test-passwd test-uid test-xdpms test-grab \ - test-apm test-fade test-xinerama test-vp \ - test-randr xdpyinfo test-mlstring test-screens \ - test-yarandom - -MOTIF_LIBS = @MOTIF_LIBS@ @PNG_LIBS@ $(XMU_LIBS) -GTK_LIBS = @GTK_LIBS@ $(XMU_LIBS) -XML_LIBS = @XML_LIBS@ - -XDPMS_LIBS = @XDPMS_LIBS@ -XINERAMA_LIBS = @XINERAMA_LIBS@ -XINPUT_LIBS = @XINPUT_LIBS@ - PASSWD_SRCS = @PASSWD_SRCS@ PASSWD_OBJS = @PASSWD_OBJS@ -PASSWD_LIBS = @PASSWD_LIBS@ LOCK_SRCS = @LOCK_SRCS@ LOCK_OBJS = @LOCK_OBJS@ -XMU_SRCS = @XMU_SRCS@ -XMU_OBJS = @XMU_OBJS@ - -GL_SRCS = @SAVER_GL_SRCS@ -GL_OBJS = @SAVER_GL_OBJS@ -GL_LIBS = @SAVER_GL_LIBS@ - -ICON_SRC = $(UTILS_SRC)/images -LOGO = $(ICON_SRC)/logo-50.xpm -GTK_ICONS = $(ICON_SRC)/screensaver-*.png -DEMO_UTIL_SRCS = $(UTILS_SRC)/resources.c $(UTILS_SRC)/usleep.c \ - $(UTILS_SRC)/visual.c $(XMU_SRCS) -DEMO_UTIL_OBJS = $(UTILS_BIN)/resources.o $(UTILS_BIN)/usleep.o \ - $(UTILS_BIN)/visual.o $(XMU_OBJS) - -SAVER_UTIL_SRCS = $(UTILS_SRC)/fade.c $(UTILS_SRC)/overlay.c \ - $(UTILS_SRC)/logo.c $(UTILS_SRC)/yarandom.c \ - $(UTILS_SRC)/minixpm.c $(UTILS_SRC)/font-retry.c \ - $(DEMO_UTIL_SRCS) -SAVER_UTIL_OBJS = $(UTILS_BIN)/fade.o $(UTILS_BIN)/overlay.o \ - $(UTILS_BIN)/logo.o $(UTILS_BIN)/yarandom.o \ - $(UTILS_BIN)/minixpm.o $(UTILS_BIN)/font-retry.o \ - $(DEMO_UTIL_OBJS) - -GETIMG_SRCS_1 = xscreensaver-getimage.c -GETIMG_OBJS_1 = xscreensaver-getimage.o - -GETIMG_SRCS = $(GETIMG_SRCS_1) \ - $(UTILS_BIN)/colorbars.o $(UTILS_BIN)/resources.o \ - $(UTILS_BIN)/yarandom.o $(UTILS_BIN)/visual.o \ - $(UTILS_BIN)/usleep.o $(UTILS_BIN)/hsv.o \ - $(UTILS_BIN)/colors.o $(UTILS_BIN)/grabscreen.o \ - $(UTILS_BIN)/logo.o $(UTILS_BIN)/minixpm.o prefs.o \ - $(XMU_SRCS) - -GETIMG_OBJS = $(GETIMG_OBJS_1) \ - $(UTILS_BIN)/colorbars.o $(UTILS_BIN)/resources.o \ - $(UTILS_BIN)/yarandom.o $(UTILS_BIN)/visual.o \ - $(UTILS_BIN)/usleep.o $(UTILS_BIN)/hsv.o \ - $(UTILS_BIN)/colors.o $(UTILS_BIN)/grabscreen.o \ - $(UTILS_BIN)/logo.o $(UTILS_BIN)/minixpm.o prefs.o \ - $(XMU_OBJS) - -SAVER_SRCS_1 = xscreensaver.c windows.c screens.c timers.c subprocs.c \ - exec.c xset.c splash.c setuid.c stderr.c mlstring.c -SAVER_OBJS_1 = xscreensaver.o windows.o screens.o timers.o subprocs.o \ - exec.o xset.o splash.o setuid.o stderr.o mlstring.o - -SAVER_SRCS = $(SAVER_SRCS_1) prefs.c dpms.c $(LOCK_SRCS) \ - $(SAVER_UTIL_SRCS) $(GL_SRCS) -SAVER_OBJS = $(SAVER_OBJS_1) prefs.o dpms.o $(LOCK_OBJS) \ - $(SAVER_UTIL_OBJS) $(GL_OBJS) +AUTH_DEFS = -DLOCALEDIR=\"$(localedir)\" -DAD_DIR='"$(AD_DIR)"' +AUTH_SRCS = xscreensaver-auth.c dialog.c passwd.c setuid.c +AUTH_OBJS = xscreensaver-auth.o $(AUTH_OBJS_1) +AUTH_OBJS_1 = dialog.o passwd.o setuid.o \ + @PASSWD_OBJS@ \ + blurb.o screens.o xinput.o prefs.o atoms.o atomswm.o \ + $(UTILS_BIN)/xft.o \ + $(UTILS_BIN)/xftwrap.o \ + $(UTILS_BIN)/utf8wc.o \ + $(UTILS_BIN)/font-retry.o \ + $(UTILS_BIN)/yarandom.o \ + $(UTILS_BIN)/usleep.o \ + $(UTILS_BIN)/resources.o \ + $(UTILS_BIN)/logo.o \ + $(UTILS_BIN)/minixpm.o +AUTH_LIBS = $(LIBS_PRE) $(XFT_LIBS) $(XINPUT_LIBS) $(XINERAMA_LIBS) \ + @SAVER_LIBS@ -lXt -lX11 -lXext -lXi \ + @PASSWD_LIBS@ $(LIBS_POST) $(INTL_LIBS) + +SYSTEMD_DEFS = +SYSTEMD_SRCS = xscreensaver-systemd.c +SYSTEMD_OBJS = xscreensaver-systemd.o blurb.o $(UTILS_BIN)/yarandom.o +SYSTEMD_LIBS = $(LIBS_PRE) @SYSTEMD_LIBS@ -lX11 $(LIBS_POST) +CMD_DEFS = CMD_SRCS = remote.c xscreensaver-command.c -CMD_OBJS = remote.o xscreensaver-command.o - -DEMO_SRCS_1 = prefs.c dpms.c -DEMO_OBJS_1 = prefs.o dpms.o - -DEMO_SRCS = $(DEMO_SRCS_1) remote.c exec.c $(DEMO_UTIL_SRCS) -DEMO_OBJS = $(DEMO_OBJS_1) remote.o exec.o $(DEMO_UTIL_OBJS) - -PDF2JPEG_SRCS = pdf2jpeg.m -PDF2JPEG_OBJS = pdf2jpeg.o -PDF2JPEG_LIBS = -framework Cocoa - -SAVER_LIBS = $(LIBS) $(X_LIBS) $(XMU_LIBS) @SAVER_LIBS@ \ - $(XDPMS_LIBS) $(XINERAMA_LIBS) $(GL_LIBS) $(X_PRE_LIBS) \ - -lXt -lX11 -lXext $(X_EXTRA_LIBS) \ - $(PASSWD_LIBS) $(INTL_LIBS) - -CMD_LIBS = $(LIBS) $(X_LIBS) \ - $(X_PRE_LIBS) -lX11 -lXext $(X_EXTRA_LIBS) - -GETIMG_LIBS = $(LIBS) $(X_LIBS) $(PNG_LIBS) $(JPEG_LIBS) \ - $(X_PRE_LIBS) -lXt -lX11 $(XMU_LIBS) -lXext $(X_EXTRA_LIBS) - -EXES = xscreensaver xscreensaver-command xscreensaver-demo \ - xscreensaver-getimage @EXES_OSX@ @EXES_SYSTEMD@ -EXES2 = @ALL_DEMO_PROGRAMS@ -EXES_OSX = pdf2jpeg +CMD_OBJS = remote.o xscreensaver-command.o blurb.o atoms.o clientmsg.o +CMD_LIBS = $(LIBS_PRE) $(XINPUT_LIBS) -lX11 -lXext $(LIBS_POST) + +GTK_DEFS = -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"' \ + -DDEFAULT_PATH_PREFIX='"@HACKDIR@"' \ + -DDEFAULT_ICONDIR='"$(GTK_UIDIR)"' \ + -DLOCALEDIR=\"$(localedir)\" \ + -I$(ICON_SRC) +GTK_SRCS = demo-Gtk.c demo-Gtk-conf.c +GTK_OBJS = demo-Gtk.o demo-Gtk-conf.o \ + blurb.o exec.o prefs.o prefsw.o dpms.o remote.o \ + clientmsg.o atoms.o \ + $(UTILS_BIN)/xmu.o \ + $(UTILS_BIN)/resources.o \ + $(UTILS_BIN)/visual.o \ + $(UTILS_BIN)/usleep.o +GTK_LIBS = $(LIBS_PRE) $(INTL_LIBS) $(XDPMS_LIBS) \ + $(XINERAMA_LIBS) $(XML_LIBS) @GTK_LIBS@ \ + -lXt -lX11 -lXext -lXi $(LIBS_POST) + +MOTIF_DEFS = -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"' \ + -DDEFAULT_PATH_PREFIX='"@HACKDIR@"' +MOTIF_SRCS = demo-Xm.c demo-Xm-widgets.c +MOTIF_OBJS = demo-Xm.o demo-Xm-widgets.o \ + blurb.o exec.o prefs.o prefsw.o dpms.o remote.o \ + clientmsg.o atoms.o \ + $(UTILS_BIN)/xmu.o \ + $(UTILS_BIN)/resources.o \ + $(UTILS_BIN)/visual.o \ + $(UTILS_BIN)/usleep.o +MOTIF_LIBS = $(LIBS_PRE) $(XDPMS_LIBS) $(XDPMS_LIBS) @MOTIF_LIBS@ \ + @PNG_LIBS@ -lXt -lX11 -lXext -lXi $(LIBS_POST) + +TEST_SRCS = test-passwd.c test-uid.c test-xdpms.c test-grab.c \ + test-fade.c test-xinerama.c test-vp.c test-randr.c \ + xdpyinfo.c test-screens.c test-yarandom.c test-xinput.c \ + test-xkb.c +TEST_EXES = test-passwd test-uid test-xdpms test-grab \ + test-fade test-xinerama test-vp test-randr \ + xdpyinfo test-screens test-yarandom test-xinput \ + test-xkb + +EXES = xscreensaver xscreensaver-command xscreensaver-settings +UTIL_EXES = xscreensaver-gfx @EXES_SYSTEMD@ +SETUID_EXES = xscreensaver-auth +DEMO_EXES = @ALL_DEMO_PROGRAMS@ EXES_SYSTEMD = xscreensaver-systemd -SCRIPTS_1 = xscreensaver-getimage-file xscreensaver-getimage-video \ - xscreensaver-text -SCRIPTS_OSX = xscreensaver-getimage-desktop -SCRIPTS = $(SCRIPTS_1) @SCRIPTS_OSX@ - HDRS = XScreenSaver_ad.h XScreenSaver_Xm_ad.h \ xscreensaver.h prefs.h remote.h exec.h \ - demo-Gtk-conf.h auth.h mlstring.h types.h -MEN_1 = xscreensaver.man xscreensaver-demo.man \ - xscreensaver-command.man \ - xscreensaver-text.man \ - xscreensaver-getimage.man \ - xscreensaver-getimage-file.man \ - xscreensaver-getimage-video.man \ - xscreensaver-systemd.man -MEN_OSX = xscreensaver-getimage-desktop.man pdf2jpeg.man -MEN = $(MEN_1) @MEN_OSX@ + demo-Gtk-conf.h auth.h types.h blurb.h atoms.h clientmsg.h \ + screens.h xinput.h fade.h +MENA = xscreensaver.man xscreensaver-settings.man \ + xscreensaver-command.man +MENB = xscreensaver-gfx.man xscreensaver-auth.man \ + xscreensaver-command.man xscreensaver-systemd.man EXTRAS = README Makefile.in \ XScreenSaver.ad.in XScreenSaver-Xm.ad xscreensaver.pam.in \ - xscreensaver-demo.glade2.in xscreensaver-demo.glade2p \ - screensaver-properties.desktop.in \ + xscreensaver.ui screensaver-properties.desktop.in \ .gdbinit -VMSFILES = compile_axp.com compile_decc.com link_axp.com link_decc.com \ - vms-getpwnam.c vms-pwd.h vms-hpwd.c vms-validate.c \ - vms_axp.opt vms_axp_12.opt vms_decc.opt vms_decc_12.opt -TARFILES = $(EXTRAS) $(VMSFILES) $(SAVER_SRCS_1) $(SYSTEMD_SRCS) \ - $(MOTIF_SRCS) $(GTK_SRCS) $(PWENT_SRCS) $(PWHELPER_SRCS) \ - $(KERBEROS_SRCS) $(PAM_SRCS) $(LOCK_SRCS_1) $(DEMO_SRCS_1) \ - $(CMD_SRCS) $(GETIMG_SRCS_1) $(PDF2JPEG_SRCS) $(HDRS) \ - $(SCRIPTS_1) $(SCRIPTS_OSX) $(MEN_1) $(MEN_OSX) \ - $(TEST_SRCS) +TARFILES = $(DAEMON_SRCS) $(GFX_SRCS) $(AUTH_SRCS) $(SYSTEMD_SRCS) \ + $(CMD_SRCS) $(GTK_SRCS) $(MOTIF_SRCS) $(PWENT_SRCS) \ + $(PWHELPER_SRCS) $(KERBEROS_SRCS) $(PAM_SRCS) \ + $(HDRS) $(MENA) $(MENB) $(TEST_SRCS) $(EXTRAS) +default: $(EXES) $(UTIL_EXES) $(SETUID_EXES) +all: $(EXES) $(UTIL_EXES) $(SETUID_EXES) $(DEMO_EXES) +tests: $(TEST_EXES) -default: $(EXES) -all: $(EXES) $(EXES2) -tests: $(TEST_EXES) -install: install-program install-ad install-scripts \ - install-gnome install-man install-xml install-pam -uninstall: uninstall-program uninstall-ad \ - uninstall-gnome uninstall-man uninstall-xml +############################################################################## +# +# Installation +# +############################################################################## -install-strip: - $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ - install +install: install-program install-ad install-man install-xml \ + install-pam install-gnome +uninstall: uninstall-program uninstall-ad uninstall-man uninstall-xml \ + uninstall-gnome -install-program: $(EXES) - @if [ ! -d $(install_prefix)$(bindir) ]; then \ - $(INSTALL_DIRS) $(install_prefix)$(bindir) ; \ +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install + +install-program:: $(EXES) + @if [ ! -d $(install_prefix)$(bindir) ]; then \ + $(INSTALL_DIRS) $(install_prefix)$(bindir) ; \ + fi ; \ + if [ ! -d $(install_prefix)$(HACKDIR) ]; then \ + $(INSTALL_DIRS) $(install_prefix)$(HACKDIR) ; \ fi - @inst="$(INSTALL_PROGRAM)" ; \ - if [ @NEED_SETUID@ = yes ]; then \ - me=`PATH="$$PATH:/usr/ucb" whoami` ; \ - if [ "$$me" = root ]; then \ - inst="$(INSTALL_SETUID)" ; \ - else \ - e=echo ; \ - $$e "" ;\ - $$e " ####################################################################";\ - $$e " Warning: xscreensaver has been compiled with support for shadow" ;\ - $$e " passwords. If your system actually uses shadow passwords," ;\ - $$e " then xscreensaver must be installed as a setuid root" ;\ - $$e " program in order for locking to work. To do this, you" ;\ - $$e " must run 'make install' as 'root', not as '$$me'." ;\ - $$e "" ;\ - $$e " For now, xscreensaver will be installed non-setuid, which" ;\ - $$e " means that locking might not work. (Try it and see.)" ;\ - $$e " ####################################################################";\ - $$e "" ;\ - fi ; \ - fi ; \ - echo $$inst xscreensaver $(install_prefix)$(bindir)/xscreensaver ; \ - $$inst xscreensaver $(install_prefix)$(bindir)/xscreensaver - @for exe in xscreensaver-command xscreensaver-demo \ - xscreensaver-getimage @EXES_OSX@ @EXES_SYSTEMD@ ; do \ - echo $(INSTALL_PROGRAM) $$exe $(install_prefix)$(bindir)/$$exe ; \ - $(INSTALL_PROGRAM) $$exe $(install_prefix)$(bindir)/$$exe ; \ + +install-program:: $(EXES) + @inst="$(INSTALL_PROGRAM)" ; \ + for exe in $(EXES); do \ + echo $$inst $$exe $(install_prefix)$(bindir)/$$exe ; \ + $$inst $$exe $(install_prefix)$(bindir)/$$exe ; \ + done + +install-program:: $(UTIL_EXES) + @inst="$(INSTALL_PROGRAM)" ; \ + for exe in $(UTIL_EXES); do \ + echo $$inst $$exe $(install_prefix)$(HACKDIR)/$$exe ; \ + $$inst $$exe $(install_prefix)$(HACKDIR)/$$exe ; \ done +install-program:: $(SETUID_EXES) + @inst="$(INSTALL_PROGRAM)" ; \ + idir="$(install_prefix)$(HACKDIR)" ; \ + if [ @SETUID_AUTH@ = yes ]; then \ + inst="$(INSTALL_SETUID)" ; \ + else \ + inst="$(INSTALL_PROGRAM)" ; \ + fi ; \ + for exe in $(SETUID_EXES); do \ + echo $$inst $$exe $$idir/$$exe ; \ + if $$inst $$exe $$idir/$$exe ; then \ + true ; \ + elif [ @SETUID_AUTH@ = yes ]; then \ + echo $(INSTALL_PROGRAM) $$exe $$idir/$$exe ; \ + if $(INSTALL_PROGRAM) $$exe $$idir/$$exe ; then \ + echo "" ; \ + echo "WARNING: unable to install $$exe setuid." ; \ + echo "WARNING: authentication may not work!" ; \ + echo "" ; \ + else \ + exit 1 ; \ + fi ; \ + else \ + exit 1 ; \ + fi ; \ + done + + +# Symlink from xscreensaver-demo -> xscreensaver-settings in /usr/bin/ +install-program:: + @D=$(install_prefix)$(bindir) ; \ + echo ln -sf xscreensaver-settings $$D/xscreensaver-demo ; \ + ln -sf xscreensaver-settings $$D/xscreensaver-demo + install-ad: XScreenSaver.ad @if [ ! -d $(install_prefix)$(AD_DIR) ]; then \ $(INSTALL_DIRS) $(install_prefix)$(AD_DIR) ; \ - fi - @-echo $(INSTALL_DATA) XScreenSaver.ad \ + fi ; \ + echo $(INSTALL_DATA) XScreenSaver.ad \ $(install_prefix)$(AD_DIR)/XScreenSaver ; \ if $(INSTALL_DATA) XScreenSaver.ad \ $(install_prefix)$(AD_DIR)/XScreenSaver ; then \ @@ -331,101 +337,106 @@ install-ad: XScreenSaver.ad $$e "" ;\ $$e " ####################################################################";\ $$e " Warning: unable to install $(install_prefix)$(AD_DIR)/XScreenSaver" ;\ - $$e " The directory is unwritable. This is probably ok;" ;\ - $$e " xscreensaver should work without that file." ;\ + $$e " This is probably ok; it should work without that file." ;\ $$e " ####################################################################";\ $$e "" ;\ exit 0 ; \ fi \ fi -install-scripts: $(SCRIPTS) munge-scripts - @for program in $(SCRIPTS); do \ - if [ -r $$program ] ; then \ - p=$$program ; \ - else \ - p=$(srcdir)/$$program ; \ - fi ; \ - echo $(INSTALL_SCRIPT) $$p \ - $(install_prefix)$(bindir)/$$program ; \ - $(INSTALL_SCRIPT) $$p \ - $(install_prefix)$(bindir)/$$program ; \ - done - -munge-scripts: $(SCRIPTS) - @tmp=/tmp/mf.$$$$ ; \ - perl="${PERL}" ; \ - rm -f $$tmp ; \ - for program in $(SCRIPTS); do \ - sed "s@^\(#!\)\(/[^ ]*/perl[^ ]*\)\(.*\)\$$@\1$$perl\3@" \ - < $(srcdir)/$$program > $$tmp ; \ - if cmp -s $(srcdir)/$$program $$tmp ; then \ - true ; \ - else \ - echo "$$program: setting interpreter to $$perl" >&2 ; \ - cat $$tmp > ./$$program ; \ - fi ; \ - done ; \ - rm -f $$tmp - # When installing man pages, we install "foo.man" as "foo.N" and update # the .TH line in the installed file with one like # # .TH XScreenSaver N "V.VV (DD-MMM-YYYY)" "X Version 11" # -# where N is the manual section suffix. +# where N is the manual section suffix (usually 1 or 6, depending). # -install-man: $(MEN) - @men="$(MEN)" ; \ +install-man:: $(MENA) $(MENB) + @ \ U=$(UTILS_SRC)/version.h ; \ - V=`sed -n 's/.*xscreensaver \([0-9]\.[^)]*)\).*/\1/p' < $$U` ; \ - T=/tmp/xs$$$$.$(mansuffix) ; \ - TH=".TH XScreenSaver $(mansuffix) \"$$V\" \"X Version 11\"" ; \ - echo "installing man pages: $$TH" ; \ + V=`sed -n 's/.*xscreensaver \([0-9]\.[^)]*)\).*/\1/p' < $$U | \ + head -1` ; \ + T=/tmp/xs$$$$.man ; \ + SUFA=$(mansuffixA) ; \ + SUFB=$(mansuffixB) ; \ \ - if [ ! -d $(install_prefix)$(manNdir) ]; then \ - $(INSTALL_DIRS) $(install_prefix)$(manNdir) ; \ - fi ; \ + INST() { \ + TH=".TH XScreenSaver $$SUF \"$$V\" \"X Version 11\"" ; \ + DIR="$(install_prefix)$(mandir)/man$$SUF" ; \ + if [ ! -d $$DIR ]; then \ + echo $(INSTALL_DIRS) $$DIR ; \ + $(INSTALL_DIRS) $$DIR ; \ + fi ; \ \ - for man in $$men; do \ - instname=`echo $$man | sed 's/\.man$$/\.$(mansuffix)/'` ; \ - manbase=`echo $$man | sed 's/\.man$$//'` ; \ - TH=".TH $$manbase $(mansuffix) \"$$V\" \"X Version 11\" \"XScreenSaver manual\"" ; \ sed -e "s/^\.TH.*/$$TH/" \ - -e 's/^\(\.BR xscr.*(\)[^()]\(.*\)/\1$(mansuffix)\2/' \ - -e 's@(MANSUFFIX)@($(mansuffix))@g' \ + -e "s/^\(\.BR xscreens[^ ]* (\)[0-9]\(.*\)/\1$$SUFA\2/" \ + -e "s@(MANSUFFIX)@($$SUFB)@g" \ < $(srcdir)/$$man > $$T ; \ - echo $(INSTALL_DATA) $(srcdir)/$$man \ - $(install_prefix)$(manNdir)/$$instname ; \ - $(INSTALL_DATA) $$T \ - $(install_prefix)$(manNdir)/$$instname ; \ - done ; \ + manbase=`echo $$man | sed 's/\.man$$//'` ; \ + echo $(INSTALL_DATA) $$man $$DIR/$$manbase.$$SUF ; \ + $(INSTALL_DATA) $$T $$DIR/$$manbase.$$SUF ; \ + } ; \ + \ + SUF=$$SUFA ; for man in $(MENA); do INST ; done ; \ + SUF=$$SUFB ; for man in $(MENB); do INST ; done ; \ rm -f $$T -uninstall-program: - @for program in $(EXES) $(SCRIPTS); do \ +# Symlink from xscreensaver-demo.1 -> xscreensaver-settings.1 in /usr/man/man1/ +install-man:: + @D=$(install_prefix)$(mandir)/man$(mansuffixA) ; \ + F1=xscreensaver-settings.$(mansuffixA) ; \ + F2=xscreensaver-demo.$(mansuffixA) ; \ + echo ln -sf $$F1 $$D/$$F2 ; \ + ln -sf $$F1 $$D/$$F2 + +# These used to be in driver/ and installed into $(bindir) +# Now they are in hacks/ and are installed into ${libexecdir}/xscreensaver/ +OLD_EXES = xscreensaver-getimage xscreensaver-getimage-file \ + xscreensaver-getimage-video xscreensaver-text \ + xscreensaver-systemd +OLD_MEN = xscreensaver-getimage.man xscreensaver-getimage-file.man \ + xscreensaver-getimage-video.man xscreensaver-text.man \ + xscreensaver-demo.man +uninstall-program:: + @for program in $(EXES) $(OLD_EXES); do \ echo rm -f $(install_prefix)$(bindir)/$$program ; \ rm -f $(install_prefix)$(bindir)/$$program ; \ done +uninstall-program:: + @for program in $(UTIL_EXES) $(SETUID_EXES); do \ + echo rm -f $(install_prefix)$(HACKDIR)/$$program ; \ + rm -f $(install_prefix)$(HACKDIR)/$$program ; \ + done + uninstall-ad: rm -f $(install_prefix)$(AD_DIR)/XScreenSaver uninstall-man: - @men="$(MEN)" ; \ + @men="$(MEN) $(OLD_MEN)" ; \ for man in $$men; do \ instname=`echo $$man | sed 's/\.man$$/\.$(mansuffix)/'` ; \ - echo rm -f $(install_prefix)$(manNdir)/$$instname* ; \ - rm -f $(install_prefix)$(manNdir)/$$instname* ; \ + echo rm -f $(install_prefix)$(manAdir)/$$instname* ; \ + rm -f $(install_prefix)$(manAdir)/$$instname* ; \ done install-pam: xscreensaver.pam - @src="xscreensaver.pam" ; \ - dest=`sed -n 's/.*PAM_SERVICE_NAME[ ]*"\([^"]*\)".*$$/\1/p' \ + @src="xscreensaver.pam" ; \ + name=`sed -n 's/.*PAM_SERVICE_NAME[ ]*"\([^"]*\)".*$$/\1/p' \ < ../config.h` ; \ dir="$(install_prefix)$(PAM_DIR)" ; \ conf="$(PAM_CONF)" ; \ \ + if [ -z "$$name" ]; then \ + echo "PAM not configured, not installing" >&2 ; \ + exit 0 ; \ + fi ; \ + \ + if [ ! -d $(install_prefix)$(PAM_ROOT) ]; then \ + echo $(INSTALL_DIRS) $(install_prefix)$(PAM_ROOT) ; \ + $(INSTALL_DIRS) $(install_prefix)$(PAM_ROOT) ; \ + fi ; \ + \ if [ -d $$dir ] ; then \ \ if [ -f $$dir/xdm ]; then \ @@ -435,52 +446,50 @@ install-pam: xscreensaver.pam fi ; \ \ if [ -z "$$src2" ]; then \ - echo $(INSTALL_DATA) $$src $$dir/$$dest ; \ - $(INSTALL_DATA) $$src $$dir/$$dest ; \ + echo $(INSTALL_DATA) $$src $$dir/$$name ; \ + $(INSTALL_DATA) $$src $$dir/$$name ; \ else \ - src="xscreensaver.pam.$$$$" ; \ - echo "grep '^#%\|^auth\|^@include' $$src2 > $$src" ; \ - grep '^#%\|^auth\|^@include' $$src2 > $$src ; \ - echo $(INSTALL_DATA) $$src $$dir/$$dest ; \ - $(INSTALL_DATA) $$src $$dir/$$dest ; \ - echo rm -f $$src ; \ - rm -f $$src ; \ + tmp="xscreensaver.pam.$$$$" ; \ + grep '^#%\|^auth\|^@include' $$src2 > $$tmp ; \ + if cmp -s $$tmp $$dir/$$name ; then \ + echo "$$dir/$$name unchanged" ; \ + else \ + echo "Updating contents of $$dir/$$name from $$src2" ; \ + $(INSTALL_DATA) $$tmp $$dir/$$name ; \ + fi ; \ + rm -f $$tmp ; \ fi ; \ \ - if [ ! -f $$dir/$$dest ]; then \ + if [ ! -f $$dir/$$name ]; then \ e=echo ; \ $$e "" ;\ $$e " ####################################################################";\ $$e " Warning: xscreensaver has been compiled with support for Pluggable" ;\ $$e " Authentication Modules (PAM). However, we were unable to" ;\ - $$e " install the file $$dir/$$dest. PAM is unlikely" ;\ - $$e " to work without this file (and old-style password" ;\ - $$e " authentication will be used instead, which may or may not" ;\ - $$e " work.)" ;\ + $$e " install the file \"$$dir/$$name\". XScreenSaver is" ;\ + $$e " unlikely to work without this file." ;\ $$e " ####################################################################";\ $$e "" ;\ fi ; \ - elif [ -f $$conf -a "x$$dest" != "x" ]; then \ - if ( grep $$dest $$conf >/dev/null ); then \ - echo "$$conf unchanged: already has an entry for $$dest" ; \ + elif [ -f $$conf -a "x$$name" != "x" ]; then \ + if ( grep $$name $$conf >/dev/null ); then \ + echo "$$conf unchanged: already has an entry for $$name" ; \ else \ - src="pam.conf.$$$$" ; \ - echo "grep -v $$dest $$conf > $$src" ; \ - grep -v $$dest $$conf > $$src ; \ - extras=`sed -n "s/^login\(.*auth.*\)$$/$$dest\1/p" $$conf`; \ - echo "$$extras" >> $$src ; \ + tmp="pam.conf.$$$$" ; \ + grep -v $$name $$conf > $$tmp ; \ + extras=`sed -n "s/^login\(.*auth.*\)$$/$$name\1/p" $$conf`; \ + echo "$$extras" >> $$tmp ; \ if [ "x$$extras" = "x" ]; then \ echo "Error: no login rules in $$conf?" >&2 ; \ else \ - echo "adding $$dest rules to $$src:" ; \ + echo "adding $$name rules to $$conf:" ; \ + echo "" ; \ echo "$$extras" | sed 's/^/ /' ; \ fi ; \ - echo $(INSTALL_DATA) $$src $$conf ; \ - $(INSTALL_DATA) $$src $$conf ; \ - echo rm -f $$src ; \ - rm -f $$src ; \ + $(INSTALL_DATA) $$tmp $$conf ; \ + rm -f $$tmp ; \ fi ; \ - if ( grep $$dest $$conf >/dev/null ); then \ + if ( grep $$name $$conf >/dev/null ); then \ echo ; \ else \ e=echo ; \ @@ -489,12 +498,17 @@ install-pam: xscreensaver.pam $$e " Warning: xscreensaver has been compiled with support for Pluggable" ;\ $$e " Authentication Modules (PAM). However, we were unable to" ;\ $$e " install xscreensaver rules in the file $$conf." ;\ - $$e " PAM is unlikely to work without this (and old-style" ;\ - $$e " password authentication will be used instead, which may" ;\ - $$e " or may not work.)" ;\ + $$e " XScreenSaver is unlikely to work without this." ;\ $$e " ####################################################################";\ $$e "" ;\ fi ; \ + else \ + e=echo ; \ + $$e "" ;\ + $$e " ####################################################################";\ + $$e " Warning: $$dir/ does not exist, not installing PAM config." ;\ + $$e " ####################################################################";\ + $$e "" ;\ fi # screensaver-properties.desktop @@ -529,43 +543,43 @@ install-gnome:: $(LOGO) fi # ../utils/images/screensaver-*.png -# into /usr/share/xscreensaver/glade/ +# into /usr/share/xscreensaver/ui/ install-gnome:: - @if [ "$(GTK_DATADIR)" != "" ]; then \ - if [ ! -d "$(install_prefix)$(GTK_GLADEDIR)" ]; then \ - echo $(INSTALL_DIRS) "$(install_prefix)$(GTK_GLADEDIR)" ;\ - $(INSTALL_DIRS) "$(install_prefix)$(GTK_GLADEDIR)" ;\ + @if [ "$(GTK_DATADIR)" != "" ]; then \ + if [ ! -d "$(install_prefix)$(GTK_UIDIR)" ]; then \ + echo $(INSTALL_DIRS) "$(install_prefix)$(GTK_UIDIR)" ;\ + $(INSTALL_DIRS) "$(install_prefix)$(GTK_UIDIR)" ;\ fi ;\ for target in $(GTK_ICONS) ; do \ dest=`echo $$target | sed 's@^.*/@@'` ;\ echo $(INSTALL_DATA) $$target \ - $(install_prefix)$(GTK_GLADEDIR)/$$dest ;\ + $(install_prefix)$(GTK_UIDIR)/$$dest ;\ $(INSTALL_DATA) $$target \ - $(install_prefix)$(GTK_GLADEDIR)/$$dest ;\ + $(install_prefix)$(GTK_UIDIR)/$$dest ;\ done ;\ fi -# xscreensaver-demo.glade2 -# into /usr/share/xscreensaver/glade/ -install-gnome:: xscreensaver-demo.glade2 +# xscreensaver.ui +# into /usr/share/xscreensaver/ui/ +install-gnome:: xscreensaver.ui @if [ "$(GTK_DATADIR)" != "" ]; then \ - if [ ! -d "$(install_prefix)$(GTK_GLADEDIR)" ]; then \ - echo $(INSTALL_DIRS) "$(install_prefix)$(GTK_GLADEDIR)" ;\ - $(INSTALL_DIRS) "$(install_prefix)$(GTK_GLADEDIR)" ;\ + if [ ! -d "$(install_prefix)$(GTK_UIDIR)" ]; then \ + echo $(INSTALL_DIRS) "$(install_prefix)$(GTK_UIDIR)" ;\ + $(INSTALL_DIRS) "$(install_prefix)$(GTK_UIDIR)" ;\ fi ;\ - target=xscreensaver-demo.glade2 ;\ - echo $(INSTALL_DATA) $$target \ - $(install_prefix)$(GTK_GLADEDIR)/$$target ;\ - if $(INSTALL_DATA) $$target \ - $(install_prefix)$(GTK_GLADEDIR)/$$target ;\ + target=xscreensaver.ui ;\ + echo $(INSTALL_DATA) $(srcdir)/$$target \ + $(install_prefix)$(GTK_UIDIR)/$$target ;\ + if $(INSTALL_DATA) $(srcdir)/$$target \ + $(install_prefix)$(GTK_UIDIR)/$$target ;\ then true ;\ else \ e=echo ; \ $$e "" ;\ $$e " ####################################################################";\ $$e " Warning: unable to install $$target into" ;\ - $$e " $(install_prefix)$(GTK_GLADEDIR)/." ;\ - $$e " Without this file, xscreensaver-demo will not" ;\ + $$e " $(install_prefix)$(GTK_UIDIR)/." ;\ + $$e " Without this file, xscreensaver-settings will not" ;\ $$e " be able to run properly." ;\ $$e " ####################################################################";\ $$e "" ;\ @@ -593,25 +607,34 @@ uninstall-gnome:: fi # ../utils/images/screensaver-*.png -# into /usr/share/xscreensaver/glade/ +# into /usr/share/xscreensaver/ui/ uninstall-gnome:: @if [ "$(GTK_DATADIR)" != "" ]; then \ for target in $(GTK_ICONS) ; do \ dest=`echo $$target | sed 's@^.*/@@'` ;\ - echo rm -f $(install_prefix)$(GTK_GLADEDIR)/$$dest ;\ - rm -f $(install_prefix)$(GTK_GLADEDIR)/$$dest ;\ + echo rm -f $(install_prefix)$(GTK_UIDIR)/$$dest ;\ + rm -f $(install_prefix)$(GTK_UIDIR)/$$dest ;\ done ;\ fi -# xscreensaver-demo.glade2 -# into /usr/share/xscreensaver/glade/ -uninstall-gnome:: xscreensaver-demo.glade2 +# xscreensaver.ui +# into /usr/share/xscreensaver/ui/ +uninstall-gnome:: @if [ "$(GTK_DATADIR)" != "" ]; then \ - target=xscreensaver-demo.glade2 ;\ - echo rm -f $(install_prefix)$(GTK_GLADEDIR)/$$target ;\ - rm -f $(install_prefix)$(GTK_GLADEDIR)/$$target ;\ + for target in xscreensaver.ui xscreensaver-demo.ui ; do \ + echo rm -f $(install_prefix)$(GTK_UIDIR)/$$target ;\ + rm -f $(install_prefix)$(GTK_UIDIR)/$$target ;\ + done ;\ + rmdir "$(GTK_UIDIR)" ;\ + rmdir "$(GTK_DATADIR)/xscreensaver" ;\ + exit 0 ;\ fi +# /usr/share/xscreensaver/glade/ no longer used +uninstall-gnome:: + -rm -rf $(GTK_DATADIR)/xscreensaver/glade + + # /usr/share/xscreensaver/config/README install-xml: @dest=$(install_prefix)$(HACK_CONF_DIR) ; \ @@ -627,14 +650,24 @@ install-xml: uninstall-xml: rm -f $(install_prefix)$(HACK_CONF_DIR)/README + +############################################################################## +# +# Clean and dependencies +# +############################################################################## + clean: - -rm -f *.o a.out core $(EXES) $(EXES2) $(TEST_EXES) \ + -rm -f *.o a.out core $(EXES) $(UTIL_EXES) $(SETUID_EXES) \ + $(DEMO_EXES) $(TEST_EXES) \ XScreenSaver_ad.h XScreenSaver_Xm_ad.h distclean: clean - -rm -f Makefile XScreenSaver.ad \ - TAGS *~ "#"* screensaver-properties.desktop \ - xscreensaver-demo.glade2 \ + -rm -f \ + TAGS *~ "#"* *.rej *.orig \ + Makefile \ + XScreenSaver.ad \ + screensaver-properties.desktop \ xscreensaver.pam # Adds all current dependencies to Makefile @@ -642,7 +675,7 @@ depend: XScreenSaver_ad.h XScreenSaver_Xm_ad.h $(DEPEND) -s '# DO NOT DELETE: updated by make depend' \ $(DEPEND_FLAGS) -- \ $(INCLUDES_1) $(DEFS) $(DEPEND_DEFINES) $(CFLAGS) $(X_CFLAGS) -- \ - $(SAVER_SRCS) $(CMD_SRCS) $(GETIMG_SRCS_1) + $(SAVER_SRCS) $(CMD_SRCS) # Adds some dependencies to Makefile.in -- not totally accurate, but pretty # close. This excludes dependencies on files in /usr/include, etc. It tries @@ -655,8 +688,8 @@ distdepend: check_men update_ad_version XScreenSaver_ad.h XScreenSaver_Xm_ad.h $(INCLUDES_1) $(DEFS) $(DEPEND_DEFINES) $(CFLAGS) $(X_CFLAGS) -- \ $(SAVER_SRCS_1) $(SYSTEMD_SRCS) $(MOTIF_SRCS) $(GTK_SRCS) \ $(PWENT_SRCS) $(PWHELPER_SRCS) $(KERBEROS_SRCS) $(PAM_SRCS) \ - $(LOCK_SRCS_1) $(DEMO_SRCS_1) $(CMD_SRCS) $(GETIMG_SRCS_1) \ - $(PDF2JPEG_SRCS) $(TEST_SRCS) 2>/dev/null | \ + $(LOCK_SRCS_1) $(DEMO_SRCS_1) $(CMD_SRCS) \ + $(TEST_SRCS) 2>/dev/null | \ sort -d | \ ( \ awk '/^# .*Makefile.in ---/,/^# DO .*distdepend/' < Makefile.in ; \ @@ -679,12 +712,12 @@ update_ad_version:: @ \ files="XScreenSaver.ad.in ../hacks/config/README ../OSX/bindist.rtf" ; \ U=$(UTILS_SRC)/version.h ; \ - V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' < $$U` ; \ + V=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^ ]*\).*/\1/p' < $$U | head -1` ; \ Y=`date '+%Y'` ; \ D=`date '+%d-%b-%Y'` ; \ for S in $$files ; do \ T=/tmp/xs.$$$$ ; \ - sed -e "s/\(.*version \)[0-9][0-9]*\.[0-9]*[ab]*[0-9]*\(.*\)/\1$$V\2/" \ + sed -e "s/\(.*version \)[0-9][0-9]*\.[0-9.]*[ab]*[0-9]*\(.*\)/\1$$V\2/" \ -e "s/\([0-9][0-9]-[A-Z][a-z][a-z]-[0-9][0-9][0-9]*\)/$$D/" \ -e "s/\( [0-9][0-9][0-9][0-9]-\)[0-9][0-9][0-9][0-9] /\1$$Y /" \ < $$S > $$T ; \ @@ -701,9 +734,9 @@ TAGS: tags tags: find $(srcdir) -name '*.[chly]' -print | xargs etags -a -echo_tarfiles: +list_tarfiles: @$(MAKE) XScreenSaver_ad.h XScreenSaver_Xm_ad.h 2>&1 >/dev/null - @echo $(TARFILES) + @find $(TARFILES) -type f -print | sort check_men: @badmen="" ; \ @@ -723,11 +756,12 @@ check_men: fi -# Rules for noticing when the objects from the utils directory are out of -# date with respect to their sources, and going and building them according -# to the rules in their own Makefile... +############################################################################## +# +# Dependencies on utils/ # -$(UTILS_BIN)/fade.o: $(UTILS_SRC)/fade.c +############################################################################## + $(UTILS_BIN)/overlay.o: $(UTILS_SRC)/overlay.c $(UTILS_BIN)/resources.o: $(UTILS_SRC)/resources.c $(UTILS_BIN)/usleep.o: $(UTILS_SRC)/usleep.c @@ -740,157 +774,219 @@ $(UTILS_BIN)/colorbars.o: $(UTILS_SRC)/colorbars.c $(UTILS_BIN)/hsv.o: $(UTILS_SRC)/hsv.c $(UTILS_BIN)/colors.o: $(UTILS_SRC)/colors.c $(UTILS_BIN)/grabscreen.o: $(UTILS_SRC)/grabscreen.c +$(UTILS_BIN)/utf8wc.o: $(UTILS_SRC)/utf8wc.c +$(UTILS_BIN)/xftwrap.o: $(UTILS_SRC)/xftwrap.c $(UTILS_BIN)/font-retry.o: $(UTILS_SRC)/font-retry.c - -UTIL_OBJS = $(SAVER_UTIL_OBJS) $(UTILS_BIN)/colorbars.o \ - $(UTILS_BIN)/hsv.o $(UTILS_BIN)/colors.o \ - $(UTILS_BIN)/grabscreen.o +$(UTILS_BIN)/xshm.o: $(UTILS_SRC)/xshm.c +$(UTILS_BIN)/aligned_malloc.o: $(UTILS_SRC)/aligned_malloc.c + + +UTIL_OBJS = $(UTILS_BIN)/overlay.o \ + $(UTILS_BIN)/resources.o \ + $(UTILS_BIN)/usleep.o \ + $(UTILS_BIN)/visual.o \ + $(UTILS_BIN)/xmu.o \ + $(UTILS_BIN)/logo.o \ + $(UTILS_BIN)/minixpm.o \ + $(UTILS_BIN)/yarandom.o \ + $(UTILS_BIN)/colorbars.o \ + $(UTILS_BIN)/hsv.o \ + $(UTILS_BIN)/colors.o \ + $(UTILS_BIN)/grabscreen.o \ + $(UTILS_BIN)/xft.o \ + $(UTILS_BIN)/xftwrap.o \ + $(UTILS_BIN)/utf8wc.o \ + $(UTILS_BIN)/font-retry.o \ + $(UTILS_BIN)/xshm.o \ + $(UTILS_BIN)/aligned_malloc.o $(UTIL_OBJS): cd $(UTILS_BIN) ; \ $(MAKE) $(@F) CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" + +############################################################################## +# +# Compiling the daemon: xscreensaver, xscreensaver-gfx, xscreensaver-auth, +# xscreensaver-systemd and xscreensaver-comand. +# +############################################################################## + # How we build object files in this directory. +CC_ALL=$(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) .c.o: - $(CC) -c $(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) $< - -.m.o: - $(OBJCC) -c $(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) $< + $(CC) -c $(CC_ALL) $< -# subprocs takes an extra -D option. -subprocs.o: subprocs.c - $(CC) -c $(INCLUDES) $(SUBP_DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) \ - $(srcdir)/subprocs.c +# # subprocs takes an extra -D option. +# subprocs.o: subprocs.c +# $(CC) -c $(CC_ALL) $(SUBP_DEFS) $< # xscreensaver takes an extra -D option. xscreensaver.o: xscreensaver.c - $(CC) -c $(INCLUDES) $(DEFS) $(INTL_DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) \ - $(srcdir)/xscreensaver.c + $(CC) -c $(CC_ALL) $(DAEMON_DEFS) $< -# demo-Gtk takes extra -D options, and an extra -I option. -demo-Gtk.o: demo-Gtk.c - $(CC) -c $(INCLUDES) $(SUBP_DEFS) -I$(ICON_SRC) \ - $(GTK_DEFS) $(INTL_DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) \ - $(srcdir)/demo-Gtk.c +xscreensaver-auth.o: XScreenSaver_ad.h +xscreensaver-auth.o: xscreensaver-auth.c + $(CC) -c $(CC_ALL) $(AUTH_DEFS) $< -# demo-Gtk-conf takes an extra -D option. -demo-Gtk-conf.o: demo-Gtk-conf.c - $(CC) -c $(INCLUDES) $(CONF_DEFS) $(GTK_DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) \ - $(srcdir)/demo-Gtk-conf.c +xscreensaver: $(DAEMON_OBJS) + $(CC) $(LDFLAGS) -o $@ $(DAEMON_OBJS) $(DAEMON_LIBS) +xscreensaver-gfx.o: XScreenSaver_ad.h +xscreensaver-gfx.o: xscreensaver-gfx.c + $(CC) -c $(CC_ALL) $(GFX_DEFS) $< +xscreensaver-gfx: $(GFX_OBJS) + $(CC) $(LDFLAGS) -o $@ $(GFX_OBJS) $(GFX_LIBS) -# How we build the default app-defaults file into the program. -# -XScreenSaver_ad.h: XScreenSaver.ad - $(SHELL) $(UTILS_SRC)/ad2c XScreenSaver.ad > XScreenSaver_ad.h +dialog.o: dialog.c + $(CC) -c $(CC_ALL) $(AUTH_DEFS) $< +xscreensaver-auth: $(AUTH_OBJS) + $(CC) $(LDFLAGS) -o $@ $(AUTH_OBJS) $(AUTH_LIBS) -XScreenSaver_Xm_ad.h: XScreenSaver-Xm.ad - $(SHELL) $(UTILS_SRC)/ad2c XScreenSaver-Xm.ad > XScreenSaver_Xm_ad.h +xscreensaver-systemd: $(SYSTEMD_OBJS) + $(CC) $(LDFLAGS) -o $@ $(SYSTEMD_OBJS) $(SYSTEMD_LIBS) -lm + +xscreensaver-command: $(CMD_OBJS) + $(CC) $(LDFLAGS) -o $@ $(CMD_OBJS) $(CMD_LIBS) -@INTLTOOL_DESKTOP_RULE@ -# The executables linked in this directory. +############################################################################## +# +# Compiling the GUI, xscreensaver-settings # -xscreensaver: $(SAVER_OBJS) - $(CC) $(LDFLAGS) -o $@ $(SAVER_OBJS) $(SAVER_LIBS) $(INTL_LIBS) +############################################################################## -xscreensaver-command: $(CMD_OBJS) - $(CC) $(LDFLAGS) -o $@ $(CMD_OBJS) $(CMD_LIBS) +demo-Gtk.o: XScreenSaver_ad.h +demo-Gtk.o: demo-Gtk.c + $(CC) -c $(CC_ALL) $(GTK_DEFS) $< +demo-Gtk-conf.o: demo-Gtk-conf.c + $(CC) -c $(CC_ALL) $(GTK_DEFS) $< + +xscreensaver-settings-Gtk: $(GTK_OBJS) + $(CC) $(LDFLAGS) -o $@ $(GTK_OBJS) $(GTK_LIBS) -xscreensaver-demo: @PREFERRED_DEMO_PROGRAM@ +demo-Xm.o: XScreenSaver_ad.h +demo-Xm.o: demo-Xm.c + $(CC) -c $(CC_ALL) $(GTK_DEFS) $< +demo-Xm-widgets.o: demo-Xm-widgets.c + $(CC) -c $(CC_ALL) $(GTK_DEFS) $< + +xscreensaver-settings-Xm: $(MOTIF_OBJS) + $(CC) $(LDFLAGS) -o $@ $(MOTIF_OBJS) $(MOTIF_LIBS) + +xscreensaver-settings: @PREFERRED_DEMO_PROGRAM@ @if [ "@PREFERRED_DEMO_PROGRAM@" = "" ]; then \ echo "WARNING: neither GTK nor Motif are available," \ - "therefore no xscreensaver-demo!" ; \ + "therefore no xscreensaver-settings!" ; \ rm -f $@@EXEEXT@ ; \ else \ echo cp -p @PREFERRED_DEMO_PROGRAM@@EXEEXT@ $@@EXEEXT@ ; \ cp -p @PREFERRED_DEMO_PROGRAM@@EXEEXT@ $@@EXEEXT@ ; \ fi -xscreensaver-demo-Xm: $(DEMO_OBJS) $(MOTIF_OBJS) - $(CC) $(LDFLAGS) -o $@ $(DEMO_OBJS) $(MOTIF_OBJS) $(LIBS) $(X_LIBS) \ - $(MOTIF_LIBS) $(INTL_LIBS) $(X_PRE_LIBS) -lXt -lX11 \ - $(XDPMS_LIBS) $(XINERAMA_LIBS) -lXext $(X_EXTRA_LIBS) -xscreensaver-demo-Gtk: $(DEMO_OBJS) $(GTK_OBJS) - $(CC) $(LDFLAGS) -o $@ $(DEMO_OBJS) $(GTK_OBJS) $(LIBS) $(X_LIBS) \ - $(GTK_LIBS) $(XML_LIBS) $(INTL_LIBS) $(X_PRE_LIBS) \ - -lXt -lX11 $(XDPMS_LIBS) $(XINERAMA_LIBS) -lXext $(X_EXTRA_LIBS) +# How we build the default app-defaults file into the program. +# +XScreenSaver_ad.h:: + @TMP=/tmp/xs$$$$.h ; \ + IN="XScreenSaver.ad" ; \ + OUT=XScreenSaver_ad.h ; \ + $(UTILS_SRC)/ad2c $$IN > $$TMP ; \ + if cmp -s $$TMP $$OUT ; then \ + rm -f "$$TMP" ; \ + else \ + echo $(UTILS_SRC)/ad2c $$IN \> $$OUT ; \ + mv $$TMP $$OUT ; \ + fi -demo-Gtk.o: XScreenSaver_ad.h -demo-Xm.o: XScreenSaver_Xm_ad.h -xscreensaver.o: XScreenSaver_ad.h -xscreensaver-getimage.o: XScreenSaver_ad.h +XScreenSaver_Xm_ad.h:: + @TMP=/tmp/xs$$$$.h ; \ + IN="XScreenSaver-Xm.ad" ; \ + OUT=XScreenSaver_Xm_ad.h ; \ + $(UTILS_SRC)/ad2c $$IN > $$TMP ; \ + if cmp -s $$TMP $$OUT ; then \ + rm -f "$$TMP" ; \ + else \ + echo $(UTILS_SRC)/ad2c $$IN \> $$OUT ; \ + mv $$TMP $$OUT ; \ + fi -xscreensaver-getimage: $(GETIMG_OBJS) - $(CC) $(LDFLAGS) -o $@ $(GETIMG_OBJS) $(GETIMG_LIBS) -lm -pdf2jpeg: $(PDF2JPEG_OBJS) - $(OBJCC) $(LDFLAGS) -o $@ $(PDF2JPEG_OBJS) $(PDF2JPEG_LIBS) -lm +# Replace this with @INTLTOOL_DESKTOP_RULE@ once +# https://bugs.launchpad.net/intltool/+bug/1749904 is fixed. +.desktop.in.desktop: $(INTLTOOL_MERGE) $(top_srcdir)/po/*.po + $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) \ + $(INTLTOOL_V_MERGE_OPTIONS) -d -u \ + -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ -xscreensaver-systemd: $(SYSTEMD_OBJS) - $(CC) $(LDFLAGS) -o $@ $(SYSTEMD_OBJS) $(SYSTEMD_LIBS) -lm -TEST_PASSWD_OBJS = test-passwd.o $(LOCK_OBJS_1) $(PASSWD_OBJS) \ - subprocs.o setuid.o splash.o prefs.o mlstring.o exec.o \ - $(SAVER_UTIL_OBJS) -test-passwd.o: XScreenSaver_ad.h +############################################################################## +# +# Debugging utilities, not built by default +# +############################################################################## -test-passwd: $(TEST_PASSWD_OBJS) XScreenSaver_ad.h - $(CC) $(LDFLAGS) -o $@ $(TEST_PASSWD_OBJS) $(SAVER_LIBS) +TESTPASS_OBJS = test-passwd.o test-passwd-b.o $(AUTH_OBJS_1) +TESTPATH_DEFS = -Dxscreensaver_auth_conv=test_auth_conv $(AUTH_DEFS) +test-passwd-b.o: XScreenSaver_ad.h +test-passwd-b.o: $(srcdir)/xscreensaver-auth.c + $(CC) -c $(CC_ALL) $(TESTPATH_DEFS) $< -o $@ +test-passwd: $(TESTPASS_OBJS) + $(CC) $(LDFLAGS) -o $@ $(TESTPASS_OBJS) $(AUTH_LIBS) test-uid: test-uid.o $(CC) $(LDFLAGS) -o $@ test-uid.o -test-xdpms: test-xdpms.o - $(CC) $(LDFLAGS) -o $@ test-xdpms.o $(LIBS) $(X_LIBS) $(XDPMS_LIBS) \ - $(X_PRE_LIBS) -lXt -lX11 -lXext $(X_EXTRA_LIBS) +TESTDPMS_LIBS = $(LIBS_PRE) $(XDPMS_LIBS) -lXt -lX11 -lXext $(LIBS_POST) +test-xdpms: test-xdpms.o blurb.o + $(CC) $(LDFLAGS) -o $@ test-xdpms.o blurb.o $(TESTDPMS_LIBS) -test-xinerama: test-xinerama.o - $(CC) $(LDFLAGS) -o $@ test-xinerama.o $(LIBS) $(X_LIBS) $(SAVER_LIBS) \ - $(X_PRE_LIBS) $(XINERAMA_LIBS) -lXt -lX11 -lXext $(X_EXTRA_LIBS) +TESTXINPUT_OBJS = test-xinput.o blurb.o xinput.o +TESTXINPUT_LIBS = $(LIBS_PRE) $(XDPMS_LIBS) -lXi -lXt -lX11 -lXext $(LIBS_POST) +test-xinput: $(TESTXINPUT_OBJS) + $(CC) $(LDFLAGS) -o $@ $(TESTXINPUT_OBJS) $(TESTXINPUT_LIBS) -test-vp: test-vp.o - $(CC) $(LDFLAGS) -o $@ test-vp.o $(LIBS) $(X_LIBS) $(SAVER_LIBS) \ - $(X_PRE_LIBS) -lXt -lX11 -lXext $(X_EXTRA_LIBS) +TESTXIN_LIBS = $(LIBS_PRE) $(XINERAMA_LIBS) -lXi -lXt -lX11 -lXext $(LIBS_POST) +test-xinerama: test-xinerama.o blurb.o + $(CC) $(LDFLAGS) -o $@ test-xinerama.o blurb.o $(TESTXIN_LIBS) -test-randr: test-randr.o - $(CC) $(LDFLAGS) -o $@ test-randr.o $(LIBS) $(X_LIBS) $(SAVER_LIBS) \ - $(X_PRE_LIBS) -lXt -lX11 -lXext $(X_EXTRA_LIBS) +TESTXKB_OBJS = test-xkb.o blurb.o +TESTXKB_LIBS = $(LIBS_PRE) $(XDPMS_LIBS) -lXi -lXt -lX11 -lXext $(LIBS_POST) +test-xkb: $(TESTXKB_OBJS) + $(CC) $(LDFLAGS) -o $@ $(TESTXKB_OBJS) $(TESTXKB_LIBS) -test-grab: test-grab.o - $(CC) $(LDFLAGS) -o $@ test-grab.o $(SAVER_LIBS) +test-vp: test-vp.o blurb.o + $(CC) $(LDFLAGS) -o $@ test-vp.o blurb.o $(GFX_LIBS) -test-apm: test-apm.o - $(CC) $(LDFLAGS) -o $@ test-apm.o $(SAVER_LIBS) -lapm +test-randr: test-randr.o blurb.o + $(CC) $(LDFLAGS) -o $@ test-randr.o blurb.o $(GFX_LIBS) -test-mlstring.o: mlstring.c -test-mlstring: test-mlstring.o - $(CC) -DTEST $(LDFLAGS) -o $@ test-mlstring.o $(SAVER_LIBS) +TESTGRAB_LIBS = $(LIBS_PRE) -lXt -lX11 -lXext $(LIBS_POST) +test-grab: test-grab.o blurb.o + $(CC) $(LDFLAGS) -o $@ test-grab.o blurb.o $(TESTGRAB_LIBS) -TEST_FADE_OBJS = test-fade.o $(UTILS_BIN)/fade.o $(DEMO_UTIL_OBJS) -test-fade: test-fade.o $(UTILS_BIN)/fade.o - $(CC) $(LDFLAGS) -o $@ $(TEST_FADE_OBJS) $(SAVER_LIBS) +TEST_FADE_OBJS = test-fade.o fade.o blurb.o atoms.o clientmsg.o xinput.o \ + $(UTILS_BIN)/visual.o $(UTILS_BIN)/resources.o $(UTILS_BIN)/usleep.o \ + $(UTILS_BIN)/logo.o $(UTILS_BIN)/minixpm.o $(UTILS_BIN)/xshm.o \ + $(UTILS_BIN)/xmu.o $(UTILS_BIN)/aligned_malloc.o +test-fade: $(TEST_FADE_OBJS) + $(CC) $(LDFLAGS) -o $@ $(TEST_FADE_OBJS) $(GFX_LIBS) -TEST_SCREENS_OBJS = test-screens.o $(DEMO_UTIL_OBJS) -test-screens.o: screens.c -test-screens: test-screens.o - $(CC) $(LDFLAGS) -o $@ $(TEST_SCREENS_OBJS) $(SAVER_LIBS) +TEST_SCREENS_OBJS = test-screens.o screens.o blurb.o +test-screens: $(TEST_SCREENS_OBJS) + $(CC) $(LDFLAGS) -o $@ $(TEST_SCREENS_OBJS) $(GFX_LIBS) -test-yarandom: test-yarandom.o - $(CC) -DTEST $(LDFLAGS) -o $@ test-yarandom.o $(UTILS_BIN)/yarandom.o +test-yarandom: test-yarandom.o blurb.o + $(CC) -DTEST $(LDFLAGS) -o $@ test-yarandom.o blurb.o $(UTILS_BIN)/yarandom.o +XDPY_DEFS = -DHAVE_GLX $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) +XDPY_LIBS = $(LIBS_PRE) -lGL -lX11 -lXext $(LIBS_POST) xdpyinfo.o: xdpyinfo.c - $(CC) -c $(INCLUDES) -DHAVE_GLX $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) \ - $(srcdir)/xdpyinfo.c - + $(CC) -c $(INCLUDES) $(XDPY_DEFS) $(srcdir)/xdpyinfo.c xdpyinfo: xdpyinfo.o - $(CC) $(LDFLAGS) -o $@ xdpyinfo.o \ - $(LIBS) $(X_LIBS) @GL_LIBS@ \ - $(X_PRE_LIBS) -lX11 -lXext $(X_EXTRA_LIBS) -lm - + $(CC) $(LDFLAGS) -o $@ xdpyinfo.o $(XDPY_LIBS) ############################################################################## # @@ -900,150 +996,89 @@ demo-Gtk-conf.o: ../config.h demo-Gtk-conf.o: $(srcdir)/demo-Gtk-conf.h demo-Gtk-conf.o: $(UTILS_SRC)/xscreensaver-intl.h demo-Gtk.o: XScreenSaver_ad.h +demo-Gtk.o: $(srcdir)/atoms.h +demo-Gtk.o: $(srcdir)/blurb.h demo-Gtk.o: ../config.h demo-Gtk.o: $(srcdir)/demo-Gtk-conf.h -demo-Gtk.o: $(srcdir)/prefs.h demo-Gtk.o: $(srcdir)/remote.h demo-Gtk.o: $(srcdir)/types.h demo-Gtk.o: $(UTILS_SRC)/resources.h demo-Gtk.o: $(UTILS_SRC)/usleep.h demo-Gtk.o: $(UTILS_SRC)/version.h demo-Gtk.o: $(UTILS_SRC)/visual.h +demo-Gtk.o: $(UTILS_SRC)/xmu.h demo-Gtk.o: $(UTILS_SRC)/xscreensaver-intl.h +demo-Xm.o: XScreenSaver_Xm_ad.h +demo-Xm.o: XScreenSaver_ad.h +demo-Xm.o: $(srcdir)/atoms.h +demo-Xm.o: $(srcdir)/blurb.h demo-Xm.o: ../config.h +demo-Xm.o: $(srcdir)/remote.h +demo-Xm.o: $(srcdir)/types.h +demo-Xm.o: $(UTILS_SRC)/resources.h +demo-Xm.o: $(UTILS_SRC)/version.h +demo-Xm.o: $(UTILS_SRC)/visual.h +demo-Xm.o: $(UTILS_SRC)/xmu.h demo-Xm-widgets.o: ../config.h -dpms.o: ../config.h -dpms.o: $(srcdir)/prefs.h -dpms.o: $(srcdir)/types.h -dpms.o: $(srcdir)/xscreensaver.h -exec.o: ../config.h -exec.o: $(srcdir)/exec.h -lock.o: $(srcdir)/auth.h -lock.o: ../config.h -lock.o: $(srcdir)/mlstring.h -lock.o: $(srcdir)/prefs.h -lock.o: $(srcdir)/types.h -lock.o: $(UTILS_SRC)/resources.h -lock.o: $(srcdir)/xscreensaver.h -mlstring.o: $(srcdir)/mlstring.h +passwd-helper.o: $(srcdir)/auth.h +passwd-helper.o: $(srcdir)/blurb.h passwd-helper.o: ../config.h -passwd-helper.o: $(srcdir)/prefs.h -passwd-helper.o: $(srcdir)/types.h -passwd-helper.o: $(srcdir)/xscreensaver.h +passwd-kerberos.o: $(srcdir)/auth.h +passwd-kerberos.o: $(srcdir)/blurb.h passwd-kerberos.o: ../config.h -passwd.o: $(srcdir)/auth.h -passwd.o: ../config.h -passwd.o: $(srcdir)/prefs.h -passwd.o: $(srcdir)/types.h -passwd.o: $(srcdir)/xscreensaver.h passwd-pam.o: $(srcdir)/auth.h +passwd-pam.o: $(srcdir)/blurb.h passwd-pam.o: ../config.h -passwd-pam.o: $(srcdir)/types.h +passwd-pwent.o: $(srcdir)/auth.h +passwd-pwent.o: $(srcdir)/blurb.h passwd-pwent.o: ../config.h -prefs.o: ../config.h -prefs.o: $(srcdir)/prefs.h -prefs.o: $(srcdir)/types.h -prefs.o: $(UTILS_SRC)/resources.h -prefs.o: $(UTILS_SRC)/version.h +remote.o: $(srcdir)/atoms.h +remote.o: $(srcdir)/blurb.h +remote.o: $(srcdir)/clientmsg.h remote.o: ../config.h remote.o: $(srcdir)/remote.h -screens.o: ../config.h -screens.o: $(srcdir)/prefs.h -screens.o: $(srcdir)/types.h -screens.o: $(UTILS_SRC)/visual.h -screens.o: $(srcdir)/xscreensaver.h -setuid.o: ../config.h -setuid.o: $(srcdir)/prefs.h -setuid.o: $(srcdir)/types.h -setuid.o: $(srcdir)/xscreensaver.h -splash.o: ../config.h -splash.o: $(srcdir)/prefs.h -splash.o: $(srcdir)/types.h -splash.o: $(UTILS_SRC)/font-retry.h -splash.o: $(UTILS_SRC)/resources.h -splash.o: $(srcdir)/xscreensaver.h -stderr.o: ../config.h -stderr.o: $(srcdir)/prefs.h -stderr.o: $(srcdir)/types.h -stderr.o: $(UTILS_SRC)/resources.h -stderr.o: $(UTILS_SRC)/visual.h -stderr.o: $(srcdir)/xscreensaver.h -subprocs.o: ../config.h -subprocs.o: $(srcdir)/exec.h -subprocs.o: $(srcdir)/prefs.h -subprocs.o: $(srcdir)/types.h -subprocs.o: $(UTILS_SRC)/visual.h -subprocs.o: $(UTILS_SRC)/yarandom.h -subprocs.o: $(srcdir)/xscreensaver.h -test-apm.o: ../config.h +test-fade.o: $(srcdir)/atoms.h +test-fade.o: $(srcdir)/blurb.h test-fade.o: ../config.h -test-fade.o: $(srcdir)/prefs.h +test-fade.o: $(srcdir)/fade.h +test-fade.o: $(srcdir)/screens.h test-fade.o: $(srcdir)/types.h -test-fade.o: $(UTILS_SRC)/fade.h +test-fade.o: $(UTILS_SRC)/resources.h test-fade.o: $(srcdir)/xscreensaver.h +test-grab.o: $(srcdir)/blurb.h test-grab.o: ../config.h -test-mlstring.o: $(srcdir)/mlstring.c -test-mlstring.o: $(srcdir)/mlstring.h -test-passwd.o: XScreenSaver_ad.h test-passwd.o: $(srcdir)/auth.h +test-passwd.o: $(srcdir)/blurb.h test-passwd.o: ../config.h -test-passwd.o: $(srcdir)/prefs.h -test-passwd.o: $(srcdir)/types.h -test-passwd.o: $(UTILS_SRC)/resources.h -test-passwd.o: $(UTILS_SRC)/version.h -test-passwd.o: $(UTILS_SRC)/visual.h -test-passwd.o: $(srcdir)/xscreensaver.h +test-randr.o: $(srcdir)/blurb.h test-randr.o: ../config.h +test-screens.o: $(srcdir)/blurb.h test-screens.o: ../config.h -test-screens.o: $(srcdir)/prefs.h -test-screens.o: $(srcdir)/screens.c -test-screens.o: $(srcdir)/types.h +test-screens.o: $(srcdir)/screens.h test-screens.o: $(UTILS_SRC)/visual.h -test-screens.o: $(srcdir)/xscreensaver.h test-uid.o: ../config.h +test-vp.o: $(srcdir)/blurb.h test-vp.o: ../config.h +test-xdpms.o: $(srcdir)/blurb.h test-xdpms.o: ../config.h +test-xinerama.o: $(srcdir)/blurb.h test-xinerama.o: ../config.h +test-xinput.o: $(srcdir)/blurb.h +test-xinput.o: ../config.h +test-xinput.o: $(srcdir)/xinput.h +test-xkb.o: $(srcdir)/blurb.h +test-xkb.o: ../config.h +test-yarandom.o: $(srcdir)/blurb.h test-yarandom.o: ../config.h test-yarandom.o: $(UTILS_SRC)/yarandom.h -timers.o: ../config.h -timers.o: $(srcdir)/prefs.h -timers.o: $(srcdir)/types.h -timers.o: $(srcdir)/xscreensaver.h -windows.o: ../config.h -windows.o: $(srcdir)/prefs.h -windows.o: $(srcdir)/types.h -windows.o: $(UTILS_SRC)/fade.h -windows.o: $(UTILS_SRC)/visual.h -windows.o: $(srcdir)/xscreensaver.h +xscreensaver-command.o: $(srcdir)/atoms.h +xscreensaver-command.o: $(srcdir)/blurb.h xscreensaver-command.o: ../config.h xscreensaver-command.o: $(srcdir)/remote.h xscreensaver-command.o: $(UTILS_SRC)/version.h -xscreensaver-getimage.o: ../config.h -xscreensaver-getimage.o: XScreenSaver_ad.h -xscreensaver-getimage.o: $(srcdir)/prefs.h -xscreensaver-getimage.o: $(srcdir)/types.h -xscreensaver-getimage.o: $(UTILS_SRC)/colorbars.h -xscreensaver-getimage.o: $(UTILS_SRC)/grabscreen.h -xscreensaver-getimage.o: $(UTILS_SRC)/resources.h -xscreensaver-getimage.o: $(UTILS_SRC)/utils.h -xscreensaver-getimage.o: $(UTILS_SRC)/version.h -xscreensaver-getimage.o: $(UTILS_SRC)/visual.h -xscreensaver-getimage.o: $(UTILS_SRC)/vroot.h -xscreensaver-getimage.o: $(UTILS_SRC)/yarandom.h -xscreensaver.o: XScreenSaver_ad.h -xscreensaver.o: $(srcdir)/auth.h -xscreensaver.o: ../config.h -xscreensaver.o: $(srcdir)/prefs.h -xscreensaver.o: $(srcdir)/types.h -xscreensaver.o: $(UTILS_SRC)/resources.h -xscreensaver.o: $(UTILS_SRC)/usleep.h -xscreensaver.o: $(UTILS_SRC)/version.h -xscreensaver.o: $(UTILS_SRC)/visual.h -xscreensaver.o: $(UTILS_SRC)/yarandom.h -xscreensaver.o: $(srcdir)/xscreensaver.h -xset.o: ../config.h -xset.o: $(srcdir)/prefs.h -xset.o: $(srcdir)/types.h -xset.o: $(srcdir)/xscreensaver.h +xscreensaver-systemd.o: $(srcdir)/blurb.h +xscreensaver-systemd.o: ../config.h +xscreensaver-systemd.o: $(UTILS_SRC)/queue.h +xscreensaver-systemd.o: $(UTILS_SRC)/version.h +xscreensaver-systemd.o: $(UTILS_SRC)/yarandom.h diff --git a/driver/XScreenSaver-Xm.ad b/driver/XScreenSaver-Xm.ad index 6b04ae9..560c48e 100644 --- a/driver/XScreenSaver-Xm.ad +++ b/driver/XScreenSaver-Xm.ad @@ -1,4 +1,4 @@ -! Resources for the Motif dialog boxes of the "xscreensaver-demo" program. +! Resources for the Motif dialog boxes of the "xscreensaver-settings" program. ! *fontList: *-helvetica-medium-r-*-*-*-120-*-*-*-iso8859-1 *demoDialog*label1.fontList: *-helvetica-medium-r-*-*-*-140-*-*-*-iso8859-1 diff --git a/driver/XScreenSaver.ad.in b/driver/XScreenSaver.ad.in index cfdd1a2..bfc6414 100644 --- a/driver/XScreenSaver.ad.in +++ b/driver/XScreenSaver.ad.in @@ -4,8 +4,8 @@ ! a screen saver and locker for the X window system ! by Jamie Zawinski ! -! version 5.44 -! 20-Mar-2020 +! version 6.00 +! 01-Apr-2021 ! ! See "man xscreensaver" for more info. The latest version is always ! available at https://www.jwz.org/xscreensaver/ @@ -47,9 +47,8 @@ *memoryLimit: 0 *lock: False *verbose: False -*timestamp: True *fade: True -*unfade: False +*unfade: True *fadeSeconds: 0:00:03 *fadeTicks: 20 *splash: True @@ -65,32 +64,11 @@ *textProgram: fortune *textURL: https://en.wikipedia.org/w/index.php?title=Special:NewPages&feed=rss -! When a saver writes an error message to stdout/stderr, it can be printed -! on the screen. -! -*captureStderr: True -*overlayStderr: True -*overlayTextForeground: #FFFF00 -*overlayTextBackground: #000000 -*font: *-medium-r-*-140-*-m-* - -! The default is to use these server extensions if available (as noted.) -*sgiSaverExtension: True -*xidleExtension: True -*procInterrupts: True - -! Turning this on makes pointerHysteresis not work. -*xinputExtensionDev: False - -! Set this to True if you are experiencing longstanding XFree86 bug #421 -! (xscreensaver not covering the whole screen) -*GetViewPortIsFullOfLies: False - ! This is what the "Settings" button on the splash screen runs. -*demoCommand: xscreensaver-demo +*demoCommand: xscreensaver-settings ! This is the URL loaded by the "Help" button on the splash screen, -! and by the "Documentation" menu item in xscreensaver-demo. +! and by the "Documentation" menu item in xscreensaver-settings. *helpURL: https://www.jwz.org/xscreensaver/man.html ! loadURL -- how the "Help" buttons load the helpURL (/bin/sh syntax.) @@ -98,11 +76,13 @@ ! ! And there are so very many options to choose from! ! -! Gnome 2.4, 2.6: (yelp can't display man pages, as of 2.6.3) +! Gnome 2.4, 2.6: ! @GNOME24@*loadURL: @WITH_BROWSER@ '%s' -@GNOME24@*manualCommand: gnome-terminal --title '%s manual' \ -@GNOME24@ --command '/bin/sh -c "man %s; read foo"' +@GNOME24@*manualCommand: yelp man:%s || \ +@GNOME24@ x-terminal-emulator -t '%s manual' \ +@GNOME24@ -e /bin/sh -c "man %s; read foo" + ! ! Gnome 2.2: ! @@ -117,21 +97,21 @@ ! ! non-Gnome systems: ! -@NOGNOME@*loadURL: firefox '%s' || mozilla '%s' || netscape '%s' +@NOGNOME@*loadURL: x-www-browser '%s' || firefox '%s' || chromium-browser '%s' @NOGNOME@*manualCommand: xterm -sb -fg black -bg gray75 -T '%s manual' \ @NOGNOME@ -e /bin/sh -c 'man "%s" ; read foo' -! The format used for printing the date and time in the password dialog box -! (see the strftime(3) manual page for details.) -*dateFormat: %d-%b-%y (%a); %I:%M %p -! For day month date: -! *dateFormat: %a %b %d, %I:%M %p -! To show the time only: +! The strftime(3) format string for printing the time on the password dialog. +*dateFormat: %I:%M %p, %a %b %e +! DD MMM: +! *dateFormat: %I:%M %p, %e %b (%a) +! 12 hour time only: ! *dateFormat: %I:%M %p -! For 24 hour time: +! 24 hour time only: ! *dateFormat: %H:%M - +! ISO 8601: +! *dateFormat: %Y-%m-%d %H:%M:%S ! This command is executed by the "New Login" button on the lock dialog. ! (That button does not appear on the dialog if this program does not exist.) @@ -141,13 +121,11 @@ ! @NEW_LOGIN_COMMAND_P@*newLoginCommand: @NEW_LOGIN_COMMAND@ - -! Change these at your peril: -! -XScreenSaver.pointerPollTime: 0:00:05 +! Mouse motions less than this many pixels per second are ignored. +! This helps with cats, trucks and earthquakes. XScreenSaver.pointerHysteresis: 10 -XScreenSaver.initialDelay: 0:00:00 -XScreenSaver.windowCreationTimeout: 0:00:30 + +! Change this at your peril: XScreenSaver.bourneShell: /bin/sh @@ -157,176 +135,179 @@ XScreenSaver.bourneShell: /bin/sh ! !============================================================================= -! Note, the daemon uses Xlib XLoadFont, not Xft. If these fonts don't -! exist, arcane heuristics are applied until we find something similar. -! -*Dialog.headingFont: -*-helvetica-bold-r-*-*-*-180-*-*-*-*-iso8859-1 -*Dialog.bodyFont: -*-helvetica-bold-r-*-*-*-140-*-*-*-*-iso8859-1 -*Dialog.labelFont: -*-helvetica-bold-r-*-*-*-140-*-*-*-*-iso8859-1 -*Dialog.unameFont: -*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1 -*Dialog.buttonFont: -*-helvetica-bold-r-*-*-*-140-*-*-*-*-iso8859-1 -*Dialog.dateFont: -*-helvetica-medium-r-*-*-*-80-*-*-*-*-iso8859-1 - -! Helvetica asterisks look terrible. -*passwd.passwdFont: -*-courier-bold-r-*-*-*-140-*-*-*-iso8859-1 - -! Whether to display the local host name in the unlock dialog. -*passwd.uname: True - -! Whether typed passwords should echo as asterisks (true) or nothing (false) -*passwd.asterisks: True - +! Which of the following color schemes is in use for the unlock dialog. +*dialogTheme: default -! The default color scheme for the unlock and splash dialogs. -! This looks pretty close to the default Gtk theme. -! -*Dialog.foreground: #000000 -*Dialog.background: #E6E6E6 -*Dialog.Button.foreground: #000000 -*Dialog.Button.background: #F5F5F5 -*Dialog.text.foreground: #000000 -*Dialog.text.background: #FFFFFF -*Dialog.topShadowColor: #FFFFFF -*Dialog.bottomShadowColor: #CECECE -*Dialog.logo.width: 210 -*Dialog.logo.height: 210 -*Dialog.internalBorderWidth: 24 -*Dialog.borderWidth: 1 -*Dialog.shadowThickness: 2 -*passwd.thermometer.foreground: #4464AC -*passwd.thermometer.background: #FFFFFF -*passwd.thermometer.width: 8 +! Resources for theme names are downcased with spaces stripped. +*themeNames: Default, Borderless, Dark Gray, Borderless Black, \ + Green Black, White, Blue, Aqua Black, Wine +*Dialog.headingFont: sans-serif bold 16 +*Dialog.bodyFont: sans-serif 14 +*Dialog.errorFont: sans-serif bold 14 +*Dialog.labelFont: sans-serif bold 14 +*Dialog.unameFont: sans-serif 12 +*Dialog.buttonFont: sans-serif bold 14 +*Dialog.dateFont: sans-serif 9 -! A few other example color schemes. -! -! A convenient way to debug these is to build and run "driver/test-passwd". -! Remember that configure overwrites XScreenSaver.ad from XScreenSaver.ad.in. - +! Whether to display the local host name in the unlock dialog. +*passwd.uname: True + +! Whether typed passwords should echo as asterisks, or as nothing. +*passwd.asterisks: True + +! The default theme is similar to the Gtk defaults. +! +*default.Dialog.foreground: #000000 +*default.Dialog.background: #E6E6E6 +*default.Dialog.button.foreground: #000000 +*default.Dialog.button.background: #F5F5F5 +*default.Dialog.logo.background: #BBBBBB +*default.Dialog.text.foreground: #000000 +*default.Dialog.error.foreground: #FF0000 +*default.Dialog.text.background: #FFFFFF +*default.Dialog.topShadowColor: #FFFFFF +*default.Dialog.bottomShadowColor: #CECECE +*default.Dialog.shadowWidth: 2 +*default.Dialog.logo.width: 210 +*default.Dialog.logo.height: 210 +*default.Dialog.thermometer.foreground: #4464AC +*default.Dialog.thermometer.background: #FFFFFF +*default.Dialog.thermometer.width: 8 +*default.Dialog.borderColor: #CECECE +*default.Dialog.borderWidth: 0 +*default.Dialog.internalPadding: 24 ! Borderless theme: ! -! *Dialog.topShadowColor: #E6E6E6 -! *Dialog.bottomShadowColor: #E6E6E6 -! *passwd.thermometer.width: 6 - +*borderless.Dialog.topShadowColor: #E6E6E6 +*borderless.Dialog.button.background: #FFFFFF +*borderless.Dialog.bottomShadowColor: #E6E6E6 +*borderless.Dialog.logo.background: #E6E6E6 +*borderless.Dialog.borderColor: #888888 +*borderless.Dialog.thermometer.width: 6 +*borderless.Dialog.borderWidth: 1 ! Dark gray theme: ! -! *Dialog.foreground: #CCCCCC -! *Dialog.background: #333333 -! *Dialog.topShadowColor: #444444 -! *Dialog.bottomShadowColor: #111111 -! *Dialog.text.foreground: #DDDDDD -! *Dialog.text.background: #666666 -! *Dialog.Button.foreground: #CCCCCC -! *Dialog.Button.background: #666666 -! *passwd.thermometer.foreground: #4464AC -! *passwd.thermometer.background: #666666 - - -! Black borderless theme: -! -! *Dialog.foreground: #CCCCCC -! *Dialog.background: #000000 -! *Dialog.topShadowColor: #000000 -! *Dialog.bottomShadowColor: #000000 -! *Dialog.text.foreground: #CCCCCC -! *Dialog.text.background: #000000 -! *Dialog.Button.foreground: #CCCCCC -! *Dialog.Button.background: #333333 -! *passwd.thermometer.foreground: #CCCCCC -! *passwd.thermometer.background: #333333 -! *passwd.thermometer.width: 3 - +*darkgray.Dialog.foreground: #CCCCCC +*darkgray.Dialog.background: #333333 +*darkgray.Dialog.topShadowColor: #444444 +*darkgray.Dialog.bottomShadowColor: #111111 +*darkgray.Dialog.borderColor: #111111 +*darkgray.Dialog.text.foreground: #DDDDDD +*darkgray.Dialog.text.background: #666666 +*darkgray.Dialog.button.foreground: #CCCCCC +*darkgray.Dialog.button.background: #666666 +*darkgray.Dialog.logo.background: #444444 +*darkgray.Dialog.thermometer.foreground: #4464AC +*darkgray.Dialog.thermometer.background: #666666 +*darkgray.Dialog.borderWidth: 0 + +! Borderless black theme: +! +*borderlessblack.Dialog.foreground: #CCCCCC +*borderlessblack.Dialog.background: #000000 +*borderlessblack.Dialog.topShadowColor: #000000 +*borderlessblack.Dialog.bottomShadowColor: #000000 +*borderlessblack.Dialog.text.foreground: #CCCCCC +*borderlessblack.Dialog.text.background: #000000 +*borderlessblack.Dialog.button.foreground: #CCCCCC +*borderlessblack.Dialog.button.background: #333333 +*borderlessblack.Dialog.logo.background: #000000 +*borderlessblack.Dialog.thermometer.foreground: #CCCCCC +*borderlessblack.Dialog.thermometer.background: #333333 +*borderlessblack.Dialog.thermometer.width: 3 +*borderlessblack.Dialog.borderColor: #333333 +*borderlessblack.Dialog.borderWidth: 1 ! Green on black theme: ! -! *Dialog.foreground: #00FF00 -! *Dialog.background: #000000 -! *Dialog.topShadowColor: #000000 -! *Dialog.bottomShadowColor: #000000 -! *Dialog.shadowThickness: 1 -! *Dialog.text.foreground: #00FF00 -! *Dialog.text.background: #006600 -! *Dialog.Button.foreground: #00FF00 -! *Dialog.Button.background: #006600 -! *passwd.thermometer.foreground: #00CC00 -! *passwd.thermometer.background: #006600 - +*greenblack.Dialog.foreground: #00FF00 +*greenblack.Dialog.background: #000000 +*greenblack.Dialog.topShadowColor: #000000 +*greenblack.Dialog.bottomShadowColor: #000000 +*greenblack.Dialog.shadowWidth: 1 +*greenblack.Dialog.text.foreground: #00FF00 +*greenblack.Dialog.text.background: #006600 +*greenblack.Dialog.button.foreground: #00FF00 +*greenblack.Dialog.button.background: #006600 +*greenblack.Dialog.logo.background: #000000 +*greenblack.Dialog.thermometer.foreground: #00CC00 +*greenblack.Dialog.thermometer.background: #006600 +*greenblack.Dialog.borderColor: #006600 +*greenblack.Dialog.borderWidth: 1 ! White theme: ! -! *Dialog.foreground: #000000 -! *Dialog.background: #FFFFFF -! *Dialog.topShadowColor: #CCCCCC -! *Dialog.bottomShadowColor: #CCCCCC -! *Dialog.shadowThickness: 1 -! *Dialog.text.foreground: #000000 -! *Dialog.text.background: #FFFFFF -! *Dialog.Button.foreground: #000000 -! *Dialog.Button.background: #FFFFFF - +*white.Dialog.foreground: #000000 +*white.Dialog.background: #FFFFFF +*white.Dialog.topShadowColor: #CCCCCC +*white.Dialog.bottomShadowColor: #CCCCCC +*white.Dialog.shadowWidth: 1 +*white.Dialog.borderColor: #CCCCCC +*white.Dialog.text.foreground: #000000 +*white.Dialog.text.background: #FFFFFF +*white.Dialog.button.foreground: #000000 +*white.Dialog.button.background: #FFFFFF +*white.Dialog.logo.background: #FFFFFF +*white.Dialog.borderWidth: 0 ! Blue theme: ! -! *Dialog.foreground: #000000 -! *Dialog.background: #BBCCDD -! *Dialog.topShadowColor: #CCDDEE -! *Dialog.bottomShadowColor: #AABBCC -! *Dialog.text.foreground: #000000 -! *Dialog.text.background: #DDEEFF -! *Dialog.Button.foreground: #000000 -! *Dialog.Button.background: #DDEEFF -! *passwd.thermometer.foreground: #5566AA -! *passwd.thermometer.background: #BBCCDD - +*blue.Dialog.foreground: #000000 +*blue.Dialog.background: #BBCCDD +*blue.Dialog.topShadowColor: #CCDDEE +*blue.Dialog.bottomShadowColor: #AABBCC +*blue.Dialog.borderColor: #AABBCC +*blue.Dialog.text.foreground: #000000 +*blue.Dialog.text.background: #DDEEFF +*blue.Dialog.button.foreground: #000000 +*blue.Dialog.button.background: #DDEEFF +*blue.Dialog.logo.background: #BBCCDD +*blue.Dialog.thermometer.foreground: #5566AA +*blue.Dialog.thermometer.background: #BBCCDD +*blue.Dialog.borderWidth: 0 ! Aqua on black borderless theme: ! -! *Dialog.foreground: #00EFEF -! *Dialog.background: #000000 -! *Dialog.topShadowColor: #000000 -! *Dialog.bottomShadowColor: #000000 -! *Dialog.Button.foreground: #000000 -! *Dialog.Button.background: #2244EE -! *Dialog.text.foreground: #2244EE -! *Dialog.text.background: #EEEEEE -! *Dialog.internalBorderWidth: 36 -! *Dialog.borderWidth: 4 -! *Dialog.shadowThickness: 2 -! *passwd.thermometer.foreground: #2244EE -! *passwd.thermometer.background: #000088 - +*aquablack.Dialog.foreground: #00EFEF +*aquablack.Dialog.background: #000000 +*aquablack.Dialog.topShadowColor: #000000 +*aquablack.Dialog.bottomShadowColor: #000000 +*aquablack.Dialog.shadowWidth: 2 +*aquablack.Dialog.button.foreground: #000000 +*aquablack.Dialog.button.background: #2244EE +*aquablack.Dialog.logo.background: #000000 +*aquablack.Dialog.text.foreground: #2244EE +*aquablack.Dialog.text.background: #EEEEEE +*aquablack.Dialog.thermometer.foreground: #2244EE +*aquablack.Dialog.thermometer.background: #000088 +*aquablack.Dialog.borderColor: #000066 +*aquablack.Dialog.borderWidth: 1 +*aquablack.Dialog.internalPadding: 36 ! Wine theme, similar to the login screen of "Ubuntu 18.04 Community". ! -! *Dialog.foreground: #AD8FA6 -! *Dialog.background: #2C041E -! *Dialog.topShadowColor: #2C041E -! *Dialog.bottomShadowColor: #2C041E -! *Dialog.text.foreground: #706B70 -! *Dialog.text.background: #F9F9F8 -! *Dialog.Button.foreground: #CFC8CB -! *Dialog.Button.background: #4D2946 -! *passwd.thermometer.foreground: #AD8FA6 -! *passwd.thermometer.background: #4D2946 -! *passwd.thermometer.width: 6 +*wine.Dialog.foreground: #AD8FA6 +*wine.Dialog.background: #2C041E +*wine.Dialog.topShadowColor: #2C041E +*wine.Dialog.bottomShadowColor: #2C041E +*wine.Dialog.text.foreground: #706B70 +*wine.Dialog.text.background: #F9F9F8 +*wine.Dialog.button.foreground: #5F585B +*wine.Dialog.logo.background: #2C041E +*wine.Dialog.thermometer.foreground: #AD8FA6 +*wine.Dialog.thermometer.background: #4D2946 +*wine.Dialog.borderColor: #4D2946 +*wine.Dialog.thermometer.width: 6 +*wine.Dialog.borderWidth: 1 -! Static text in the dialog boxes: +! For displaying error messages about crashed screen savers. ! -*passwd.heading.label: XScreenSaver %s -*passwd.body.label: This screen is locked. -*passwd.unlock.label: OK -*passwd.login.label: New Login -*passwd.user.label: Username: - -*splash.heading.label: XScreenSaver %s -*splash.body.label: Copyright \251 1991-2020 by -*splash.body2.label: Jamie Zawinski -*splash.demo.label: Settings -*splash.help.label: Help +*errorFont: sans-serif bold 18 +*errorColor: #FF0000 !============================================================================= @@ -337,7 +318,7 @@ XScreenSaver.bourneShell: /bin/sh ! If you want to disable a screensaver, DO NOT remove it from this list: ! instead, mark it as inactive by placing a "-" at the beginning of the line. ! -! You can use the `xscreensaver-demo' program to edit the current list of +! You can use the `xscreensaver-settings' program to edit the current list of ! screen savers interactively. ! !============================================================================= @@ -579,111 +560,132 @@ XScreenSaver.bourneShell: /bin/sh vfeedback -root \n\ @GL_KLUDGE@ GL: deepstars -root \n\ @GL_KLUDGE@ GL: gravitywell -root \n\ +@GL_KLUDGE@ GL: beats -root \n\ +@GL_KLUDGE@ GL: covid19 -root \n\ @GL_KLUDGE@ GL: etruscanvenus -root \n\ -@GL_KLUDGE@ GL: gibson -root \n +@GL_KLUDGE@ GL: gibson -root \n\ +@GL_KLUDGE@ GL: headroom -root \n\ +@GL_KLUDGE@ GL: sphereeversion -root \n !============================================================================= ! ! Pretty names for the hacks that have unusual capitalization. -! Used by xscreensaver-demo. +! Used by xscreensaver-settings. ! !============================================================================= -*hacks.antinspect.name: AntInspect -*hacks.antmaze.name: AntMaze -*hacks.antspotlight.name: AntSpotlight -*hacks.binaryring.name: BinaryRing -*hacks.blinkbox.name: BlinkBox -*hacks.blitspin.name: BlitSpin -*hacks.blocktube.name: BlockTube -*hacks.bouncingcow.name: BouncingCow -*hacks.boxfit.name: BoxFit +*hacks.antinspect.name: Ant Inspect +*hacks.antmaze.name: Ant Maze +*hacks.antspotlight.name: Ant Spotlight +*hacks.apple2.name: Apple ][ +*hacks.binaryring.name: Binary Ring +*hacks.blinkbox.name: Blink Box +*hacks.blitspin.name: Blit Spin +*hacks.blocktube.name: Block Tube +*hacks.bouncingcow.name: Bouncing Cow +*hacks.boxfit.name: Box Fit *hacks.bsod.name: BSOD -*hacks.bubble3d.name: Bubble3D -*hacks.ccurve.name: CCurve -*hacks.cloudlife.name: CloudLife -*hacks.companioncube.name: CompanionCube -*hacks.cubestack.name: CubeStack -*hacks.cubestorm.name: CubeStorm -*hacks.cubetwist.name: CubeTwist -*hacks.cubicgrid.name: CubicGrid -*hacks.cwaves.name: CWaves -*hacks.dangerball.name: DangerBall -*hacks.decayscreen.name: DecayScreen -*hacks.deepstars.name: DeepStars +*hacks.bubble3d.name: Bubble 3D +*hacks.ccurve.name: C Curve +*hacks.cityflow.name: City Flow +*hacks.cloudlife.name: Cloud Life +*hacks.companioncube.name: Companion Cube +*hacks.covid19.name: COVID19 +*hacks.cube21.name: Cube 21 +*hacks.cubestack.name: Cube Stack +*hacks.cubestorm.name: Cube Storm +*hacks.cubetwist.name: Cube Twist +*hacks.cubicgrid.name: Cubic Grid +*hacks.cwaves.name: C Waves +*hacks.dangerball.name: Danger Ball +*hacks.decayscreen.name: Decay Screen +*hacks.deepstars.name: Deep Stars *hacks.dnalogo.name: DNA Logo -*hacks.dymaxionmap.name: DymaxionMap -*hacks.energystream.name: EnergyStream -*hacks.etruscanvenus.name: EtruscanVenus -*hacks.euler2d.name: Euler2D -*hacks.fadeplot.name: FadePlot -*hacks.filmleader.name: FilmLeader -*hacks.flipflop.name: FlipFlop -*hacks.flipscreen3d.name: FlipScreen3D -*hacks.fliptext.name: FlipText -*hacks.fluidballs.name: FluidBalls -*hacks.flyingtoasters.name: FlyingToasters -*hacks.fontglide.name: FontGlide -*hacks.fuzzyflakes.name: FuzzyFlakes -*hacks.geodesicgears.name: GeodesicGears +*hacks.dymaxionmap.name: Dymaxion Map +*hacks.energystream.name: Energy Stream +*hacks.etruscanvenus.name: Etruscan Venus +*hacks.euler2d.name: Euler 2D +*hacks.fadeplot.name: Fade Plot +*hacks.fiberlamp.name: Fiber Lamp +*hacks.filmleader.name: Film Leader +*hacks.flipflop.name: Flip Flop +*hacks.flipscreen3d.name: Flip Screen 3D +*hacks.fliptext.name: Flip Text +*hacks.fluidballs.name: Fluid Balls +*hacks.flyingtoasters.name: Flying Toasters +*hacks.fontglide.name: Font Glide +*hacks.fuzzyflakes.name: Fuzzy Flakes +*hacks.geodesicgears.name: Geodesic Gears *hacks.gflux.name: GFlux +*hacks.glblur.name: GL Blur +*hacks.glcells.name: GL Cells *hacks.gleidescope.name: Gleidescope -*hacks.glforestfire.name: GLForestFire +*hacks.glforestfire.name: GL Forest Fire +*hacks.glhanoi.name: GL Hanoi *hacks.glitchpeg.name: GlitchPEG -*hacks.gravitywell.name: GravityWell -*hacks.hyperball.name: HyperBall -*hacks.hypercube.name: HyperCube +*hacks.glknots.name: GL Knots +*hacks.glmatrix.name: GL Matrix +*hacks.glplanet.name: GL Planet +*hacks.glschool.name: GL School +*hacks.glslideshow.name: GL Slideshow +*hacks.glsnake.name: GL Snake +*hacks.gltext.name: GL Text +*hacks.gravitywell.name: Gravity Well +*hacks.hexstrut.name: Hex Strut *hacks.ifs.name: IFS -*hacks.imsmap.name: IMSMap -*hacks.jigglypuff.name: JigglyPuff -*hacks.juggler3d.name: Juggler3D -*hacks.lcdscrub.name: LCDscrub +*hacks.imsmap.name: IMS Map +*hacks.jigglypuff.name: Jiggly Puff +*hacks.juggler3d.name: Juggler 3D +*hacks.lcdscrub.name: LCD Scrub *hacks.lmorph.name: LMorph *hacks.m6502.name: m6502 -*hacks.maze3d.name: Maze3D -*hacks.memscroller.name: MemScroller -*hacks.metaballs.name: MetaBalls -*hacks.mirrorblob.name: MirrorBlob -*hacks.moebiusgears.name: MoebiusGears -*hacks.morph3d.name: Morph3D -*hacks.nerverot.name: NerveRot -*hacks.noseguy.name: NoseGuy -*hacks.popsquares.name: PopSquares -*hacks.projectiveplane.name:ProjectivePlane -*hacks.quasicrystal.name: QuasiCrystal -*hacks.raverhoop.name: RaverHoop -*hacks.razzledazzle.name: RazzleDazzle -*hacks.rd-bomb.name: RDbomb -*hacks.rdbomb.name: RDbomb -*hacks.romanboy.name: RomanBoy -*hacks.rotzoomer.name: RotZoomer -*hacks.rubikblocks.name: RubikBlocks +*hacks.maze3d.name: Maze 3D +*hacks.memscroller.name: Mem Scroller +*hacks.metaballs.name: Meta Balls +*hacks.mirrorblob.name: Mirror Blob +*hacks.moebius.name: Möbius +*hacks.moebiusgears.name: Möbius Gears +*hacks.moire.name: Moiré +*hacks.moire2.name: Moiré 2 +*hacks.morph3d.name: Morph 3D +*hacks.nerverot.name: Nerve Rot +*hacks.noseguy.name: Nose Guy +*hacks.pacman.name: Pac-Man +*hacks.photopile.name: Photo Pile +*hacks.popsquares.name: Pop Squares +*hacks.projectiveplane.name:Projective Plane +*hacks.quasicrystal.name: Quasi-Crystal +*hacks.raverhoop.name: Raver Hoop +*hacks.razzledazzle.name: Razzle Dazzle +*hacks.rd-bomb.name: RD-Bomb +*hacks.rd-bomb.name: RD-Bomb +*hacks.romanboy.name: Roman Boy +*hacks.rotzoomer.name: Rot Zoomer +*hacks.rubikblocks.name: Rubik Blocks *hacks.sballs.name: SBalls -*hacks.shadebobs.name: ShadeBobs -*hacks.sierpinski3d.name: Sierpinski3D -*hacks.skytentacles.name: SkyTentacles -*hacks.slidescreen.name: SlideScreen -*hacks.speedmine.name: SpeedMine -*hacks.splitflap.name: SplitFlap -*hacks.starwars.name: StarWars -*hacks.stonerview.name: StonerView +*hacks.shadebobs.name: Shade Bobs +*hacks.sierpinski3d.name: Sierpinski 3D +*hacks.skytentacles.name: Sky Tentacles +*hacks.slidescreen.name: Slide Screen +*hacks.speedmine.name: Speed Mine +*hacks.sphereeversion.name: Sphere Eversion +*hacks.splitflap.name: Split-Flap +*hacks.starwars.name: Star Wars +*hacks.stonerview.name: Stoner View *hacks.t3d.name: T3D -*hacks.testx11.name: TestX11 -*hacks.timetunnel.name: TimeTunnel -*hacks.topblock.name: TopBlock -*hacks.tronbit.name: TronBit -*hacks.unknownpleasures.name:UnknownPleasures +*hacks.testx11.name: Test X11 +*hacks.timetunnel.name: Time Tunnel +*hacks.topblock.name: Top Block +*hacks.tronbit.name: Tron Bit +*hacks.unknownpleasures.name:Unknown Pleasures *hacks.vfeedback.name: VFeedback -*hacks.vidwhacker.name: VidWhacker -*hacks.webcollage.name: WebCollage -*hacks.whirlwindwarp.name: WhirlWindWarp -*hacks.winduprobot.name: WindupRobot +*hacks.vidwhacker.name: Vid Whacker +*hacks.webcollage.name: Web Collage +*hacks.whirlwindwarp.name: Whirlwind Warp +*hacks.winduprobot.name: Windup Robot *hacks.xanalogtv.name: XAnalogTV *hacks.xrayswarm.name: XRaySwarm -! obsolete, but still used by xscreensaver-demo-Xm. -*hacks.documentation.isInstalled: True - ! (xrdb prevention kludge: whole file) */ diff --git a/driver/XScreenSaver_Xm_ad.h b/driver/XScreenSaver_Xm_ad.h new file mode 100644 index 0000000..371e0a2 --- /dev/null +++ b/driver/XScreenSaver_Xm_ad.h @@ -0,0 +1,108 @@ +"*fontList: *-helvetica-medium-r-*-*-*-120-*-*-*-iso8859-1", +"*demoDialog*label1.fontList: *-helvetica-medium-r-*-*-*-140-*-*-*-iso8859-1", +"*cmdText.fontList: *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1", +"*label0.fontList: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1", +"XScreenSaver*doc.fontList: *-helvetica-medium-r-*-*-*-100-*-*-*-iso8859-1", +"*foreground: #000000", +"*background: #C0C0C0", +"*XmTextField.foreground: #000000", +"*XmTextField.background: #FFFFFF", +"*list.foreground: #000000", +"*list.background: #FFFFFF", +"*ApplicationShell.title: XScreenSaver", +"*warning.title: XScreenSaver", +"*warning_popup.title: XScreenSaver", +"*allowShellResize: True", +"*autoUnmanage: False", +"*menubar*file.labelString: File", +"*menubar*file.mnemonic: F", +"*file.blank.labelString: Blank Screen Now", +"*file.blank.mnemonic: B", +"*file.lock.labelString: Lock Screen Now", +"*file.lock.mnemonic: L", +"*file.kill.labelString: Kill Daemon", +"*file.kill.mnemonic: K", +"*file.restart.labelString: Restart Daemon", +"*file.restart.mnemonic: R", +"*file.exit.labelString: Exit", +"*file.exit.mnemonic: E", +"*menubar*edit.labelString: Edit", +"*menubar*edit.mnemonic: E", +"*edit.cut.labelString: Cut", +"*edit.cut.mnemonic: u", +"*edit.copy.labelString: Copy", +"*edit.copy.mnemonic: C", +"*edit.paste.labelString: Paste", +"*edit.paste.mnemonic: P", +"*menubar*help.labelString: Help", +"*menubar*help.mnemonic: H", +"*help.about.labelString: About...", +"*help.about.mnemonic: A", +"*help.docMenu.labelString: Documentation...", +"*help.docMenu.mnemonic: D", +"*demoTab.marginWidth: 10", +"*optionsTab.marginWidth: 10", +"*XmScrolledWindow.topOffset: 10", +"*XmScrolledWindow.leftOffset: 10", +"*demoTab.topOffset: 4", +"*form1.bottomOffset: 10", +"*form3.leftOffset: 10", +"*form3.rightOffset: 10", +"*frame.topOffset: 10", +"*frame.bottomOffset: 10", +"*enabled.topOffset: 10", +"*visLabel.topOffset: 10", +"*combo.topOffset: 10", +"*form4.bottomOffset: 4", +"*hr.bottomOffset: 4", +"*XmComboBox.marginWidth: 0", +"*XmComboBox.marginHeight: 0", +"*demo.marginWidth: 30", +"*demo.marginHeight: 4", +"*man.marginWidth: 10", +"*man.marginHeight: 4", +"*down.leftOffset: 40", +"*down.marginWidth: 4", +"*down.marginHeight: 4", +"*up.marginWidth: 4", +"*up.marginHeight: 4", +"*frame.traversalOn: False", +"*list.automaticSelection: True", +"*list.visibleItemCount: 20", +"*doc.columns: 60", +"*combo.columns: 11", +"*demoTab.labelString: Graphics Demos", +"*optionsTab.labelString: Screensaver Options", +"*down.labelString: \\\\/ ", +"*up.labelString: /\\\\ ", +"*frameLabel.labelString: ", +"*cmdLabel.labelString: Command Line:", +"*cmdLabel.alignment: ALIGNMENT_BEGINNING", +"*enabled.labelString: Enabled", +"*visLabel.labelString: Visual:", +"*visLabel.alignment: ALIGNMENT_END", +"*visLabel.leftOffset: 20", +"*demo.labelString: Demo", +"*man.labelString: Documentation...", +"*done.labelString: Quit", +"*preferencesLabel.labelString: XScreenSaver Parameters", +"*timeoutLabel.labelString: Saver Timeout", +"*cycleLabel.labelString: Cycle Timeout", +"*fadeSecondsLabel.labelString: Fade Duration", +"*fadeTicksLabel.labelString: Fade Ticks", +"*lockLabel.labelString: Lock Timeout", +"*passwdLabel.labelString: Password Timeout", +"*preferencesForm*XmTextField.columns: 8", +"*verboseToggle.labelString: Verbose", +"*cmapToggle.labelString: Install Colormap", +"*fadeToggle.labelString: Fade Colormap", +"*unfadeToggle.labelString: Unfade Colormap", +"*lockToggle.labelString: Require Password", +"*OK.marginWidth: 30", +"*OK.marginHeight: 4", +"*OK.leftOffset: 10", +"*OK.bottomOffset: 10", +"*Cancel.marginWidth: 30", +"*Cancel.marginHeight: 4", +"*Cancel.rightOffset: 10", +"*Cancel.bottomOffset: 10", diff --git a/driver/XScreenSaver_ad.h b/driver/XScreenSaver_ad.h new file mode 100644 index 0000000..22e213a --- /dev/null +++ b/driver/XScreenSaver_ad.h @@ -0,0 +1,534 @@ +"#error Do not run app-defaults files through xrdb!", +"#error That does not do what you might expect.", +"#error Put this file in /usr/lib/X11/app-defaults/XScreenSaver instead.", +"*mode: random", +"*timeout: 0:10:00", +"*cycle: 0:10:00", +"*lockTimeout: 0:00:00", +"*passwdTimeout: 0:00:30", +"*dpmsEnabled: False", +"*dpmsQuickoffEnabled: False", +"*dpmsStandby: 2:00:00", +"*dpmsSuspend: 2:00:00", +"*dpmsOff: 4:00:00", +"*grabDesktopImages: True", +"*grabVideoFrames: False", +"*chooseRandomImages: True", +"*imageDirectory: /Library/Desktop Pictures/", +"*nice: 10", +"*memoryLimit: 0", +"*lock: False", +"*verbose: False", +"*fade: True", +"*unfade: True", +"*fadeSeconds: 0:00:03", +"*fadeTicks: 20", +"*splash: True", +"*splashDuration: 0:00:05", +"*visualID: default", +"*installColormap: True", +"*ignoreUninstalledPrograms: False", +"*authWarningSlack: 20", +"*textMode: file", +"*textLiteral: XScreenSaver", +"*textFile: ", +"*textProgram: fortune", +"*textURL: https://en.wikipedia.org/w/index.php?title=Special:NewPages&feed=rss", +"*demoCommand: xscreensaver-settings", +"*helpURL: https://www.jwz.org/xscreensaver/man.html", +"*loadURL: gnome-open '%s'", +"*manualCommand: yelp man:%s || \ + x-terminal-emulator -t '%s manual' \ + -e /bin/sh -c \"man %s; read foo\"", +"*dateFormat: %I:%M %p, %a %b %e", +"*newLoginCommand: no-such-login-manager", +"XScreenSaver.pointerHysteresis: 10", +"XScreenSaver.bourneShell: /bin/sh", +"*dialogTheme: default", +"*themeNames: Default, Borderless, Dark Gray, Borderless Black, \ + Green Black, White, Blue, Aqua Black, Wine", +"*Dialog.headingFont: sans-serif bold 16", +"*Dialog.bodyFont: sans-serif 14", +"*Dialog.errorFont: sans-serif bold 14", +"*Dialog.labelFont: sans-serif bold 14", +"*Dialog.unameFont: sans-serif 12", +"*Dialog.buttonFont: sans-serif bold 14", +"*Dialog.dateFont: sans-serif 9", +"*passwd.uname: True", +"*passwd.asterisks: True", +"*default.Dialog.foreground: #000000", +"*default.Dialog.background: #E6E6E6", +"*default.Dialog.button.foreground: #000000", +"*default.Dialog.button.background: #F5F5F5", +"*default.Dialog.logo.background: #BBBBBB", +"*default.Dialog.text.foreground: #000000", +"*default.Dialog.error.foreground: #FF0000", +"*default.Dialog.text.background: #FFFFFF", +"*default.Dialog.topShadowColor: #FFFFFF", +"*default.Dialog.bottomShadowColor: #CECECE", +"*default.Dialog.shadowWidth: 2", +"*default.Dialog.logo.width: 210", +"*default.Dialog.logo.height: 210", +"*default.Dialog.thermometer.foreground: #4464AC", +"*default.Dialog.thermometer.background: #FFFFFF", +"*default.Dialog.thermometer.width: 8", +"*default.Dialog.borderColor: #CECECE", +"*default.Dialog.borderWidth: 0", +"*default.Dialog.internalPadding: 24", +"*borderless.Dialog.topShadowColor: #E6E6E6", +"*borderless.Dialog.button.background: #FFFFFF", +"*borderless.Dialog.bottomShadowColor: #E6E6E6", +"*borderless.Dialog.logo.background: #E6E6E6", +"*borderless.Dialog.borderColor: #888888", +"*borderless.Dialog.thermometer.width: 6", +"*borderless.Dialog.borderWidth: 1", +"*darkgray.Dialog.foreground: #CCCCCC", +"*darkgray.Dialog.background: #333333", +"*darkgray.Dialog.topShadowColor: #444444", +"*darkgray.Dialog.bottomShadowColor: #111111", +"*darkgray.Dialog.borderColor: #111111", +"*darkgray.Dialog.text.foreground: #DDDDDD", +"*darkgray.Dialog.text.background: #666666", +"*darkgray.Dialog.button.foreground: #CCCCCC", +"*darkgray.Dialog.button.background: #666666", +"*darkgray.Dialog.logo.background: #444444", +"*darkgray.Dialog.thermometer.foreground: #4464AC", +"*darkgray.Dialog.thermometer.background: #666666", +"*darkgray.Dialog.borderWidth: 0", +"*borderlessblack.Dialog.foreground: #CCCCCC", +"*borderlessblack.Dialog.background: #000000", +"*borderlessblack.Dialog.topShadowColor: #000000", +"*borderlessblack.Dialog.bottomShadowColor: #000000", +"*borderlessblack.Dialog.text.foreground: #CCCCCC", +"*borderlessblack.Dialog.text.background: #000000", +"*borderlessblack.Dialog.button.foreground: #CCCCCC", +"*borderlessblack.Dialog.button.background: #333333", +"*borderlessblack.Dialog.logo.background: #000000", +"*borderlessblack.Dialog.thermometer.foreground: #CCCCCC", +"*borderlessblack.Dialog.thermometer.background: #333333", +"*borderlessblack.Dialog.thermometer.width: 3", +"*borderlessblack.Dialog.borderColor: #333333", +"*borderlessblack.Dialog.borderWidth: 1", +"*greenblack.Dialog.foreground: #00FF00", +"*greenblack.Dialog.background: #000000", +"*greenblack.Dialog.topShadowColor: #000000", +"*greenblack.Dialog.bottomShadowColor: #000000", +"*greenblack.Dialog.shadowWidth: 1", +"*greenblack.Dialog.text.foreground: #00FF00", +"*greenblack.Dialog.text.background: #006600", +"*greenblack.Dialog.button.foreground: #00FF00", +"*greenblack.Dialog.button.background: #006600", +"*greenblack.Dialog.logo.background: #000000", +"*greenblack.Dialog.thermometer.foreground: #00CC00", +"*greenblack.Dialog.thermometer.background: #006600", +"*greenblack.Dialog.borderColor: #006600", +"*greenblack.Dialog.borderWidth: 1", +"*white.Dialog.foreground: #000000", +"*white.Dialog.background: #FFFFFF", +"*white.Dialog.topShadowColor: #CCCCCC", +"*white.Dialog.bottomShadowColor: #CCCCCC", +"*white.Dialog.shadowWidth: 1", +"*white.Dialog.borderColor: #CCCCCC", +"*white.Dialog.text.foreground: #000000", +"*white.Dialog.text.background: #FFFFFF", +"*white.Dialog.button.foreground: #000000", +"*white.Dialog.button.background: #FFFFFF", +"*white.Dialog.logo.background: #FFFFFF", +"*white.Dialog.borderWidth: 0", +"*blue.Dialog.foreground: #000000", +"*blue.Dialog.background: #BBCCDD", +"*blue.Dialog.topShadowColor: #CCDDEE", +"*blue.Dialog.bottomShadowColor: #AABBCC", +"*blue.Dialog.borderColor: #AABBCC", +"*blue.Dialog.text.foreground: #000000", +"*blue.Dialog.text.background: #DDEEFF", +"*blue.Dialog.button.foreground: #000000", +"*blue.Dialog.button.background: #DDEEFF", +"*blue.Dialog.logo.background: #BBCCDD", +"*blue.Dialog.thermometer.foreground: #5566AA", +"*blue.Dialog.thermometer.background: #BBCCDD", +"*blue.Dialog.borderWidth: 0", +"*aquablack.Dialog.foreground: #00EFEF", +"*aquablack.Dialog.background: #000000", +"*aquablack.Dialog.topShadowColor: #000000", +"*aquablack.Dialog.bottomShadowColor: #000000", +"*aquablack.Dialog.shadowWidth: 2", +"*aquablack.Dialog.button.foreground: #000000", +"*aquablack.Dialog.button.background: #2244EE", +"*aquablack.Dialog.logo.background: #000000", +"*aquablack.Dialog.text.foreground: #2244EE", +"*aquablack.Dialog.text.background: #EEEEEE", +"*aquablack.Dialog.thermometer.foreground: #2244EE", +"*aquablack.Dialog.thermometer.background: #000088", +"*aquablack.Dialog.borderColor: #000066", +"*aquablack.Dialog.borderWidth: 1", +"*aquablack.Dialog.internalPadding: 36", +"*wine.Dialog.foreground: #AD8FA6", +"*wine.Dialog.background: #2C041E", +"*wine.Dialog.topShadowColor: #2C041E", +"*wine.Dialog.bottomShadowColor: #2C041E", +"*wine.Dialog.text.foreground: #706B70", +"*wine.Dialog.text.background: #F9F9F8", +"*wine.Dialog.button.foreground: #5F585B", +"*wine.Dialog.logo.background: #2C041E", +"*wine.Dialog.thermometer.foreground: #AD8FA6", +"*wine.Dialog.thermometer.background: #4D2946", +"*wine.Dialog.borderColor: #4D2946", +"*wine.Dialog.thermometer.width: 6", +"*wine.Dialog.borderWidth: 1", +"*errorFont: sans-serif bold 18", +"*errorColor: #FF0000", +"*programs: \ + maze -root \\n\ + GL: superquadrics -root \\n\ + attraction -root \\n\ + blitspin -root \\n\ + greynetic -root \\n\ + helix -root \\n\ + hopalong -root \\n\ + imsmap -root \\n\ +- noseguy -root \\n\ +- pyro -root \\n\ + qix -root \\n\ +- rocks -root \\n\ + rorschach -root \\n\ + decayscreen -root \\n\ + flame -root \\n\ + halo -root \\n\ + slidescreen -root \\n\ + pedal -root \\n\ + bouboule -root \\n\ +- braid -root \\n\ + coral -root \\n\ + deco -root \\n\ + drift -root \\n\ +- fadeplot -root \\n\ + galaxy -root \\n\ + goop -root \\n\ + grav -root \\n\ + ifs -root \\n\ + GL: jigsaw -root \\n\ + julia -root \\n\ +- kaleidescope -root \\n\ + GL: moebius -root \\n\ + moire -root \\n\ + GL: morph3d -root \\n\ + mountain -root \\n\ + munch -root \\n\ + penrose -root \\n\ + GL: pipes -root \\n\ + rd-bomb -root \\n\ + GL: rubik -root \\n\ +- sierpinski -root \\n\ + slip -root \\n\ + GL: sproingies -root \\n\ + starfish -root \\n\ + strange -root \\n\ + swirl -root \\n\ + triangle -root \\n\ + xjack -root \\n\ + xlyap -root \\n\ + GL: atlantis -root \\n\ + bsod -root \\n\ + GL: bubble3d -root \\n\ + GL: cage -root \\n\ +- crystal -root \\n\ + cynosure -root \\n\ + discrete -root \\n\ + distort -root \\n\ + epicycle -root \\n\ + flow -root \\n\ + GL: glplanet -root \\n\ + interference -root \\n\ + kumppa -root \\n\ + GL: lament -root \\n\ + moire2 -root \\n\ + GL: sonar -root \\n\ + GL: stairs -root \\n\ + truchet -root \\n\ +- vidwhacker -root \\n\ + blaster -root \\n\ + bumps -root \\n\ + ccurve -root \\n\ + compass -root \\n\ + deluxe -root \\n\ +- demon -root \\n\ + GL: extrusion -root \\n\ +- loop -root \\n\ + penetrate -root \\n\ + petri -root \\n\ + phosphor -root \\n\ + GL: pulsar -root \\n\ + ripples -root \\n\ + shadebobs -root \\n\ + GL: sierpinski3d -root \\n\ + spotlight -root \\n\ + squiral -root \\n\ + wander -root \\n\ +- webcollage -root \\n\ + xflame -root \\n\ + xmatrix -root \\n\ + GL: gflux -root \\n\ +- nerverot -root \\n\ + xrayswarm -root \\n\ + xspirograph -root \\n\ + GL: circuit -root \\n\ + GL: dangerball -root \\n\ +- GL: dnalogo -root \\n\ + GL: engine -root \\n\ + GL: flipscreen3d -root \\n\ + GL: gltext -root \\n\ + GL: menger -root \\n\ + GL: molecule -root \\n\ + rotzoomer -root \\n\ + scooter -root \\n\ + speedmine -root \\n\ + GL: starwars -root \\n\ + GL: stonerview -root \\n\ + vermiculate -root \\n\ + whirlwindwarp -root \\n\ + zoom -root \\n\ + anemone -root \\n\ + apollonian -root \\n\ + GL: boxed -root \\n\ + GL: cubenetic -root \\n\ + GL: endgame -root \\n\ + euler2d -root \\n\ + fluidballs -root \\n\ + GL: flurry -root \\n\ +- GL: glblur -root \\n\ + GL: glsnake -root \\n\ + halftone -root \\n\ + GL: juggler3d -root \\n\ + GL: lavalite -root \\n\ +- polyominoes -root \\n\ + GL: queens -root \\n\ +- GL: sballs -root \\n\ + GL: spheremonics -root \\n\ +- thornbird -root \\n\ + twang -root \\n\ +- GL: antspotlight -root \\n\ + apple2 -root \\n\ + GL: atunnel -root \\n\ + barcode -root \\n\ + GL: blinkbox -root \\n\ + GL: blocktube -root \\n\ + GL: bouncingcow -root \\n\ + cloudlife -root \\n\ + GL: cubestorm -root \\n\ + eruption -root \\n\ + GL: flipflop -root \\n\ + GL: flyingtoasters -root \\n\ + fontglide -root \\n\ + GL: gleidescope -root \\n\ + GL: glknots -root \\n\ + GL: glmatrix -root \\n\ +- GL: glslideshow -root \\n\ + GL: hypertorus -root \\n\ +- GL: jigglypuff -root \\n\ + metaballs -root \\n\ + GL: mirrorblob -root \\n\ + piecewise -root \\n\ + GL: polytopes -root \\n\ + pong -root \\n\ + popsquares -root \\n\ + GL: surfaces -root \\n\ + xanalogtv -root \\n\ + abstractile -root \\n\ + anemotaxis -root \\n\ +- GL: antinspect -root \\n\ + fireworkx -root \\n\ + fuzzyflakes -root \\n\ + interaggregate -root \\n\ + intermomentary -root \\n\ + memscroller -root \\n\ + GL: noof -root \\n\ + pacman -root \\n\ + GL: pinion -root \\n\ + GL: polyhedra -root \\n\ +- GL: providence -root \\n\ + substrate -root \\n\ + wormhole -root \\n\ +- GL: antmaze -root \\n\ + GL: boing -root \\n\ + boxfit -root \\n\ + GL: carousel -root \\n\ + celtic -root \\n\ + GL: crackberg -root \\n\ + GL: cube21 -root \\n\ + fiberlamp -root \\n\ + GL: fliptext -root \\n\ + GL: glhanoi -root \\n\ + GL: tangram -root \\n\ + GL: timetunnel -root \\n\ + GL: glschool -root \\n\ + GL: topblock -root \\n\ + GL: cubicgrid -root \\n\ + cwaves -root \\n\ + GL: gears -root \\n\ + GL: glcells -root \\n\ + GL: lockward -root \\n\ + m6502 -root \\n\ + GL: moebiusgears -root \\n\ + GL: voronoi -root \\n\ + GL: hypnowheel -root \\n\ + GL: klein -root \\n\ +- lcdscrub -root \\n\ + GL: photopile -root \\n\ + GL: skytentacles -root \\n\ + GL: rubikblocks -root \\n\ + GL: companioncube -root \\n\ + GL: hilbert -root \\n\ + GL: tronbit -root \\n\ + GL: geodesic -root \\n\ + hexadrop -root \\n\ + GL: kaleidocycle -root \\n\ + GL: quasicrystal -root \\n\ + GL: unknownpleasures -root \\n\ + binaryring -root \\n\ + GL: cityflow -root \\n\ + GL: geodesicgears -root \\n\ + GL: projectiveplane -root \\n\ + GL: romanboy -root \\n\ + tessellimage -root \\n\ + GL: winduprobot -root \\n\ + GL: splitflap -root \\n\ + GL: cubestack -root \\n\ + GL: cubetwist -root \\n\ + GL: discoball -root \\n\ + GL: dymaxionmap -root \\n\ + GL: energystream -root \\n\ + GL: hexstrut -root \\n\ + GL: hydrostat -root \\n\ + GL: raverhoop -root \\n\ + GL: splodesic -root \\n\ + GL: unicrud -root \\n\ + GL: esper -root \\n\ + GL: vigilance -root \\n\ + GL: crumbler -root \\n\ + filmleader -root \\n\ + glitchpeg -root \\n\ + GL: handsy -root \\n\ + GL: maze3d -root \\n\ + GL: peepers -root \\n\ + GL: razzledazzle -root \\n\ + vfeedback -root \\n\ + GL: deepstars -root \\n\ + GL: gravitywell -root \\n\ + GL: beats -root \\n\ + GL: covid19 -root \\n\ + GL: etruscanvenus -root \\n\ + GL: gibson -root \\n\ + GL: headroom -root \\n\ + GL: sphereeversion -root \\n", +"*hacks.antinspect.name: Ant Inspect", +"*hacks.antmaze.name: Ant Maze", +"*hacks.antspotlight.name: Ant Spotlight", +"*hacks.apple2.name: Apple ][", +"*hacks.binaryring.name: Binary Ring", +"*hacks.blinkbox.name: Blink Box", +"*hacks.blitspin.name: Blit Spin", +"*hacks.blocktube.name: Block Tube", +"*hacks.bouncingcow.name: Bouncing Cow", +"*hacks.boxfit.name: Box Fit", +"*hacks.bsod.name: BSOD", +"*hacks.bubble3d.name: Bubble 3D", +"*hacks.ccurve.name: C Curve", +"*hacks.cityflow.name: City Flow", +"*hacks.cloudlife.name: Cloud Life", +"*hacks.companioncube.name: Companion Cube", +"*hacks.covid19.name: COVID19", +"*hacks.cube21.name: Cube 21", +"*hacks.cubestack.name: Cube Stack", +"*hacks.cubestorm.name: Cube Storm", +"*hacks.cubetwist.name: Cube Twist", +"*hacks.cubicgrid.name: Cubic Grid", +"*hacks.cwaves.name: C Waves", +"*hacks.dangerball.name: Danger Ball", +"*hacks.decayscreen.name: Decay Screen", +"*hacks.deepstars.name: Deep Stars", +"*hacks.dnalogo.name: DNA Logo", +"*hacks.dymaxionmap.name: Dymaxion Map", +"*hacks.energystream.name: Energy Stream", +"*hacks.etruscanvenus.name: Etruscan Venus", +"*hacks.euler2d.name: Euler 2D", +"*hacks.fadeplot.name: Fade Plot", +"*hacks.fiberlamp.name: Fiber Lamp", +"*hacks.filmleader.name: Film Leader", +"*hacks.flipflop.name: Flip Flop", +"*hacks.flipscreen3d.name: Flip Screen 3D", +"*hacks.fliptext.name: Flip Text", +"*hacks.fluidballs.name: Fluid Balls", +"*hacks.flyingtoasters.name: Flying Toasters", +"*hacks.fontglide.name: Font Glide", +"*hacks.fuzzyflakes.name: Fuzzy Flakes", +"*hacks.geodesicgears.name: Geodesic Gears", +"*hacks.gflux.name: GFlux", +"*hacks.glblur.name: GL Blur", +"*hacks.glcells.name: GL Cells", +"*hacks.gleidescope.name: Gleidescope", +"*hacks.glforestfire.name: GL Forest Fire", +"*hacks.glhanoi.name: GL Hanoi", +"*hacks.glitchpeg.name: GlitchPEG", +"*hacks.glknots.name: GL Knots", +"*hacks.glmatrix.name: GL Matrix", +"*hacks.glplanet.name: GL Planet", +"*hacks.glschool.name: GL School", +"*hacks.glslideshow.name: GL Slideshow", +"*hacks.glsnake.name: GL Snake", +"*hacks.gltext.name: GL Text", +"*hacks.gravitywell.name: Gravity Well", +"*hacks.hexstrut.name: Hex Strut", +"*hacks.ifs.name: IFS", +"*hacks.imsmap.name: IMS Map", +"*hacks.jigglypuff.name: Jiggly Puff", +"*hacks.juggler3d.name: Juggler 3D", +"*hacks.lcdscrub.name: LCD Scrub", +"*hacks.lmorph.name: LMorph", +"*hacks.m6502.name: m6502", +"*hacks.maze3d.name: Maze 3D", +"*hacks.memscroller.name: Mem Scroller", +"*hacks.metaballs.name: Meta Balls", +"*hacks.mirrorblob.name: Mirror Blob", +"*hacks.moebius.name: Möbius", +"*hacks.moebiusgears.name: Möbius Gears", +"*hacks.moire.name: Moiré", +"*hacks.moire2.name: Moiré 2", +"*hacks.morph3d.name: Morph 3D", +"*hacks.nerverot.name: Nerve Rot", +"*hacks.noseguy.name: Nose Guy", +"*hacks.pacman.name: Pac-Man", +"*hacks.photopile.name: Photo Pile", +"*hacks.popsquares.name: Pop Squares", +"*hacks.projectiveplane.name:Projective Plane", +"*hacks.quasicrystal.name: Quasi-Crystal", +"*hacks.raverhoop.name: Raver Hoop", +"*hacks.razzledazzle.name: Razzle Dazzle", +"*hacks.rd-bomb.name: RD-Bomb", +"*hacks.rd-bomb.name: RD-Bomb", +"*hacks.romanboy.name: Roman Boy", +"*hacks.rotzoomer.name: Rot Zoomer", +"*hacks.rubikblocks.name: Rubik Blocks", +"*hacks.sballs.name: SBalls", +"*hacks.shadebobs.name: Shade Bobs", +"*hacks.sierpinski3d.name: Sierpinski 3D", +"*hacks.skytentacles.name: Sky Tentacles", +"*hacks.slidescreen.name: Slide Screen", +"*hacks.speedmine.name: Speed Mine", +"*hacks.sphereeversion.name: Sphere Eversion", +"*hacks.splitflap.name: Split-Flap", +"*hacks.starwars.name: Star Wars", +"*hacks.stonerview.name: Stoner View", +"*hacks.t3d.name: T3D", +"*hacks.testx11.name: Test X11", +"*hacks.timetunnel.name: Time Tunnel", +"*hacks.topblock.name: Top Block", +"*hacks.tronbit.name: Tron Bit", +"*hacks.unknownpleasures.name:Unknown Pleasures", +"*hacks.vfeedback.name: VFeedback", +"*hacks.vidwhacker.name: Vid Whacker", +"*hacks.webcollage.name: Web Collage", +"*hacks.whirlwindwarp.name: Whirlwind Warp", +"*hacks.winduprobot.name: Windup Robot", +"*hacks.xanalogtv.name: XAnalogTV", +"*hacks.xrayswarm.name: XRaySwarm", diff --git a/driver/atoms.c b/driver/atoms.c new file mode 100644 index 0000000..e8b6add --- /dev/null +++ b/driver/atoms.c @@ -0,0 +1,70 @@ +/* xscreensaver-command, Copyright © 1991-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#include /* for CARD32 */ +#include +#include + +#include "atoms.h" + +Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_RESPONSE, + XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO, XA_EXIT, + XA_BLANK, XA_LOCK, XA_ACTIVATE, XA_SUSPEND, XA_NEXT, XA_PREV, + XA_DEACTIVATE, XA_CYCLE, XA_RESTART, XA_PREFS, + XA_NET_WM_PID, XA_NET_WM_STATE, XA_NET_WM_STATE_ABOVE, + XA_NET_WM_STATE_FULLSCREEN, XA_NET_WM_BYPASS_COMPOSITOR, + XA_NET_WM_WINDOW_TYPE, XA_NET_WM_WINDOW_TYPE_SPLASH, + XA_NET_WM_WINDOW_TYPE_DIALOG, XA_NET_WM_WINDOW_TYPE_NOTIFICATION, + XA_NET_WM_WINDOW_TYPE_NORMAL; + +void +init_xscreensaver_atoms (Display *dpy) +{ +# define A(N) XInternAtom (dpy, (N), False) + XA_SCREENSAVER = A("SCREENSAVER"); + XA_SCREENSAVER_ID = A("_SCREENSAVER_ID"); + XA_SCREENSAVER_VERSION = A("_SCREENSAVER_VERSION"); + XA_SCREENSAVER_STATUS = A("_SCREENSAVER_STATUS"); + XA_SCREENSAVER_RESPONSE = A("_SCREENSAVER_RESPONSE"); + + XA_ACTIVATE = A("ACTIVATE"); + XA_DEACTIVATE = A("DEACTIVATE"); + XA_SUSPEND = A("SUSPEND"); + XA_RESTART = A("RESTART"); + XA_CYCLE = A("CYCLE"); + XA_NEXT = A("NEXT"); + XA_PREV = A("PREV"); + XA_SELECT = A("SELECT"); + XA_EXIT = A("EXIT"); + XA_DEMO = A("DEMO"); + XA_PREFS = A("PREFS"); + XA_LOCK = A("LOCK"); + XA_BLANK = A("BLANK"); + + XA_NET_WM_PID = A("_NET_WM_PID"); + XA_NET_WM_STATE = A("_NET_WM_STATE"); + XA_NET_WM_STATE_ABOVE = A("_NET_WM_STATE_ABOVE"); + XA_NET_WM_STATE_FULLSCREEN = A("_NET_WM_STATE_FULLSCREEN"); + XA_NET_WM_BYPASS_COMPOSITOR = A("_NET_WM_BYPASS_COMPOSITOR"); + XA_NET_WM_WINDOW_TYPE = A("_NET_WM_WINDOW_TYPE"); + XA_NET_WM_WINDOW_TYPE_SPLASH = A("_NET_WM_WINDOW_TYPE_SPLASH"); + XA_NET_WM_WINDOW_TYPE_DIALOG = A("_NET_WM_WINDOW_TYPE_DIALOG"); + XA_NET_WM_WINDOW_TYPE_NOTIFICATION = A("_NET_WM_WINDOW_TYPE_NOTIFICATION"); + XA_NET_WM_WINDOW_TYPE_NORMAL = A("_NET_WM_WINDOW_TYPE_NORMAL"); +# undef A +} diff --git a/driver/atoms.h b/driver/atoms.h new file mode 100644 index 0000000..b5a7b7c --- /dev/null +++ b/driver/atoms.h @@ -0,0 +1,38 @@ +/* xscreensaver-command, Copyright © 1991-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifndef _XSCREENSAVER_ATOMS_H_ +#define _XSCREENSAVER_ATOMS_H_ + +extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_RESPONSE, + XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO, XA_EXIT, + XA_BLANK, XA_LOCK, XA_ACTIVATE, XA_SUSPEND, XA_NEXT, XA_PREV, + XA_DEACTIVATE, XA_CYCLE, XA_RESTART, XA_PREFS, + XA_NET_WM_PID, XA_NET_WM_STATE, XA_NET_WM_STATE_ABOVE, + XA_NET_WM_STATE_FULLSCREEN, XA_NET_WM_BYPASS_COMPOSITOR, + XA_NET_WM_WINDOW_TYPE, XA_NET_WM_WINDOW_TYPE_SPLASH, + XA_NET_WM_WINDOW_TYPE_DIALOG, XA_NET_WM_WINDOW_TYPE_NOTIFICATION, + XA_NET_WM_WINDOW_TYPE_NORMAL; + +extern void init_xscreensaver_atoms (Display *dpy); +extern void xscreensaver_set_wm_atoms (Display *, Window, + int width, int height, + Window for_window); + +/* You might think that to store an array of 32-bit quantities onto a + server-side property, you would pass an array of 32-bit data quantities + into XChangeProperty(). You would be wrong. You have to use an array + of longs, even if long is 64 bits (using 32 of each 64.) + */ +typedef long PROP32; + + +#endif /* _XSCREENSAVER_ATOMS_H_ */ diff --git a/driver/atomswm.c b/driver/atomswm.c new file mode 100644 index 0000000..887dc2c --- /dev/null +++ b/driver/atomswm.c @@ -0,0 +1,101 @@ +/* xscreensaver-command, Copyright © 1991-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include +#include /* for CARD32 */ +#include +#include +#include + +#include "atoms.h" + +#ifdef HAVE_UNAME +# include /* for uname() */ +#endif /* HAVE_UNAME */ + + +/* Set some properties to hopefully tell the window manager to leave us alone. + This is used by xscreensaver-gfx and xscreensaver-auth but not xscreensaver. + */ +void +xscreensaver_set_wm_atoms (Display *dpy, Window window, int width, int height, + Window for_window) +{ + XClassHint class_hints; + XSizeHints size_hints; +# ifdef HAVE_UNAME + struct utsname uts; +# endif + Atom va[10]; + long vl[10]; + class_hints.res_name = "xscreensaver"; /* not progname */ + class_hints.res_class = "XScreenSaver"; + size_hints.flags = PMinSize | PMaxSize; + size_hints.min_width = size_hints.max_width = width; /* non-resizable */ + size_hints.min_height = size_hints.max_height = height; + XStoreName (dpy, window, "XScreenSaver"); + XSetClassHint (dpy, window, &class_hints); + XSetWMNormalHints (dpy, window, &size_hints); + + /* XA_WM_COMMAND and _NET_WM_PID are later updated by spawn_screenhack. */ + XChangeProperty (dpy, window, XA_WM_COMMAND, + XA_STRING, 8, PropModeReplace, + (unsigned char *) class_hints.res_name, + strlen (class_hints.res_name)); + +# ifdef HAVE_UNAME + if (! uname (&uts)) + XChangeProperty (dpy, window, + XA_WM_CLIENT_MACHINE, XA_STRING, 8, + PropModeReplace, (unsigned char *) uts.nodename, + strlen (uts.nodename)); +# endif + + /* In the olden days, OverrideRedirect meant that the window manager did + not see or touch our window, but these days, compositing WMs like to + get up to all sorts of shenanigans. I don't know whether setting these + properties has any effect, but they *might* tell the WM to keep its + grubby paws off of our windows. + */ + + vl[0] = 1; /* _NET_WM_BYPASS_COMPOSITOR = 1 */ + XChangeProperty (dpy, window, XA_NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32, + PropModeReplace, (unsigned char *) vl, 1); + + /* _NET_WM_STATE = [ _NET_WM_STATE_ABOVE, _NET_WM_STATE_FULLSCREEN ] */ + va[0] = XA_NET_WM_STATE_ABOVE; + va[1] = XA_NET_WM_STATE_FULLSCREEN; + XChangeProperty (dpy, window, XA_NET_WM_STATE, XA_ATOM, 32, + PropModeReplace, (unsigned char *) va, 2); + + /* As there is no _NET_WM_WINDOW_TYPE_SCREENSAVER, which property is + most likely to effectively communicate "on top always" to the WM? + _NET_WM_WINDOW_TYPE = NORMAL, SPLASH, DIALOG or NOTIFICATION? */ + va[0] = XA_NET_WM_WINDOW_TYPE_NOTIFICATION; + XChangeProperty (dpy, window, XA_NET_WM_WINDOW_TYPE, XA_ATOM, 32, + PropModeReplace, (unsigned char *) va, 1); + + if (for_window) /* This is the error dialog for a saver window */ + { + va[0] = for_window; + /* _WM_TRANSIENT_FOR = screensaver_window */ + XChangeProperty (dpy, window, + XA_WM_TRANSIENT_FOR, XA_WINDOW, 32, + PropModeReplace, (unsigned char *) va, 1); + } +} diff --git a/driver/auth.h b/driver/auth.h index 65e00f3..40594ea 100644 --- a/driver/auth.h +++ b/driver/auth.h @@ -1,9 +1,7 @@ /* auth.h --- Providing authentication mechanisms. - * + * Copyright © 1993-2021 Jamie Zawinski * (c) 2007, Quest Software, Inc. All rights reserved. - * - * This file is part of XScreenSaver, - * Copyright (c) 1993-2004 Jamie Zawinski + * This file is part of XScreenSaver. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -13,10 +11,8 @@ * software for any purpose. It is provided "as is" without express or * implied warranty. */ -#ifndef XSS_AUTH_H -#define XSS_AUTH_H - -#include "types.h" +#ifndef __XSCREENSAVER_AUTH_H__ +#define __XSCREENSAVER_AUTH_H__ #undef Bool #undef True @@ -25,7 +21,9 @@ #define True 1 #define False 0 -struct auth_message { +extern Bool verbose_p; + +typedef struct { enum { AUTH_MSGTYPE_INFO, AUTH_MSGTYPE_ERROR, @@ -33,22 +31,61 @@ struct auth_message { AUTH_MSGTYPE_PROMPT_ECHO } type; const char *msg; -}; +} auth_message; -struct auth_response { +typedef struct { char *response; -}; +} auth_response; -int -gui_auth_conv(int num_msg, - const struct auth_message auth_msgs[], - struct auth_response **resp, - saver_info *si); -void -xss_authenticate(saver_info *si, Bool verbose_p); +/* To run all authentication methods. + */ +extern void disavow_privileges (void); +extern Bool lock_priv_init (void); +extern Bool lock_init (void); + +/* Returns true if authenticated. */ +extern Bool xscreensaver_auth (void *closure, + Bool (*conv_fn) (void *closure, + int nmsgs, + const auth_message *msg, + auth_response **resp), + void (*finished_fn) (void *closure, + Bool authenticated_p)); -void -auth_finished_cb (saver_info *si); +/* The implementations, called by xscreensaver_auth. + */ +#ifdef HAVE_KERBEROS +extern Bool kerberos_lock_init (void); +extern Bool kerberos_passwd_valid_p (void *closure, const char *plaintext); #endif + +#ifdef HAVE_PAM +extern Bool pam_priv_init (void); +extern Bool pam_try_unlock (void *closure, + Bool (*conv_fn) (void *closure, + int nmsgs, + const auth_message *msg, + auth_response **resp)); +#endif + +#ifdef PASSWD_HELPER_PROGRAM +extern Bool ext_priv_init (void); +extern Bool ext_passwd_valid_p (void *closure, const char *plaintext); +#endif + +extern Bool pwent_lock_init (void); +extern Bool pwent_priv_init (void); +extern Bool pwent_passwd_valid_p (void *closure, const char *plaintext); + +/* GUI conversation function to pass to xscreensaver_auth. */ +extern Bool xscreensaver_auth_conv (void *closure, + int num_msg, + const auth_message *msg, + auth_response **resp); +extern void xscreensaver_auth_finished (void *closure, Bool authenticated_p); +extern void xscreensaver_splash (void *root_widget); + +#endif /* __XSCREENSAVER_AUTH_H__ */ + diff --git a/driver/blurb.c b/driver/blurb.c new file mode 100644 index 0000000..d732a9b --- /dev/null +++ b/driver/blurb.c @@ -0,0 +1,50 @@ +/* xscreensaver, Copyright © 1991-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "blurb.h" + +#include +#include + +const char *progname = ""; +int verbose_p = 0; + +const char * +blurb (void) +{ + static char buf[255] = { 0 }; + struct tm tm; + time_t now; + int i; + + now = time ((time_t *) 0); + localtime_r (&now, &tm); + i = strlen (progname); + if (i > 40) i = 40; + memcpy (buf, progname, i); + buf[i++] = ':'; + buf[i++] = ' '; + buf[i++] = '0' + (tm.tm_hour >= 10 ? tm.tm_hour/10 : 0); + buf[i++] = '0' + (tm.tm_hour % 10); + buf[i++] = ':'; + buf[i++] = '0' + (tm.tm_min >= 10 ? tm.tm_min/10 : 0); + buf[i++] = '0' + (tm.tm_min % 10); + buf[i++] = ':'; + buf[i++] = '0' + (tm.tm_sec >= 10 ? tm.tm_sec/10 : 0); + buf[i++] = '0' + (tm.tm_sec % 10); + buf[i] = 0; + return buf; +} + diff --git a/driver/blurb.h b/driver/blurb.h new file mode 100644 index 0000000..6e33c76 --- /dev/null +++ b/driver/blurb.h @@ -0,0 +1,11 @@ +/* progname plus timestamp */ + +#ifndef __BLURB_H__ +#define __BLURB_H__ + +extern const char *progname; +extern int verbose_p; +extern const char *blurb (void); + +#endif /* __BLURB_H__ */ + diff --git a/driver/clientmsg.c b/driver/clientmsg.c new file mode 100644 index 0000000..f3d9d71 --- /dev/null +++ b/driver/clientmsg.c @@ -0,0 +1,123 @@ +/* xscreensaver, Copyright © 1991-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +#include "blurb.h" +#include "atoms.h" +#include "clientmsg.h" + +extern Bool verbose_p; + +static int +error_handler (Display *dpy, XErrorEvent *error) +{ + return 0; +} + + +Window +find_screensaver_window (Display *dpy, char **version) +{ + int i; + Window root = RootWindowOfScreen (DefaultScreenOfDisplay (dpy)); + Window root2, parent, *kids; + unsigned int nkids; + XErrorHandler old_handler; + Window ret = 0; + + XSync (dpy, False); + old_handler = XSetErrorHandler (error_handler); + + if (version) *version = 0; + + if (! XQueryTree (dpy, root, &root2, &parent, &kids, &nkids)) + abort (); + if (root != root2) + abort (); + if (parent) + abort (); + if (! (kids && nkids)) + goto DONE; + for (i = 0; i < nkids; i++) + { + Atom type; + int format; + unsigned long nitems, bytesafter; + unsigned char *v = 0; + int status; + + /* We're walking the list of root-level windows and trying to find + the one that has a particular property on it. We need to trap + BadWindows errors while doing this, because it's possible that + some random window might get deleted in the meantime. (That + window won't have been the one we're looking for.) + */ + status = XGetWindowProperty (dpy, kids[i], + XA_SCREENSAVER_VERSION, + 0, 200, False, XA_STRING, + &type, &format, &nitems, &bytesafter, + &v); + if (status == Success && type != None) + { + ret = kids[i]; + if (version) + *version = (char *) v; + else + XFree (v); + goto DONE; + } + if (v) XFree (v); + } + + DONE: + if (kids) XFree (kids); + XSetErrorHandler (old_handler); + return ret; +} + + +void +clientmessage_response (Display *dpy, XEvent *xev, Bool ok, const char *msg) +{ + char *proto; + int L = 0; + + if (verbose_p || !ok) + { + Atom cmd = xev->xclient.data.l[0]; + char *name = XGetAtomName (dpy, cmd); + fprintf (stderr, "%s: ClientMessage %s: %s\n", blurb(), + (name ? name : "???"), msg); + } + + L = strlen (msg); + proto = (char *) malloc (L + 2); + if (!proto) return; + proto[0] = (ok ? '+' : '-'); + memcpy (proto+1, msg, L); + L++; + proto[L] = 0; + + XChangeProperty (dpy, xev->xclient.window, + XA_SCREENSAVER_RESPONSE, XA_STRING, 8, + PropModeReplace, (unsigned char *) proto, L); + free (proto); +} diff --git a/driver/clientmsg.h b/driver/clientmsg.h new file mode 100644 index 0000000..cd836d8 --- /dev/null +++ b/driver/clientmsg.h @@ -0,0 +1,19 @@ +/* xscreensaver, Copyright © 1991-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifndef __CLIENTMSG_H__ +#define __CLIENTMSG_H__ + +extern Window find_screensaver_window (Display *, char **version); +extern void clientmessage_response (Display *, XEvent *, Bool ok, + const char *msg); + +#endif /* __CLIENTMSG_H__ */ diff --git a/driver/demo-Gtk-conf.c b/driver/demo-Gtk-conf.c index bac6ecc..6d04215 100644 --- a/driver/demo-Gtk-conf.c +++ b/driver/demo-Gtk-conf.c @@ -1,5 +1,5 @@ /* demo-Gtk-conf.c --- implements the dynamic configuration dialogs. - * xscreensaver, Copyright (c) 2001-2014 Jamie Zawinski + * xscreensaver, Copyright (c) 2001-2020 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -59,8 +59,21 @@ # endif /* LIBXML_VERSION */ #endif /* xmlChildrenNode */ +#if (__GNUC__ >= 4) /* Ignore useless warnings generated by gtk.h */ +# undef inline +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wstrict-prototypes" +# pragma GCC diagnostic ignored "-Wlong-long" +# pragma GCC diagnostic ignored "-Wvariadic-macros" +# pragma GCC diagnostic ignored "-Wpedantic" +#endif + #include +#if (__GNUC__ >= 4) +# pragma GCC diagnostic pop +#endif + #include "demo-Gtk-conf.h" /* Deal with deprecation of direct access to struct fields on the way to GTK3 @@ -1320,7 +1333,7 @@ parameters_to_cmd_line (GList *parms, gboolean default_p) { int L = g_list_length (parms); int LL = 0; - char **strs = (char **) calloc (sizeof (*parms), L); + char **strs = (char **) calloc (sizeof (*strs), L); char *result; char *out; int i, j; @@ -1428,7 +1441,7 @@ parse_command_line_into_parameters (const char *filename, char *option = rest->data; rest->data = 0; - if (option[0] != '-' && option[0] != '+') + if (option && option[0] != '-' && option[0] != '+') { if (debug_p) fprintf (stderr, "%s: WARNING: %s: not a switch: \"%s\"\n", @@ -1737,7 +1750,8 @@ get_description (GList *parms, gboolean verbose_p) s++; else if (s[1] == ' ' || s[1] == '\t') s++; /* next line is indented: leave newline */ - else if (!strncmp(s+1, "http:", 5)) + else if (!strncmp(s+1, "http:", 5) || + !strncmp(s+1, "https:", 5)) s++; /* next line begins a URL: leave newline */ else s[0] = ' '; /* delete newline to un-fold this line */ @@ -1770,7 +1784,7 @@ get_description (GList *parms, gboolean verbose_p) } #if 0 - if (verbose_p) + /*if (verbose_p)*/ { fprintf (stderr, "%s: text read is \"%s\"\n", blurb(),doc->string); fprintf (stderr, "%s: description is \"%s\"\n", blurb(), d); diff --git a/driver/demo-Gtk.c b/driver/demo-Gtk.c index da98c53..b5e82e2 100644 --- a/driver/demo-Gtk.c +++ b/driver/demo-Gtk.c @@ -1,5 +1,5 @@ /* demo-Gtk.c --- implements the interactive demo-mode and options dialogs. - * xscreensaver, Copyright (c) 1993-2020 Jamie Zawinski + * xscreensaver, Copyright © 1993-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -16,6 +16,8 @@ #ifdef HAVE_GTK /* whole file */ +#include "blurb.h" + #include #include @@ -35,18 +37,13 @@ # include #endif /* ENABLE_NLS */ -#ifndef VMS -# include /* for getpwuid() */ -#else /* VMS */ -# include "vms-pwd.h" -#endif /* VMS */ - #ifdef HAVE_UNAME # include /* for uname() */ #endif /* HAVE_UNAME */ #include #include +#include /* for getpwuid() */ #include #include @@ -68,20 +65,19 @@ #include #include -#ifdef HAVE_XMU -# ifndef VMS -# include -# else /* VMS */ -# include -# endif -#else -# include "xmu.h" -#endif - #ifdef HAVE_XINERAMA # include #endif /* HAVE_XINERAMA */ +#if (__GNUC__ >= 4) /* Ignore useless warnings generated by gtk.h */ +# undef inline +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wstrict-prototypes" +# pragma GCC diagnostic ignored "-Wlong-long" +# pragma GCC diagnostic ignored "-Wvariadic-macros" +# pragma GCC diagnostic ignored "-Wpedantic" +#endif + #include #ifdef HAVE_CRAPPLET @@ -92,38 +88,36 @@ #include #ifdef HAVE_GTK2 -# include # include #else /* !HAVE_GTK2 */ # define G_MODULE_EXPORT /**/ #endif /* !HAVE_GTK2 */ -#if defined(DEFAULT_ICONDIR) && !defined(GLADE_DIR) -# define GLADE_DIR DEFAULT_ICONDIR -#endif -#if !defined(DEFAULT_ICONDIR) && defined(GLADE_DIR) -# define DEFAULT_ICONDIR GLADE_DIR -#endif - #ifndef HAVE_XML /* Kludge: this is defined in demo-Gtk-conf.c when HAVE_XML. It is unused otherwise, so in that case, stub it out. */ static const char *hack_configuration_path = 0; #endif +#if (__GNUC__ >= 4) +# pragma GCC diagnostic pop +#endif #include "version.h" -#include "prefs.h" +#include "types.h" #include "resources.h" /* for parse_time() */ -#include "visual.h" /* for has_writable_cells() */ #include "remote.h" /* for xscreensaver_command() */ +#include "visual.h" +#include "atoms.h" #include "usleep.h" +#include "xmu.h" #include "logo-50.xpm" #include "logo-180.xpm" #include "demo-Gtk-conf.h" +#include "atoms.h" #include #include @@ -182,14 +176,6 @@ static void hack_subproc_environment (Window preview_window_id, Bool debug_p); #define countof(x) (sizeof((x))/sizeof((*x))) -/* You might think that to read an array of 32-bit quantities out of a - server-side property, you would pass an array of 32-bit data quantities - into XGetWindowProperty(). You would be wrong. You have to use an array - of longs, even if long is 64 bits (using 32 of each 64.) - */ -typedef long PROP32; - -char *progname = 0; char *progclass = "XScreenSaver"; XrmDatabase db; @@ -208,7 +194,7 @@ typedef struct { conf_data *cdata; /* private data for per-hack configuration */ #ifdef HAVE_GTK2 - GladeXML *glade_ui; /* Glade UI file */ + GtkBuilder *gtk_ui; /* UI file */ #endif /* HAVE_GTK2 */ Bool debug_p; /* whether to print diagnostics */ @@ -247,13 +233,6 @@ typedef struct { a closure object of our own down into the various widget callbacks. */ static state *global_state_kludge; -Atom XA_VROOT; -Atom XA_SCREENSAVER, XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_VERSION; -Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO; -Atom XA_ACTIVATE, XA_SUSPEND, XA_BLANK, XA_LOCK, XA_RESTART, XA_EXIT; -Atom XA_NEXT, XA_PREV; - - static void populate_demo_window (state *, int list_elt); static void populate_prefs_page (state *); static void populate_popup_window (state *); @@ -272,16 +251,15 @@ static void kill_preview_subproc (state *, Bool reset_p); static void schedule_preview_check (state *); -/* Prototypes of functions used by the Glade-generated code, - to avoid warnings. +/* Prototypes of functions used by the Gtk-generated code, to avoid warnings. */ -void exit_menu_cb (GtkMenuItem *, gpointer user_data); -void about_menu_cb (GtkMenuItem *, gpointer user_data); -void doc_menu_cb (GtkMenuItem *, gpointer user_data); -void file_menu_cb (GtkMenuItem *, gpointer user_data); -void activate_menu_cb (GtkMenuItem *, gpointer user_data); -void lock_menu_cb (GtkMenuItem *, gpointer user_data); -void kill_menu_cb (GtkMenuItem *, gpointer user_data); +void exit_menu_cb (GtkAction *, gpointer user_data); +void about_menu_cb (GtkAction *, gpointer user_data); +void doc_menu_cb (GtkAction *, gpointer user_data); +void file_menu_cb (GtkAction *, gpointer user_data); +void activate_menu_cb (GtkAction *, gpointer user_data); +void lock_menu_cb (GtkAction *, gpointer user_data); +void kill_menu_cb (GtkAction *, gpointer user_data); void restart_menu_cb (GtkWidget *, gpointer user_data); void run_this_cb (GtkButton *, gpointer user_data); void manual_cb (GtkButton *, gpointer user_data); @@ -303,33 +281,14 @@ void settings_switch_page_cb (GtkNotebook *, GtkNotebookPage *, gint page_num, gpointer user_data); void settings_cancel_cb (GtkButton *, gpointer user_data); void settings_ok_cb (GtkButton *, gpointer user_data); +void preview_theme_cb (GtkWidget *, gpointer user_data); static void kill_gnome_screensaver (void); static void kill_kde_screensaver (void); - /* Some random utility functions */ -const char *blurb (void); - -const char * -blurb (void) -{ - time_t now = time ((time_t *) 0); - char *ct = (char *) ctime (&now); - static char buf[255]; - int n = strlen(progname); - if (n > 100) n = 99; - strncpy(buf, progname, n); - buf[n++] = ':'; - buf[n++] = ' '; - strncpy(buf+n, ct+11, 8); - strcpy(buf+n+9, ": "); - return buf; -} - - static GtkWidget * name_to_widget (state *s, const char *name) { @@ -339,38 +298,49 @@ name_to_widget (state *s, const char *name) if (!*name) abort(); #ifdef HAVE_GTK2 - if (!s->glade_ui) + if (!s->gtk_ui) { - /* First try to load the Glade file from the current directory; + /* First try to load the UI file from the current directory; if there isn't one there, check the installed directory. */ -# define GLADE_FILE_NAME "xscreensaver-demo.glade2" - const char * const files[] = { GLADE_FILE_NAME, - GLADE_DIR "/" GLADE_FILE_NAME }; +# define UI_FILE "xscreensaver.ui" + const char * const files[] = { UI_FILE, + DEFAULT_ICONDIR "/" UI_FILE }; int i; + + s->gtk_ui = gtk_builder_new (); + for (i = 0; i < countof (files); i++) { struct stat st; if (!stat (files[i], &st)) { - s->glade_ui = glade_xml_new (files[i], NULL, NULL); - break; + GError* error = NULL; + + if (gtk_builder_add_from_file (s->gtk_ui, files[i], &error)) + break; + else + { + g_warning ("Couldn't load builder file %s: %s", + files[i], error->message); + g_error_free (error); + } } } - if (!s->glade_ui) + if (i >= countof (files)) { fprintf (stderr, - "%s: could not load \"" GLADE_FILE_NAME "\"\n" - "\tfrom " GLADE_DIR "/ or current directory.\n", + "%s: could not load \"" UI_FILE "\"\n" + "\tfrom " DEFAULT_ICONDIR "/ or current directory.\n", blurb()); exit (-1); } -# undef GLADE_FILE_NAME +# undef UI_FILE - glade_xml_signal_autoconnect (s->glade_ui); + gtk_builder_connect_signals (s->gtk_ui, NULL); } - w = glade_xml_get_widget (s->glade_ui, name); + w = GTK_WIDGET (gtk_builder_get_object (s->gtk_ui, name)); #else /* !HAVE_GTK2 */ @@ -382,7 +352,7 @@ name_to_widget (state *s, const char *name) #endif /* HAVE_GTK2 */ if (w) return w; - fprintf (stderr, "%s: no widget \"%s\" (wrong Glade file?)\n", + fprintf (stderr, "%s: no widget \"%s\" (wrong UI file?)\n", blurb(), name); abort(); } @@ -774,12 +744,12 @@ run_hack (state *s, int list_elt, Bool report_errors_p) /* Button callbacks According to Eric Lassauge, this G_MODULE_EXPORT crud is needed to make - libglade work on Cygwin; apparently all Glade callbacks need this magic - extra declaration. I do not pretend to understand. + GTK work on Cygwin; apparently all GTK callbacks need this magic extra + declaration. I do not pretend to understand. */ G_MODULE_EXPORT void -exit_menu_cb (GtkMenuItem *menuitem, gpointer user_data) +exit_menu_cb (GtkAction *menu_action, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ flush_dialog_changes_and_save (s); @@ -798,28 +768,27 @@ wm_toplevel_close_cb (GtkWidget *widget, GdkEvent *event, gpointer data) G_MODULE_EXPORT void -about_menu_cb (GtkMenuItem *menuitem, gpointer user_data) +about_menu_cb (GtkAction *menu_action, gpointer user_data) { +#if 1 + /* Let's just pop up the splash dialog instead. */ + preview_theme_cb (NULL, user_data); +#else char msg [2048]; - char *vers = strdup (screensaver_id + 4); - char *s, *s2; char copy[1024]; - char year[5]; char *desc = _("For updates, check https://www.jwz.org/xscreensaver/"); - s = strchr (vers, ','); + char *version = strdup (screensaver_id + 17); + char *year = strchr (version, '-'); + char *s = strchr (version, ' '); + *s = 0; + year = strchr (year+1, '-') + 1; + s = strchr (year, ')'); *s = 0; - s += 2; - - s2 = vers; - s2 = strrchr (vers, '-'); - s2++; - strncpy (year, s2, 4); - year[4] = 0; /* Ole Laursen says "don't use _() here because non-ASCII characters aren't allowed in localizable string keys." - (I don't want to just use (c) instead of because that doesn't + (I don't want to just use (c) instead of © because that doesn't look as good in the plain-old default Latin1 "C" locale.) */ #ifdef HAVE_GTK2 @@ -837,7 +806,7 @@ about_menu_cb (GtkMenuItem *menuitem, gpointer user_data) #ifdef HAVE_CRAPPLET { const gchar *auth[] = { 0 }; - GtkWidget *about = gnome_about_new (progclass, vers, "", auth, desc, + GtkWidget *about = gnome_about_new (progclass, version, "", auth, desc, "xscreensaver.xpm"); gtk_widget_show (about); } @@ -851,7 +820,8 @@ about_menu_cb (GtkMenuItem *menuitem, gpointer user_data) GtkWidget *dialog = gtk_dialog_new (); GtkWidget *hbox, *icon, *vbox, *label1, *label2, *hb, *ok; - GtkWidget *parent = GTK_WIDGET (menuitem); + GSList *proxies = gtk_action_get_proxies (menu_action); + GtkWidget *parent = GTK_WIDGET (proxies->data); while (GET_PARENT (parent)) parent = GET_PARENT (parent); @@ -871,7 +841,7 @@ about_menu_cb (GtkMenuItem *menuitem, gpointer user_data) vbox = gtk_vbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); - label1 = gtk_label_new (vers); + label1 = gtk_label_new (version); gtk_box_pack_start (GTK_BOX (vbox), label1, TRUE, TRUE, 0); gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label1), 0.0, 0.75); @@ -928,11 +898,12 @@ about_menu_cb (GtkMenuItem *menuitem, gpointer user_data) gdk_window_show (GET_WINDOW (GTK_WIDGET (dialog))); gdk_window_raise (GET_WINDOW (GTK_WIDGET (dialog))); } +#endif /* 0 */ } G_MODULE_EXPORT void -doc_menu_cb (GtkMenuItem *menuitem, gpointer user_data) +doc_menu_cb (GtkAction *menu_action, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ saver_preferences *p = &s->prefs; @@ -947,11 +918,11 @@ doc_menu_cb (GtkMenuItem *menuitem, gpointer user_data) } help_command = (char *) malloc (strlen (p->load_url_command) + - (strlen (p->help_url) * 4) + 20); + (strlen (p->help_url) * 5) + 20); strcpy (help_command, "( "); sprintf (help_command + strlen(help_command), p->load_url_command, - p->help_url, p->help_url, p->help_url, p->help_url); + p->help_url, p->help_url, p->help_url, p->help_url, p->help_url); strcat (help_command, " ) &"); if (system (help_command) < 0) fprintf (stderr, "%s: fork error\n", blurb()); @@ -960,7 +931,7 @@ doc_menu_cb (GtkMenuItem *menuitem, gpointer user_data) G_MODULE_EXPORT void -file_menu_cb (GtkMenuItem *menuitem, gpointer user_data) +file_menu_cb (GtkAction *menu_action, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ sensitize_menu_items (s, False); @@ -968,7 +939,7 @@ file_menu_cb (GtkMenuItem *menuitem, gpointer user_data) G_MODULE_EXPORT void -activate_menu_cb (GtkMenuItem *menuitem, gpointer user_data) +activate_menu_cb (GtkAction *menu_action, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ run_cmd (s, XA_ACTIVATE, 0); @@ -976,7 +947,7 @@ activate_menu_cb (GtkMenuItem *menuitem, gpointer user_data) G_MODULE_EXPORT void -lock_menu_cb (GtkMenuItem *menuitem, gpointer user_data) +lock_menu_cb (GtkAction *menu_action, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ run_cmd (s, XA_LOCK, 0); @@ -984,7 +955,7 @@ lock_menu_cb (GtkMenuItem *menuitem, gpointer user_data) G_MODULE_EXPORT void -kill_menu_cb (GtkMenuItem *menuitem, gpointer user_data) +kill_menu_cb (GtkAction *menu_action, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ run_cmd (s, XA_EXIT, 0); @@ -998,7 +969,7 @@ restart_menu_cb (GtkWidget *widget, gpointer user_data) flush_dialog_changes_and_save (s); xscreensaver_command (GDK_DISPLAY(), XA_EXIT, 0, False, NULL); sleep (1); - if (system ("xscreensaver -nosplash &") < 0) + if (system ("xscreensaver -splash &") < 0) fprintf (stderr, "%s: fork error\n", blurb()); await_xscreensaver (s); @@ -1084,12 +1055,6 @@ demo_write_init_file (state *s, saver_preferences *p) { Display *dpy = GDK_DISPLAY(); -#if 0 - /* #### try to figure out why shit keeps getting reordered... */ - if (strcmp (s->prefs.screenhacks[0]->name, "DNA Lounge Slideshow")) - abort(); -#endif - if (!write_init_file (dpy, p, s->short_version, False)) { if (s->debug_p) @@ -1191,7 +1156,7 @@ force_list_select_item (state *s, GtkWidget *list, int list_elt, Bool scroll_p) if (!was) gtk_widget_set_sensitive (parent, True); #ifdef HAVE_GTK2 model = gtk_tree_view_get_model (GTK_TREE_VIEW (list)); - g_assert (model); + if (!model) abort(); if (gtk_tree_model_iter_nth_child (model, &iter, NULL, list_elt)) { selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list)); @@ -1485,6 +1450,25 @@ flush_checkbox (GtkTreeModel *model, #endif /* HAVE_GTK2 */ + +static char * +theme_name_strip (const char *s) +{ + const char *in = s; + char *s2 = strdup(s); + char *out = s2; + for (; *in; in++) + if (*in >= 'A' && *in <= 'Z') + *out++ = *in + ('a'-'A'); + else if (*in == ' ' || *in == '\t') + ; + else + *out++ = *in; + *out = 0; + return s2; +} + + /* Flush out any changes made in the main dialog window (where changes take place immediately: clicking on a checkbox causes the init file to be written right away.) @@ -1492,6 +1476,7 @@ flush_checkbox (GtkTreeModel *model, static Bool flush_dialog_changes_and_save (state *s) { + Display *dpy = GDK_DISPLAY(); saver_preferences *p = &s->prefs; saver_preferences P2, *p2 = &P2; #ifdef HAVE_GTK2 @@ -1578,7 +1563,6 @@ flush_dialog_changes_and_save (state *s) #if 0 CHECKBOX (p2->verbose_p, "verbose_button"); - CHECKBOX (p2->capture_stderr_p, "capture_button"); CHECKBOX (p2->splash_p, "splash_button"); #endif @@ -1596,7 +1580,6 @@ flush_dialog_changes_and_save (state *s) TEXT (p2->text_url, "text_url_entry"); } - CHECKBOX (p2->install_cmap_p, "install_button"); CHECKBOX (p2->fade_p, "fade_button"); CHECKBOX (p2->unfade_p, "unfade_button"); SECONDS (&p2->fade_seconds, "fade_spinbutton"); @@ -1610,12 +1593,13 @@ flush_dialog_changes_and_save (state *s) /* Warn if the image directory doesn't exist, when: - not being warned before - image directory is changed and the directory doesn't exist - - image directory does not begin with http:// + - image directory is not a URL */ if (p2->image_directory && *p2->image_directory && !directory_p (p2->image_directory) && - strncmp(p2->image_directory, "http://", 6) && + strncmp(p2->image_directory, "http://", 7) && + strncmp(p2->image_directory, "https://", 8) && ( !already_warned_about_missing_image_directory || ( p->image_directory && *p->image_directory && @@ -1634,11 +1618,8 @@ flush_dialog_changes_and_save (state *s) /* Map the mode menu to `saver_mode' enum values. */ { - GtkOptionMenu *opt = GTK_OPTION_MENU (name_to_widget (s, "mode_menu")); - GtkMenu *menu = GTK_MENU (gtk_option_menu_get_menu (opt)); - GtkWidget *selected = gtk_menu_get_active (menu); - GList *kids = gtk_container_children (GTK_CONTAINER (menu)); - int menu_elt = g_list_index (kids, (gpointer) selected); + GtkComboBox *opt = GTK_COMBO_BOX (name_to_widget (s, "mode_menu")); + int menu_elt = gtk_combo_box_get_active (opt); if (menu_elt < 0 || menu_elt >= countof(mode_menu_order)) abort(); p2->mode = mode_menu_order[menu_elt]; } @@ -1651,11 +1632,33 @@ flush_dialog_changes_and_save (state *s) : -1); } + /* Theme menu. */ + { + GtkComboBox *cbox = GTK_COMBO_BOX (name_to_widget (s, "theme_menu")); + char *themes = get_string_resource (dpy, "themeNames", "ThemeNames"); + int menu_index = gtk_combo_box_get_active (cbox); + char *token = themes; + char *name, *last; + int i = 0; + while ((name = strtok_r (token, ",", &last))) + { + token = 0; + if (i == menu_index) + { + char *name2 = theme_name_strip (name); + if (p->dialog_theme) free (p->dialog_theme); + p2->dialog_theme = name2; + } + i++; + } + } + # define COPY(field, name) \ if (p->field != p2->field) { \ changed = True; \ if (s->debug_p) \ - fprintf (stderr, "%s: %s => %d\n", blurb(), name, (int) p2->field); \ + fprintf (stderr, "%s: %s => %ld\n", blurb(), \ + name, (unsigned long) p2->field); \ } \ p->field = p2->field @@ -1675,7 +1678,6 @@ flush_dialog_changes_and_save (state *s) #if 0 COPY(verbose_p, "verbose_p"); - COPY(capture_stderr_p, "capture_stderr_p"); COPY(splash_p, "splash_p"); #endif @@ -1690,6 +1692,7 @@ flush_dialog_changes_and_save (state *s) COPY(grab_video_p, "grab_video_p"); COPY(random_image_p, "random_image_p"); + COPY(dialog_theme, "dialog_theme"); # undef COPY # define COPYSTR(FIELD,NAME) \ @@ -1717,14 +1720,7 @@ flush_dialog_changes_and_save (state *s) if (changed) { - Display *dpy = GDK_DISPLAY(); - Bool enabled_p = (p->dpms_enabled_p && p->mode != DONT_BLANK); - sync_server_dpms_settings (dpy, enabled_p, p->dpms_quickoff_p, - p->dpms_standby / 1000, - p->dpms_suspend / 1000, - p->dpms_off / 1000, - False); - + sync_server_dpms_settings (GDK_DISPLAY(), p); changed = demo_write_init_file (s, p); } @@ -1744,9 +1740,10 @@ flush_popup_changes_and_save (state *s) int list_elt = selected_list_element (s); GtkEntry *cmd = GTK_ENTRY (name_to_widget (s, "cmd_text")); - GtkCombo *vis = GTK_COMBO (name_to_widget (s, "visual_combo")); + GtkComboBoxEntry *vis = GTK_COMBO_BOX_ENTRY (name_to_widget (s, "visual_combo")); + GtkEntry *visent = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (vis))); - const char *visual = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (vis)->entry)); + const char *visual = gtk_entry_get_text (visent); const char *command = gtk_entry_get_text (cmd); char c; @@ -1791,7 +1788,7 @@ flush_popup_changes_and_save (state *s) { gdk_beep (); /* unparsable */ visual = ""; - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (vis)->entry), _("Any")); + gtk_entry_set_text (visent, _("Any")); } changed = flush_changes (s, list_elt, -1, command, visual); @@ -1839,21 +1836,8 @@ mode_menu_item_cb (GtkWidget *widget, gpointer user_data) GtkWidget *list = name_to_widget (s, "list"); int list_elt; - GList *menu_items = - gtk_container_children (GTK_CONTAINER (GET_PARENT (widget))); - int menu_index = 0; - saver_mode new_mode; - - while (menu_items) - { - if (menu_items->data == widget) - break; - menu_index++; - menu_items = menu_items->next; - } - if (!menu_items) abort(); - - new_mode = mode_menu_order[menu_index]; + int menu_index = gtk_combo_box_get_active (GTK_COMBO_BOX (widget)); + saver_mode new_mode = mode_menu_order[menu_index]; /* Keep the same list element displayed as before; except if we're switching *to* "one screensaver" mode from any other mode, set @@ -1901,7 +1885,7 @@ list_activated_cb (GtkTreeView *list, char *str; int list_elt; - g_return_if_fail (!gdk_pointer_is_grabbed ()); + if (gdk_pointer_is_grabbed()) return; str = gtk_tree_path_to_string (path); list_elt = strtol (str, NULL, 10); @@ -2305,7 +2289,12 @@ browse_text_program_cb (GtkButton *button, gpointer user_data) } - +G_MODULE_EXPORT void +preview_theme_cb (GtkWidget *w, gpointer user_data) +{ + if (system ("xscreensaver-auth --splash &") < 0) + fprintf (stderr, "%s: splash exec failed\n", blurb()); +} G_MODULE_EXPORT void @@ -2761,6 +2750,7 @@ update_list_sensitivity (state *s) static void populate_prefs_page (state *s) { + Display *dpy = GDK_DISPLAY(); saver_preferences *p = &s->prefs; Bool can_lock_p = True; @@ -2813,7 +2803,6 @@ populate_prefs_page (state *s) TOGGLE_ACTIVE ("lock_button", p->lock_p); #if 0 TOGGLE_ACTIVE ("verbose_button", p->verbose_p); - TOGGLE_ACTIVE ("capture_button", p->capture_stderr_p); TOGGLE_ACTIVE ("splash_button", p->splash_p); #endif TOGGLE_ACTIVE ("dpms_button", p->dpms_enabled_p); @@ -2821,7 +2810,6 @@ populate_prefs_page (state *s) TOGGLE_ACTIVE ("grab_desk_button", p->grab_desktop_p); TOGGLE_ACTIVE ("grab_video_button", p->grab_video_p); TOGGLE_ACTIVE ("grab_image_button", p->random_image_p); - TOGGLE_ACTIVE ("install_button", p->install_cmap_p); TOGGLE_ACTIVE ("fade_button", p->fade_p); TOGGLE_ACTIVE ("unfade_button", p->unfade_p); @@ -2866,40 +2854,73 @@ populate_prefs_page (state *s) p->tmode == TEXT_URL); + /* Theme menu */ + { + GtkComboBox *cbox = GTK_COMBO_BOX (name_to_widget (s, "theme_menu")); + + /* Without this, pref_changed_cb gets called an exponentially-increasing + number of times on the themes menu, despite the call to + gtk_list_store_clear(). */ + static Bool done_once = False; + + if (cbox && !done_once) + { + char *themes = get_string_resource (dpy, "themeNames", "ThemeNames"); + char *token = themes; + char *name, *name2, *last; + GtkListStore *model; + GtkTreeIter iter; + int i = 0; + done_once = True; + + g_object_get (G_OBJECT (cbox), "model", &model, NULL); + if (!model) abort(); + gtk_list_store_clear (model); + + gtk_signal_connect (GTK_OBJECT (cbox), "changed", + GTK_SIGNAL_FUNC (pref_changed_cb), (gpointer) s); + + while ((name = strtok_r (token, ",", &last))) + { + int L; + token = 0; + + /* Strip leading and trailing whitespace */ + while (*name == ' ' || *name == '\t' || *name == '\n') + name++; + L = strlen(name); + while (L && (name[L-1] == ' ' || name[L-1] == '\t' || + name[L-1] == '\n')) + name[--L] = 0; + + gtk_list_store_append (model, &iter); + gtk_list_store_set (model, &iter, 0, name, -1); + + name2 = theme_name_strip (name); + if (!strcmp (p->dialog_theme, name2)) + gtk_combo_box_set_active (cbox, i); + free (name2); + i++; + } + } + } + + /* Map the `saver_mode' enum to mode menu to values. */ { - GtkOptionMenu *opt = GTK_OPTION_MENU (name_to_widget (s, "mode_menu")); + GtkComboBox *opt = GTK_COMBO_BOX (name_to_widget (s, "mode_menu")); int i; for (i = 0; i < countof(mode_menu_order); i++) if (mode_menu_order[i] == p->mode) break; - gtk_option_menu_set_history (opt, i); + gtk_combo_box_set_active (opt, i); update_list_sensitivity (s); } { - Bool found_any_writable_cells = False; - Bool fading_possible = False; Bool dpms_supported = False; - Display *dpy = GDK_DISPLAY(); - int nscreens = ScreenCount(dpy); /* real screens, not Xinerama */ - int i; - for (i = 0; i < nscreens; i++) - { - Screen *s = ScreenOfDisplay (dpy, i); - if (has_writable_cells (s, DefaultVisualOfScreen (s))) - { - found_any_writable_cells = True; - break; - } - } - - fading_possible = found_any_writable_cells; -#ifdef HAVE_XF86VMODE_GAMMA - fading_possible = True; -#endif #ifdef HAVE_DPMS_EXTENSION { @@ -2923,7 +2944,6 @@ populate_prefs_page (state *s) */ SENSITIZE ("dpms_frame", dpms_supported); SENSITIZE ("dpms_button", dpms_supported); - SENSITIZE ("dpms_quickoff_button", dpms_supported); SENSITIZE ("dpms_standby_label", dpms_supported && p->dpms_enabled_p); SENSITIZE ("dpms_standby_mlabel", dpms_supported && p->dpms_enabled_p); @@ -2934,24 +2954,26 @@ populate_prefs_page (state *s) SENSITIZE ("dpms_off_label", dpms_supported && p->dpms_enabled_p); SENSITIZE ("dpms_off_mlabel", dpms_supported && p->dpms_enabled_p); SENSITIZE ("dpms_off_spinbutton", dpms_supported && p->dpms_enabled_p); + SENSITIZE ("dpms_quickoff_button", dpms_supported); - /* Colormaps - */ - SENSITIZE ("cmap_frame", found_any_writable_cells || fading_possible); - SENSITIZE ("install_button", found_any_writable_cells); - SENSITIZE ("fade_button", fading_possible); - SENSITIZE ("unfade_button", fading_possible); - - SENSITIZE ("fade_label", (fading_possible && - (p->fade_p || p->unfade_p))); - SENSITIZE ("fade_spinbutton", (fading_possible && - (p->fade_p || p->unfade_p))); + SENSITIZE ("fade_label", (p->fade_p || p->unfade_p)); + SENSITIZE ("fade_spinbutton", (p->fade_p || p->unfade_p)); # undef SENSITIZE } } +/* Allow the documentation label to re-flow when the text is changed. + http://blog.borovsak.si/2009/05/wrapping-adn-resizing-gtklabel.html + */ +static void +cb_allocate (GtkWidget *label, GtkAllocation *allocation, gpointer data) +{ + gtk_widget_set_size_request (label, allocation->width - 8, -1); +} + + static void populate_popup_window (state *s) { @@ -2962,6 +2984,9 @@ populate_popup_window (state *s) gtk_label_set_selectable (doc); */ + g_signal_connect (G_OBJECT (doc), "size-allocate", + G_CALLBACK (cb_allocate), NULL); + # ifdef HAVE_XML if (s->cdata) { @@ -2998,6 +3023,14 @@ populate_popup_window (state *s) gtk_label_set_text (doc, (doc_string ? _(doc_string) : _("No description available."))); + + { + GtkWidget *w = name_to_widget (s, "dialog_vbox"); + gtk_widget_hide (w); + gtk_widget_unrealize (w); + gtk_widget_realize (w); + gtk_widget_show (w); + } } @@ -3022,7 +3055,7 @@ sensitize_menu_items (state *s, Bool force_p) static Bool running_p = False; static time_t last_checked = 0; time_t now = time ((time_t *) 0); - const char *names[] = { "activate_menu", "lock_menu", "kill_menu", + const char *names[] = { "activate_action", "lock_action", "kill_action", /* "demo" */ }; int i; @@ -3034,8 +3067,8 @@ sensitize_menu_items (state *s, Bool force_p) for (i = 0; i < countof(names); i++) { - GtkWidget *w = name_to_widget (s, names[i]); - gtk_widget_set_sensitive (GTK_WIDGET(w), running_p); + GtkAction *a = GTK_ACTION (gtk_builder_get_object (s->gtk_ui, names[i])); + gtk_action_set_sensitive (a, running_p); } } @@ -3107,7 +3140,7 @@ fix_text_entry_sizes (state *s) /* Now fix the width of the combo box. */ w = GTK_WIDGET (name_to_widget (s, "visual_combo")); - w = GTK_COMBO (w)->entry; + w = GTK_COMBO_BOX_ENTRY (w)->entry; width = gdk_string_width (w->style->font, "PseudoColor___"); gtk_widget_set_usize (w, width, -2); @@ -3313,7 +3346,7 @@ populate_demo_window (state *s, int list_elt) GtkFrame *frame1 = GTK_FRAME (name_to_widget (s, "preview_frame")); GtkFrame *frame2 = GTK_FRAME (name_to_widget (s, "opt_frame")); GtkEntry *cmd = GTK_ENTRY (name_to_widget (s, "cmd_text")); - GtkCombo *vis = GTK_COMBO (name_to_widget (s, "visual_combo")); + GtkComboBoxEntry *vis = GTK_COMBO_BOX_ENTRY (name_to_widget (s, "visual_combo")); GtkWidget *list = GTK_WIDGET (name_to_widget (s, "list")); if (p->mode == BLANK_ONLY) @@ -3363,7 +3396,7 @@ populate_demo_window (state *s, int list_elt) gtk_window_set_title (GTK_WINDOW (s->popup_widget), title); } - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (vis)->entry), + gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (vis))), (hack ? (hack->visual && *hack->visual ? hack->visual @@ -3471,10 +3504,11 @@ initialize_sort_map (state *s) char *name = (hack->name && *hack->name ? strdup (hack->name) : make_hack_name (dpy, hack->command)); - char *str; - for (str = name; *str; str++) - *str = tolower(*str); - sort_hack_cmp_names_kludge[i] = name; + gchar *s2 = g_str_to_ascii (name, 0); /* Sort "Möbius" properly */ + gchar *s3 = g_ascii_strdown (s2, -1); + free (name); + free (s2); + sort_hack_cmp_names_kludge[i] = s3; } /* Sort list->hack map alphabetically @@ -3782,7 +3816,7 @@ get_best_gl_visual (state *s) char *av[10]; int ac = 0; - av[ac++] = "xscreensaver-gl-helper"; + av[ac++] = "xscreensaver-gl-visual"; av[ac] = 0; if (pipe (fds)) @@ -4395,7 +4429,9 @@ gnome_screensaver_window (Screen *screen) &bytesafter, &name) == Success && type != None - && !strcmp ((char *) name, "gnome-screensaver")) + && (!strcmp ((char *) name, "gnome-screensaver") || + !strcmp ((char *) name, "mate-screensaver") || + !strcmp ((char *) name, "cinnamon-screensaver"))) { gnome_window = kids[i]; break; @@ -4464,11 +4500,9 @@ the_network_is_not_the_computer (state *s) lhost = ""; else lhost = uts.nodename; -# elif defined(VMS) - strcpy (lhost, getenv("SYS$NODE")); -# else /* !HAVE_UNAME && !VMS */ +# else /* !HAVE_UNAME */ strcat (lhost, ""); -# endif /* !HAVE_UNAME && !VMS */ +# endif /* !HAVE_UNAME */ if (p && p->pw_name) luser = p->pw_name; @@ -4791,10 +4825,7 @@ main (int argc, char **argv) progname = real_progname; - s->short_version = (char *) malloc (5); - memcpy (s->short_version, screensaver_id + 17, 4); - s->short_version [4] = 0; - + s->short_version = XSCREENSAVER_VERSION; /* Register our error message logger for every ``log domain'' known. There's no way to do this globally, so I grepped the Gtk/Gdk sources @@ -5007,7 +5038,7 @@ main (int argc, char **argv) dpy = XtDisplay (toplevel_shell); db = XtDatabase (dpy); - XtGetApplicationNameAndClass (dpy, &progname, &progclass); + XtGetApplicationNameAndClass (dpy, (char **) &progname, &progclass); XSetErrorHandler (demo_ehandler); /* Let's just ignore these. They seem to confuse Irix Gtk... */ @@ -5046,6 +5077,7 @@ main (int argc, char **argv) p->db = db; s->nscreens = screen_count (dpy); + init_xscreensaver_atoms (dpy); hack_environment (s); /* must be before initialize_sort_map() */ load_init_file (dpy, p); @@ -5069,26 +5101,7 @@ main (int argc, char **argv) } #endif - - /* Intern the atoms that xscreensaver_command() needs. - */ - XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False); - XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False); - XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False); - XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False); - XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False); - XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False); - XA_SELECT = XInternAtom (dpy, "SELECT", False); - XA_DEMO = XInternAtom (dpy, "DEMO", False); - XA_ACTIVATE = XInternAtom (dpy, "ACTIVATE", False); - XA_SUSPEND = XInternAtom (dpy, "SUSPEND", False); - XA_BLANK = XInternAtom (dpy, "BLANK", False); - XA_LOCK = XInternAtom (dpy, "LOCK", False); - XA_NEXT = XInternAtom (dpy, "NEXT", False); - XA_PREV = XInternAtom (dpy, "PREV", False); - XA_EXIT = XInternAtom (dpy, "EXIT", False); - XA_RESTART = XInternAtom (dpy, "RESTART", False); - + init_xscreensaver_atoms (dpy); /* Create the window and all its widgets. */ @@ -5171,31 +5184,32 @@ main (int argc, char **argv) #endif /* !HAVE_GTK2 */ /* Hook up callbacks to the items on the mode menu. */ - { - GtkOptionMenu *opt = GTK_OPTION_MENU (name_to_widget (s, "mode_menu")); - GtkMenu *menu = GTK_MENU (gtk_option_menu_get_menu (opt)); - GList *kids = gtk_container_children (GTK_CONTAINER (menu)); - int i; - for (i = 0; kids; kids = kids->next, i++) - { - gtk_signal_connect (GTK_OBJECT (kids->data), "activate", - GTK_SIGNAL_FUNC (mode_menu_item_cb), - (gpointer) s); - - /* The "random-same" mode menu item does not appear unless - there are multple screens. - */ - if (s->nscreens <= 1 && - mode_menu_order[i] == RANDOM_HACKS_SAME) - gtk_widget_hide (GTK_WIDGET (kids->data)); - } + gtk_signal_connect (GTK_OBJECT (name_to_widget (s, "mode_menu")), + "changed", GTK_SIGNAL_FUNC (mode_menu_item_cb), + (gpointer) s); + if (s->nscreens <= 1) + { + GtkComboBox *opt = GTK_COMBO_BOX (name_to_widget (s, "mode_menu")); + GtkTreeModel *list = gtk_combo_box_get_model (opt); + unsigned int i; + for (i = 0; i < countof(mode_menu_order); i++) + { + /* The "random-same" mode menu item does not appear unless + there are multiple screens. + */ + if (mode_menu_order[i] == RANDOM_HACKS_SAME) + { + GtkTreeIter iter; + gtk_tree_model_iter_nth_child (list, &iter, NULL, i); + gtk_list_store_remove (GTK_LIST_STORE (list), &iter); + break; + } + } - if (s->nscreens <= 1) /* recompute option-menu size */ - { - gtk_widget_unrealize (GTK_WIDGET (menu)); - gtk_widget_realize (GTK_WIDGET (menu)); - } - } + /* recompute option-menu size */ + gtk_widget_unrealize (GTK_WIDGET (opt)); + gtk_widget_realize (GTK_WIDGET (opt)); + } /* Handle the -prefs command-line argument. */ @@ -5299,7 +5313,7 @@ main (int argc, char **argv) the_network_is_not_the_computer (s); - if (senesculent_p()) + if (time ((time_t *) 0) - XSCREENSAVER_RELEASED > 60*60*24*30*17) warning_dialog (s->toplevel_widget, _("Warning:\n\n" "This version of xscreensaver is VERY OLD!\n" @@ -5312,7 +5326,6 @@ main (int argc, char **argv) ), D_NONE, 7); - /* Run the Gtk event loop, and not the Xt event loop. This means that if there were Xt timers or fds registered, they would never get serviced, and if there were any Xt widgets, they would never have events delivered. diff --git a/driver/demo-Xm-widgets.c b/driver/demo-Xm-widgets.c index cbe3393..d47259b 100644 --- a/driver/demo-Xm-widgets.c +++ b/driver/demo-Xm-widgets.c @@ -79,6 +79,8 @@ tab_cb (Widget button, XtPointer client_data, XtPointer ignored) } +extern Widget create_xscreensaver_demo (Widget parent); + Widget create_xscreensaver_demo (Widget parent) { @@ -539,14 +541,12 @@ create_options_page (Widget parent) timeoutLabel cycleLabel fadeSecondsLabel - fadeTicksLabel lockLabel passwdLabel timeoutText cycleText fadeSecondsText - fadeTicksText lockText passwdText @@ -566,11 +566,11 @@ create_options_page (Widget parent) Arg av[64]; int ac = 0; Widget children[100]; - Widget timeout_label, cycle_label, fade_seconds_label, fade_ticks_label; + Widget timeout_label, cycle_label, fade_seconds_label; Widget lock_label, passwd_label, hr; Widget preferences_form; - Widget timeout_text, cycle_text, fade_text, fade_ticks_text; + Widget timeout_text, cycle_text, fade_text; Widget lock_timeout_text, passwd_timeout_text, verbose_toggle; Widget install_cmap_toggle, fade_toggle, unfade_toggle; Widget lock_toggle, prefs_done, prefs_cancel; @@ -601,10 +601,6 @@ create_options_page (Widget parent) "fadeSecondsLabel", av, ac); ac = 0; XtSetArg(av[ac], XmNalignment, XmALIGNMENT_END); ac++; - fade_ticks_label = XmCreateLabelGadget (preferences_form, "fadeTicksLabel", - av, ac); - ac = 0; - XtSetArg(av[ac], XmNalignment, XmALIGNMENT_END); ac++; lock_label = XmCreateLabelGadget (preferences_form, "lockLabel", av, ac); ac = 0; XtSetArg(av[ac], XmNalignment, XmALIGNMENT_END); ac++; @@ -613,8 +609,6 @@ create_options_page (Widget parent) timeout_text = XmCreateTextField (preferences_form, "timeoutText", av, ac); cycle_text = XmCreateTextField (preferences_form, "cycleText", av, ac); fade_text = XmCreateTextField (preferences_form, "fadeSecondsText", av, ac); - fade_ticks_text = XmCreateTextField (preferences_form, "fadeTicksText", - av, ac); lock_timeout_text = XmCreateTextField (preferences_form, "lockText", av, ac); passwd_timeout_text = XmCreateTextField (preferences_form, "passwdText", @@ -684,20 +678,6 @@ create_options_page (Widget parent) XmNrightWidget, fade_text, NULL); - XtVaSetValues (fade_ticks_label, - XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNtopOffset, 0, - XmNtopWidget, fade_ticks_text, - XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNbottomOffset, 0, - XmNbottomWidget, fade_ticks_text, - XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, 20, - XmNrightAttachment, XmATTACH_WIDGET, - XmNrightOffset, 4, - XmNrightWidget, fade_ticks_text, - NULL); - XtVaSetValues (lock_label, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopOffset, 0, @@ -751,7 +731,7 @@ create_options_page (Widget parent) XmNleftWidget, cycle_text, NULL); - XtVaSetValues (fade_ticks_text, + XtVaSetValues (lock_timeout_text, XmNtopAttachment, XmATTACH_WIDGET, XmNtopOffset, 2, XmNtopWidget, fade_text, @@ -760,15 +740,6 @@ create_options_page (Widget parent) XmNleftWidget, fade_text, NULL); - XtVaSetValues (lock_timeout_text, - XmNtopAttachment, XmATTACH_WIDGET, - XmNtopOffset, 2, - XmNtopWidget, fade_ticks_text, - XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, - XmNleftOffset, 0, - XmNleftWidget, fade_ticks_text, - NULL); - XtVaSetValues (passwd_timeout_text, XmNtopAttachment, XmATTACH_WIDGET, XmNtopOffset, 4, @@ -822,10 +793,10 @@ create_options_page (Widget parent) XtVaSetValues (unfade_toggle, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopOffset, 0, - XmNtopWidget, fade_ticks_text, + XmNtopWidget, lock_timeout_text, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomOffset, 0, - XmNbottomWidget, fade_ticks_text, + XmNbottomWidget, lock_timeout_text, XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, XmNleftOffset, 0, XmNleftWidget, fade_toggle, @@ -836,10 +807,10 @@ create_options_page (Widget parent) XtVaSetValues (lock_toggle, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopOffset, 0, - XmNtopWidget, lock_timeout_text, + XmNtopWidget, passwd_timeout_text, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomOffset, 0, - XmNbottomWidget, lock_timeout_text, + XmNbottomWidget, passwd_timeout_text, XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, XmNleftOffset, 0, XmNleftWidget, unfade_toggle, @@ -872,13 +843,11 @@ create_options_page (Widget parent) children[ac++] = timeout_label; children[ac++] = cycle_label; children[ac++] = fade_seconds_label; - children[ac++] = fade_ticks_label; children[ac++] = lock_label; children[ac++] = passwd_label; children[ac++] = timeout_text; children[ac++] = cycle_text; children[ac++] = fade_text; - children[ac++] = fade_ticks_text; children[ac++] = lock_timeout_text; children[ac++] = passwd_timeout_text; children[ac++] = verbose_toggle; diff --git a/driver/demo-Xm.c b/driver/demo-Xm.c index 3497641..547bbe9 100644 --- a/driver/demo-Xm.c +++ b/driver/demo-Xm.c @@ -1,5 +1,5 @@ /* demo-Xm.c --- implements the interactive demo-mode and options dialogs. - * xscreensaver, Copyright (c) 1993-2003, 2005 Jamie Zawinski + * xscreensaver, Copyright © 1993-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -16,23 +16,20 @@ #ifdef HAVE_MOTIF /* whole file */ +#include "blurb.h" + #include #ifdef HAVE_UNISTD_H # include #endif -#ifndef VMS -# include /* for getpwuid() */ -#else /* VMS */ -# include "vms-pwd.h" -#endif /* VMS */ - #ifdef HAVE_UNAME # include /* for uname() */ #endif /* HAVE_UNAME */ #include +#include /* for getpwuid() */ #include /* for CARD32 */ #include /* for XA_INTEGER */ @@ -48,18 +45,6 @@ # include #endif /* HAVE_XPM */ -#ifdef HAVE_XMU -# ifndef VMS -# include -# else /* VMS */ -# include -# endif -#else -# include "xmu.h" -#endif - - - #include #include #include @@ -78,11 +63,12 @@ #endif /* HAVE_XMCOMBOBOX */ #include "version.h" -#include "prefs.h" +#include "types.h" #include "resources.h" /* for parse_time() */ -#include "visual.h" /* for has_writable_cells() */ #include "remote.h" /* for xscreensaver_command() */ -#include "usleep.h" +#include "visual.h" +#include "atoms.h" +#include "xmu.h" #include #include @@ -92,7 +78,6 @@ #define countof(x) (sizeof((x))/sizeof((*x))) -char *progname = 0; char *progclass = "XScreenSaver"; XrmDatabase db; @@ -102,20 +87,12 @@ typedef struct { static void *global_prefs_pair; /* I hate C so much... */ -char *blurb (void) { return progname; } - extern Widget create_xscreensaver_demo (Widget parent); extern const char *visual_menu[]; static char *short_version = 0; -Atom XA_VROOT; -Atom XA_SCREENSAVER, XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_VERSION; -Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO; -Atom XA_ACTIVATE, XA_SUSPEND, XA_BLANK, XA_LOCK, XA_RESTART, XA_EXIT; - - static void populate_demo_window (Widget toplevel, int which, prefs_pair *pair); static void populate_prefs_page (Widget top, prefs_pair *pair); @@ -297,7 +274,7 @@ run_hack (Widget widget, int which, Bool report_errors_p) /* Button callbacks */ -void +static void exit_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { apply_changes_and_save (XtParent (button)); @@ -313,7 +290,7 @@ wm_close_cb (Widget widget, GdkEvent *event, XtPointer data) } #endif -void +static void cut_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { /* #### */ @@ -323,7 +300,7 @@ cut_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) } -void +static void copy_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { /* #### */ @@ -333,7 +310,7 @@ copy_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) } -void +static void paste_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { /* #### */ @@ -343,7 +320,7 @@ paste_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) } -void +static void about_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { char buf [2048]; @@ -356,8 +333,8 @@ about_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) sprintf (buf, "%s\n%s\n" "\n" - "This is the Motif version of \"xscreensaver-demo\". The Motif\n" - "version is no longer maintained. Please use the GTK version\n" + "This is the Motif version of \"xscreensaver-settings\".\n" + "It is no longer maintained. Please use the GTK version\n" "instead, which has many more features.\n" "\n" "For xscreensaver updates, check https://www.jwz.org/xscreensaver/", @@ -368,7 +345,7 @@ about_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) } -void +static void doc_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { prefs_pair *pair = (prefs_pair *) client_data; @@ -385,39 +362,39 @@ doc_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) } help_command = (char *) malloc (strlen (p->load_url_command) + - (strlen (p->help_url) * 4) + 20); + (strlen (p->help_url) * 5) + 20); strcpy (help_command, "( "); sprintf (help_command + strlen(help_command), p->load_url_command, - p->help_url, p->help_url, p->help_url, p->help_url); + p->help_url, p->help_url, p->help_url, p->help_url, p->help_url); strcat (help_command, " ) &"); system (help_command); free (help_command); } -void +static void activate_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { run_cmd (XtParent (button), XA_ACTIVATE, 0); } -void +static void lock_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { run_cmd (XtParent (button), XA_LOCK, 0); } -void +static void kill_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { run_cmd (XtParent (button), XA_EXIT, 0); } -void +static void restart_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { #if 0 @@ -427,7 +404,7 @@ restart_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) apply_changes_and_save (button); xscreensaver_command (XtDisplay (button), XA_EXIT, 0, False, NULL); sleep (1); - system ("xscreensaver -nosplash &"); + system ("xscreensaver -splash &"); #endif await_xscreensaver (button); @@ -641,7 +618,7 @@ apply_changes_and_save (Widget widget) return 0; } -void +static void run_this_cb (Widget button, XtPointer client_data, XtPointer ignored) { int which = selected_hack_number (XtParent (button)); @@ -651,7 +628,7 @@ run_this_cb (Widget button, XtPointer client_data, XtPointer ignored) } -void +static void manual_cb (Widget button, XtPointer client_data, XtPointer ignored) { prefs_pair *pair = (prefs_pair *) client_data; @@ -695,7 +672,7 @@ manual_cb (Widget button, XtPointer client_data, XtPointer ignored) } -void +static void run_next_cb (Widget button, XtPointer client_data, XtPointer ignored) { prefs_pair *pair = (prefs_pair *) client_data; @@ -725,7 +702,7 @@ run_next_cb (Widget button, XtPointer client_data, XtPointer ignored) } -void +static void run_prev_cb (Widget button, XtPointer client_data, XtPointer ignored) { prefs_pair *pair = (prefs_pair *) client_data; @@ -781,7 +758,7 @@ hack_time_text (Widget button, const char *line, Time *store, Bool sec_p) } -void +static void prefs_ok_cb (Widget button, XtPointer client_data, XtPointer ignored) { prefs_pair *pair = (prefs_pair *) client_data; @@ -825,7 +802,6 @@ prefs_ok_cb (Widget button, XtPointer client_data, XtPointer ignored) MINUTES (&p2->timeout, "timeoutText"); MINUTES (&p2->cycle, "cycleText"); SECONDS (&p2->fade_seconds, "fadeSecondsText"); - INTEGER (&p2->fade_ticks, "fadeTicksText"); MINUTES (&p2->lock_timeout, "lockText"); SECONDS (&p2->passwd_timeout, "passwdText"); CHECKBOX (p2->verbose_p, "verboseToggle"); @@ -848,7 +824,6 @@ prefs_ok_cb (Widget button, XtPointer client_data, XtPointer ignored) COPY(lock_timeout); COPY(passwd_timeout); COPY(fade_seconds); - COPY(fade_ticks); COPY(verbose_p); COPY(install_cmap_p); COPY(fade_p); @@ -863,7 +838,7 @@ prefs_ok_cb (Widget button, XtPointer client_data, XtPointer ignored) } -void +static void prefs_cancel_cb (Widget button, XtPointer client_data, XtPointer ignored) { prefs_pair *pair = (prefs_pair *) client_data; @@ -996,8 +971,6 @@ populate_prefs_page (Widget top, prefs_pair *pair) XtVaSetValues (name_to_widget (top, "passwdText"), XmNvalue, s, NULL); format_time (s, p->fade_seconds); XtVaSetValues (name_to_widget (top, "fadeSecondsText"), XmNvalue, s, NULL); - sprintf (s, "%u", p->fade_ticks); - XtVaSetValues (name_to_widget (top, "fadeTicksText"), XmNvalue, s, NULL); XtVaSetValues (name_to_widget (top, "verboseToggle"), XmNset, p->verbose_p, NULL); @@ -1009,42 +982,6 @@ populate_prefs_page (Widget top, prefs_pair *pair) XmNset, p->unfade_p, NULL); XtVaSetValues (name_to_widget (top, "lockToggle"), XmNset, p->lock_p, NULL); - - - { - Bool found_any_writable_cells = False; - Display *dpy = XtDisplay (top); - int nscreens = ScreenCount(dpy); - int i; - for (i = 0; i < nscreens; i++) - { - Screen *s = ScreenOfDisplay (dpy, i); - if (has_writable_cells (s, DefaultVisualOfScreen (s))) - { - found_any_writable_cells = True; - break; - } - } - -#ifdef HAVE_XF86VMODE_GAMMA - found_any_writable_cells = True; /* if we can gamma fade, go for it */ -#endif - - XtVaSetValues (name_to_widget (top, "fadeSecondsLabel"), XtNsensitive, - found_any_writable_cells, NULL); - XtVaSetValues (name_to_widget (top, "fadeTicksLabel"), XtNsensitive, - found_any_writable_cells, NULL); - XtVaSetValues (name_to_widget (top, "fadeSecondsText"), XtNsensitive, - found_any_writable_cells, NULL); - XtVaSetValues (name_to_widget (top, "fadeTicksText"), XtNsensitive, - found_any_writable_cells, NULL); - XtVaSetValues (name_to_widget (top, "cmapToggle"), XtNsensitive, - found_any_writable_cells, NULL); - XtVaSetValues (name_to_widget (top, "fadeToggle"), XtNsensitive, - found_any_writable_cells, NULL); - XtVaSetValues (name_to_widget (top, "unfadeToggle"), XtNsensitive, - found_any_writable_cells, NULL); - } } @@ -1054,7 +991,7 @@ sensitize_demo_widgets (Widget toplevel, Bool sensitive_p) const char *names[] = { "cmdLabel", "cmdText", "enabled", "visLabel", "combo", "demo", "man" }; int i; - for (i = 0; i < sizeof(names)/countof(*names); i++) + for (i = 0; i < countof(names); i++) { Widget w = name_to_widget (toplevel, names[i]); XtVaSetValues (w, XtNsensitive, sensitive_p, NULL); @@ -1063,7 +1000,7 @@ sensitize_demo_widgets (Widget toplevel, Bool sensitive_p) /* I don't know how to handle these yet... */ { const char *names2[] = { "cut", "copy", "paste" }; - for (i = 0; i < sizeof(names2)/countof(*names2); i++) + for (i = 0; i < countof(names2); i++) { Widget w = name_to_widget (toplevel, names2[i]); XtVaSetValues (w, XtNsensitive, FALSE, NULL); @@ -1208,7 +1145,7 @@ pixmapify_buttons (Widget toplevel) -char * +static char * get_hack_blurb (Display *dpy, screenhack *hack) { char *doc_string; @@ -1301,8 +1238,8 @@ get_hack_blurb (Display *dpy, screenhack *hack) # endif /* 0 */ doc_string = strdup ( "\n" - "This is the Motif version of \"xscreensaver-demo\". The Motif " - "version is no longer maintained. Please use the GTK version " + "This is the Motif version of \"xscreensaver-settings\"." + "It is no longer maintained. Please use the GTK version " "instead, which has many more features." "\n\n" "If you were running the GTK version, there would be a preview " @@ -1475,10 +1412,10 @@ sanity_check_resources (Widget toplevel) { const char *names[] = { "demoTab", "optionsTab", "cmdLabel", "visLabel", "enabled", "demo", "man", "timeoutLabel", - "cycleLabel", "fadeSecondsLabel", "fadeTicksLabel", + "cycleLabel", "fadeSecondsLabel", "lockLabel", "passwdLabel" }; int i; - for (i = 0; i < sizeof(names)/countof(*names); i++) + for (i = 0; i < countof(names); i++) { Widget w = name_to_widget (toplevel, names[i]); const char *name = XtName(w); @@ -1566,11 +1503,9 @@ the_network_is_not_the_computer (Widget parent) lhost = ""; else lhost = uts.nodename; -# elif defined(VMS) - strcpy (lhost, getenv("SYS$NODE")); -# else /* !HAVE_UNAME && !VMS */ +# else /* !HAVE_UNAME */ strcat (lhost, ""); -# endif /* !HAVE_UNAME && !VMS */ +# endif /* !HAVE_UNAME */ if (p && p->pw_name) luser = p->pw_name; @@ -1738,7 +1673,7 @@ main (int argc, char **argv) dpy = XtDisplay (toplevel_shell); db = XtDatabase (dpy); - XtGetApplicationNameAndClass (dpy, &progname, &progclass); + XtGetApplicationNameAndClass (dpy, (char **) &progname, &progclass); XSetErrorHandler (demo_ehandler); /* Complain about unrecognized command-line arguments. @@ -1758,9 +1693,9 @@ main (int argc, char **argv) } } - short_version = (char *) malloc (5); - memcpy (short_version, screensaver_id + 17, 4); - short_version [4] = 0; + short_version = strdup (screensaver_id + 17); + s = strchr (short_version, ' '); + *s = 0; /* Load the init file, which may end up consulting the X resource database and the site-wide app-defaults file. Note that at this point, it's @@ -1789,22 +1724,7 @@ main (int argc, char **argv) #endif - /* Intern the atoms that xscreensaver_command() needs. - */ - XA_VROOT = XInternAtom (dpy, "__SWM_VROOT", False); - XA_SCREENSAVER = XInternAtom (dpy, "SCREENSAVER", False); - XA_SCREENSAVER_VERSION = XInternAtom (dpy, "_SCREENSAVER_VERSION",False); - XA_SCREENSAVER_STATUS = XInternAtom (dpy, "_SCREENSAVER_STATUS", False); - XA_SCREENSAVER_ID = XInternAtom (dpy, "_SCREENSAVER_ID", False); - XA_SCREENSAVER_RESPONSE = XInternAtom (dpy, "_SCREENSAVER_RESPONSE", False); - XA_SELECT = XInternAtom (dpy, "SELECT", False); - XA_DEMO = XInternAtom (dpy, "DEMO", False); - XA_ACTIVATE = XInternAtom (dpy, "ACTIVATE", False); - XA_SUSPEND = XInternAtom (dpy, "SUSPEND", False); - XA_BLANK = XInternAtom (dpy, "BLANK", False); - XA_LOCK = XInternAtom (dpy, "LOCK", False); - XA_EXIT = XInternAtom (dpy, "EXIT", False); - XA_RESTART = XInternAtom (dpy, "RESTART", False); + init_xscreensaver_atoms (dpy); /* Create the window and all its widgets. */ diff --git a/driver/dialog.c b/driver/dialog.c new file mode 100644 index 0000000..fce74c4 --- /dev/null +++ b/driver/dialog.c @@ -0,0 +1,2507 @@ +/* dialog.c --- the password dialog and splash screen. + * xscreensaver, Copyright © 1993-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + + +/* This file renders the unlock dialog and splash screen, using Xlib and Xft. + * One significant complication is that it must read raw XInput2 events to + * get keyboard and mouse input, as the "xscreensaver" process has the mouse + * and keyboard grabbed while this is running. + * + * It might be possible to implement this file using Gtk instead of Xlib, + * but the grab situation might make that tricky: those events would have to + * be re-sent to the toolkit widgets in a way that it would understand them. + * Also, toolkits tend to assume that a window manager exists, and this + * window must be an OverrideRedirect window with no focus management. + * + * Crashes here are interpreted as "unauthorized" and do not unlock the + * screen. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_UNISTD_H +# include +#endif + +#ifdef HAVE_UNAME +# include +#endif /* HAVE_UNAME */ +#include +#include + +#include /* for CARD32 */ +#include +#include +#include +#include + +#ifdef ENABLE_NLS +# include +# include +# define _(S) gettext(S) +#else +# define _(S) (S) +#endif + +#ifdef HAVE_XKB +# include +# include +#endif + +#include "version.h" +#include "blurb.h" +#include "auth.h" +#include "atoms.h" +#include "screens.h" +#include "xft.h" +#include "xftwrap.h" +#include "xinput.h" +#include "resources.h" +#include "visual.h" +#include "font-retry.h" +#include "prefs.h" +#include "usleep.h" + +extern Bool debug_p; + +#undef DEBUG_METRICS +#undef DEBUG_STACKING + +#define LOCK_FAILURE_ATOM "_XSCREENSAVER_AUTH_FAILURES" + +#undef MAX +#undef MIN +#define MAX(a,b) ((a)>(b)?(a):(b)) +#define MIN(a,b) ((a)<(b)?(a):(b)) + +#define MAX_BYTES_PER_CHAR 8 /* UTF-8 uses up to 6 bytes */ +#define MAX_PASSWD_CHARS 280 /* Longest possible passphrase */ + +typedef struct window_state window_state; + + +typedef enum { + AUTH_READ, /* reading input or ready to do so */ + AUTH_SUCCESS, /* auth success, unlock */ + AUTH_FAIL, /* auth fail */ + AUTH_CANCEL, /* user canceled, or typed blank password */ + AUTH_TIME, /* timed out */ + AUTH_FINISHED, /* user pressed enter */ + AUTH_NOTIFY /* displaying message after finished */ +} auth_state; + + +/* A mini-toolkit for rendering text labels, input fields, and buttons. + */ +typedef enum { CENTER, LEFT, RIGHT } line_align; + +typedef struct { + Bool down_p; + XRectangle rect; + char *cmd; + void (*fn) (window_state *ws); + Bool disabled_p; +} line_button_state; + + +typedef struct { + char *text; + XftFont *font; + XftColor fg; + Pixel bg; + enum { LABEL, BUTTON, TEXT, TEXT_RO } type; + line_align align; + Bool float_p; + Bool i_beam; + line_button_state *button; +} dialog_line; + + +/* Global state. + */ +struct window_state { + XtAppContext app; + Display *dpy; + Screen *screen; + Position cx, cy, x, y; + Dimension min_height; + Window window; + Colormap cmap; + + Bool splash_p; + auth_state auth_state; + int xi_opcode; + int xkb_opcode; + + /* Variant strings + */ + char *version; + char *user; + int nmsgs; + const auth_message *msgs; + + /* "Characters" in the password may be a variable number of bytes long. + plaintext_passwd contains the raw bytes. + plaintext_passwd_char_size indicates the size in bytes of each character, + so that we can make backspace work. + censored_passwd is the asterisk version. + + Maybe it would be more sensible to use uint32_t and utils/utf8wc.c here, + but the multi-byte string returned by XLookupString might not be UTF-8 + (see comment in handle_keypress). + */ + char plaintext_passwd [MAX_PASSWD_CHARS * MAX_BYTES_PER_CHAR]; + char censored_passwd [MAX_PASSWD_CHARS * MAX_BYTES_PER_CHAR]; + char plaintext_passwd_char_size [MAX_PASSWD_CHARS]; + + XComposeStatus compose_status; + + XtIntervalId timer; + + XtIntervalId cursor_timer; /* Blink the I-beam */ + int i_beam; + + double start_time, end_time; + + Bool show_stars_p; /* "I regret that I have but one asterisk for my country." + -- Nathan Hale, 1776. */ + Bool caps_p; /* Whether we saw a keypress with caps-lock on */ + + char *dialog_theme; + char *heading_label; + char *body_label; + char *hostname_label; + char *date_format; + char *kbd_layout_label; + char *newlogin_cmd; + + /* Resources for fonts and colors */ + XftDraw *xftdraw; + XftFont *heading_font; + XftFont *body_font; + XftFont *error_font; + XftFont *label_font; + XftFont *date_font; + XftFont *button_font; + XftFont *hostname_font; + + Pixel foreground; + Pixel background; + XftColor xft_foreground; + XftColor xft_text_foreground; + XftColor xft_button_foreground; + XftColor xft_error_foreground; + Pixel passwd_background; + Pixel thermo_foreground; + Pixel thermo_background; + Pixel shadow_top; + Pixel shadow_bottom; + Pixel border_color; + Pixel button_background; + Pixel logo_background; + + Dimension preferred_logo_width; + Dimension preferred_logo_height; + Dimension thermo_width; + Dimension internal_padding; + Dimension shadow_width; + Dimension border_width; + + Pixmap logo_pixmap; + Pixmap logo_clipmask; + unsigned int logo_width, logo_height; + int logo_npixels; + unsigned long *logo_pixels; + + line_button_state newlogin_button_state; + line_button_state unlock_button_state; + line_button_state demo_button_state; + line_button_state help_button_state; +}; + + +static void +draw_shaded_rectangle (Display *dpy, Window window, + int x, int y, + int width, int height, + int thickness, + unsigned long top_color, + unsigned long bottom_color) +{ + XPoint points[4]; + XGCValues gcv; + GC gc1, gc2; + if (thickness == 0) return; + + gcv.foreground = top_color; + gc1 = XCreateGC (dpy, window, GCForeground, &gcv); + gcv.foreground = bottom_color; + gc2 = XCreateGC (dpy, window, GCForeground, &gcv); + + points [0].x = x; + points [0].y = y; + points [1].x = x + width; + points [1].y = y; + points [2].x = x + width - thickness; + points [2].y = y + thickness; + points [3].x = x; + points [3].y = y + thickness; + XFillPolygon (dpy, window, gc1, points, 4, Convex, CoordModeOrigin); + + points [0].x = x; + points [0].y = y + thickness; + points [1].x = x; + points [1].y = y + height; + points [2].x = x + thickness; + points [2].y = y + height - thickness; + points [3].x = x + thickness; + points [3].y = y + thickness; + XFillPolygon (dpy, window, gc1, points, 4, Convex, CoordModeOrigin); + + points [0].x = x + width; + points [0].y = y; + points [1].x = x + width - thickness; + points [1].y = y + thickness; + points [2].x = x + width - thickness; + points [2].y = y + height - thickness; + points [3].x = x + width; + points [3].y = y + height - thickness; + XFillPolygon (dpy, window, gc2, points, 4, Convex, CoordModeOrigin); + + points [0].x = x; + points [0].y = y + height; + points [1].x = x + width; + points [1].y = y + height; + points [2].x = x + width; + points [2].y = y + height - thickness; + points [3].x = x + thickness; + points [3].y = y + height - thickness; + XFillPolygon (dpy, window, gc2, points, 4, Convex, CoordModeOrigin); + + XFreeGC (dpy, gc1); + XFreeGC (dpy, gc2); +} + +#define IBEAM_WIDTH 2 + +static void +draw_i_beam (Display *dpy, Drawable d, Pixel color, int x, int y, int height) +{ + XGCValues gcv; + GC gc; + gcv.foreground = color; + gcv.line_width = IBEAM_WIDTH; + gc = XCreateGC (dpy, d, GCForeground | GCLineWidth, &gcv); + XDrawLine (dpy, d, gc, x, y, x, y + height); /* Ceci n'est pas une pipe */ + XFreeGC (dpy, gc); +} + + +static int +draw_dialog_line (window_state *ws, Drawable d, dialog_line *line, + int left, int right, int y, Bool clear_p) +{ + int w = right - left; + int h; + int xpad = 0, ypad = 0; + XGlyphInfo overall; + line_align align = line->align; + int oleft = left; + int tleft = left; + int oright = right; + int clip_w = 0; + int gutter = 0; + XRectangle rect; + int xoff2 = 0; + int yoff2 = 0; + char *text2 = 0; + char *text = line->text; + int nlines = 1; + + /* Adjust left/right margins based on the type of the line. + */ + switch (line->type) { + case LABEL: + if (line->float_p && line->align == LEFT) + { + /* Add 1px to leave a little padding between the top border of the + label and the ascenders. */ + ypad = ws->shadow_width + 1; + right = left + w/2 - ws->shadow_width * 2 - line->font->ascent / 2; + align = RIGHT; + } + + if (*line->text) + text = text2 = xft_word_wrap (ws->dpy, line->font, line->text, + right - left); + break; + + case BUTTON: /* box is fixed width at 1/3, text centered */ + align = CENTER; + xpad = 0; + /* make the buttons a little taller than everything else */ + /* Add 1px as above */ + ypad = ws->shadow_width + line->font->ascent / 2 + 1; + gutter = ws->shadow_width; + clear_p = True; + + switch (line->align) { + case LEFT: + right = left + w/3 - xpad; + break; + case CENTER: + xpad = ws->shadow_width * 2; + left += w/3 + xpad; + right -= w/3 + xpad; + break; + case RIGHT: + left = right - w/3 + xpad; + break; + } + oright = right; + xpad = 0; + break; + + case TEXT: /* box is fixed width at 1/2, text left */ + case TEXT_RO: + align = LEFT; + oleft = left + xoff2; + clear_p = True; + xpad = ws->shadow_width + line->font->ascent / 4; + /* Add 1px as above */ + ypad = ws->shadow_width + 1; + gutter = ws->shadow_width; + if (gutter < 2) gutter = 2; + + switch (line->align) { + case LEFT: + right = left + w/2; + break; + case RIGHT: + left = right - w/2; + break; + case CENTER: + abort(); + break; + } + + /* If the text is longer than the field, scroll horizontally to show + the end of the text instead of the beginning. + */ + XftTextExtentsUtf8_multi (ws->dpy, line->font, (FcChar8 *) text, + strlen(text), &overall); + if (overall.width >= w/2 - ws->shadow_width * 2 - IBEAM_WIDTH) + { + align = RIGHT; + left = right - w/2; + } + break; + + default: abort(); break; + } + + /* Clear out the area we're about to overwrite. + */ + h = nlines * (line->font->ascent + line->font->descent) + ypad*2; + if (clear_p) + { + GC gc; + XGCValues gcv; + gcv.foreground = line->bg; + gc = XCreateGC (ws->dpy, d, GCForeground, &gcv); + XFillRectangle (ws->dpy, d, gc, left, y, oright-left, h); + XFreeGC (ws->dpy, gc); + } + + /* Draw borders if necessary. + */ + switch (line->type) { + case LABEL: break; + case BUTTON: case TEXT: case TEXT_RO: + { + Bool in_p = (line->type != BUTTON); + if (line->button) + { + line->button->rect.x = left; + line->button->rect.y = y; + line->button->rect.width = right-left; + line->button->rect.height = h; + in_p = line->button->down_p || line->button->disabled_p; + } + tleft = left; + draw_shaded_rectangle (ws->dpy, d, + left, y, right-left, h, + ws->shadow_width, + (in_p ? ws->shadow_bottom : ws->shadow_top), + (in_p ? ws->shadow_top : ws->shadow_bottom)); + clip_w = ws->shadow_width; + } + break; + default: abort(); break; + } + + /* Draw the text inside our box. + */ + nlines = XftTextExtentsUtf8_multi (ws->dpy, line->font, (FcChar8 *) text, + strlen(text), &overall); + w = overall.width - overall.x; + switch (align) { + case LEFT: left = left + xpad; break; + case RIGHT: left = right - w - xpad; break; + case CENTER: + oleft = left; + left = left + xpad + (right - left - w) / 2; + if (left < oleft) left = oleft; + break; + default: abort(); break; + } + + rect.x = MAX (oleft, MAX (left, tleft + clip_w)); + rect.width = MIN (oright, right) - rect.x - clip_w; + rect.y = y + ypad - overall.y + line->font->ascent; + rect.height = overall.height; + + XftDrawSetClipRectangles (ws->xftdraw, 0, 0, &rect, 1); + + if (line->type == BUTTON && + line->button && + (line->button->down_p || line->button->disabled_p)) + xoff2 = yoff2 = MIN (ws->shadow_width, line->font->ascent/2); + + XftDrawStringUtf8_multi (ws->xftdraw, &line->fg, line->font, + left + xoff2, + y + ypad + yoff2 + line->font->ascent, + (FcChar8 *) text, strlen (text), + (align == LEFT ? 1 : align == CENTER ? 0 : -1)); +# ifdef DEBUG_METRICS + { + GC gc; + XGCValues gcv; + int yy = y + ypad + yoff2 + line->font->ascent; + gcv.foreground = line->fg.pixel; + gc = XCreateGC (ws->dpy, d, GCForeground, &gcv); + /* draw a line on the baseline of the text */ + XDrawLine (ws->dpy, d, gc, 0, yy, right, yy); + yy -= line->font->ascent; + /* a line above the ascenders */ + XDrawLine (ws->dpy, d, gc, left, yy, right, yy); + yy += line->font->ascent + line->font->descent; + /* and below the descenders */ + XDrawLine (ws->dpy, d, gc, left, yy, right, yy); + XFreeGC (ws->dpy, gc); + } +# endif + + if (line->i_beam) + draw_i_beam (ws->dpy, d, + ws->foreground, + left + xoff2 + overall.width, + y + ypad + yoff2, + line->font->ascent + line->font->descent); + + XftDrawSetClip (ws->xftdraw, 0); + + if (text2) free (text2); + + y += ypad*2 + (nlines * (line->font->ascent + line->font->descent)) + gutter; + return y; +} + + +static int +draw_dialog_lines (window_state *sp, Drawable d, dialog_line *lines, + int left, int right, int top) +{ + int i; + int maxy = 0; + for (i = 0; lines[i].text; i++) + { + Bool clear_p = (i > 0 && lines[i-1].float_p ? False : True); + int y = draw_dialog_line (sp, d, &lines[i], left, right, top, clear_p); + if (y > maxy) maxy = y; + if (! lines[i].float_p) + top = maxy; + } + return top; +} + + +static pid_t +fork_and_exec (Display *dpy, int argc, char **argv) +{ + char buf [255]; + pid_t forked = fork(); + switch ((int) forked) { + case -1: + sprintf (buf, "%s: couldn't fork", blurb()); + perror (buf); + break; + + case 0: + close (ConnectionNumber (dpy)); /* close display fd */ + execvp (argv[0], argv); /* shouldn't return. */ + + sprintf (buf, "%s: pid %lu: couldn't exec %s", blurb(), + (unsigned long) getpid(), argv[0]); + perror (buf); + exit (1); /* exits child fork */ + break; + + default: /* parent fork */ + if (verbose_p) + { + int i; + fprintf (stderr, "%s: pid %lu: launched", + blurb(), (unsigned long) forked); + for (i = 0; i < argc; i++) + fprintf (stderr, " %s", argv[i]); + fprintf (stderr, "\n"); + } + break; + } + + return forked; +} + + +/* Loading resources + */ +static void +resource_keys (window_state *ws, const char **name, const char **rclass) +{ + const char *theme = ws->dialog_theme; + const char *name2 = (ws->splash_p ? "splash" : "passwd"); + const char *class2 = "Dialog"; + static char res[200], rclass2[200]; + char *s; + + /* First try $THEME."Dialog.value" */ + sprintf (res, "%s.%s.%s", theme, name2, *name); + sprintf (rclass2, "%s.%s.%s", theme, class2, *rclass); + s = get_string_resource (ws->dpy, res, rclass2); + if (s && *s) goto DONE; + + /* Next try "default.Dialog.value" */ + if (s) free (s); + theme = "default"; + sprintf (res, "%s.%s.%s", theme, name2, *name); + sprintf (rclass2, "%s.%s.%s", theme, class2, *rclass); + s = get_string_resource (ws->dpy, res, rclass2); + if (s && *s) goto DONE; + + /* Next try "Dialog.value" */ + if (s) free (s); + sprintf (res, "%s.%s", theme, *name); + sprintf (rclass2, "%s.%s", theme, *rclass); + s = get_string_resource (ws->dpy, res, rclass2); + if (s && *s) goto DONE; + + DONE: + *name = res; + *rclass = rclass2; + if (s) free (s); +} + + +static char * +get_str (window_state *ws, const char *name, const char *rclass) +{ + resource_keys (ws, &name, &rclass); + return get_string_resource (ws->dpy, (char *) name, (char *) rclass); +} + + +static XftFont * +get_font (window_state *ws, const char *name) +{ + const char *rclass = "Font"; + XftFont *f; + char *s; + resource_keys (ws, &name, &rclass); + s = get_string_resource (ws->dpy, (char *) name, (char *) rclass); + if (!s || !*s) + s = "sans-serif 14"; + f = load_xft_font_retry (ws->dpy, DefaultScreen(ws->dpy), s); + if (!f) abort(); + return f; +} + +static unsigned long +get_color (window_state *ws, const char *name, const char *rclass) +{ + resource_keys (ws, &name, &rclass); + return get_pixel_resource (ws->dpy, DefaultColormapOfScreen (ws->screen), + (char *) name, (char *) rclass); +} + +static void +get_xft_color (window_state *ws, XftColor *ret, + const char *name, const char *rclass) +{ + char *s; + resource_keys (ws, &name, &rclass); + s = get_string_resource (ws->dpy, (char *) name, (char *) rclass); + if (!s || !*s) s = "black"; + XftColorAllocName (ws->dpy, + DefaultVisualOfScreen(ws->screen), + DefaultColormapOfScreen (ws->screen), + s, ret); +} + +static int +get_int (window_state *ws, const char *name, const char *rclass) +{ + resource_keys (ws, &name, &rclass); + return get_integer_resource (ws->dpy, (char *) name, (char *) rclass); +} + + +/* Decide where on the X11 screen to place the dialog. + This is complicated because, in the face of RANDR and Xinerama, we want + to center it on a *monitor*, not on what X calls a 'Screen'. So get the + monitor state, then figure out which one of those the mouse is in. + */ +static void +splash_pick_window_position (Display *dpy, Position *xP, Position *yP) +{ + Window pointer_root, pointer_child; + int root_x = 0, root_y = 0, win_x, win_y; + unsigned int mask; + monitor **monitors; + monitor *m = 0; + int i; + + XQueryPointer (dpy, RootWindow (dpy, 0), + &pointer_root, &pointer_child, + &root_x, &root_y, &win_x, &win_y, &mask); + + monitors = scan_monitors (dpy); + if (!monitors || !*monitors) abort(); + + for (i = 0; monitors[i]; i++) + { + monitor *m0 = monitors[i]; + if (m0->sanity == S_SANE && + root_x >= m0->x && + root_y >= m0->y && + root_x < m0->x + m0->width && + root_y < m0->y + m0->height) + { + m = m0; + break; + } + } + + if (!m) + { + if (verbose_p) + fprintf (stderr, "%s: mouse is not on any monitor?\n", blurb()); + m = monitors[0]; + } + else if (verbose_p) + fprintf (stderr, + "%s: mouse is at %d,%d on monitor %d %dx%d+%d+%d \"%s\"\n", + blurb(), root_x, root_y, m->id, + m->width, m->height, m->x, m->y, + (m->desc ? m->desc : "")); + + *xP = m->x + m->width/2; + *yP = m->y + m->height/2; + + free_monitors (monitors); +} + + +static void unlock_cb (window_state *ws); + + +/* This program only needs one option from the init file, so it + just reads the .ad file and the .xscreensaver file directly rather + than going through Xt and Xrm. + */ +static void init_line_handler (int lineno, + const char *key, const char *val, + void *closure) +{ + window_state *ws = (window_state *) closure; + if (val && *val && !strcmp (key, "dialogTheme")) + { + if (ws->dialog_theme) free (ws->dialog_theme); + ws->dialog_theme = strdup (val); + } +} + +static void +read_init_file_simple (window_state *ws) +{ + const char *home = getenv("HOME"); + const char *fn1 = AD_DIR "/XScreenSaver"; + char *fn2; + if (!home || !*home) return; + fn2 = (char *) malloc (strlen(home) + 40); + sprintf (fn2, "%s/.xscreensaver", home); + + if (debug_p) + fprintf (stderr, "%s: reading %s\n", blurb(), fn1); + parse_init_file (fn1, init_line_handler, ws); + + if (debug_p) + fprintf (stderr, "%s: reading %s\n", blurb(), fn2); + parse_init_file (fn2, init_line_handler, ws); + + if (verbose_p) + fprintf (stderr, "%s: theme: %s\n", blurb(), + (ws->dialog_theme ? ws->dialog_theme : "none")); +} + + +static void +grab_keyboard_and_mouse (window_state *ws) +{ + /* If we have been launched by xscreensaver, these grabs won't succeed, + and that is expected. But if we are being run manually for debugging, + they are necessary to avoid having events seen by two apps at once. + (We don't bother to ungrab, that happens when we exit.) + */ + Display *dpy = ws->dpy; + Window root = RootWindowOfScreen (ws->screen); + XGrabKeyboard (dpy, root, True, GrabModeAsync, GrabModeAsync, CurrentTime); + XGrabPointer (dpy, root, True, + (ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | LeaveWindowMask | + PointerMotionMask | PointerMotionHintMask | + Button1MotionMask | Button2MotionMask | + Button3MotionMask | Button4MotionMask | + Button5MotionMask | ButtonMotionMask), + GrabModeAsync, GrabModeAsync, root, + None, CurrentTime); +} + + +static void +get_keyboard_layout (window_state *ws) +{ +# ifdef HAVE_XKB + XkbStateRec state; + XkbDescPtr desc = 0; + Atom name = 0; + char *namestr = 0; + + if (! ws->xkb_opcode) + { + if (! XkbQueryExtension (ws->dpy, 0, &ws->xkb_opcode, 0, 0, 0)) + { + ws->xkb_opcode = -1; /* Only try once */ + if (verbose_p) + fprintf (stderr, "%s: XkbQueryExtension failed\n", blurb()); + return; + } + + if (! XkbSelectEvents (ws->dpy, XkbUseCoreKbd, + XkbMapNotifyMask | XkbStateNotifyMask, + XkbMapNotifyMask | XkbStateNotifyMask)) + { + if (verbose_p) + fprintf (stderr, "%s: XkbSelectEvents failed\n", blurb()); + } + } + + if (XkbGetState (ws->dpy, XkbUseCoreKbd, &state)) + { + if (verbose_p) + fprintf (stderr, "%s: XkbGetState failed\n", blurb()); + return; + } + desc = XkbGetKeyboard (ws->dpy, XkbAllComponentsMask, XkbUseCoreKbd); + if (!desc || !desc->names) + { + if (verbose_p) + fprintf (stderr, "%s: XkbGetKeyboard failed\n", blurb()); + goto DONE; + } + name = desc->names->groups[state.group]; + namestr = (name ? XGetAtomName (ws->dpy, name) : 0); + if (!namestr) + { + if (verbose_p) + fprintf (stderr, "%s: XkbGetKeyboard returned null layout\n", blurb()); + goto DONE; + } + + if (ws->kbd_layout_label) + free (ws->kbd_layout_label); + ws->kbd_layout_label = namestr; + + if (verbose_p) + fprintf (stderr, "%s: kbd layout: %s\n", blurb(), + namestr ? namestr : "null"); + + DONE: + if (desc) XFree (desc); +# endif /* HAVE_XKB */ +} + + +static double +double_time (void) +{ + struct timeval now; +# ifdef GETTIMEOFDAY_TWO_ARGS + struct timezone tzp; + gettimeofday(&now, &tzp); +# else + gettimeofday(&now); +# endif + + return (now.tv_sec + ((double) now.tv_usec * 0.000001)); +} + + +static void +create_window (window_state *ws, int w, int h) +{ + XSetWindowAttributes attrs; + unsigned long attrmask; + Window ow = ws->window; + + attrmask = CWOverrideRedirect | CWEventMask; + attrs.override_redirect = True; + attrs.event_mask = ExposureMask | VisibilityChangeMask; + ws->window = XCreateWindow (ws->dpy, + RootWindowOfScreen(ws->screen), + ws->x, ws->y, w, h, 0, + DefaultDepthOfScreen (ws->screen), + InputOutput, + DefaultVisualOfScreen(ws->screen), + attrmask, &attrs); + XSetWindowBackground (ws->dpy, ws->window, ws->background); + XSetWindowColormap (ws->dpy, ws->window, ws->cmap); + xscreensaver_set_wm_atoms (ws->dpy, ws->window, w, h, 0); + + if (ow) + { + XMapRaised (ws->dpy, ws->window); + XDestroyWindow (ws->dpy, ow); + } +} + + +/* Loads resources and creates and returns the global window state. + */ +static window_state * +window_init (Widget root_widget, Bool splash_p) +{ + Display *dpy = XtDisplay (root_widget); + Screen *screen = XtScreen (root_widget); + window_state *ws; + Bool resource_error_p = False; + + ws = (window_state *) calloc (1, sizeof(*ws)); + if (!ws) abort(); + + ws->splash_p = splash_p; + ws->dpy = dpy; + ws->screen = screen; + ws->app = XtWidgetToApplicationContext (root_widget); + + /* Read default theme from resources before the init file. */ + ws->dialog_theme = + get_string_resource (ws->dpy, "dialogTheme", "DialogTheme"); + if (!ws->dialog_theme || !*ws->dialog_theme) + ws->dialog_theme = strdup ("default"); + + /* Read theme from init file before any other resources. */ + read_init_file_simple (ws); + + { + struct passwd *p = getpwuid (getuid()); + if (!p || !p->pw_name || !*p->pw_name) abort(); + ws->user = p->pw_name; + } + + ws->cmap = XCreateColormap (dpy, RootWindowOfScreen (screen), /* Old skool */ + DefaultVisualOfScreen (screen), + AllocNone); + + ws->newlogin_cmd = get_str (ws, "newLoginCommand", "NewLoginCommand"); + ws->date_format = get_str (ws, "dateFormat", "DateFormat"); + ws->show_stars_p = + get_boolean_resource (ws->dpy, "passwd.asterisks", "Passwd.Boolean"); + + /* Put the version number in the label. */ + { + char *version = strdup (screensaver_id + 17); + char *year = strchr (version, '-'); + char *s = strchr (version, ' '); + *s = 0; + year = strchr (year+1, '-') + 1; + s = strchr (year, ')'); + *s = 0; + ws->heading_label = (char *) malloc (100); + ws->version = strdup(version); + sprintf (ws->heading_label, "XScreenSaver %.4s, v%.10s", year, version); + + if (splash_p) + { + ws->body_label = (char *) malloc (100); + sprintf (ws->body_label, + _("Copyright \xC2\xA9 1991-%.4s by\nJamie Zawinski "), + year); + } + } + + ws->heading_font = get_font (ws, "headingFont"); + ws->button_font = get_font (ws, "buttonFont"); + ws->body_font = get_font (ws, "bodyFont"); + ws->error_font = get_font (ws, "errorFont"); + ws->label_font = get_font (ws, "labelFont"); + ws->date_font = get_font (ws, "dateFont"); + ws->hostname_font = get_font (ws, "unameFont"); + + ws->foreground = get_color (ws, "foreground", "Foreground"); + ws->background = get_color (ws, "background", "Background"); + + get_xft_color (ws, &ws->xft_foreground, "foreground", "Foreground"); + get_xft_color (ws, &ws->xft_text_foreground, + "text.foreground", "Text.Foreground"); + get_xft_color (ws, &ws->xft_error_foreground, + "error.foreground", "Error.Foreground"); + get_xft_color (ws, &ws->xft_button_foreground, + "button.foreground", "Button.Foreground"); + + ws->shadow_top = get_color (ws, "topShadowColor", "Foreground"); + ws->shadow_bottom = get_color (ws, "bottomShadowColor", "Background"); + ws->border_color = get_color (ws, "borderColor", "BorderColor"); + ws->passwd_background = get_color (ws, "text.background", "Text.Background"); + ws->button_background = + get_color (ws, "button.background", "Button.Background"); + ws->thermo_foreground = + get_color (ws, "thermometer.foreground", "Thermometer.Foreground"); + ws->thermo_background = + get_color ( ws, "thermometer.background", "Thermometer.Background"); + ws->logo_background = get_color ( ws, "logo.background", "Logo.Background"); + + if (resource_error_p) + { + /* Make sure the error messages show up. */ + ws->foreground = BlackPixelOfScreen (screen); + ws->background = WhitePixelOfScreen (screen); + } + + ws->preferred_logo_width = get_int (ws, "logo.width", "Logo.Width"); + ws->preferred_logo_height = get_int (ws, "logo.height", "Logo.Height"); + ws->thermo_width = get_int (ws, "thermometer.width", "Thermometer.Width"); + ws->shadow_width = get_int (ws, "shadowWidth", "ShadowWidth"); + ws->border_width = get_int (ws, "borderWidth", "BorderWidth"); + ws->internal_padding = + get_int (ws, "internalPadding", "InternalPadding"); + + if (ws->preferred_logo_width == 0) ws->preferred_logo_width = 150; + if (ws->preferred_logo_height == 0) ws->preferred_logo_height = 150; + if (ws->internal_padding == 0) ws->internal_padding = 15; + if (ws->thermo_width == 0) ws->thermo_width = ws->shadow_width; + + if (ws->splash_p) ws->thermo_width = 0; + +# ifdef HAVE_UNAME + if (!splash_p && + get_boolean_resource (ws->dpy, "passwd.uname", "Passwd.Boolean")) + { + struct utsname uts; + if (!uname (&uts) && *uts.nodename) + ws->hostname_label = strdup (uts.nodename); + } +# endif + + get_keyboard_layout (ws); + + /* Load the logo pixmap, based on font size */ + { + int x, y; + unsigned int bw, d; + Window root = RootWindowOfScreen(ws->screen); + Visual *visual = DefaultVisualOfScreen (ws->screen); + int logo_size = (ws->heading_font->ascent > 24 ? 2 : 1); + ws->logo_pixmap = xscreensaver_logo (screen, visual, root, ws->cmap, + ws->background, + &ws->logo_pixels, &ws->logo_npixels, + &ws->logo_clipmask, logo_size); + if (!ws->logo_pixmap) abort(); + XGetGeometry (dpy, ws->logo_pixmap, &root, &x, &y, + &ws->logo_width, &ws->logo_height, &bw, &d); + } + + splash_pick_window_position (ws->dpy, &ws->cx, &ws->cy); + + ws->x = ws->y = 0; + create_window (ws, 1, 1); + + /* Select SubstructureNotifyMask on the root window so that we know + when another process has mapped a window, so that we can make our + window always be on top. */ + { + Window root = RootWindowOfScreen (ws->screen); + XWindowAttributes xgwa; + XGetWindowAttributes (ws->dpy, root, &xgwa); + XSelectInput (ws->dpy, root, + xgwa.your_event_mask | SubstructureNotifyMask); + } + + + ws->newlogin_button_state.cmd = ws->newlogin_cmd; + ws->demo_button_state.cmd = + get_string_resource (ws->dpy, "demoCommand", "Command"); + { + char *load = get_string_resource (ws->dpy, "loadURL", "Command"); + char *url = get_string_resource (ws->dpy, "helpURL", "URL"); + if (load && *load && url && *url) + { + char *cmd = (char *) malloc (strlen(load) + (strlen(url) * 5) + 10); + sprintf (cmd, load, url, url, url, url, url); + ws->help_button_state.cmd = cmd; + } + } + + ws->unlock_button_state.fn = unlock_cb; + + grab_keyboard_and_mouse (ws); + + return ws; +} + + +#ifdef DEBUG_STACKING +static void +describe_window (Display *dpy, Window w) +{ + XClassHint ch; + char *name = 0; + if (XGetClassHint (dpy, w, &ch)) + { + fprintf (stderr, "0x%lx \"%s\", \"%s\"\n", (unsigned long) w, + ch.res_class, ch.res_name); + XFree (ch.res_class); + XFree (ch.res_name); + } + else if (XFetchName (dpy, w, &name) && name) + { + fprintf (stderr, "0x%lx \"%s\"\n", (unsigned long) w, name); + XFree (name); + } + else + { + fprintf (stderr, "0x%lx (untitled)\n", (unsigned long) w); + } +} +#endif /* DEBUG_STACKING */ + + +/* Returns true if some other window is on top of this one. + */ +static Bool +window_occluded_p (Display *dpy, Window window) +{ + int screen; + +# ifdef DEBUG_STACKING + fprintf (stderr, "\n"); +# endif + + for (screen = 0; screen < ScreenCount (dpy); screen++) + { + int i; + Window root = RootWindow (dpy, screen); + Window root2 = 0, parent = 0, *kids = 0; + unsigned int nkids = 0; + Bool saw_our_window_p = False; + Bool saw_later_window_p = False; + if (! XQueryTree (dpy, root, &root2, &parent, &kids, &nkids)) + { +# ifdef DEBUG_STACKING + fprintf (stderr, "%s: XQueryTree failed\n", blurb()); +# endif + continue; + } + + for (i = 0; i < nkids; i++) + { + if (kids[i] == window) + { + saw_our_window_p = True; +# ifdef DEBUG_STACKING + fprintf (stderr, "%s: our window: ", blurb()); + describe_window (dpy, kids[i]); +# endif + } + else if (saw_our_window_p) + { + saw_later_window_p = True; +# ifdef DEBUG_STACKING + fprintf (stderr, "%s: higher window: ", blurb()); + describe_window (dpy, kids[i]); +# endif + break; + } + else + { +# ifdef DEBUG_STACKING + fprintf (stderr, "%s: lower window: ", blurb()); + describe_window (dpy, kids[i]); +# endif + } + } + + if (kids) + XFree ((char *) kids); + + if (saw_later_window_p) + return True; + else if (saw_our_window_p) + return False; + /* else our window is not on this screen; keep going, try the next. */ + } + + /* Window doesn't exist? */ +# ifdef DEBUG_STACKING + fprintf (stderr, "%s: our window isn't on the screen\n", blurb()); +# endif + return False; +} + + +/* Strip leading and trailing whitespace. */ +static char * +trim (const char *s) +{ + char *s2; + int L; + if (!s) return 0; + while (*s == ' ' || *s == '\t' || *s == '\r' || *s == '\n') + s++; + s2 = strdup (s); + L = strlen (s2); + while (L > 0 && + (s2[L-1] == ' ' || s2[L-1] == '\t' || + s2[L-1] == '\r' || s2[L-1] == '\n')) + s2[--L] = 0; + return s2; +} + + +/* Repaint the entire window. + */ +static void +window_draw (window_state *ws) +{ + Display *dpy = ws->dpy; + Screen *screen = DefaultScreenOfDisplay (dpy); + Window root = RootWindowOfScreen (screen); + Visual *visual = DefaultVisualOfScreen(screen); + int depth = DefaultDepthOfScreen (screen); + XWindowAttributes xgwa; + +# define MIN_COLUMNS 22 /* Set window width based on headingFont ascent. */ + + int ext_border = (ws->internal_padding / 2 + + ws->shadow_width + ws->border_width); + + Pixmap dbuf; + unsigned int logo_frame_width, logo_frame_height; + unsigned int window_width, window_height; + unsigned int text_left, text_right; + unsigned int thermo_x; + unsigned int x, y; + GC gc; + XGCValues gcv; + char date_text[100]; + time_t now = time ((time_t *) 0); + struct tm *tm = localtime (&now); + double ratio = 1 - ((double_time() - ws->start_time) / + (ws->end_time - ws->start_time)); + dialog_line *lines = + (dialog_line *) calloc (ws->nmsgs + 40, sizeof(*lines)); + Bool emitted_user_p = False; + int i = 0, j; + + XGetWindowAttributes (ws->dpy, ws->window, &xgwa); + + if (!lines) abort(); + + strftime (date_text, sizeof(date_text)-2, ws->date_format, tm); + + logo_frame_width = (ws->logo_width + ws->internal_padding * 2 + + ws->shadow_width * 2); + logo_frame_height = logo_frame_width; + if (logo_frame_width < ws->preferred_logo_width) + logo_frame_width = ws->preferred_logo_width; + if (logo_frame_height < ws->preferred_logo_height) + logo_frame_height = ws->preferred_logo_height; + + thermo_x = ext_border * 1.5 + logo_frame_width + ws->shadow_width; + text_left = (thermo_x + ws->internal_padding + + (ws->thermo_width + ? ws->thermo_width + ws->shadow_width * 3 + : 0)); + text_right = text_left + ws->heading_font->ascent * MIN_COLUMNS; + window_width = text_right + ws->internal_padding + ext_border; + window_height = window_width * 3; /* reduced later */ + + dbuf = XCreatePixmap (dpy, root, window_width, window_height, depth); + gc = XCreateGC (dpy, dbuf, 0, &gcv); + XSetForeground (dpy, gc, ws->background); + XFillRectangle (dpy, dbuf, gc, 0, 0, window_width, window_height); + + if (ws->xftdraw) + XftDrawDestroy (ws->xftdraw); + ws->xftdraw = XftDrawCreate (dpy, dbuf, visual, xgwa.colormap); + + lines[i].text = ws->heading_label; /* XScreenSaver */ + lines[i].font = ws->heading_font; + lines[i].fg = ws->xft_foreground; + lines[i].bg = ws->background; + lines[i].type = LABEL; + lines[i].align = CENTER; + i++; + + if (time ((time_t *) 0) - XSCREENSAVER_RELEASED > 60*60*24*30*17) + { + lines[i].text = _("Update available!\nThis version is very old.\n"); + lines[i].font = ws->error_font; + lines[i].fg = ws->xft_error_foreground; + lines[i].bg = ws->background; + lines[i].type = LABEL; + lines[i].align = CENTER; + i++; + } + else if (strstr (ws->version, "a") || + strstr (ws->version, "b")) + { + lines[i].text = _("PRE-RELEASE VERSION"); + lines[i].font = ws->error_font; + lines[i].fg = ws->xft_error_foreground; + lines[i].bg = ws->background; + lines[i].type = LABEL; + lines[i].align = CENTER; + i++; + } + + if (ws->hostname_label && *ws->hostname_label) + { + lines[i].text = ws->hostname_label; + lines[i].font = ws->hostname_font; + lines[i].fg = ws->xft_foreground; + lines[i].bg = ws->background; + lines[i].type = LABEL; + lines[i].align = CENTER; + i++; + } + +# define BLANK_LINE \ + lines[i].text = ""; \ + lines[i].font = ws->body_font; \ + lines[i].fg = ws->xft_foreground; \ + lines[i].bg = ws->background; \ + lines[i].type = LABEL; \ + lines[i].align = CENTER; \ + i++ + + BLANK_LINE; + + if (debug_p && !ws->splash_p) + { + lines[i].text = + _("DEBUG MODE:\nAll keystrokes are being logged to stderr.\n"); + lines[i].font = ws->error_font; + lines[i].fg = ws->xft_error_foreground; + lines[i].bg = ws->background; + lines[i].type = LABEL; + lines[i].align = CENTER; + i++; + } + + if (ws->body_label && *ws->body_label) + { + lines[i].text = ws->body_label; /* Copyright or error message */ + lines[i].font = ws->body_font; + lines[i].fg = ws->xft_foreground; + lines[i].bg = ws->background; + lines[i].type = LABEL; + lines[i].align = CENTER; + i++; + + BLANK_LINE; + } + + for (j = 0; j < ws->nmsgs; j++) /* PAM msgs */ + { + switch (ws->msgs[j].type) { + case AUTH_MSGTYPE_INFO: + case AUTH_MSGTYPE_ERROR: + lines[i].text = trim (ws->msgs[j].msg); + lines[i].font = (ws->msgs[j].type == AUTH_MSGTYPE_ERROR + ? ws->error_font + : ws->body_font); + lines[i].fg = (ws->msgs[j].type == AUTH_MSGTYPE_ERROR + ? ws->xft_error_foreground + : ws->xft_foreground); + lines[i].bg = ws->background; + lines[i].type = LABEL; + lines[i].align = CENTER; + i++; + break; + + case AUTH_MSGTYPE_PROMPT_NOECHO: + case AUTH_MSGTYPE_PROMPT_ECHO: + + /* Show the logged in user before the first password field. */ + if (!emitted_user_p) + { + lines[i].text = _("Username:"); + lines[i].font = ws->label_font; + lines[i].fg = ws->xft_foreground; + lines[i].bg = ws->background; + lines[i].type = LABEL; + lines[i].align = LEFT; + lines[i].float_p = True; + i++; + + lines[i].text = ws->user; /* $USER */ + lines[i].font = ws->label_font; + lines[i].fg = ws->xft_text_foreground; + lines[i].bg = ws->passwd_background; + lines[i].type = TEXT_RO; + lines[i].align = RIGHT; + i++; + } + + lines[i].text = trim (ws->msgs[j].msg); /* PAM prompt text */ + lines[i].font = ws->label_font; + lines[i].fg = ws->xft_foreground; + lines[i].bg = ws->background; + lines[i].type = LABEL; + lines[i].align = LEFT; + lines[i].float_p = True; + i++; + + lines[i].text = (ws->auth_state == AUTH_FINISHED + ? _("Checking...") : + ws->msgs[j].type == AUTH_MSGTYPE_PROMPT_ECHO + ? ws->plaintext_passwd /* Hopefully UTF-8 */ + : ws->show_stars_p + ? ws->censored_passwd + : ""); + lines[i].font = ws->label_font; + lines[i].fg = ws->xft_text_foreground; + lines[i].bg = ws->passwd_background; + lines[i].type = TEXT; + lines[i].align = RIGHT; + lines[i].i_beam = (ws->i_beam && ws->auth_state != AUTH_FINISHED); + i++; + + /* Show the current time below the first password field only. */ + if (*date_text && !emitted_user_p) + { + lines[i].text = date_text; + lines[i].font = ws->date_font; + lines[i].fg = ws->xft_foreground; + lines[i].bg = ws->background; + lines[i].type = LABEL; + lines[i].align = RIGHT; + i++; + } + + /* Show the current keyboard layout below that. */ + if (ws->kbd_layout_label && *ws->kbd_layout_label && !emitted_user_p) + { + lines[i].text = ws->kbd_layout_label; + lines[i].font = ws->date_font; + lines[i].fg = ws->xft_foreground; + lines[i].bg = ws->background; + lines[i].type = LABEL; + lines[i].align = RIGHT; + i++; + } + + emitted_user_p = True; + break; + + default: + abort(); + break; + } + } + + lines[i].text = 0; + y = draw_dialog_lines (ws, dbuf, lines, + text_left, text_right, + ws->border_width + ws->internal_padding + + ws->shadow_width); + window_height = y; + window_height += (ws->button_font->ascent * 4); + window_height += (ws->internal_padding + ws->shadow_width * 2 + + ws->border_width); + + + /* Keep logo area square or taller */ + if (window_height < logo_frame_height + ws->shadow_width * 4) + window_height = logo_frame_height + ws->shadow_width * 4; + + /* Fitt's Law: It is distracting to reduce the height of the window + after creation. */ + if (window_height < ws->min_height) + window_height = ws->min_height; + ws->min_height = window_height; + + + + /* Now do a second set of lines for the buttons at the bottom. */ + + memset (lines, 0, sizeof(*lines)); + i = 0; + + if (ws->splash_p) + { + lines[i].text = _("Settings"); + lines[i].font = ws->button_font; + lines[i].fg = ws->xft_button_foreground; + lines[i].bg = ws->button_background; + lines[i].type = BUTTON; + lines[i].align = LEFT; + lines[i].float_p = True; + lines[i].button = &ws->demo_button_state; + i++; + + lines[i].text = _("Help"); + lines[i].font = ws->button_font; + lines[i].fg = ws->xft_button_foreground; + lines[i].bg = ws->button_background; + lines[i].type = BUTTON; + lines[i].align = RIGHT; + lines[i].button = &ws->help_button_state; + i++; + } + else + { + if (ws->newlogin_cmd && *ws->newlogin_cmd) + { + lines[i].text = _("New Login"); + lines[i].font = ws->button_font; + lines[i].fg = ws->xft_button_foreground; + lines[i].bg = ws->button_background; + lines[i].type = BUTTON; + lines[i].align = LEFT; + lines[i].float_p = True; + lines[i].button = &ws->newlogin_button_state; + i++; + } + + lines[i].text = _("OK"); + lines[i].font = ws->button_font; + lines[i].fg = ws->xft_button_foreground; + lines[i].bg = ws->button_background; + lines[i].type = BUTTON; + lines[i].align = RIGHT; + lines[i].button = &ws->unlock_button_state; + i++; + } + + lines[i].text = 0; + y = draw_dialog_lines (ws, dbuf, lines, + text_left, text_right, + window_height - ws->internal_padding - + ext_border - + ws->shadow_width - + (ws->button_font->ascent * 2)); + + /* The thermometer */ + if (ws->thermo_width) + { + if (ws->auth_state != AUTH_NOTIFY) + { + int thermo_w = ws->thermo_width; + int thermo_h = window_height - ext_border * 2; + int thermo_h2 = thermo_h - ws->shadow_width * 2; + int thermo_h3 = thermo_h2 * (1.0 - ratio); + + XSetForeground (dpy, gc, ws->thermo_foreground); + XFillRectangle (dpy, dbuf, gc, + thermo_x + ws->shadow_width, + ext_border + ws->shadow_width, + thermo_w, thermo_h2); + if (thermo_h3 > 0) + { + XSetForeground (dpy, gc, ws->thermo_background); + XFillRectangle (dpy, dbuf, gc, + thermo_x + ws->shadow_width, + ext_border + ws->shadow_width, + thermo_w, thermo_h3); + } + } + + draw_shaded_rectangle (dpy, dbuf, + thermo_x, ext_border, + ws->thermo_width + ws->shadow_width * 2, + window_height - ext_border * 2, + ws->shadow_width, + ws->shadow_bottom, ws->shadow_top); + } + + /* The logo, centered vertically. + */ + { + int bot = window_height - ext_border * 2; + int xoff = (logo_frame_width - ws->logo_width) / 2; + int yoff = (bot - ws->logo_height) / 2; + x = ext_border; + y = ext_border; + XSetForeground (dpy, gc, ws->logo_background); + XFillRectangle (dpy, dbuf, gc, x, y, logo_frame_width, bot); + XSetForeground (dpy, gc, ws->foreground); + XSetBackground (dpy, gc, ws->background); + XSetClipMask (dpy, gc, ws->logo_clipmask); + XSetClipOrigin (dpy, gc, x + xoff, y + yoff); + XCopyArea (dpy, ws->logo_pixmap, dbuf, gc, 0, 0, + ws->logo_width, ws->logo_height, + x + xoff, y + yoff); + XSetClipMask (dpy, gc, 0); + draw_shaded_rectangle (dpy, dbuf, + x, y, + logo_frame_width, + bot, + ws->shadow_width, + ws->shadow_bottom, ws->shadow_top); + } + + /* The window's shadow */ + draw_shaded_rectangle (dpy, dbuf, + ws->border_width, ws->border_width, + window_width - ws->border_width * 2, + window_height - ws->border_width * 2, + ws->shadow_width, + ws->shadow_top, ws->shadow_bottom); + + /* The window's border */ + draw_shaded_rectangle (dpy, dbuf, + 0, 0, window_width, window_height, + ws->border_width, + ws->border_color, ws->border_color); + + + /* Now that everything has been rendered into the pixmap, reshape the window + and copy the pixmap to it. This double-buffering is to prevent flicker. + + You'd think we could just reshape the window and then XMapRaised, but no. + With the XCompose extension enabled and the "Mutter" window manager, the + dialog window was sometimes not appearing on the screen, despite the fact + that XQueryTree reported it as the topmost window. The mouse pointer also + reflected it being there, but it wasn't visible. This is probably related + to the "XCompositeGetOverlayWindow" window in some way, which is a magic, + invisible window that is secretly excluded from the list returned by + XQueryTree, but I can't figure out what was really going on, except that + XMapRaised did not make my OverrideRedirect window appear topmost on the + screen. + + However! Though XMapRaised was not working, it turns out that destroying + and re-creating the window *does* make it appear. So we do that, any time + the window's shape has changed, or some other window has raised above it. + + Calling XQueryTree at 30fps could conceivably be a performance problem, + if there are thousands of windows on the screen. But here we are. + */ + { + Bool size_changed_p, occluded_p; + + /* It's distracting to move or shrink the window after creating it. */ + if (xgwa.height > 100 && xgwa.height > window_height) + window_height = xgwa.height; + if (! ws->x) + { + ws->x = ws->cx - (window_width / 2); + ws->y = ws->cy - (window_height / 2); + } + + /* If there is any change to the window's size, or if the window is + not on top, destroy and re-create the window. */ + size_changed_p = !(xgwa.x == ws->x && + xgwa.y == ws->y && + xgwa.width == window_width && + xgwa.height == window_height); + occluded_p = (!size_changed_p && + window_occluded_p (ws->dpy, ws->window)); + + if (size_changed_p || occluded_p) + { +# if 0 /* Window sometimes disappears under Mutter 3.30.2, Feb 2021. */ + XWindowChanges wc; + wc.x = ws->x; + wc.y = ws->y; + wc.width = window_width; + wc.height = window_height; + if (verbose_p) + fprintf (stderr, "%s: reshaping window %dx%d+%d+%d\n", blurb(), + wc.width, wc.height, wc.x, wc.y); + XConfigureWindow (ws->dpy, ws->window, CWX|CWY|CWWidth|CWHeight, &wc); +# else + if (verbose_p) + fprintf (stderr, "%s: re-creating window: %s\n", blurb(), + size_changed_p ? "size changed" : "occluded"); + create_window (ws, window_width, window_height); +# endif + XMapRaised (ws->dpy, ws->window); + XInstallColormap (ws->dpy, ws->cmap); + } + } + + XFreeGC (dpy, gc); + gc = XCreateGC (dpy, ws->window, 0, &gcv); + XCopyArea (dpy, dbuf, ws->window, gc, 0, 0, + window_width, window_height, 0, 0); + XSync (dpy, False); + XFreeGC (dpy, gc); + XFreePixmap (dpy, dbuf); + free (lines); + + if (verbose_p > 1) + { + static time_t last = 0; + static int count = 0; + count++; + if (now > last) + { + double fps = count / (double) (now - last); + fprintf (stderr, "%s: FPS: %0.1f\n", blurb(), fps); + count = 0; + last = now; + } + } +} + + +/* Unmaps the window and frees window_state. + */ +static void +destroy_window (window_state *ws) +{ + XEvent event; + + memset (ws->plaintext_passwd, 0, sizeof(ws->plaintext_passwd)); + memset (ws->plaintext_passwd_char_size, 0, + sizeof(ws->plaintext_passwd_char_size)); + memset (ws->censored_passwd, 0, sizeof(ws->censored_passwd)); + + if (ws->timer) + { + XtRemoveTimeOut (ws->timer); + ws->timer = 0; + } + + if (ws->cursor_timer) + { + XtRemoveTimeOut (ws->cursor_timer); + ws->cursor_timer = 0; + } + + while (XCheckMaskEvent (ws->dpy, PointerMotionMask, &event)) + if (verbose_p) + fprintf (stderr, "%s: discarding MotionNotify event\n", blurb()); + + if (ws->window) + { + XDestroyWindow (ws->dpy, ws->window); + ws->window = 0; + } + + if (ws->heading_label) free (ws->heading_label); + if (ws->date_format) free (ws->date_format); + if (ws->hostname_label) free (ws->hostname_label); + if (ws->kbd_layout_label) free (ws->kbd_layout_label); + + if (ws->heading_font) XftFontClose (ws->dpy, ws->heading_font); + if (ws->body_font) XftFontClose (ws->dpy, ws->body_font); + if (ws->label_font) XftFontClose (ws->dpy, ws->label_font); + if (ws->date_font) XftFontClose (ws->dpy, ws->date_font); + if (ws->button_font) XftFontClose (ws->dpy, ws->button_font); + if (ws->hostname_font) XftFontClose (ws->dpy, ws->hostname_font); + + XftColorFree (ws->dpy, DefaultVisualOfScreen (ws->screen), + DefaultColormapOfScreen (ws->screen), + &ws->xft_foreground); + XftColorFree (ws->dpy, DefaultVisualOfScreen (ws->screen), + DefaultColormapOfScreen (ws->screen), + &ws->xft_button_foreground); + XftColorFree (ws->dpy, DefaultVisualOfScreen (ws->screen), + DefaultColormapOfScreen (ws->screen), + &ws->xft_text_foreground); + XftColorFree (ws->dpy, DefaultVisualOfScreen (ws->screen), + DefaultColormapOfScreen (ws->screen), + &ws->xft_error_foreground); + XftDrawDestroy (ws->xftdraw); + +# if 0 /* screw this, we're exiting anyway */ + if (ws->foreground != black && ws->foreground != white) + XFreeColors (ws->dpy, ws->cmap, &ws->foreground, 1, 0L); + if (ws->background != black && ws->background != white) + XFreeColors (ws->dpy, ws->cmap, &ws->background, 1, 0L); + if (ws->button_background != black && ws->button_background != white) + XFreeColors (ws->dpy, ws->cmap, &ws->button_background, 1, 0L); + if (ws->passwd_background != black && ws->passwd_background != white) + XFreeColors (ws->dpy, ws->cmap, &ws->passwd_background, 1, 0L); + if (ws->thermo_foreground != black && ws->thermo_foreground != white) + XFreeColors (ws->dpy, ws->cmap, &ws->thermo_foreground, 1, 0L); + if (ws->thermo_background != black && ws->thermo_background != white) + XFreeColors (ws->dpy, ws->cmap, &ws->thermo_background, 1, 0L); + if (ws->logo_background != black && ws->logo_background != white) + XFreeColors (ws->dpy, ws->cmap, &ws->logo_background, 1, 0L); + if (ws->shadow_top != black && ws->shadow_top != white) + XFreeColors (ws->dpy, ws->cmap, &ws->shadow_top, 1, 0L); + if (ws->shadow_bottom != black && ws->shadow_bottom != white) + XFreeColors (ws->dpy, ws->cmap, &ws->shadow_bottom, 1, 0L); +# endif + + if (ws->logo_pixmap) + XFreePixmap (ws->dpy, ws->logo_pixmap); + if (ws-> logo_clipmask) + XFreePixmap (ws->dpy, ws->logo_clipmask); + if (ws->logo_pixels) + { + if (ws->logo_npixels) + XFreeColors (ws->dpy, ws->cmap, ws->logo_pixels, ws->logo_npixels, 0L); + free (ws->logo_pixels); + ws->logo_pixels = 0; + ws->logo_npixels = 0; + } + + XSync (ws->dpy, False); + memset (ws, 0, sizeof(*ws)); + free (ws); + +} + + +static void +unlock_cb (window_state *ws) +{ + if (ws->auth_state == AUTH_READ) + ws->auth_state = AUTH_FINISHED; +} + + +/* We store the count and last time of authorization failures on a property + on the root window, so that on subsequent runs of this program that + succeed, we can warn the user that someone tried to log in and failed. + */ +static void +persistent_auth_status_failure (window_state *ws, + Bool increment_p, Bool clear_p, + int *count_ret, + time_t *time_ret) +{ + Display *dpy = ws->dpy; + Window w = RootWindow (dpy, 0); /* always screen 0 */ + Atom prop = XInternAtom (ws->dpy, LOCK_FAILURE_ATOM, False); + int count = 0; + time_t tt = 0; + + Atom type; + unsigned char *dataP = 0; + int format; + unsigned long nitems, bytesafter; + + if (increment_p && clear_p) abort(); + + /* Read the old property so that we can increment it. */ + if (XGetWindowProperty (dpy, w, prop, + 0, 999, False, XA_INTEGER, + &type, &format, &nitems, &bytesafter, + &dataP) + == Success + && type == XA_INTEGER + && nitems >= 2 + && dataP) + { + count = ((PROP32 *) dataP) [0]; + tt = ((PROP32 *) dataP) [1]; /* Y2038 bug: unsigned 32 bit time_t */ + if (verbose_p) + fprintf (stderr, "%s: previous auth failures: %d @ %lu\n", + blurb(), count, (unsigned long) tt); + } + + if (dataP) + XFree (dataP); + + if (clear_p) + { + XDeleteProperty (dpy, w, prop); + if (verbose_p) + fprintf (stderr, "%s: deleted auth failure property\n", blurb()); + } + else if (increment_p) + { + PROP32 vv[2]; + count++; + + /* Remember the time of the *oldest* failed login. A failed login + 5 seconds ago does not mean we should skip warning about a failed + login yesterday. + */ + if (tt <= 0) tt = time ((time_t *) 0); + + vv[0] = (PROP32) count; + vv[1] = (PROP32) tt; + XChangeProperty (dpy, w, prop, XA_INTEGER, 32, + PropModeReplace, (unsigned char *) vv, 2); + if (verbose_p) + fprintf (stderr, "%s: saved auth failure: %d @ %lu\n", + blurb(), count, (unsigned long) tt); + } + + if (count_ret) *count_ret = count; + if (time_ret) *time_ret = tt; +} + + + +static void +handle_keypress (window_state *ws, XKeyEvent *event) +{ + unsigned char decoded [MAX_BYTES_PER_CHAR * 10]; /* leave some slack */ + KeySym keysym = 0; + + /* XLookupString may return more than one character via XRebindKeysym; + and on some systems it returns multi-byte UTF-8 characters (contrary + to its documentation, which says it returns only Latin1.) + + It seems to only do so, however, if setlocale() has been called. + See the code inside ENABLE_NLS in xscreensaver-auth.c. + + The X Keyboard Extension X11R6.4 documentation says: "When Xkb is + present, XLookupString is allowed, but not required, to return strings + in character sets other than ISO Latin-1, depending on the current + locale." So I guess that means that multi-byte strings returned by + XLookupString might not be UTF-8, and thus might not be compatible + with XftDrawStringUtf8. + */ + int decoded_size = XLookupString (event, (char *)decoded, sizeof(decoded), + &keysym, &ws->compose_status); + + if (decoded_size > MAX_BYTES_PER_CHAR) + { + /* The multi-byte character returned is too large. */ + XBell (ws->dpy, 0); + return; + } + + decoded[decoded_size] = 0; + + /* Add 10% to the time remaining every time a key is pressed, but don't + go past the max duration. */ + { + time_t now = time ((time_t *) 0); + int max = get_seconds_resource (ws->dpy, "passwdTimeout", "Time"); + int remain = ws->end_time - now; + remain *= 1.1; + if (remain > max) remain = max; + if (remain < 3) remain = 3; + ws->end_time = now + remain; + } + + + if (decoded_size == 1) /* Handle single-char commands */ + { + switch (*decoded) + { + case '\010': case '\177': /* Backspace */ + { + /* kludgey way to get the number of "logical" characters. */ + int nchars = strlen (ws->plaintext_passwd_char_size); + int nbytes = strlen (ws->plaintext_passwd); + if (nbytes <= 0) + XBell (ws->dpy, 0); + else + { + int i; + for (i = ws->plaintext_passwd_char_size[nchars-1]; i >= 0; i--) + { + if (nbytes < 0) abort(); + ws->plaintext_passwd[nbytes--] = 0; + } + ws->plaintext_passwd_char_size[nchars-1] = 0; + } + } + break; + + case '\012': case '\015': /* Enter */ + unlock_cb (ws); + break; + + case '\033': /* Escape */ + ws->auth_state = AUTH_CANCEL; + break; + + case '\025': case '\030': /* Erase line */ + memset (ws->plaintext_passwd, 0, sizeof (ws->plaintext_passwd)); + memset (ws->plaintext_passwd_char_size, 0, + sizeof (ws->plaintext_passwd_char_size)); + break; + + default: + if (*decoded < ' ' && *decoded != '\t') /* Other ctrl char */ + XBell (ws->dpy, 0); + else + goto SELF_INSERT; + break; + } + } + else + { + int nbytes, nchars; + SELF_INSERT: + nbytes = strlen (ws->plaintext_passwd); + nchars = strlen (ws->plaintext_passwd_char_size); + if (nchars + 1 >= sizeof (ws->plaintext_passwd_char_size)-1 || + nbytes + decoded_size >= sizeof (ws->plaintext_passwd)-1) + XBell (ws->dpy, 0); /* overflow */ + else if (decoded_size == 0) + ; /* Non-inserting keysym (Shift, Ctrl) */ + else + { + ws->plaintext_passwd_char_size[nchars] = decoded_size; + ws->plaintext_passwd_char_size[nchars+1] = 0; + memcpy (ws->plaintext_passwd + nbytes, decoded, decoded_size); + ws->plaintext_passwd[nbytes + decoded_size] = 0; + } + } + + /* Construct the string of asterisks. */ + { + char *out = ws->censored_passwd; + int i; + *out = 0; + for (i = 0; i < MAX_PASSWD_CHARS && ws->plaintext_passwd_char_size[i]; i++) + { + const char *b = /* "\xE2\x80\xA2"; */ /* U+2022 Bullet */ + "\xe2\x97\x8f"; /* U+25CF Black Circle */ + strcat (out, b); + out += strlen(out); + } + } +} + + +static Bool +handle_button (window_state *ws, XEvent *xev, line_button_state *bs) +{ + Bool mouse_in_box = + (xev->xbutton.x_root >= (ws->x + bs->rect.x) && + xev->xbutton.x_root < (ws->x + bs->rect.x + bs->rect.width) && + xev->xbutton.y_root >= (ws->y + bs->rect.y) && + xev->xbutton.y_root < (ws->y + bs->rect.y + bs->rect.height)); + + bs->down_p = (!bs->disabled_p && + mouse_in_box && + xev->xany.type != ButtonRelease); + + if (xev->xany.type == ButtonRelease && mouse_in_box && !bs->disabled_p) + { + bs->disabled_p = True; /* Only allow them to press the button once. */ + if (bs->fn) + bs->fn (ws); + else if (bs->cmd) + { + int ac = 0; + char *av[10]; + av[ac++] = "/bin/sh"; + av[ac++] = "-c"; + av[ac++] = bs->cmd; + av[ac] = 0; + fork_and_exec (ws->dpy, ac, av); + } + else + XBell (ws->dpy, 0); + } + return mouse_in_box; +} + + +static Bool +handle_event (window_state *ws, XEvent *xev) +{ + Bool refresh_p = False; + switch (xev->xany.type) { + case KeyPress: + if (ws->splash_p) + ws->auth_state = AUTH_CANCEL; + else + { + handle_keypress (ws, &xev->xkey); + ws->caps_p = (xev->xkey.state & LockMask); + if (ws->auth_state == AUTH_NOTIFY) + ws->auth_state = AUTH_CANCEL; + } + refresh_p = True; + break; + + case ButtonPress: + case ButtonRelease: + { + if (! (handle_button (ws, xev, &ws->newlogin_button_state) || + handle_button (ws, xev, &ws->unlock_button_state) || + handle_button (ws, xev, &ws->demo_button_state) || + handle_button (ws, xev, &ws->help_button_state))) + if (ws->splash_p && xev->xany.type == ButtonRelease) + ws->auth_state = AUTH_CANCEL; + refresh_p = True; + } + default: + break; + } + return refresh_p; +} + + +/* Blink the I-beam cursor. */ +static void +cursor_timer (XtPointer closure, XtIntervalId *id) +{ + window_state *ws = (window_state *) closure; + int timeout = 0.7 * 1000 * (ws->i_beam ? 0.25 : 0.75); + if (ws->cursor_timer) + XtRemoveTimeOut (ws->cursor_timer); + ws->cursor_timer = + XtAppAddTimeOut (ws->app, timeout, cursor_timer, (XtPointer) ws); + ws->i_beam = !ws->i_beam; +} + + +/* Redraw the window for the thermometer, and exit if the time has expired. + */ +static void +thermo_timer (XtPointer closure, XtIntervalId *id) +{ + window_state *ws = (window_state *) closure; + int timeout = 1000/30; /* FPS */ + double now = double_time(); + if (now >= ws->end_time) + ws->auth_state = AUTH_TIME; + if (ws->timer) XtRemoveTimeOut (ws->timer); + ws->timer = XtAppAddTimeOut (ws->app, timeout, thermo_timer, (XtPointer) ws); +} + + +static void +gui_main_loop (window_state *ws, Bool splash_p, Bool notification_p) +{ + int timeout; + Bool refresh_p = True; + + if (splash_p) + { + timeout = get_seconds_resource (ws->dpy, "splashDuration", "Time"); + if (timeout <= 1) timeout = 1; + } + else if (ws->auth_state == AUTH_NOTIFY) + timeout = 5; + else + { + timeout = get_seconds_resource (ws->dpy, "passwdTimeout", "Time"); + if (timeout <= 5) timeout = 5; + cursor_timer (ws, 0); + } + + ws->start_time = double_time(); + ws->end_time = ws->start_time + timeout; + + /* Since the "xscreensaver" process holds the mouse and keyboard grabbed + while "xscreensaver-auth" is running, we don't receive normal KeyPress + events. That means that the XInput2 extension is required in order to + snoop on the keyboard in a way that bypasses grabs. + */ + if (! ws->xi_opcode) + { + Bool ov = verbose_p; + verbose_p = False; + init_xinput (ws->dpy, &ws->xi_opcode); + verbose_p = ov; + } + + thermo_timer (ws, 0); + window_draw (ws); + + while (ws->auth_state == AUTH_READ || + ws->auth_state == AUTH_NOTIFY) + { + XEvent xev; + XtInputMask m = XtAppPending (ws->app); + + if (m & XtIMXEvent) + /* Process timers then block on an X event (which we know is there) */ + XtAppNextEvent (ws->app, &xev); + else + { + if (m) + /* Process timers only, don't block */ + XtAppProcessEvent (ws->app, m); + else + { + if (refresh_p) + { + /* Redraw when outstanding events have been processed. */ + window_draw (ws); + refresh_p = False; + } + + /* No way to say "block until timer *or* X pending". + Without this, the timer that changes auth_state will fire but + then we will still be blocked until the next X event. */ + usleep (1000000/30); + } + continue; + } + + if ((m & ~XtIMXEvent) && !ws->splash_p) + refresh_p = True; /* In auth mode, all timers refresh */ + + if (verbose_p || debug_p) + print_xinput_event (ws->dpy, &xev, ""); + + /* Convert XInput events to Xlib events, for simplicity and familiarity. + */ + if (xev.xcookie.type == GenericEvent && + xev.xcookie.extension == ws->xi_opcode && + (xev.xcookie.data || XGetEventData (ws->dpy, &xev.xcookie))) + { + XEvent ev2; + Bool ok = + xinput_event_to_xlib (xev.xcookie.evtype, xev.xcookie.data, &ev2); + XFreeEventData (ws->dpy, &xev.xcookie); + if (ok) + xev = ev2; + } + + if (handle_event (ws, &xev)) + refresh_p = True; + + XtDispatchEvent (&xev); + + switch (xev.xany.type) { + + /* I don't think we ever receive these, but if we do, redraw. */ + case Expose: case GraphicsExpose: + refresh_p = True; + break; + + /* Likewise, receiving this event would be ideal, but we don't. */ + case VisibilityNotify: + refresh_p = True; + if (verbose_p > 1) + fprintf (stderr, "%s: VisibilityNotify\n", blurb()); + break; + + /* When another override-redirect window is raised above us, + we receive several ConfigureNotify events on the root window. */ + case ConfigureNotify: + if (verbose_p > 1) + fprintf (stderr, "%s: ConfigureNotify\n", blurb()); + break; + + case MappingNotify: + /* This event is supposed to be sent when the keymap is changed. + You would think that typing XK_ISO_Next_Group to change the + keyboard layout would count as such. It does not. */ + if (verbose_p) + fprintf (stderr, "%s: MappingNotify\n", blurb()); + get_keyboard_layout (ws); + refresh_p = True; + break; + + default: + break; + } + + /* Since MappingNotify doesn't work, we have to do this crap instead. */ + if (xev.xany.type == ws->xkb_opcode) + { + XkbEvent *xkb = (XkbEvent *) &xev; + if (verbose_p) + fprintf (stderr, "%s: XKB event %d\n", blurb(), xkb->any.xkb_type); + get_keyboard_layout (ws); + refresh_p = True; + } + } + + /* Re-raw the window one last time, since it might sit here for a while + while PAM does it's thing. */ + window_draw (ws); + XSync (ws->dpy, False); + + if (verbose_p) { + const char *kind = (splash_p ? "splash" : + notification_p ? "notification" : "authentication"); + switch (ws->auth_state) { + case AUTH_FINISHED: + fprintf (stderr, "%s: %s input finished\n", blurb(), kind); break; + case AUTH_CANCEL: + fprintf (stderr, "%s: %s canceled\n", blurb(), kind); break; + case AUTH_TIME: + fprintf (stderr, "%s: %s timed out\n", blurb(), kind); break; + default: break; + } + } +} + + +/* Pops up a dialog and waits for the user to complete it. + Returns 0 on successful completion. + Updates 'resp' with any entered response. + */ +static Bool +dialog_session (window_state *ws, + int nmsgs, + const auth_message *msgs, + auth_response *resp) +{ + int i; + + ws->auth_state = AUTH_READ; + ws->nmsgs = nmsgs; + ws->msgs = msgs; + + memset (ws->plaintext_passwd, 0, sizeof(ws->plaintext_passwd)); + memset (ws->plaintext_passwd_char_size, 0, + sizeof(ws->plaintext_passwd_char_size)); + memset (ws->censored_passwd, 0, sizeof(ws->censored_passwd)); + ws->unlock_button_state.disabled_p = False; + + gui_main_loop (ws, False, False); + + if (ws->auth_state != AUTH_FINISHED) + return True; /* Timed out or canceled */ + + /* Find the (at most one) input field in the previous batch and return + the entered plaintext to it. */ + for (i = 0; i < nmsgs; i++) + { + if (msgs[i].type == AUTH_MSGTYPE_PROMPT_ECHO || + msgs[i].type == AUTH_MSGTYPE_PROMPT_NOECHO) + { + if (resp[i].response) abort(); + resp[i].response = strdup(ws->plaintext_passwd); + } + } + + ws->nmsgs = 0; + ws->msgs = 0; + + return False; +} + + +/* To retain this across multiple calls from PAM to xscreensaver_auth_conv. */ +window_state *global_ws = 0; + + +/* The authentication conversation function. + + Like a PAM conversation function, this accepts multiple messages in a + single round. We can only do one text entry field in the dialog at a + time, so if there is more than one entry, multiple dialogs will be used. + + PAM might call this multiple times before authenticating. We are unable + to combine multiple messages onto a single dialog if PAM splits them + between calls to this function. + + Returns True on success. If the user timed out or cancelled, we just exit. + */ +Bool +xscreensaver_auth_conv (void *closure, + int nmsgs, + const auth_message *msgs, + auth_response **resp) +{ + Widget root_widget = (Widget) closure; + int i; + int prev_msg = 0; + int field_count = 0; + auth_response *responses; + window_state *ws = global_ws; + + if (!ws) + ws = global_ws = window_init (root_widget, False); + + responses = calloc (nmsgs, sizeof(*responses)); + if (!responses) abort(); + + for (i = 0; i < nmsgs; i++) + { + if (msgs[i].type == AUTH_MSGTYPE_PROMPT_ECHO || + msgs[i].type == AUTH_MSGTYPE_PROMPT_NOECHO) + { + /* A text input field. */ + + if (field_count > 0) + { + /* This is the second one -- we must run the dialog on + the field collected so far. */ + if (dialog_session (ws, + i - prev_msg, + msgs + prev_msg, + responses + prev_msg)) + goto END; + prev_msg = i; + field_count = 0; + } + + field_count++; + } + } + + if (prev_msg < i || nmsgs == 0) + /* Run the dialog on the stuff that's left. This happens if there was + more than one text field. */ + dialog_session (ws, + i - prev_msg, + msgs + prev_msg, + responses + prev_msg); + + END: + + switch (ws->auth_state) { + case AUTH_CANCEL: + case AUTH_TIME: + /* No need to return to PAM or clean up. We're outta here! + Exit with 0 to distinguish it from our "success" or "failure" + exit codes. */ + destroy_window (ws); + exit (0); + break; + case AUTH_FINISHED: + *resp = responses; + return True; + default: + abort(); + break; + } +} + + +/* Called after authentication is complete so that we can present a "nope" + dialog if it failed, or snitch on previous failed login attempts. + */ +void +xscreensaver_auth_finished (void *closure, Bool authenticated_p) +{ + Widget root_widget = (Widget) closure; + window_state *ws = global_ws; + char msg[1024]; + int unlock_failures = 0; + time_t failure_time = 0; + Bool prompted_p = !!ws; + + /* If this was called without xscreensaver_auth_conv() ever having been + called, then either PAM decided that the user is authenticated without + a prompt (e.g. a bluetooth fob); or there was an error initializing + passwords (e.g., shadow passwords but not setuid.) + */ + if (!ws) + ws = global_ws = window_init (root_widget, False); + + if (authenticated_p) + { + /* Read the old failure count, and delete it. */ + persistent_auth_status_failure (ws, False, True, + &unlock_failures, &failure_time); + } + else + { + /* Increment the failure count. */ + persistent_auth_status_failure (ws, True, False, + &unlock_failures, &failure_time); + } + + /* If we have something to say, put the dialog back up for a few seconds + to display it. Otherwise, don't bother. + */ + if (!authenticated_p && !prompted_p) + strcpy (msg, _("Password initialization failed")); + else if (!authenticated_p && ws && ws->caps_p) + strcpy (msg, _("Authentication failed (Caps Lock?)")); + else if (!authenticated_p) + strcpy (msg, _("Authentication failed!")); + else if (authenticated_p && unlock_failures > 0) + { + time_t now = time ((time_t *) 0); + int sec = now - failure_time; + int min = (sec + 30) / 60; + int hours = (min + 30) / 60; + int days = (hours + 12) / 24; + char ago[100]; + int warning_slack = + get_integer_resource (ws->dpy, "authWarningSlack", "AuthWarningSlack"); + + if (sec < warning_slack) + { + if (verbose_p) + fprintf (stderr, "%s: ignoring recent unlock failures:" + " %d within %d sec\n", + blurb(), unlock_failures, warning_slack); + goto END; + } + else if (days > 1) sprintf (ago, _("%d days ago"), days); + else if (hours > 1) sprintf (ago, _("%d hours ago"), hours); + else if (min > 1) sprintf (ago, _("%d minutes ago"), min); + else sprintf (ago, _("just now")); + + if (unlock_failures == 1) + sprintf (msg, _("There has been 1 failed login attempt, %s."), ago); + else + sprintf (msg, + _("There have been %d failed login attempts, oldest %s."), + unlock_failures, ago); + } + else + { + /* No need to pop up a window. Authenticated, and there are no previous + failures to report. + */ + goto END; + } + + if (!*msg) abort(); + ws->body_label = strdup (msg); + + ws->auth_state = AUTH_NOTIFY; + gui_main_loop (ws, False, True); + + END: + destroy_window (global_ws); +} + + +void +xscreensaver_splash (void *closure) +{ + Widget root_widget = (Widget) closure; + window_state *ws = window_init (root_widget, True); + ws->auth_state = AUTH_READ; + gui_main_loop (ws, True, False); + destroy_window (ws); + exit (0); +} diff --git a/driver/dpms.c b/driver/dpms.c index a0dd7b8..15721ea 100644 --- a/driver/dpms.c +++ b/driver/dpms.c @@ -1,5 +1,5 @@ -/* dpms.c --- syncing the X Display Power Management values - * xscreensaver, Copyright (c) 2001-2017 Jamie Zawinski +/* dpms.c --- syncing the X Display Power Management System values + * xscreensaver, Copyright © 2001-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -10,81 +10,33 @@ * implied warranty. */ -/* Display Power Management System (DPMS.) - - On XFree86 systems, "man xset" reports: - - -dpms The -dpms option disables DPMS (Energy Star) features. - +dpms The +dpms option enables DPMS (Energy Star) features. - - dpms flags... - The dpms option allows the DPMS (Energy Star) - parameters to be set. The option can take up to three - numerical values, or the `force' flag followed by a - DPMS state. The `force' flags forces the server to - immediately switch to the DPMS state specified. The - DPMS state can be one of `standby', `suspend', or - `off'. When numerical values are given, they set the - inactivity period before the three modes are activated. - The first value given is for the `standby' mode, the - second is for the `suspend' mode, and the third is for - the `off' mode. Setting these values implicitly - enables the DPMS features. A value of zero disables a - particular mode. - - However, note that the implementation is more than a little bogus, - in that there is code in /usr/X11R6/lib/libXdpms.a to implement all - the usual server-extension-querying utilities -- but there are no - prototypes in any header file! Thus, the prototypes here. (The - stuff in X11/extensions/dpms.h and X11/extensions/dpmsstr.h define - the raw X protcol, they don't define the API to libXdpms.a.) - - Some documentation: - Library: ftp://ftp.x.org/pub/R6.4/xc/doc/specs/Xext/DPMSLib.ms - Protocol: ftp://ftp.x.org/pub/R6.4/xc/doc/specs/Xext/DPMS.ms - */ - #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include +#include -#ifdef HAVE_DPMS_EXTENSION /* almost the whole file */ +#include "xscreensaver.h" -# include -# include -/*# include */ +#ifndef HAVE_DPMS_EXTENSION /* almost the whole file */ - /* Why this crap is not in a header file somewhere, I have no idea. Losers! - */ - extern Bool DPMSQueryExtension (Display *, int *event_ret, int *err_ret); - extern Status DPMSGetVersion (Display *, int *major_ret, int *minor_ret); - extern Bool DPMSCapable (Display *); - extern Status DPMSInfo (Display *, CARD16 *power_level, BOOL *state); - extern Status DPMSEnable (Display *dpy); - extern Status DPMSDisable (Display *dpy); - extern Status DPMSForceLevel (Display *, CARD16 level); - extern Status DPMSSetTimeouts (Display *, CARD16 standby, CARD16 suspend, - CARD16 off); - extern Bool DPMSGetTimeouts (Display *, CARD16 *standby, - CARD16 *suspend, CARD16 *off); - -#endif /* HAVE_DPMS_EXTENSION */ - - -/* This file doesn't need the Xt headers, so stub these types out... */ -#undef XtPointer -#define XtAppContext void* -#define XrmDatabase void* -#define XtIntervalId void* -#define XtPointer void* -#define Widget void* +void +sync_server_dpms_settings (Display *dpy, struct saver_preferences *p) +{ + if (p->verbose_p) + fprintf (stderr, "%s: DPMS not supported at compile time\n", blurb()); +} -#include "xscreensaver.h" +Bool monitor_powered_on_p (Display *dpy) { return True; } +void monitor_power_on (saver_info *si, Bool on_p) { return; } + +#else /* HAVE_DPMS_EXTENSION -- whole file */ + +# include +# include -#ifdef HAVE_DPMS_EXTENSION static Bool error_handler_hit_p = False; @@ -97,9 +49,7 @@ ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error) void -sync_server_dpms_settings (Display *dpy, Bool enabled_p, Bool dpms_quickoff_p, - int standby_secs, int suspend_secs, int off_secs, - Bool verbose_p) +sync_server_dpms_settings (Display *dpy, struct saver_preferences *p) { int event = 0, error = 0; BOOL o_enabled = False; @@ -107,11 +57,29 @@ sync_server_dpms_settings (Display *dpy, Bool enabled_p, Bool dpms_quickoff_p, CARD16 o_standby = 0, o_suspend = 0, o_off = 0; Bool bogus_p = False; + Bool enabled_p = (p->dpms_enabled_p && p->mode != DONT_BLANK); + Bool dpms_quickoff_p = p->dpms_quickoff_p; + int standby_secs = p->dpms_standby / 1000; + int suspend_secs = p->dpms_suspend / 1000; + int off_secs = p->dpms_off / 1000; + Bool verbose_p = p->verbose_p; + static Bool warned_p = False; + + /* If the monitor is currently powered off, defer any changes until + we are next called while it is powered on. */ + if (! monitor_powered_on_p (dpy)) + return; + + /* Why did I do this? It makes DPMS never happen. + XSetScreenSaver (dpy, 0, 0, 0, 0); + XForceScreenSaver (dpy, ScreenSaverReset); + */ + if (dpms_quickoff_p && !off_secs) - { - /* To do this, we might need to temporarily re-enable DPMS first. */ - off_secs = 0xFFFF; - } + { + /* To do this, we might need to temporarily re-enable DPMS first. */ + off_secs = 0xFFFF; + } if (standby_secs == 0 && suspend_secs == 0 && off_secs == 0) /* all zero implies "DPMS disabled" */ @@ -134,22 +102,25 @@ sync_server_dpms_settings (Display *dpy, Bool enabled_p, Bool dpms_quickoff_p, if (! DPMSQueryExtension (dpy, &event, &error)) { - if (verbose_p) - fprintf (stderr, "%s: XDPMS extension not supported.\n", blurb()); + if (verbose_p && !warned_p) + fprintf (stderr, "%s: XDPMS extension not supported\n", blurb()); + warned_p = True; return; } if (! DPMSCapable (dpy)) { - if (verbose_p) - fprintf (stderr, "%s: DPMS not supported.\n", blurb()); + if (verbose_p && !warned_p) + fprintf (stderr, "%s: DPMS not supported\n", blurb()); + warned_p = True; return; } if (! DPMSInfo (dpy, &o_power, &o_enabled)) { - if (verbose_p) - fprintf (stderr, "%s: unable to get DPMS state.\n", blurb()); + if (verbose_p && !warned_p) + fprintf (stderr, "%s: unable to get DPMS state\n", blurb()); + warned_p = True; return; } @@ -157,19 +128,20 @@ sync_server_dpms_settings (Display *dpy, Bool enabled_p, Bool dpms_quickoff_p, { if (! (enabled_p ? DPMSEnable (dpy) : DPMSDisable (dpy))) { - if (verbose_p) - fprintf (stderr, "%s: unable to set DPMS state.\n", blurb()); + if (verbose_p && !warned_p) + fprintf (stderr, "%s: unable to set DPMS state\n", blurb()); + warned_p = True; return; } else if (verbose_p) - fprintf (stderr, "%s: turned DPMS %s.\n", blurb(), + fprintf (stderr, "%s: turned DPMS %s\n", blurb(), enabled_p ? "on" : "off"); } if (bogus_p) { if (verbose_p) - fprintf (stderr, "%s: not setting bogus DPMS timeouts: %d %d %d.\n", + fprintf (stderr, "%s: not setting bogus DPMS timeouts: %d %d %d\n", blurb(), standby_secs, suspend_secs, off_secs); return; } @@ -177,7 +149,7 @@ sync_server_dpms_settings (Display *dpy, Bool enabled_p, Bool dpms_quickoff_p, if (!DPMSGetTimeouts (dpy, &o_standby, &o_suspend, &o_off)) { if (verbose_p) - fprintf (stderr, "%s: unable to get DPMS timeouts.\n", blurb()); + fprintf (stderr, "%s: unable to get DPMS timeouts\n", blurb()); return; } @@ -188,34 +160,34 @@ sync_server_dpms_settings (Display *dpy, Bool enabled_p, Bool dpms_quickoff_p, if (!DPMSSetTimeouts (dpy, standby_secs, suspend_secs, off_secs)) { if (verbose_p) - fprintf (stderr, "%s: unable to set DPMS timeouts.\n", blurb()); + fprintf (stderr, "%s: unable to set DPMS timeouts\n", blurb()); return; } else if (verbose_p) - fprintf (stderr, "%s: set DPMS timeouts: %d %d %d.\n", blurb(), + fprintf (stderr, "%s: set DPMS timeouts: %d %d %d\n", blurb(), standby_secs, suspend_secs, off_secs); } } Bool -monitor_powered_on_p (saver_info *si) +monitor_powered_on_p (Display *dpy) { Bool result; int event_number, error_number; BOOL onoff = False; CARD16 state; - if (!DPMSQueryExtension(si->dpy, &event_number, &error_number)) + if (!DPMSQueryExtension(dpy, &event_number, &error_number)) /* Server doesn't know -- assume the monitor is on. */ result = True; - else if (!DPMSCapable(si->dpy)) + else if (!DPMSCapable(dpy)) /* Server says the monitor doesn't do power management -- so it's on. */ result = True; else { - DPMSInfo(si->dpy, &state, &onoff); + DPMSInfo(dpy, &state, &onoff); if (!onoff) /* Server says DPMS is disabled -- so the monitor is on. */ result = True; @@ -235,17 +207,19 @@ monitor_powered_on_p (saver_info *si) void monitor_power_on (saver_info *si, Bool on_p) { - if ((!!on_p) != monitor_powered_on_p (si)) + if ((!!on_p) != monitor_powered_on_p (si->dpy)) { XErrorHandler old_handler; int event_number, error_number; + static Bool warned_p = False; if (!DPMSQueryExtension(si->dpy, &event_number, &error_number) || !DPMSCapable(si->dpy)) { - if (si->prefs.verbose_p) + if (si->prefs.verbose_p && !warned_p) fprintf (stderr, - "%s: unable to power %s monitor: no DPMS extension.\n", + "%s: unable to power %s monitor: no DPMS extension\n", blurb(), (on_p ? "on" : "off")); + warned_p = True; return; } @@ -269,36 +243,12 @@ monitor_power_on (saver_info *si, Bool on_p) XSetErrorHandler (old_handler); /* Ignore error_handler_hit_p, just probe monitor instead */ - if ((!!on_p) != monitor_powered_on_p (si)) /* double-check */ + if ((!!on_p) != monitor_powered_on_p (si->dpy)) /* double-check */ fprintf (stderr, - "%s: DPMSForceLevel(dpy, %s) did not change monitor power state.\n", + "%s: DPMSForceLevel(dpy, %s) did not change monitor power state\n", blurb(), (on_p ? "DPMSModeOn" : "DPMSModeOff")); } } -#else /* !HAVE_DPMS_EXTENSION */ - -void -sync_server_dpms_settings (Display *dpy, Bool enabled_p, - Bool dpms_quickoff_p, - int standby_secs, int suspend_secs, int off_secs, - Bool verbose_p) -{ - if (verbose_p) - fprintf (stderr, "%s: DPMS support not compiled in.\n", blurb()); -} - -Bool -monitor_powered_on_p (saver_info *si) -{ - return True; -} - -void -monitor_power_on (saver_info *si, Bool on_p) -{ - return; -} - -#endif /* !HAVE_DPMS_EXTENSION */ +#endif /* HAVE_DPMS_EXTENSION -- whole file */ diff --git a/driver/exec.c b/driver/exec.c index 38ca88a..8d1c45a 100644 --- a/driver/exec.c +++ b/driver/exec.c @@ -1,5 +1,5 @@ /* exec.c --- executes a program in *this* pid, without an intervening process. - * xscreensaver, Copyright (c) 1991-2013 Jamie Zawinski + * xscreensaver, Copyright © 1991-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -69,14 +69,6 @@ /* and also setrlimit() and RLIMIT_AS */ #endif -#ifdef VMS -# include -# include /* for close */ -# include /* for getpid */ -# define pid_t int -# define fork vfork -#endif /* VMS */ - #include "exec.h" extern const char *blurb (void); @@ -84,8 +76,6 @@ extern const char *blurb (void); static void nice_process (int nice_level); -#ifndef VMS - static void exec_simple_command (const char *command) { @@ -161,26 +151,12 @@ exec_complex_command (const char *shell, const char *command) execvp (av[0], av); /* shouldn't return. */ } -#else /* VMS */ - -static void -exec_vms_command (const char *command) -{ - system (command); - fflush (stderr); - fflush (stdout); - exit (1); /* Note that this only exits a child fork. */ -} - -#endif /* !VMS */ - void exec_command (const char *shell, const char *command, int nice_level) { int hairy_p; -#ifndef VMS nice_process (nice_level); hairy_p = !!strpbrk (command, "*?$&!<>[];`'\\\"="); @@ -204,10 +180,6 @@ exec_command (const char *shell, const char *command, int nice_level) else /* Otherwise, we can just exec the program directly. */ exec_simple_command (command); - -#else /* VMS */ - exec_vms_command (command); -#endif /* VMS */ } @@ -242,7 +214,7 @@ nice_process (int nice_level) } #else fprintf (stderr, - "%s: don't know how to change process priority on this system.\n", + "%s: don't know how to change process priority on this system\n", blurb()); #endif diff --git a/driver/exts.c b/driver/exts.c new file mode 100644 index 0000000..641325d --- /dev/null +++ b/driver/exts.c @@ -0,0 +1,238 @@ +/* xscreensaver, Copyright © 1991-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +/* Some random diagnostics printed in -verbose mode about what extensions + are available on the server, and their version numbers. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include + +#include + +#ifdef HAVE_XSHM_EXTENSION +# include +#endif /* HAVE_XSHM_EXTENSION */ + +#ifdef HAVE_DPMS_EXTENSION +# include +#endif /* HAVE_DPMS_EXTENSION */ + + +#ifdef HAVE_DOUBLE_BUFFER_EXTENSION +# include +#endif /* HAVE_DOUBLE_BUFFER_EXTENSION */ + +#ifdef HAVE_XF86VMODE +# include +#endif /* HAVE_XF86VMODE */ + +#ifdef HAVE_XINERAMA +# include +#endif /* HAVE_XINERAMA */ + +#ifdef HAVE_RANDR +# include +#endif /* HAVE_RANDR */ + +#ifdef HAVE_XCOMPOSITE_EXTENSION +# include +#endif + +#ifdef HAVE_XKB +# include +#endif + +#include "xscreensaver.h" + + +void +print_available_extensions (saver_info *si) +{ + int i, j; + static struct { + const char *name; const char *desc; + Bool useful_p; + Status (*version_fn) (Display *, int *majP, int *minP); + } exts[] = { + +# if 0 + { "MIT-SCREEN-SAVER", "MIT Screen-Saver", + False, 0 + }, +# endif + { "MIT-SHM", "Shared Memory", +# ifdef HAVE_XSHM_EXTENSION + True, (Status (*) (Display*,int*,int*)) XShmQueryVersion /* 4 args */ +# else + False, 0 +# endif + }, { "DOUBLE-BUFFER", "Double-Buffering", +# ifdef HAVE_DOUBLE_BUFFER_EXTENSION + True, XdbeQueryExtension +# else + False, 0 +# endif + }, { "DPMS", "Power Management", +# ifdef HAVE_DPMS_EXTENSION + True, DPMSGetVersion +# else + False, 0 +# endif + }, { "GLX", "GLX", +# ifdef HAVE_GL + True, 0 +# else + False, 0 +# endif + }, { "XFree86-VidModeExtension", "XF86 Video-Mode", +# ifdef HAVE_XF86VMODE + True, XF86VidModeQueryVersion +# else + False, 0 +# endif + }, { "XC-VidModeExtension", "XC Video-Mode", +# ifdef HAVE_XF86VMODE + True, XF86VidModeQueryVersion +# else + False, 0 +# endif + }, { "XINERAMA", "Xinerama", +# ifdef HAVE_XINERAMA + True, XineramaQueryVersion +# else + False, 0 +# endif + }, { "RANDR", "Resize-and-Rotate", +# ifdef HAVE_RANDR + True, XRRQueryVersion +# else + False, 0 +# endif + }, { "Composite", "Composite", +# ifdef HAVE_XCOMPOSITE_EXTENSION + True, XCompositeQueryVersion +# else + True, 0 +# endif + }, { "XKEYBOARD", "XKeyboard", +# ifdef HAVE_XKB + True, 0, +# else + False, 0 +# endif + }, { "DRI", "DRI", True, 0 + }, { "NV-CONTROL", "NVidia", True, 0 + }, { "NV-GLX", "NVidia GLX", True, 0 + }, { "Apple-DRI", "Apple-DRI", True, 0 + }, { "Apple-WM", "Apple-WM", True, 0 + }, { "XInputExtension", "XInput", True, 0 + }, + }; + + fprintf (stderr, "%s: running on display \"%s\"\n", blurb(), + DisplayString(si->dpy)); + fprintf (stderr, "%s: vendor is %s, %d\n", blurb(), + ServerVendor(si->dpy), VendorRelease(si->dpy)); + + fprintf (stderr, "%s: useful extensions:\n", blurb()); + for (i = 0; i < countof(exts); i++) + { + int op = 0, event = 0, error = 0; + char buf [255]; + int maj = 0, min = 0; + int dummy1, dummy2, dummy3; + + /* Most of the extension version functions take 3 args, + writing results into args 2 and 3, but some take more. + We only ever care about the first two results, but we + pass in three extra pointers just in case. + */ + Status (*version_fn_2) (Display*,int*,int*,int*,int*,int*) = + (Status (*) (Display*,int*,int*,int*,int*,int*)) exts[i].version_fn; + + if (!XQueryExtension (si->dpy, exts[i].name, &op, &event, &error)) + continue; + sprintf (buf, "%s: ", blurb()); + strcat (buf, exts[i].desc); + + if (!strcmp (exts[i].desc, "XInput")) + { + int maj = 999, min = 999; /* Desired */ + XIQueryVersion (si->dpy, &maj, &min); /* Actual */ + sprintf (buf+strlen(buf), " (%d.%d)", maj, min); + } + else if (!version_fn_2) + ; + else if (version_fn_2 (si->dpy, &maj, &min, &dummy1, &dummy2, &dummy3)) + sprintf (buf+strlen(buf), " (%d.%d)", maj, min); + else + strcat (buf, " (unavailable)"); + + if (!exts[i].useful_p) + strcat (buf, " (disabled at compile time)"); + fprintf (stderr, "%s\n", buf); + } + +# ifdef HAVE_LIBSYSTEMD + fprintf (stderr, "%s: libsystemd\n", blurb()); +# else + fprintf (stderr, "%s: libsystemd (disabled at compile time)\n", blurb()); +# endif + + for (i = 0; i < si->nscreens; i++) + { + saver_screen_info *ssi = &si->screens[i]; + unsigned long colormapped_depths = 0; + unsigned long non_mapped_depths = 0; + XVisualInfo vi_in, *vi_out; + int out_count; + + if (!ssi->real_screen_p) continue; + + vi_in.screen = ssi->real_screen_number; + vi_out = XGetVisualInfo (si->dpy, VisualScreenMask, &vi_in, &out_count); + if (!vi_out) continue; + for (j = 0; j < out_count; j++) { + if (vi_out[j].depth >= 32) continue; + if (vi_out[j].class == PseudoColor) + colormapped_depths |= (1 << vi_out[j].depth); + else + non_mapped_depths |= (1 << vi_out[j].depth); + } + XFree ((char *) vi_out); + + if (colormapped_depths) + { + fprintf (stderr, "%s: screen %d colormapped depths:", blurb(), + ssi->real_screen_number); + for (j = 0; j < 32; j++) + if (colormapped_depths & (1 << j)) + fprintf (stderr, " %d", j); + fprintf (stderr, "\n"); + } + if (non_mapped_depths) + { + fprintf (stderr, "%s: screen %d non-colormapped depths:", + blurb(), ssi->real_screen_number); + for (j = 0; j < 32; j++) + if (non_mapped_depths & (1 << j)) + fprintf (stderr, " %d", j); + fprintf (stderr, "\n"); + } + } +} diff --git a/driver/fade.c b/driver/fade.c new file mode 100644 index 0000000..9451582 --- /dev/null +++ b/driver/fade.c @@ -0,0 +1,1749 @@ +/* xscreensaver, Copyright © 1992-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +/* There are several different mechanisms here for fading the desktop to + black, and then fading it back in again. + + - Colormaps: This only works on 8-bit displays, which basically haven't + existed since the 90s. It takes the current colormap, makes a writable + copy of it, and then animates the color cells to fade and unfade. + + - XF86 Gamma or RANDR Gamma: These do the fade by altering the brightness + settings of the screen. This works on any system that has the "XF86 + Video-Mode" extension (which is every modern system) AND ALSO has gamma + support in the video driver. But it turns out that as of 2021, the + Raspberry Pi HDMI video driver still does not support gamma. And there's + no way to determine that the video driver lacks gamma support even though + the extension exists. Since the Pi is probably the single most popular + platform for running X11 on the desktop these days, that makes this + method pretty much useless now. + + - SGI VC: Same as the above, but only works on SGI. + + - XSHM: This works by taking a screenshot and hacking the bits by hand. + It's slow. Also, in order to fade in from black to the desktop (possibly + hours after it faded out) it has to retain that first screenshot of the + desktop to fade back to. But if the desktop had changed in the meantime, + there will be a glitch at the end as it snaps from the screenshot to the + new current reality. + + In summary, everything is terrible because X11 doesn't support alpha. + + + The fade process goes like this: + + Screen saver activates: + - Fade out: + - Desktop is visible + - Save screenshot for later + - Map invisible temp windows + - Fade from desktop to black + - Erase saver windows to black and raise them + - Destroy temp windows + + Screen saver deactivates: + - Fade out: + - Saver graphics are visible + - Map invisible temp windows + - Do not save a screenshot + - Fade from graphics to black + - Erase saver windows to black and raise them + - Destroy temp windows + + - Fade in: + - Screen is black + - Map invisible temp windows + - Do not save a screenshot + - Unmap saver windows + - Fade from black to saved screenshot + - Destroy temp windows + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include + +#ifdef HAVE_JWXYZ +# include "jwxyz.h" +#else /* real X11 */ +# include +# include +# include +# include +#endif /* !HAVE_JWXYZ */ + +#include "blurb.h" +#include "visual.h" +#include "usleep.h" +#include "fade.h" +#include "xshm.h" +#include "atoms.h" +#include "clientmsg.h" +#include "xmu.h" + +/* Since gamma fading doesn't work on the Raspberry Pi, probably the single + most popular desktop Linux system these days, let's not use this fade + method even if the extension exists (which it does). + */ +#undef HAVE_XF86VMODE_GAMMA + +/* I'm not sure that the RANDR fade method brings anything to the party + that the XF86 method does See below. + */ +#undef HAVE_RANDR_12 + +#define HAVE_XINPUT2 1 /* Mandatory */ + + +#ifdef HAVE_XINPUT2 +# include +# include "xinput.h" +#endif + + +typedef struct { + int nscreens; + Pixmap *screenshots; +} fade_state; + + +/* #### There's a bunch of duplicated code in the back half of the + four _fade and _whack functions that could probably be combined. + */ +#ifdef HAVE_SGI_VC_EXTENSION +static int sgi_gamma_fade (XtAppContext, Display *, Window *wins, int count, + double secs, Bool out_p); +#endif +#ifdef HAVE_XF86VMODE_GAMMA +static int xf86_gamma_fade (XtAppContext, Display *, Window *wins, int count, + double secs, Bool out_p); +#endif +#ifdef HAVE_RANDR_12 +static int randr_gamma_fade (XtAppContext, Display *, Window *wins, int count, + double secs, Bool out_p); +#endif +static int colormap_fade (XtAppContext, Display *, Window *wins, int count, + double secs, Bool out_p, Bool from_desktop_p); +static int xshm_fade (XtAppContext, Display *, + Window *wins, int count, double secs, + Bool out_p, Bool from_desktop_p, fade_state *); + + +static double +double_time (void) +{ + struct timeval now; +# ifdef GETTIMEOFDAY_TWO_ARGS + struct timezone tzp; + gettimeofday(&now, &tzp); +# else + gettimeofday(&now); +# endif + + return (now.tv_sec + ((double) now.tv_usec * 0.000001)); +} + + +#ifdef HAVE_XINPUT2 +static int xi_opcode = -1; +#endif + +/* Closure arg points to a Bool saying whether motion events count. + Motion aborts fade-out, but only clicks and keys abort fade-in. + */ +static Bool +user_event_p (Display *dpy, XEvent *event, XPointer arg) +{ + Bool motion_p = *((Bool *) arg); + + switch (event->xany.type) { + case KeyPress: case ButtonPress: + return True; + break; + case MotionNotify: + if (motion_p) return True; + break; +# ifdef HAVE_XINPUT2 + case GenericEvent: + { + XIRawEvent *re; + if (event->xcookie.extension != xi_opcode) + return False; + if (! event->xcookie.data) + XGetEventData (dpy, &event->xcookie); + if (! event->xcookie.data) + return False; + re = event->xcookie.data; + + if (re->evtype == XI_RawKeyPress || + re->evtype == XI_RawButtonPress) + return True; + else if (motion_p && re->evtype == XI_RawMotion) + return True; + + /* Calling XFreeEventData here is bad news */ + } + break; +# endif /* HAVE_XINPUT2 */ + default: break; + } + + return False; +} + + +static Bool +user_active_p (XtAppContext app, Display *dpy, Bool fade_out_p) +{ + XEvent event; + XtInputMask m; + Bool motion_p = fade_out_p; /* Motion aborts fade-out, not fade-in. */ + motion_p = False; /* Naah, never abort on motion only */ + +# ifdef HAVE_XINPUT2 + if (xi_opcode == -1) + { + Bool ov = verbose_p; + xi_opcode = 0; /* only init once */ + verbose_p = False; /* xscreensaver already printed this */ + init_xinput (dpy, &xi_opcode); + verbose_p = ov; + } +# endif + + m = XtAppPending (app); + if (m & ~XtIMXEvent) + { + /* Process timers and signals only, don't block. */ + if (verbose_p > 1) + fprintf (stderr, "%s: Xt pending %ld\n", blurb(), m); + XtAppProcessEvent (app, m); + } + + /* If there is user activity, bug out. (Bug out on keypresses or + mouse presses, but not motion, and not release events. Bugging + out on motion made the unfade hack be totally useless, I think.) + */ + if (XCheckIfEvent (dpy, &event, &user_event_p, (XPointer) &motion_p)) + { + if (verbose_p > 1) + { + XIRawEvent *re = 0; + if (event.xany.type == GenericEvent && !event.xcookie.data) + { + XGetEventData (dpy, &event.xcookie); + re = event.xcookie.data; + } + fprintf (stderr, "%s: user input %d %d\n", blurb(), + event.xany.type, + (re ? re->evtype : -1)); + } + XPutBackEvent (dpy, &event); + return True; + } + + return False; +} + + +static void +flush_user_input (Display *dpy) +{ + XEvent event; + Bool motion_p = True; + while (XCheckIfEvent (dpy, &event, &user_event_p, (XPointer) &motion_p)) + if (verbose_p > 1) + { + XIRawEvent *re = 0; + if (event.xany.type == GenericEvent && !event.xcookie.data) + { + XGetEventData (dpy, &event.xcookie); + re = event.xcookie.data; + } + fprintf (stderr, "%s: flushed user event %d %d\n", blurb(), + event.xany.type, + (re ? re->evtype : -1)); + } +} + + +/* This bullshit is needed because the VidMode and SHM extensions don't work + on remote displays. */ +static Bool error_handler_hit_p = False; + +static int +ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error) +{ + if (verbose_p > 1) + XmuPrintDefaultErrorMessage (dpy, error, stderr); + error_handler_hit_p = True; + return 0; +} + + +/* Returns true if canceled by user activity. */ +Bool +fade_screens (XtAppContext app, Display *dpy, + Window *saver_windows, int nwindows, + double seconds, Bool out_p, Bool from_desktop_p, + void **closureP) +{ + int status = False; + fade_state *state = 0; + + if (nwindows <= 0) abort(); + if (!saver_windows) abort(); + + if (!closureP) abort(); + state = (fade_state *) *closureP; + if (!state) + { + state = (fade_state *) calloc (1, sizeof (*state)); + *closureP = state; + } + + if (from_desktop_p && !out_p) + abort(); /* Fading in from desktop makes no sense */ + + if (out_p) + flush_user_input (dpy); /* Flush at start of cycle */ + +# ifdef HAVE_SGI_VC_EXTENSION + /* First try to do it by fading the gamma in an SGI-specific way... */ + status = sgi_gamma_fade (app, dpy, saver_windows, nwindows, seconds, out_p); + if (status == 0 || status == 1) + return status; /* faded, possibly canceled */ +# endif + +# ifdef HAVE_RANDR_12 + /* Then try to do it by fading the gamma in an RANDR-specific way... */ + status = randr_gamma_fade (app, dpy, saver_windows, nwindows, seconds, out_p); + if (status == 0 || status == 1) + return status; /* faded, possibly canceled */ +# endif + +# ifdef HAVE_XF86VMODE_GAMMA + /* Then try to do it by fading the gamma in an XFree86-specific way... */ + status = xf86_gamma_fade(app, dpy, saver_windows, nwindows, seconds, out_p); + if (status == 0 || status == 1) + return status; /* faded, possibly canceled */ +# endif + + if (has_writable_cells (DefaultScreenOfDisplay (dpy), + DefaultVisual (dpy, 0))) + { + /* Do it the old-fashioned way, which only really worked on + 8-bit displays. */ + status = colormap_fade (app, dpy, saver_windows, nwindows, seconds, + out_p, from_desktop_p); + if (status == 0 || status == 1) + return status; /* faded, possibly canceled */ + } + + /* Else do it the hard way, by hacking a screenshot. */ + status = xshm_fade (app, dpy, saver_windows, nwindows, seconds, out_p, + from_desktop_p, state); + status = (status ? True : False); + + return status; +} + +/**************************************************************************** + + Colormap fading + + ****************************************************************************/ + + +/* The business with `cmaps_per_screen' is to fake out the SGI 8-bit video + hardware, which is capable of installing multiple (4) colormaps + simultaneously. We have to install multiple copies of the same set of + colors in order to fill up all the available slots in the hardware color + lookup table, so we install an extra N colormaps per screen to make sure + that all screens really go black. + + I'm told that this trick also works with XInside's AcceleratedX when using + the Matrox Millennium card (which also allows multiple PseudoColor and + TrueColor visuals to co-exist and display properly at the same time.) + + This trick works ok on the 24-bit Indy video hardware, but doesn't work at + all on the O2 24-bit hardware. I guess the higher-end hardware is too + "good" for this to work (dammit.) So... I figured out the "right" way to + do this on SGIs, which is to ramp the monitor's gamma down to 0. That's + what is implemented in sgi_gamma_fade(), so we use that if we can. + + Returns: + 0: faded normally + 1: canceled by user activity + -1: unable to fade because the extension isn't supported. + */ +static int +colormap_fade (XtAppContext app, Display *dpy, + Window *saver_windows, int nwindows, + double seconds, Bool out_p, Bool from_desktop_p) +{ + int status = -1; + Colormap *window_cmaps = 0; + int i, j, k; + int cmaps_per_screen = 5; + int nscreens = ScreenCount(dpy); + int ncmaps = nscreens * cmaps_per_screen; + Colormap *fade_cmaps = 0; + Bool installed = False; + int total_ncolors; + XColor *orig_colors, *current_colors, *screen_colors, *orig_screen_colors; + int screen; + + window_cmaps = (Colormap *) calloc(sizeof(Colormap), nwindows); + if (!window_cmaps) abort(); + for (screen = 0; screen < nwindows; screen++) + { + XWindowAttributes xgwa; + XGetWindowAttributes (dpy, saver_windows[screen], &xgwa); + window_cmaps[screen] = xgwa.colormap; + } + + error_handler_hit_p = False; + + if (verbose_p > 1) + fprintf (stderr, "%s: colormap fade %s\n", + blurb(), (out_p ? "out" : "in")); + + total_ncolors = 0; + for (i = 0; i < nscreens; i++) + total_ncolors += CellsOfScreen (ScreenOfDisplay(dpy, i)); + + orig_colors = (XColor *) calloc(sizeof(XColor), total_ncolors); + current_colors = (XColor *) calloc(sizeof(XColor), total_ncolors); + + /* Get the contents of the colormap we are fading from or to. */ + screen_colors = orig_colors; + for (i = 0; i < nscreens; i++) + { + Screen *sc = ScreenOfDisplay (dpy, i); + int ncolors = CellsOfScreen (sc); + Colormap cmap = (from_desktop_p || !out_p + ? DefaultColormapOfScreen(sc) + : window_cmaps[i]); + for (j = 0; j < ncolors; j++) + screen_colors[j].pixel = j; + XQueryColors (dpy, cmap, screen_colors, ncolors); + + screen_colors += ncolors; + } + + memcpy (current_colors, orig_colors, total_ncolors * sizeof (XColor)); + + + /* Make the writable colormaps (we keep these around and reuse them.) */ + if (!fade_cmaps) + { + fade_cmaps = (Colormap *) calloc(sizeof(Colormap), ncmaps); + for (i = 0; i < nscreens; i++) + { + Visual *v = DefaultVisual(dpy, i); + Screen *s = ScreenOfDisplay(dpy, i); + if (has_writable_cells (s, v)) + for (j = 0; j < cmaps_per_screen; j++) + fade_cmaps[(i * cmaps_per_screen) + j] = + XCreateColormap (dpy, RootWindowOfScreen (s), v, AllocAll); + } + } + + /* Run the animation at the maximum frame rate in the time allotted. */ + { + double start_time = double_time(); + double end_time = start_time + seconds; + double prev = 0; + double now; + int frames = 0; + double max = 1/60.0; /* max FPS */ + while ((now = double_time()) < end_time) + { + double ratio = (end_time - now) / seconds; + if (!out_p) ratio = 1-ratio; + + /* For each screen, compute the current value of each color... + */ + orig_screen_colors = orig_colors; + screen_colors = current_colors; + for (j = 0; j < nscreens; j++) + { + int ncolors = CellsOfScreen (ScreenOfDisplay (dpy, j)); + for (k = 0; k < ncolors; k++) + { + /* This doesn't take into account the relative luminance of the + RGB components (0.299, 0.587, and 0.114 at gamma 2.2) but + the difference is imperceptible for this application... */ + screen_colors[k].red = orig_screen_colors[k].red * ratio; + screen_colors[k].green = orig_screen_colors[k].green * ratio; + screen_colors[k].blue = orig_screen_colors[k].blue * ratio; + } + screen_colors += ncolors; + orig_screen_colors += ncolors; + } + + /* Put the colors into the maps... + */ + screen_colors = current_colors; + for (j = 0; j < nscreens; j++) + { + int ncolors = CellsOfScreen (ScreenOfDisplay (dpy, j)); + for (k = 0; k < cmaps_per_screen; k++) + { + Colormap c = fade_cmaps[j * cmaps_per_screen + k]; + if (c) + XStoreColors (dpy, c, screen_colors, ncolors); + } + screen_colors += ncolors; + } + + /* Put the maps on the screens, and then take the windows off the + screen. (only need to do this the first time through the loop.) + */ + if (!installed) + { + for (j = 0; j < ncmaps; j++) + if (fade_cmaps[j]) + XInstallColormap (dpy, fade_cmaps[j]); + installed = True; + + if (!out_p) + for (j = 0; j < nwindows; j++) + { + XUnmapWindow (dpy, saver_windows[j]); + XClearWindow (dpy, saver_windows[j]); + } + } + + XSync (dpy, False); + + if (error_handler_hit_p) + goto DONE; + if (user_active_p (app, dpy, out_p)) + { + status = 1; /* user activity status code */ + goto DONE; + } + frames++; + + if (now < prev + max) + usleep (1000000 * (prev + max - now)); + prev = now; + } + + if (verbose_p > 1) + fprintf (stderr, "%s: %.0f FPS\n", blurb(), frames / (now - start_time)); + } + + status = 0; /* completed fade with no user activity */ + + DONE: + + if (orig_colors) free (orig_colors); + if (current_colors) free (current_colors); + + /* If we've been given windows to raise after blackout, raise them before + releasing the colormaps. + */ + if (out_p) + { + for (i = 0; i < nwindows; i++) + { + XClearWindow (dpy, saver_windows[i]); + XMapRaised (dpy, saver_windows[i]); + } + XSync(dpy, False); + } + + /* Now put the target maps back. + If we're fading out, use the given cmap (or the default cmap, if none.) + If we're fading in, always use the default cmap. + */ + for (i = 0; i < nscreens; i++) + { + Colormap cmap = window_cmaps[i]; + if (!cmap || !out_p) + cmap = DefaultColormap(dpy, i); + XInstallColormap (dpy, cmap); + } + + /* The fade (in or out) is complete, so we don't need the black maps on + stage any more. + */ + for (i = 0; i < ncmaps; i++) + if (fade_cmaps[i]) + { + XUninstallColormap(dpy, fade_cmaps[i]); + XFreeColormap(dpy, fade_cmaps[i]); + fade_cmaps[i] = 0; + } + free (window_cmaps); + free(fade_cmaps); + fade_cmaps = 0; + + if (error_handler_hit_p) status = -1; + return status; +} + + +/**************************************************************************** + + SGI gamma fading + + ****************************************************************************/ + +#ifdef HAVE_SGI_VC_EXTENSION + +# include + +struct screen_sgi_gamma_info { + int gamma_map; /* ??? always using 0 */ + int nred, ngreen, nblue; + unsigned short *red1, *green1, *blue1; + unsigned short *red2, *green2, *blue2; + int gamma_size; + int gamma_precision; + Bool alpha_p; +}; + + +static void sgi_whack_gamma(Display *dpy, int screen, + struct screen_sgi_gamma_info *info, float ratio); + +/* Returns: + 0: faded normally + 1: canceled by user activity + -1: unable to fade because the extension isn't supported. + */ +static int +sgi_gamma_fade (XtAppContext app, Display *dpy, + Window *saver_windows, int nwindows, + double seconds, Bool out_p) +{ + int nscreens = ScreenCount(dpy); + struct timeval then, now; + int i, screen; + int status = -1; + struct screen_sgi_gamma_info *info = (struct screen_sgi_gamma_info *) + calloc(nscreens, sizeof(*info)); + + if (verbose_p > 1) + fprintf (stderr, "%s: sgi fade %s\n", + blurb(), (out_p ? "out" : "in")); + + /* Get the current gamma maps for all screens. + Bug out and return -1 if we can't get them for some screen. + */ + for (screen = 0; screen < nscreens; screen++) + { + if (!XSGIvcQueryGammaMap(dpy, screen, info[screen].gamma_map, + &info[screen].gamma_size, + &info[screen].gamma_precision, + &info[screen].alpha_p)) + goto FAIL; + + if (!XSGIvcQueryGammaColors(dpy, screen, info[screen].gamma_map, + XSGIVC_COMPONENT_RED, + &info[screen].nred, &info[screen].red1)) + goto FAIL; + if (! XSGIvcQueryGammaColors(dpy, screen, info[screen].gamma_map, + XSGIVC_COMPONENT_GREEN, + &info[screen].ngreen, &info[screen].green1)) + goto FAIL; + if (!XSGIvcQueryGammaColors(dpy, screen, info[screen].gamma_map, + XSGIVC_COMPONENT_BLUE, + &info[screen].nblue, &info[screen].blue1)) + goto FAIL; + + if (info[screen].gamma_precision == 8) /* Scale it up to 16 bits. */ + { + int j; + for(j = 0; j < info[screen].nred; j++) + info[screen].red1[j] = + ((info[screen].red1[j] << 8) | info[screen].red1[j]); + for(j = 0; j < info[screen].ngreen; j++) + info[screen].green1[j] = + ((info[screen].green1[j] << 8) | info[screen].green1[j]); + for(j = 0; j < info[screen].nblue; j++) + info[screen].blue1[j] = + ((info[screen].blue1[j] << 8) | info[screen].blue1[j]); + } + + info[screen].red2 = (unsigned short *) + malloc(sizeof(*info[screen].red2) * (info[screen].nred+1)); + info[screen].green2 = (unsigned short *) + malloc(sizeof(*info[screen].green2) * (info[screen].ngreen+1)); + info[screen].blue2 = (unsigned short *) + malloc(sizeof(*info[screen].blue2) * (info[screen].nblue+1)); + } + +#ifdef GETTIMEOFDAY_TWO_ARGS + gettimeofday(&then, &tzp); +#else + gettimeofday(&then); +#endif + + /* If we're fading in (from black), then first crank the gamma all the + way down to 0, then take the windows off the screen. + */ + if (!out_p) + { + for (screen = 0; screen < nscreens; screen++) + sgi_whack_gamma(dpy, screen, &info[screen], 0.0); + + for (screen = 0; screen < nwindows; screen++) + { + XUnmapWindow (dpy, saver_windows[screen]); + XClearWindow (dpy, saver_windows[screen]); + XSync(dpy, False); + } + } + + /* Run the animation at the maximum frame rate in the time allotted. */ + { + double start_time = double_time(); + double end_time = start_time + seconds; + double prev = 0; + double now; + int frames = 0; + double max = 1/60.0; /* max FPS */ + while ((now = double_time()) < end_time) + { + double ratio = (end_time - now) / seconds; + if (!out_p) ratio = 1-ratio; + + for (screen = 0; screen < nwindows; screen++) + sgi_whack_gamma (dpy, screen, &info[screen], ratio); + + if (error_handler_hit_p) + goto FAIL; + if (user_active_p (app, dpy, out_p)) + { + status = 1; /* user activity status code */ + goto DONE; + } + frames++; + + if (now < prev + max) + usleep (1000000 * (prev + max - now)); + prev = now; + } + + if (verbose_p > 1) + fprintf (stderr, "%s: %.0f FPS\n", blurb(), frames / (now - start_time)); + } + + status = 0; /* completed fade with no user activity */ + + DONE: + + if (out_p) + { + for (screen = 0; screen < nwindows; screen++) + { + XClearWindow (dpy, saver_windows[screen]); + XMapRaised (dpy, saver_windows[screen]); + } + XSync(dpy, False); + } + + /* I can't explain this; without this delay, we get a flicker. + I suppose there's some lossage with stale bits being in the + hardware frame buffer or something, and this delay gives it + time to flush out. This sucks! */ + usleep(100000); /* 1/10th second */ + + for (screen = 0; screen < nscreens; screen++) + sgi_whack_gamma(dpy, screen, &info[screen], 1.0); + XSync(dpy, False); + + FAIL: + for (screen = 0; screen < nscreens; screen++) + { + if (info[screen].red1) free (info[screen].red1); + if (info[screen].green1) free (info[screen].green1); + if (info[screen].blue1) free (info[screen].blue1); + if (info[screen].red2) free (info[screen].red2); + if (info[screen].green2) free (info[screen].green2); + if (info[screen].blue2) free (info[screen].blue2); + } + free(info); + + if (verbose_p > 1 && status) + fprintf (stderr, "%s: SGI fade %s failed\n", + blurb(), (out_p ? "out" : "in")); + + if (error_handler_hit_p) status = -1; + return status; +} + +static void +sgi_whack_gamma (Display *dpy, int screen, struct screen_sgi_gamma_info *info, + float ratio) +{ + int k; + + if (ratio < 0) ratio = 0; + if (ratio > 1) ratio = 1; + for (k = 0; k < info->gamma_size; k++) + { + info->red2[k] = info->red1[k] * ratio; + info->green2[k] = info->green1[k] * ratio; + info->blue2[k] = info->blue1[k] * ratio; + } + + XSGIvcStoreGammaColors16(dpy, screen, info->gamma_map, info->nred, + XSGIVC_MComponentRed, info->red2); + XSGIvcStoreGammaColors16(dpy, screen, info->gamma_map, info->ngreen, + XSGIVC_MComponentGreen, info->green2); + XSGIvcStoreGammaColors16(dpy, screen, info->gamma_map, info->nblue, + XSGIVC_MComponentBlue, info->blue2); + XSync(dpy, False); +} + +#endif /* HAVE_SGI_VC_EXTENSION */ + + +/**************************************************************************** + + XFree86 gamma fading + + ****************************************************************************/ + +#ifdef HAVE_XF86VMODE_GAMMA + +#include + +typedef struct { + XF86VidModeGamma vmg; + int size; + unsigned short *r, *g, *b; +} xf86_gamma_info; + +static int xf86_check_gamma_extension (Display *dpy); +static Bool xf86_whack_gamma (Display *dpy, int screen, + xf86_gamma_info *ginfo, float ratio); + +/* Returns: + 0: faded normally + 1: canceled by user activity + -1: unable to fade because the extension isn't supported. + */ +static int +xf86_gamma_fade (XtAppContext app, Display *dpy, + Window *saver_windows, int nwindows, + double seconds, Bool out_p) +{ + int nscreens = ScreenCount(dpy); + int screen; + int status = -1; + xf86_gamma_info *info = 0; + + static int ext_ok = -1; + + if (verbose_p > 1) + fprintf (stderr, "%s: xf86 fade %s\n", + blurb(), (out_p ? "out" : "in")); + + /* Only probe the extension once: the answer isn't going to change. */ + if (ext_ok == -1) + ext_ok = xf86_check_gamma_extension (dpy); + + /* If this server doesn't have the gamma extension, bug out. */ + if (ext_ok == 0) + goto FAIL; + +# ifndef HAVE_XF86VMODE_GAMMA_RAMP + if (ext_ok == 2) ext_ok = 1; /* server is newer than client! */ +# endif + + info = (xf86_gamma_info *) calloc(nscreens, sizeof(*info)); + + /* Get the current gamma maps for all screens. + Bug out and return -1 if we can't get them for some screen. + */ + for (screen = 0; screen < nscreens; screen++) + { + if (ext_ok == 1) /* only have gamma parameter, not ramps. */ + { + if (!XF86VidModeGetGamma(dpy, screen, &info[screen].vmg)) + goto FAIL; + } +# ifdef HAVE_XF86VMODE_GAMMA_RAMP + else if (ext_ok == 2) /* have ramps */ + { + if (!XF86VidModeGetGammaRampSize(dpy, screen, &info[screen].size)) + goto FAIL; + if (info[screen].size <= 0) + goto FAIL; + + info[screen].r = (unsigned short *) + calloc(info[screen].size, sizeof(unsigned short)); + info[screen].g = (unsigned short *) + calloc(info[screen].size, sizeof(unsigned short)); + info[screen].b = (unsigned short *) + calloc(info[screen].size, sizeof(unsigned short)); + + if (!(info[screen].r && info[screen].g && info[screen].b)) + goto FAIL; + +# if 0 + if (verbose_p > 1 && out_p) + { + int i; + fprintf (stderr, "%s: initial gamma ramps, size %d:\n", + blurb(), info[screen].size); + fprintf (stderr, "%s: R:", blurb()); + for (i = 0; i < info[screen].size; i++) + fprintf (stderr, " %d", info[screen].r[i]); + fprintf (stderr, "\n%s: G:", blurb()); + for (i = 0; i < info[screen].size; i++) + fprintf (stderr, " %d", info[screen].g[i]); + fprintf (stderr, "\n%s: B:", blurb()); + for (i = 0; i < info[screen].size; i++) + fprintf (stderr, " %d", info[screen].b[i]); + fprintf (stderr, "\n"); + } +# endif /* 0 */ + + if (!XF86VidModeGetGammaRamp(dpy, screen, info[screen].size, + info[screen].r, + info[screen].g, + info[screen].b)) + goto FAIL; + } +# endif /* HAVE_XF86VMODE_GAMMA_RAMP */ + else + abort(); + } + + /* If we're fading in (from black), then first crank the gamma all the + way down to 0, then take the windows off the screen. + */ + if (!out_p) + { + for (screen = 0; screen < nscreens; screen++) + xf86_whack_gamma(dpy, screen, &info[screen], 0.0); + for (screen = 0; screen < nwindows; screen++) + { + XUnmapWindow (dpy, saver_windows[screen]); + XClearWindow (dpy, saver_windows[screen]); + XSync(dpy, False); + } + } + + /* Run the animation at the maximum frame rate in the time allotted. */ + { + double start_time = double_time(); + double end_time = start_time + seconds; + double prev = 0; + double now; + int frames = 0; + double max = 1/60.0; /* max FPS */ + while ((now = double_time()) < end_time) + { + double ratio = (end_time - now) / seconds; + if (!out_p) ratio = 1-ratio; + + for (screen = 0; screen < nscreens; screen++) + xf86_whack_gamma (dpy, screen, &info[screen], ratio); + + if (error_handler_hit_p) + goto FAIL; + if (user_active_p (app, dpy, out_p)) + { + status = 1; /* user activity status code */ + goto DONE; + } + frames++; + + if (now < prev + max) + usleep (1000000 * (prev + max - now)); + prev = now; + } + + if (verbose_p > 1) + fprintf (stderr, "%s: %.0f FPS\n", blurb(), frames / (now - start_time)); + } + + status = 0; /* completed fade with no user activity */ + + DONE: + + if (out_p) + { + for (screen = 0; screen < nwindows; screen++) + { + XClearWindow (dpy, saver_windows[screen]); + XMapRaised (dpy, saver_windows[screen]); + } + XSync(dpy, False); + } + + /* I can't explain this; without this delay, we get a flicker. + I suppose there's some lossage with stale bits being in the + hardware frame buffer or something, and this delay gives it + time to flush out. This sucks! */ + usleep(100000); /* 1/10th second */ + + for (screen = 0; screen < nscreens; screen++) + xf86_whack_gamma(dpy, screen, &info[screen], 1.0); + XSync(dpy, False); + + FAIL: + if (info) + { + for (screen = 0; screen < nscreens; screen++) + { + if (info[screen].r) free(info[screen].r); + if (info[screen].g) free(info[screen].g); + if (info[screen].b) free(info[screen].b); + } + free(info); + } + + if (verbose_p > 1 && status) + fprintf (stderr, "%s: xf86 fade %s failed\n", + blurb(), (out_p ? "out" : "in")); + + if (error_handler_hit_p) status = -1; + return status; +} + + +static Bool +safe_XF86VidModeQueryVersion (Display *dpy, int *majP, int *minP) +{ + Bool result; + XErrorHandler old_handler; + XSync (dpy, False); + error_handler_hit_p = False; + old_handler = XSetErrorHandler (ignore_all_errors_ehandler); + + result = XF86VidModeQueryVersion (dpy, majP, minP); + + XSync (dpy, False); + XSetErrorHandler (old_handler); + XSync (dpy, False); + + return (error_handler_hit_p + ? False + : result); +} + + + +/* VidModeExtension version 2.0 or better is needed to do gamma. + 2.0 added gamma values; 2.1 added gamma ramps. + */ +# define XF86_VIDMODE_GAMMA_MIN_MAJOR 2 +# define XF86_VIDMODE_GAMMA_MIN_MINOR 0 +# define XF86_VIDMODE_GAMMA_RAMP_MIN_MAJOR 2 +# define XF86_VIDMODE_GAMMA_RAMP_MIN_MINOR 1 + + + +/* Returns 0 if gamma fading not available; 1 if only gamma value setting + is available; 2 if gamma ramps are available. + */ +static int +xf86_check_gamma_extension (Display *dpy) +{ + int event, error, major, minor; + + if (!XF86VidModeQueryExtension (dpy, &event, &error)) + return 0; /* display doesn't have the extension. */ + + if (!safe_XF86VidModeQueryVersion (dpy, &major, &minor)) + return 0; /* unable to get version number? */ + + if (major < XF86_VIDMODE_GAMMA_MIN_MAJOR || + (major == XF86_VIDMODE_GAMMA_MIN_MAJOR && + minor < XF86_VIDMODE_GAMMA_MIN_MINOR)) + return 0; /* extension is too old for gamma. */ + + if (major < XF86_VIDMODE_GAMMA_RAMP_MIN_MAJOR || + (major == XF86_VIDMODE_GAMMA_RAMP_MIN_MAJOR && + minor < XF86_VIDMODE_GAMMA_RAMP_MIN_MINOR)) + return 1; /* extension is too old for gamma ramps. */ + + /* Copacetic */ + return 2; +} + + +/* XFree doesn't let you set gamma to a value smaller than this. + Apparently they didn't anticipate the trick I'm doing here... + */ +#define XF86_MIN_GAMMA 0.1 + + +static Bool +xf86_whack_gamma(Display *dpy, int screen, xf86_gamma_info *info, + float ratio) +{ + XErrorHandler old_handler; + XSync (dpy, False); + error_handler_hit_p = False; + old_handler = XSetErrorHandler (ignore_all_errors_ehandler); + + if (ratio < 0) ratio = 0; + if (ratio > 1) ratio = 1; + + if (info->size == 0) /* we only have a gamma number, not a ramp. */ + { + XF86VidModeGamma g2; + + g2.red = info->vmg.red * ratio; + g2.green = info->vmg.green * ratio; + g2.blue = info->vmg.blue * ratio; + +# ifdef XF86_MIN_GAMMA + if (g2.red < XF86_MIN_GAMMA) g2.red = XF86_MIN_GAMMA; + if (g2.green < XF86_MIN_GAMMA) g2.green = XF86_MIN_GAMMA; + if (g2.blue < XF86_MIN_GAMMA) g2.blue = XF86_MIN_GAMMA; +# endif + + if (! XF86VidModeSetGamma (dpy, screen, &g2)) + return -1; + } + else + { +# ifdef HAVE_XF86VMODE_GAMMA_RAMP + + unsigned short *r, *g, *b; + int i; + r = (unsigned short *) malloc(info->size * sizeof(unsigned short)); + g = (unsigned short *) malloc(info->size * sizeof(unsigned short)); + b = (unsigned short *) malloc(info->size * sizeof(unsigned short)); + + for (i = 0; i < info->size; i++) + { + r[i] = info->r[i] * ratio; + g[i] = info->g[i] * ratio; + b[i] = info->b[i] * ratio; + } + + if (! XF86VidModeSetGammaRamp(dpy, screen, info->size, r, g, b)) + return -1; + + free (r); + free (g); + free (b); + +# else /* !HAVE_XF86VMODE_GAMMA_RAMP */ + abort(); +# endif /* !HAVE_XF86VMODE_GAMMA_RAMP */ + } + + XSync (dpy, False); + XSetErrorHandler (old_handler); + XSync (dpy, False); + + return status; +} + +#endif /* HAVE_XF86VMODE_GAMMA */ + + +/**************************************************************************** + + RANDR gamma fading + + **************************************************************************** + + + Dec 2020: I noticed that gamma fading was not working on a Raspberry Pi + with Raspbian 10.6, and wrote this under the hypothesis that the XF86 + gamma fade code was failing and maybe the RANDR version would work better. + Then I discovered that gamma simply isn't supported by the Raspberry Pi + HDMI driver: + + https://github.com/raspberrypi/firmware/issues/1274 + + I should have tried this first and seen it not work: + + xrandr --output HDMI-1 --brightness .1 + + Since I still don't have an answer to the question of whether the XF86 + gamma fading method works on modern Linux systems that also have RANDR, + I'm leaving this new code turned off for now, as it is largely untested. + The new code would be useful if: + + A) The XF86 way doesn't work but the RANDR way does, or + B) There exist systems that have RANDR but do not have XF86. + + But until Raspberry Pi supports gamma, both gamma methods fail to work + for far too many users for them to be used in XScreenSaver. + */ +#ifdef HAVE_RANDR_12 + +# include + +typedef struct { + RRCrtc crtc; + Bool enabled_p; + XRRCrtcGamma *gamma; +} randr_gamma_info; + + +static int +randr_check_gamma_extension (Display *dpy) +{ + int event, error, major, minor; + if (! XRRQueryExtension (dpy, &event, &error)) + return 0; + + if (! XRRQueryVersion (dpy, &major, &minor)) { + if (verbose_p > 1) fprintf (stderr, "%s: no randr ext\n", blurb()); + return 0; + } + + /* Reject if < 1.5. It's possible that 1.2 - 1.4 work, but untested. */ + if (major < 1 || (major == 1 && minor < 5)) { + if (verbose_p > 1) fprintf (stderr, "%s: randr ext only version %d.%d\n", + blurb(), major, minor); + return 0; + } + + return 1; +} + + +static void randr_whack_gamma (Display *dpy, int screen, + randr_gamma_info *ginfo, float ratio); + +/* Returns: + 0: faded normally + 1: canceled by user activity + -1: unable to fade because the extension isn't supported. + */ +static int +randr_gamma_fade (XtAppContext app, Display *dpy, + Window *saver_windows, int nwindows, + double seconds, Bool out_p) +{ + int xsc = ScreenCount (dpy); + int nscreens = 0; + int j, screen; + int status = -1; + randr_gamma_info *info = 0; + + static int ext_ok = -1; + + if (verbose_p > 1) + fprintf (stderr, "%s: randr fade %s\n", + blurb(), (out_p ? "out" : "in")); + + /* Only probe the extension once: the answer isn't going to change. */ + if (ext_ok == -1) + ext_ok = randr_check_gamma_extension (dpy); + + /* If this server doesn't have the RANDR extension, bug out. */ + if (ext_ok == 0) + goto FAIL; + + /* Add up the virtual screens on each X screen. */ + for (screen = 0; screen < xsc; screen++) + { + XRRScreenResources *res = + XRRGetScreenResources (dpy, RootWindow (dpy, screen)); + nscreens += res->noutput; + XRRFreeScreenResources (res); + } + + if (nscreens <= 0) + goto FAIL; + + info = (randr_gamma_info *) calloc(nscreens, sizeof(*info)); + + /* Get the current gamma maps for all screens. + Bug out and return -1 if we can't get them for some screen. + */ + for (screen = 0, j = 0; screen < xsc; screen++) + { + XRRScreenResources *res = + XRRGetScreenResources (dpy, RootWindow (dpy, screen)); + int k; + for (k = 0; k < res->noutput; k++, j++) + { + XRROutputInfo *rroi = XRRGetOutputInfo (dpy, res, res->outputs[j]); + RRCrtc crtc = (rroi->crtc ? rroi->crtc : + rroi->ncrtc ? rroi->crtcs[0] : 0); + + info[j].crtc = crtc; + info[j].gamma = XRRGetCrtcGamma (dpy, crtc); + + /* #### is this test sufficient? */ + info[j].enabled_p = (rroi->connection != RR_Disconnected); + +# if 0 + if (verbose_p > 1 && out_p) + { + int m; + fprintf (stderr, "%s: initial gamma ramps, size %d:\n", + blurb(), info[j].gamma->size); + fprintf (stderr, "%s: R:", blurb()); + for (m = 0; m < info[j].gamma->size; m++) + fprintf (stderr, " %d", info[j].gamma->red[m]); + fprintf (stderr, "\n%s: G:", blurb()); + for (m = 0; m < info[j].gamma->size; m++) + fprintf (stderr, " %d", info[j].gamma->green[m]); + fprintf (stderr, "\n%s: B:", blurb()); + for (m = 0; m < info[j].gamma->size; m++) + fprintf (stderr, " %d", info[j].gamma->blue[m]); + fprintf (stderr, "\n"); + } +# endif /* 0 */ + + XRRFreeOutputInfo (rroi); + } + XRRFreeScreenResources (res); + } + + /* If we're fading in (from black), then first crank the gamma all the + way down to 0, then take the windows off the screen. + */ + if (!out_p) + { + for (screen = 0; screen < nscreens; screen++) + randr_whack_gamma(dpy, screen, &info[screen], 0.0); + for (screen = 0; screen < nwindows; screen++) + { + XUnmapWindow (dpy, saver_windows[screen]); + XClearWindow (dpy, saver_windows[screen]); + XSync(dpy, False); + } + } + + /* Run the animation at the maximum frame rate in the time allotted. */ + { + double start_time = double_time(); + double end_time = start_time + seconds; + double prev = 0; + double now; + int frames = 0; + double max = 1/60.0; /* max FPS */ + while ((now = double_time()) < end_time) + { + double ratio = (end_time - now) / seconds; + if (!out_p) ratio = 1-ratio; + + for (screen = 0; screen < nwindows; screen++) + { + if (!info[screen].enabled_p) + continue; + + randr_whack_gamma (dpy, screen, &info[screen], ratio); + } + + if (error_handler_hit_p) + goto FAIL; + if (user_active_p (app, dpy, out_p)) + { + status = 1; /* user activity status code */ + goto DONE; + } + frames++; + + if (now < prev + max) + usleep (1000000 * (prev + max - now)); + prev = now; + } + + if (verbose_p > 1) + fprintf (stderr, "%s: %.0f FPS\n", blurb(), frames / (now - start_time)); + } + + status = 0; /* completed fade with no user activity */ + + DONE: + + if (out_p) + { + for (screen = 0; screen < nwindows; screen++) + { + XClearWindow (dpy, saver_windows[screen]); + XMapRaised (dpy, saver_windows[screen]); + } + XSync(dpy, False); + } + + /* I can't explain this; without this delay, we get a flicker. + I suppose there's some lossage with stale bits being in the + hardware frame buffer or something, and this delay gives it + time to flush out. This sucks! */ + /* #### That comment was about XF86, not verified with randr. */ + usleep(100000); /* 1/10th second */ + + for (screen = 0; screen < nscreens; screen++) + randr_whack_gamma (dpy, screen, &info[screen], 1.0); + XSync(dpy, False); + + FAIL: + if (info) + { + for (screen = 0; screen < nscreens; screen++) + { + if (info[screen].gamma) XRRFreeGamma (info[screen].gamma); + } + free(info); + } + + if (verbose_p > 1 && status) + fprintf (stderr, "%s: randr fade %s failed\n", + blurb(), (out_p ? "out" : "in")); + + return status; +} + + +static void +randr_whack_gamma (Display *dpy, int screen, randr_gamma_info *info, + float ratio) +{ + XErrorHandler old_handler; + XRRCrtcGamma *g2; + int i; + + XSync (dpy, False); + error_handler_hit_p = False; + old_handler = XSetErrorHandler (ignore_all_errors_ehandler); + + if (ratio < 0) ratio = 0; + if (ratio > 1) ratio = 1; + + g2 = XRRAllocGamma (info->gamma->size); + for (i = 0; i < info->gamma->size; i++) + { + g2->red[i] = ratio * info->gamma->red[i]; + g2->green[i] = ratio * info->gamma->green[i]; + g2->blue[i] = ratio * info->gamma->blue[i]; + } + + XRRSetCrtcGamma (dpy, info->crtc, g2); + XRRFreeGamma (g2); + + XSync (dpy, False); + XSetErrorHandler (old_handler); + XSync (dpy, False); + + return 0; +} + +#endif /* HAVE_RANDR_12 */ + + +/**************************************************************************** + + XSHM screen-shot fading + + ****************************************************************************/ + +typedef struct { + GC gc; + Window window; + Pixmap screenshot; + XImage *src, *intermediate; +} xshm_fade_info; + + +static int xshm_whack (Display *, XShmSegmentInfo *, + xshm_fade_info *, float ratio); + +/* Returns: + 0: faded normally + 1: canceled by user activity + -1: unknown error + */ +static int +xshm_fade (XtAppContext app, Display *dpy, + Window *saver_windows, int nwindows, double seconds, + Bool out_p, Bool from_desktop_p, fade_state *state) +{ + int screen; + int status = -1; + xshm_fade_info *info = 0; + XShmSegmentInfo shm_info; + Window saver_window = 0; + XErrorHandler old_handler = 0; + + XSync (dpy, False); + old_handler = XSetErrorHandler (ignore_all_errors_ehandler); + error_handler_hit_p = False; + + if (verbose_p > 1) + fprintf (stderr, "%s: SHM fade %s\n", + blurb(), (out_p ? "out" : "in")); + + info = (xshm_fade_info *) calloc(nwindows, sizeof(*info)); + if (!info) goto FAIL; + + saver_window = find_screensaver_window (dpy, 0); + if (!saver_window) goto FAIL; + + /* Retrieve a screenshot of the area covered by each window. + Windows might not be mapped. + Bug out and return -1 if we can't get one for some screen. + */ + + for (screen = 0; screen < nwindows; screen++) + { + XWindowAttributes xgwa; + Window root; + XGCValues gcv; + GC gc; + unsigned long attrmask = 0; + XSetWindowAttributes attrs; + + XGetWindowAttributes (dpy, saver_windows[screen], &xgwa); + root = RootWindowOfScreen (xgwa.screen); + + info[screen].src = + create_xshm_image (dpy, xgwa.visual, xgwa.depth, + ZPixmap, &shm_info, xgwa.width, xgwa.height); + if (!info[screen].src) goto FAIL; + + info[screen].intermediate = + create_xshm_image (dpy, xgwa.visual, xgwa.depth, + ZPixmap, &shm_info, xgwa.width, xgwa.height); + if (!info[screen].intermediate) goto FAIL; + + if (!out_p) + { + /* If we are fading in, retrieve the saved screenshot from + before we faded out. */ + if (state->nscreens <= screen) goto FAIL; + info[screen].screenshot = state->screenshots[screen]; + } + else + { + /* Create a pixmap and grab a screenshot into it. */ + info[screen].screenshot = + XCreatePixmap (dpy, root, xgwa.width, xgwa.height, xgwa.depth); + if (!info[screen].screenshot) goto FAIL; + + gcv.function = GXcopy; + gcv.subwindow_mode = IncludeInferiors; + gc = XCreateGC (dpy, root, GCFunction | GCSubwindowMode, &gcv); + XCopyArea (dpy, root, info[screen].screenshot, gc, + xgwa.x, xgwa.y, xgwa.width, xgwa.height, 0, 0); + XFreeGC (dpy, gc); + } + + /* Create the fader window for the animation. */ + attrmask = CWOverrideRedirect; + attrs.override_redirect = True; + info[screen].window = + XCreateWindow (dpy, root, xgwa.x, xgwa.y, + xgwa.width, xgwa.height, xgwa.border_width, xgwa.depth, + InputOutput, xgwa.visual, + attrmask, &attrs); + if (!info[screen].window) goto FAIL; + /* XSelectInput (dpy, info[screen].window, + KeyPressMask | ButtonPressMask); */ + + /* Copy the screenshot pixmap to the source image */ + if (! get_xshm_image (dpy, info[screen].screenshot, info[screen].src, + 0, 0, ~0L, &shm_info)) + goto FAIL; + + gcv.function = GXcopy; + info[screen].gc = XCreateGC (dpy, info[screen].window, GCFunction, &gcv); + } + + /* If we're fading out from the desktop, save our screen shots for later use. + But not if we're fading out from the savers to black. In that case we + don't want to overwrite the desktop screenshot with the current screenshot + which is of the final frames of the just-killed graphics hacks. */ + if (from_desktop_p) + { + if (!out_p) abort(); + for (screen = 0; screen < state->nscreens; screen++) + if (state->screenshots[screen]) + XFreePixmap (dpy, state->screenshots[screen]); + if (state->screenshots) + free (state->screenshots); + state->nscreens = nwindows; + state->screenshots = calloc (nwindows, sizeof(*state->screenshots)); + if (!state->screenshots) + state->nscreens = 0; + for (screen = 0; screen < state->nscreens; screen++) + state->screenshots[screen] = info[screen].screenshot; + } + + for (screen = 0; screen < nwindows; screen++) + { + if (out_p) + /* Copy the screenshot to the fader window */ + XSetWindowBackgroundPixmap (dpy, info[screen].window, + info[screen].screenshot); + else + { + XSetWindowBackgroundPixmap (dpy, info[screen].window, None); + XSetWindowBackground (dpy, info[screen].window, BlackPixel (dpy, 0)); + } + + XMapRaised (dpy, info[screen].window); + + /* Now that we have mapped the screenshot on the fader windows, + take the saver windows off the screen. */ + if (out_p) + { + XUnmapWindow (dpy, saver_windows[screen]); + XClearWindow (dpy, saver_windows[screen]); + } + } + + /* Run the animation at the maximum frame rate in the time allotted. */ + { + double start_time = double_time(); + double end_time = start_time + seconds; + double prev = 0; + double now; + int frames = 0; + double max = 1/60.0; /* max FPS */ + while ((now = double_time()) < end_time) + { + double ratio = (end_time - now) / seconds; + if (!out_p) ratio = 1-ratio; + + for (screen = 0; screen < nwindows; screen++) + if (xshm_whack (dpy, &shm_info, &info[screen], ratio)) + goto FAIL; + + if (error_handler_hit_p) + goto FAIL; + if (user_active_p (app, dpy, out_p)) + { + status = 1; /* user activity status code */ + goto DONE; + } + frames++; + + if (now < prev + max) + usleep (1000000 * (prev + max - now)); + prev = now; + } + + if (verbose_p > 1) + fprintf (stderr, "%s: %.0f FPS\n", blurb(), frames / (now - start_time)); + } + + status = 0; /* completed fade with no user activity */ + + DONE: + + /* If we're fading out, we have completed the transition from what was + on the screen to black, using our fader windows. Now raise the saver + windows and take the fader windows off the screen. Since they're both + black, that will be imperceptible. + */ + if (out_p) + { + for (screen = 0; screen < nwindows; screen++) + { + XClearWindow (dpy, saver_windows[screen]); + XMapRaised (dpy, saver_windows[screen]); + if (info[screen].window) + XUnmapWindow (dpy, info[screen].window); + } + } + + XSync (dpy, False); + + FAIL: + + /* After fading in, take the saver windows off the screen before + destroying the occluding screenshot windows. */ + if (!out_p) + { + for (screen = 0; screen < nwindows; screen++) + { + XUnmapWindow (dpy, saver_windows[screen]); + XClearWindow (dpy, saver_windows[screen]); + } + } + + if (info) + { + for (screen = 0; screen < nwindows; screen++) + { + if (info[screen].src) + destroy_xshm_image (dpy, info[screen].src, &shm_info); + if (info[screen].intermediate) + destroy_xshm_image (dpy, info[screen].intermediate, &shm_info); + if (info[screen].window) + XDestroyWindow (dpy, info[screen].window); + if (info[screen].gc) + XFreeGC (dpy, info[screen].gc); + } + free (info); + } + + /* If fading in, delete the screenshot pixmaps, and the list of them. */ + if (!out_p && saver_window) + { + for (screen = 0; screen < state->nscreens; screen++) + if (state->screenshots[screen]) + XFreePixmap (dpy, state->screenshots[screen]); + if (state->screenshots) + free (state->screenshots); + state->nscreens = 0; + state->screenshots = 0; + } + + XSync (dpy, False); + XSetErrorHandler (old_handler); + + if (error_handler_hit_p) status = -1; + if (verbose_p > 1 && status) + fprintf (stderr, "%s: SHM fade %s failed\n", + blurb(), (out_p ? "out" : "in")); + + return status; +} + + +static int +xshm_whack (Display *dpy, XShmSegmentInfo *shm_info, + xshm_fade_info *info, float ratio) +{ + unsigned char *inbits = (unsigned char *) info->src->data; + unsigned char *outbits = (unsigned char *) info->intermediate->data; + unsigned char *end = (outbits + + info->intermediate->bytes_per_line * + info->intermediate->height); + unsigned char ramp[256]; + int i; + + XSync (dpy, False); + + if (ratio < 0) ratio = 0; + if (ratio > 1) ratio = 1; + + for (i = 0; i < sizeof(ramp); i++) + ramp[i] = i * ratio; + while (outbits < end) + *outbits++ = ramp[*inbits++]; + + put_xshm_image (dpy, info->window, info->gc, info->intermediate, 0, 0, 0, 0, + info->intermediate->width, info->intermediate->height, + shm_info); + XSync (dpy, False); + return 0; +} diff --git a/driver/fade.h b/driver/fade.h new file mode 100644 index 0000000..56725b5 --- /dev/null +++ b/driver/fade.h @@ -0,0 +1,20 @@ +/* xscreensaver, Copyright © 1992-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifndef __FADE_H__ +#define __FADE_H__ + +/* Returns true if canceled by user activity. */ +extern Bool fade_screens (XtAppContext app, Display *dpy, + Window *black_windows, int nwindows, + double seconds, Bool out_p, Bool from_desktop_p, + void **closureP); +#endif /* __FADE_H__ */ diff --git a/driver/passwd-helper.c b/driver/passwd-helper.c index a3a6b92..4b17c63 100644 --- a/driver/passwd-helper.c +++ b/driver/passwd-helper.c @@ -1,6 +1,6 @@ /* passwd-helper.c --- verifying typed passwords with external helper program + * xscreensaver, Copyright © 1993-2021 Jamie Zawinski * written by Olaf Kirch - * xscreensaver, Copyright (c) 1993-2005 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -11,6 +11,18 @@ * implied warranty. */ + +/***************************************************************************** + + I strongly suspect that this code has not been used in decades, and I + am considering removing it. These details should be hidden behind PAM. + If you are using this code, email me and tell me why. -- jwz, Feb 2021 + + *****************************************************************************/ + +#error "email jwz@jwz.org about passwd-helper.c" + + /* The idea here is to be able to run xscreensaver without any setuid bits. * Password verification happens through an external program that you feed * your password to on stdin. The external command is invoked with a user @@ -35,18 +47,6 @@ #ifndef NO_LOCKING /* whole file */ -#include /* not used for much... */ - -/* This file doesn't need the Xt headers, so stub these types out... */ -#undef XtPointer -#define XtAppContext void* -#define XrmDatabase void* -#define XtIntervalId void* -#define XtPointer void* -#define Widget void* - -#include "xscreensaver.h" - #include #ifdef HAVE_UNISTD_H # include @@ -57,11 +57,14 @@ #include #include #include - #include +#include "blurb.h" +#include "auth.h" + + static int -ext_run (const char *user, const char *typed_passwd, int verbose_p) +ext_run (const char *user, const char *typed_passwd) { int pfd[2], status; pid_t pid; @@ -70,10 +73,7 @@ ext_run (const char *user, const char *typed_passwd, int verbose_p) return 0; if (verbose_p) - fprintf (stderr, "%s: ext_run (%s, %s)\n", - blurb(), PASSWD_HELPER_PROGRAM, user); - - block_sigchld(); + fprintf (stderr, "%s: EXT: %s\n", blurb(), PASSWD_HELPER_PROGRAM); if ((pid = fork()) < 0) { close(pfd[0]); @@ -89,7 +89,7 @@ ext_run (const char *user, const char *typed_passwd, int verbose_p) /* Helper is invoked as helper service-name [user] */ execlp(PASSWD_HELPER_PROGRAM, PASSWD_HELPER_PROGRAM, "xscreensaver", user, NULL); if (verbose_p) - fprintf(stderr, "%s: %s\n", PASSWD_HELPER_PROGRAM, + fprintf(stderr, "%s: EXT: %s\n", PASSWD_HELPER_PROGRAM, strerror(errno)); exit(1); } @@ -106,14 +106,11 @@ ext_run (const char *user, const char *typed_passwd, int verbose_p) if (errno == EINTR) continue; if (verbose_p) - fprintf(stderr, "%s: ext_run: waitpid failed: %s\n", + fprintf(stderr, "%s: EXT: waitpid failed: %s\n", blurb(), strerror(errno)); - unblock_sigchld(); return 0; } - unblock_sigchld(); - if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) return 0; return 1; @@ -126,37 +123,36 @@ ext_run (const char *user, const char *typed_passwd, int verbose_p) to root. */ int -ext_passwd_valid_p (const char *typed_passwd, int verbose_p) +ext_passwd_valid_p (void *closure, const char *typed_passwd) { struct passwd *pw; int res = 0; if ((pw = getpwuid(getuid())) != NULL) - res = ext_run (pw->pw_name, typed_passwd, verbose_p); + res = ext_run (pw->pw_name, typed_passwd); endpwent(); #ifdef ALLOW_ROOT_PASSWD if (!res) - res = ext_run ("root", typed_passwd, verbose_p); + res = ext_run ("root", typed_passwd); #endif /* ALLOW_ROOT_PASSWD */ return res; } -int -ext_priv_init (int argc, char **argv, int verbose_p) +Bool +ext_priv_init (void) { /* Make sure the passwd helper exists */ if (access(PASSWD_HELPER_PROGRAM, X_OK) < 0) { fprintf(stderr, - "%s: warning: %s does not exist.\n" - "%s: password authentication via " - "external helper will not work.\n", + "%s: EXT: warning: %s does not exist.\n" + "%s: EXT password authentication will not work.\n", blurb(), PASSWD_HELPER_PROGRAM, blurb()); - return 0; + return False; } - return 1; + return True; } #endif /* NO_LOCKING -- whole file */ diff --git a/driver/passwd-kerberos.c b/driver/passwd-kerberos.c index 202e0eb..7d94ebd 100644 --- a/driver/passwd-kerberos.c +++ b/driver/passwd-kerberos.c @@ -1,6 +1,6 @@ /* kpasswd.c --- verify kerberos passwords. - * written by Nat Lanza (magus@cs.cmu.edu) for - * xscreensaver, Copyright (c) 1993-2004 Jamie Zawinski + * xscreensaver, Copyright © 1993-2021 Jamie Zawinski + * written by Nat Lanza (magus@cs.cmu.edu) * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -11,6 +11,17 @@ * implied warranty. */ +/***************************************************************************** + + I strongly suspect that this code has not been used in decades, and I + am considering removing it. These details should be hidden behind PAM. + If you are using this code, email me and tell me why. -- jwz, Feb 2021 + + *****************************************************************************/ + +#error "email jwz@jwz.org about passwd-kerberos.c" + + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -48,9 +59,7 @@ # include #endif /* !HAVE_KERBEROS5 */ -#if !defined(VMS) && !defined(HAVE_ADJUNCT_PASSWD) -# include -#endif +#include #ifdef __bsdi__ @@ -60,13 +69,9 @@ # endif #endif /* __bsdi__ */ -/* blargh */ -#undef Bool -#undef True -#undef False -#define Bool int -#define True 1 -#define False 0 +#include "blurb.h" +#include "auth.h" + /* The user information we need to store */ #ifdef HAVE_DARWIN @@ -78,10 +83,6 @@ static const char *tk_file; #endif /* !HAVE_DARWIN */ -/* warning suppression: duplicated in passwd.c */ -extern Bool kerberos_lock_init (int argc, char **argv, Bool verbose_p); -extern Bool kerberos_passwd_valid_p (const char *typed_passwd, Bool verbose_p); - /* Called at startup to grab user, instance, and realm information from the user's ticketfile (remember, name.inst@realm). Since we're @@ -102,7 +103,7 @@ extern Bool kerberos_passwd_valid_p (const char *typed_passwd, Bool verbose_p); We don't use the arguments we're given, though. */ Bool -kerberos_lock_init (int argc, char **argv, Bool verbose_p) +kerberos_lock_init (void) { # ifdef HAVE_DARWIN @@ -182,7 +183,7 @@ key_to_key(char *user, char *instance, char *realm, char *passwd, C_Block key) some sites. So, we do a quick, painful hack with a tmpfile. */ Bool -kerberos_passwd_valid_p (const char *typed_passwd, Bool verbose_p) +kerberos_passwd_valid_p (void *closure, const char *typed_passwd) { # ifdef HAVE_DARWIN return (klNoErr == @@ -201,10 +202,10 @@ kerberos_passwd_valid_p (const char *typed_passwd, Bool verbose_p) /* temporarily switch to a new ticketfile. I'm not using tmpnam() because it isn't entirely portable. this could probably be fixed with autoconf. */ - newtkfile = malloc(80 * sizeof(char)); - memset(newtkfile, 0, sizeof(newtkfile)); - - sprintf(newtkfile, "/tmp/xscrn-%i.XXXXXX", getpid()); + char *tmpdir = getenv("TMPDIR"); + if (!tmpdir || !*tmpdir) tmpdir = "/tmp"; + newtkfile = malloc (strlen(tmpdir) + 40); + sprintf (newtkfile, "%s/xscreensaver.XXXXXX", tmpdir); if( (fh = mkstemp(newtkfile)) < 0) { diff --git a/driver/passwd-pam.c b/driver/passwd-pam.c index d463bc2..87942ab 100644 --- a/driver/passwd-pam.c +++ b/driver/passwd-pam.c @@ -1,7 +1,6 @@ /* passwd-pam.c --- verifying typed passwords with PAM - * (Pluggable Authentication Modules.) - * written by Bill Nottingham (and jwz) for - * xscreensaver, Copyright (c) 1993-2017 Jamie Zawinski + * xscreensaver, Copyright © 1993-2021 Jamie Zawinski + * By Bill Nottingham and jwz. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -10,26 +9,37 @@ * documentation. No representations are made about the suitability of this * software for any purpose. It is provided "as is" without express or * implied warranty. - * - * Some PAM resources: - * - * PAM home page: - * http://www.us.kernel.org/pub/linux/libs/pam/ - * - * PAM FAQ: - * http://www.us.kernel.org/pub/linux/libs/pam/FAQ - * - * PAM Application Developers' Guide: - * http://www.us.kernel.org/pub/linux/libs/pam/Linux-PAM-html/Linux-PAM_ADG.html - * - * PAM Mailing list archives: - * http://www.linuxhq.com/lnxlists/linux-pam/ - * - * Compatibility notes, especially between Linux and Solaris: - * http://www.contrib.andrew.cmu.edu/u/shadow/pam.html - * - * The Open Group's PAM API documentation: - * http://www.opengroup.org/onlinepubs/8329799/pam_start.htm + */ + +/* PAM sucks in that there is no way to tell whether a particular service is + configured at all. That is, there is no way to tell the difference between + "authentication of the FOO service is not allowed" and "the user typed the + wrong password." + + On RedHat 5.1 systems, if a service name is not known, it defaults to being + not allowed (because the fallback service, /etc/pam.d/other, is set to + `pam_deny'.) + + On Solaris 2.6 systems, unknown services default to authenticating normally. + + So, we require that an "xscreensaver" PAM service exist. This has a bad + failure mode, however: if that service doesn't exist, then XScreenSaver + will lock the screen, but is unable to unlock. (With the non-PAM password + code, XScreenSaver can refuse to lock, because it is able to determine up + front that it was unable to retrieve the password info.) + + At startup, we check for the existence of /etc/pam.d/xscreensaver or + /etc/pam.conf, and if those don't exist, we print a warning that PAM is + probably not configured properly. This isn't *necessarily* correct, since + those files are not a part of PAM's C API, but it's how real-world systems + actually work. + + Also note that FreeBSD's implementation of PAM requires the calling process + to be running as root during the entire interactive PAM conversation: it + can't ever disavow privileges. Linux's PAM implementation uses a setuid + helper so that a non-root process can still authenticate, as is right and + proper. Consequently, XScreenSaver does not support PAM on FreeBSD. + Dear FreeBSD, get your shit together. */ #ifdef HAVE_CONFIG_H @@ -43,36 +53,17 @@ # include #endif -extern char *blurb(void); - - #include #include #include +#include #include #include #include -#include -#include -#include - -#include +#include "blurb.h" #include "auth.h" -extern sigset_t block_sigchld (void); -extern void unblock_sigchld (void); - -/* blargh */ -#undef Bool -#undef True -#undef False -#define Bool int -#define True 1 -#define False 0 - -#undef countof -#define countof(x) (sizeof((x))/sizeof(*(x))) /* Some time between Red Hat 4.2 and 7.0, the words were transposed in the various PAM_x_CRED macro names. Yay! @@ -89,10 +80,14 @@ static int pam_conversation (int nmsgs, struct pam_response **resp, void *closure); -void pam_try_unlock(saver_info *si, Bool verbose_p, - Bool (*valid_p)(const char *typed_passwd, Bool verbose_p)); +typedef struct { + Bool (*conv_fn) (void *closure, + int nmsgs, + const auth_message *msg, + auth_response **resp); + void *conv_fn_closure; +} pam_conv_closure; -Bool pam_priv_init (int argc, char **argv, Bool verbose_p); #ifdef HAVE_PAM_FAIL_DELAY /* We handle delays ourself.*/ @@ -116,52 +111,6 @@ Bool pam_priv_init (int argc, char **argv, Bool verbose_p); #endif /* !PAM_STRERROR_TWO_ARGS */ -/* PAM sucks in that there is no way to tell whether a particular service - is configured at all. That is, there is no way to tell the difference - between "authentication of the FOO service is not allowed" and "the - user typed the wrong password." - - On RedHat 5.1 systems, if a service name is not known, it defaults to - being not allowed (because the fallback service, /etc/pam.d/other, is - set to `pam_deny'.) - - On Solaris 2.6 systems, unknown services default to authenticating normally. - - So, we could simply require that the person who installs xscreensaver - set up an "xscreensaver" PAM service. However, if we went that route, - it would have a really awful failure mode: the failure mode would be that - xscreensaver was willing to *lock* the screen, but would be unwilling to - *unlock* the screen. (With the non-PAM password code, the analagous - situation -- security not being configured properly, for example do to the - executable not being installed as setuid root -- the failure mode is much - more palettable, in that xscreensaver will refuse to *lock* the screen, - because it can know up front that there is no password that will work.) - - Another route would be to have the service name to consult be computed at - compile-time (perhaps with a configure option.) However, that doesn't - really solve the problem, because it means that the same executable might - work fine on one machine, but refuse to unlock when run on another - machine. - - Another alternative would be to look in /etc/pam.conf or /etc/pam.d/ at - runtime to see what services actually exist. But I think that's no good, - because who is to say that the PAM info is actually specified in those - files? Opening and reading those files is not a part of the PAM client - API, so it's not guarenteed to work on any given system. - - An alternative I tried was to specify a list of services to try, and to - try them all in turn ("xscreensaver", "xlock", "xdm", and "login"). - This worked, but it was slow (and I also had to do some contortions to - work around bugs in Linux PAM 0.64-3.) - - So what we do today is, try PAM once, and if that fails, try the usual - getpwent() method. So if PAM doesn't work, it will at least make an - attempt at looking up passwords in /etc/passwd or /etc/shadow instead. - - This all kind of blows. I'm not sure what else to do. - */ - - /* On SunOS 5.6, the `pam_conv.appdata_ptr' slot seems to be ignored, and the `closure' argument to pc.conv always comes in as random garbage. So we get around this by using a global variable instead. Shoot me! @@ -172,97 +121,70 @@ Bool pam_priv_init (int argc, char **argv, Bool verbose_p); static void *suns_pam_implementation_blows = 0; -/** - * This function is the PAM conversation driver. It conducts a full - * authentication round by invoking the GUI with various prompts. +/* This function invokes the PAM conversation. It conducts a full + authentication round by presenting the GUI with various prompts. */ -void -pam_try_unlock(saver_info *si, Bool verbose_p, - Bool (*valid_p)(const char *typed_passwd, Bool verbose_p)) +Bool +pam_try_unlock (void *closure, + Bool (*conv_fn) (void *closure, + int nmsgs, + const auth_message *msg, + auth_response **resp)) { const char *service = PAM_SERVICE_NAME; pam_handle_t *pamh = 0; int status = -1; struct pam_conv pc; -# ifdef HAVE_SIGTIMEDWAIT - sigset_t set; - struct timespec timeout; -# endif /* HAVE_SIGTIMEDWAIT */ + struct passwd *p = getpwuid (getuid()); + const char *user = (p && p->pw_name && *p->pw_name ? p->pw_name : 0); + pam_conv_closure conv_closure; + + if (!user) + { + fprintf (stderr, "%s: PAM: unable to get current user\n", blurb()); + return False; + } + conv_closure.conv_fn = conv_fn; + conv_closure.conv_fn_closure = closure; + pc.appdata_ptr = &conv_closure; pc.conv = &pam_conversation; - pc.appdata_ptr = (void *) si; /* On SunOS 5.6, the `appdata_ptr' slot seems to be ignored, and the `closure' argument to pc.conv always comes in as random garbage. */ - suns_pam_implementation_blows = (void *) si; + suns_pam_implementation_blows = pc.appdata_ptr; /* Initialize PAM. */ - status = pam_start (service, si->user, &pc, &pamh); + status = pam_start (service, user, &pc, &pamh); if (verbose_p) - fprintf (stderr, "%s: pam_start (\"%s\", \"%s\", ...) ==> %d (%s)\n", - blurb(), service, si->user, + fprintf (stderr, "%s: PAM: pam_start (\"%s\", \"%s\", ...) ==> %d (%s)\n", + blurb(), service, user, status, PAM_STRERROR (pamh, status)); if (status != PAM_SUCCESS) goto DONE; - /* #### We should set PAM_TTY to the display we're using, but we - don't have that handy from here. So set it to :0.0, which is a - good guess (and has the bonus of counting as a "secure tty" as - far as PAM is concerned...) - */ { - char *tty = strdup (":0.0"); + char *tty = getenv ("DISPLAY"); + if (!tty || !*tty) tty = ":0.0"; status = pam_set_item (pamh, PAM_TTY, tty); if (verbose_p) fprintf (stderr, "%s: pam_set_item (p, PAM_TTY, \"%s\") ==> %d (%s)\n", blurb(), tty, status, PAM_STRERROR(pamh, status)); - free (tty); } - /* Try to authenticate as the current user. - We must turn off our SIGCHLD handler for the duration of the call to - pam_authenticate(), because in some cases, the underlying PAM code - will do this: - - 1: fork a setuid subprocess to do some dirty work; - 2: read a response from that subprocess; - 3: waitpid(pid, ...) on that subprocess. - - If we (the ignorant parent process) have a SIGCHLD handler, then there's - a race condition between steps 2 and 3: if the subprocess exits before - waitpid() was called, then our SIGCHLD handler fires, and gets notified - of the subprocess death; then PAM's call to waitpid() fails, because the - process has already been reaped. - - I consider this a bug in PAM, since the caller should be able to have - whatever signal handlers it wants -- the PAM documentation doesn't say - "oh by the way, if you use PAM, you can't use SIGCHLD." - */ - PAM_NO_DELAY(pamh); if (verbose_p) fprintf (stderr, "%s: pam_authenticate (...) ...\n", blurb()); -# ifdef HAVE_SIGTIMEDWAIT - timeout.tv_sec = 0; - timeout.tv_nsec = 1; - set = -# endif /* HAVE_SIGTIMEDWAIT */ - block_sigchld(); status = pam_authenticate (pamh, 0); -# ifdef HAVE_SIGTIMEDWAIT - sigtimedwait (&set, NULL, &timeout); - /* #### What is the portable thing to do if we don't have it? */ -# endif /* HAVE_SIGTIMEDWAIT */ - unblock_sigchld(); if (verbose_p) fprintf (stderr, "%s: pam_authenticate (...) ==> %d (%s)\n", blurb(), status, PAM_STRERROR(pamh, status)); - if (status == PAM_SUCCESS) /* Win! */ + if (status == PAM_SUCCESS) /* So far so good... */ { int status2; @@ -341,22 +263,16 @@ pam_try_unlock(saver_info *si, Bool verbose_p, (status2 == PAM_SUCCESS ? "Success" : "Failure")); } - if (status == PAM_SUCCESS) - si->unlock_state = ul_success; /* yay */ - else if (si->unlock_state == ul_cancel || - si->unlock_state == ul_time) - ; /* more specific failures ok */ - else - si->unlock_state = ul_fail; /* generic failure */ + return (status == PAM_SUCCESS); } Bool -pam_priv_init (int argc, char **argv, Bool verbose_p) +pam_priv_init (void) { /* We have nothing to do at init-time. However, we might as well do some error checking. - If "/etc/pam.d" exists and is a directory, but "/etc/pam.d/xlock" + If "/etc/pam.d" exists and is a directory, but "/etc/pam.d/xscreensaver" does not exist, warn that PAM probably isn't going to work. This is a priv-init instead of a non-priv init in case the directory @@ -375,8 +291,8 @@ pam_priv_init (int argc, char **argv, Bool verbose_p) { if (stat (file, &st) != 0) fprintf (stderr, - "%s: warning: %s does not exist.\n" - "%s: password authentication via PAM is unlikely to work.\n", + "%s: PAM: warning: %s does not exist.\n" + "%s: PAM: password authentication is unlikely to work.\n", blurb(), file, blurb()); } else if (stat (file2, &st) == 0) @@ -396,8 +312,8 @@ pam_priv_init (int argc, char **argv, Bool verbose_p) if (!ok) { fprintf (stderr, - "%s: warning: %s does not list the `%s' service.\n" - "%s: password authentication via PAM is unlikely to work.\n", + "%s: PAM: warning: %s does not list the `%s' service.\n" + "%s: PAM: password authentication is unlikely to work.\n", blurb(), file2, PAM_SERVICE_NAME, blurb()); } } @@ -406,8 +322,8 @@ pam_priv_init (int argc, char **argv, Bool verbose_p) else { fprintf (stderr, - "%s: warning: neither %s nor %s exist.\n" - "%s: password authentication via PAM is unlikely to work.\n", + "%s: PAM: warning: neither %s nor %s exist.\n" + "%s: PAM: password authentication is unlikely to work.\n", blurb(), file2, file, blurb()); } @@ -416,23 +332,22 @@ pam_priv_init (int argc, char **argv, Bool verbose_p) } +/* This is pam_conv->conv */ static int pam_conversation (int nmsgs, const struct pam_message **msg, struct pam_response **resp, - void *vsaver_info) + void *closure) { - int i, ret = -1; - struct auth_message *messages = 0; - struct auth_response *authresp = 0; + int i; + auth_message *messages = 0; + auth_response *authresp = 0; struct pam_response *pam_responses; - saver_info *si = (saver_info *) vsaver_info; - Bool verbose_p; + pam_conv_closure *conv_closure; /* On SunOS 5.6, the `closure' argument always comes in as random garbage. */ - si = (saver_info *) suns_pam_implementation_blows; - - verbose_p = si->prefs.verbose_p; + closure = suns_pam_implementation_blows; + conv_closure = closure; /* Converting the PAM prompts into the XScreenSaver native format. * It was a design goal to collapse (INFO,PROMPT) pairs from PAM @@ -443,11 +358,9 @@ pam_conversation (int nmsgs, * pass along whatever was passed in here. */ - messages = calloc(nmsgs, sizeof(struct auth_message)); - pam_responses = calloc(nmsgs, sizeof(*pam_responses)); - - if (!pam_responses || !messages) - goto end; + messages = calloc (nmsgs, sizeof(*messages)); + pam_responses = calloc (nmsgs, sizeof(*pam_responses)); + if (!pam_responses || !messages) abort(); if (verbose_p) fprintf (stderr, "%s: pam_conversation (", blurb()); @@ -483,44 +396,25 @@ pam_conversation (int nmsgs, if (verbose_p) fprintf (stderr, ") ...\n"); - ret = si->unlock_cb(nmsgs, messages, &authresp, si); - - /* #### If the user times out, or hits ESC or Cancel, we return PAM_CONV_ERR, - and PAM logs this as an authentication failure. It would be nice if - there was some way to indicate that this was a "cancel" rather than - a "fail", so that it wouldn't show up in syslog, but I think the - only options are PAM_SUCCESS and PAM_CONV_ERR. (I think that - PAM_ABORT means "internal error", not "cancel".) Bleh. - */ - - if (ret == 0) - { - for (i = 0; i < nmsgs; ++i) - pam_responses[i].resp = authresp[i].response; - } + /* This opens the dialog box and runs the X11 event loop. + It only returns if the user entered a password. + If they hit cancel, or timed out, it exited. + */ + conv_closure->conv_fn (conv_closure->conv_fn_closure, nmsgs, messages, + &authresp); -end: - if (messages) - free(messages); + for (i = 0; i < nmsgs; ++i) + pam_responses[i].resp = authresp[i].response; - if (authresp) - free(authresp); + if (messages) free (messages); + if (authresp) free (authresp); if (verbose_p) - fprintf (stderr, "%s: pam_conversation (...) ==> %s\n", blurb(), - (ret == 0 ? "PAM_SUCCESS" : "PAM_CONV_ERR")); - - if (ret == 0) - { - *resp = pam_responses; - return PAM_SUCCESS; - } - - /* Failure only */ - if (pam_responses) - free(pam_responses); + fprintf (stderr, "%s: pam_conversation (...) ==> PAM_SUCCESS\n", + blurb()); - return PAM_CONV_ERR; + *resp = pam_responses; + return PAM_SUCCESS; } #endif /* NO_LOCKING -- whole file */ diff --git a/driver/passwd-pwent.c b/driver/passwd-pwent.c index bb0edfc..b6c74de 100644 --- a/driver/passwd-pwent.c +++ b/driver/passwd-pwent.c @@ -1,5 +1,5 @@ /* passwd-pwent.c --- verifying typed passwords with the OS. - * xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski + * xscreensaver, Copyright © 1993-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -28,13 +28,8 @@ #include #include #include -#ifndef VMS -# include -# include -#else /* VMS */ -# include "vms-pwd.h" -#endif /* VMS */ - +#include +#include #ifdef __bsdi__ # include @@ -47,6 +42,7 @@ #if defined(HAVE_SHADOW_PASSWD) /* passwds live in /etc/shadow */ # include +# define PWNAME "spnam" # define PWTYPE struct spwd * # define PWPSLOT sp_pwdp # define GETPW getspnam @@ -56,6 +52,7 @@ # include # include +# define PWNAME "prpwnam" # define PWTYPE struct pr_passwd * # define PWPSLOT ufld.fd_encrypt # define GETPW getprpwnam @@ -66,6 +63,7 @@ # include # include +# define PWNAME "pwanam" # define PWTYPE struct passwd_adjunct * # define PWPSLOT pwa_passwd # define GETPW getpwanam @@ -75,43 +73,33 @@ # include # include +# define PWNAME "spwnam" # define PWTYPE struct s_passwd * # define PWPSLOT pw_passwd # define GETPW getspwnam # define HAVE_BIGCRYPT -#endif +#elif defined(HAVE_PWNAM_SHADOW_PASSWD) +# define PWNAME "pwnam_shadow" +# define PWTYPE struct passwd * +# define PWPSLOT pw_passwd +# define GETPW getpwnam_shadow -/* blargh */ -#undef Bool -#undef True -#undef False -#define Bool int -#define True 1 -#define False 0 +#endif +#include "blurb.h" +#include "auth.h" -extern const char *blurb(void); +#ifdef ALLOW_ROOT_PASSWD static char *encrypted_root_passwd = 0; -static char *encrypted_user_passwd = 0; - -#ifdef VMS -# define ROOT "SYSTEM" -#else -# define ROOT "root" -#endif - -#ifndef VMS -Bool pwent_priv_init (int argc, char **argv, Bool verbose_p); -Bool pwent_lock_init (int argc, char **argv, Bool verbose_p); -Bool pwent_passwd_valid_p (const char *typed_passwd, Bool verbose_p); #endif +static char *encrypted_user_passwd = 0; +#define ROOT "root" -#ifndef VMS static char * user_name (void) @@ -140,17 +128,6 @@ user_name (void) return (u ? strdup(u) : 0); } -#else /* VMS */ - -static char * -user_name (void) -{ - char *u = getenv("USER"); - return (u ? strdup(u) : 0); -} - -#endif /* VMS */ - static Bool passwd_known_p (const char *pw) @@ -162,24 +139,28 @@ passwd_known_p (const char *pw) static char * -get_encrypted_passwd(const char *user) +get_encrypted_passwd (const char *user) { char *result = 0; + const char *pwtype = "pwnam"; -#ifdef PWTYPE +# ifdef PWTYPE if (user && *user && !result) { /* First check the shadow passwords. */ PWTYPE p = GETPW((char *) user); if (p && passwd_known_p (p->PWPSLOT)) - result = strdup(p->PWPSLOT); + { + result = strdup(p->PWPSLOT); + pwtype = PWNAME; + } } -#endif /* PWTYPE */ +# endif /* PWTYPE */ if (user && *user && !result) { /* Check non-shadow passwords too. */ struct passwd *p = getpwnam(user); if (p && passwd_known_p (p->pw_passwd)) - result = strdup(p->pw_passwd); + result = strdup(p->pw_passwd); } /* The manual for passwd(4) on HPUX 10.10 says: @@ -200,15 +181,20 @@ get_encrypted_passwd(const char *user) *s = 0; } -#ifndef HAVE_PAM - /* We only issue this warning if not compiled with support for PAM. - If we're using PAM, it's not unheard of that normal pwent passwords - would be unavailable. */ + /* We only issue this warning in non-verbose mode if not compiled with + support for PAM. If we're using PAM, it's common for pwent passwords + to be unavailable. */ - if (!result) - fprintf (stderr, "%s: couldn't get password of \"%s\"\n", - blurb(), (user ? user : "(null)")); -#endif /* !HAVE_PAM */ + if (!result && + (verbose_p +# ifdef HAVE_PAM + || 0 +# else + || 1 +# endif + )) + fprintf (stderr, "%s: %s: couldn't get password of \"%s\"\n", + blurb(), pwtype, (user ? user : "(null)")); return result; } @@ -221,10 +207,8 @@ get_encrypted_passwd(const char *user) locking isn't possible. (It will also have written to stderr.) */ -#ifndef VMS - Bool -pwent_priv_init (int argc, char **argv, Bool verbose_p) +pwent_priv_init (void) { char *u; @@ -235,7 +219,9 @@ pwent_priv_init (int argc, char **argv, Bool verbose_p) u = user_name(); encrypted_user_passwd = get_encrypted_passwd(u); +#ifdef ALLOW_ROOT_PASSWD encrypted_root_passwd = get_encrypted_passwd(ROOT); +#endif if (u) free (u); if (encrypted_user_passwd) @@ -246,7 +232,7 @@ pwent_priv_init (int argc, char **argv, Bool verbose_p) Bool -pwent_lock_init (int argc, char **argv, Bool verbose_p) +pwent_lock_init (void) { if (encrypted_user_passwd) return True; @@ -287,7 +273,7 @@ passwds_match_p (const char *cleartext, const char *ciphertext) to root. */ Bool -pwent_passwd_valid_p (const char *typed_passwd, Bool verbose_p) +pwent_passwd_valid_p (void *closure, const char *typed_passwd) { if (encrypted_user_passwd && passwds_match_p (typed_passwd, encrypted_user_passwd)) @@ -305,8 +291,6 @@ pwent_passwd_valid_p (const char *typed_passwd, Bool verbose_p) return False; } -#else /* VMS */ -Bool pwent_lock_init (int argc, char **argv, Bool verbose_p) { return True; } -#endif /* VMS */ - +#else /* NO_LOCKING */ +int _ignore_; #endif /* NO_LOCKING -- whole file */ diff --git a/driver/passwd.c b/driver/passwd.c index 68e1a0b..11ca134 100644 --- a/driver/passwd.c +++ b/driver/passwd.c @@ -1,5 +1,5 @@ /* passwd.c --- verifying typed passwords with the OS. - * xscreensaver, Copyright (c) 1993-2019 Jamie Zawinski + * xscreensaver, Copyright © 1993-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -14,8 +14,6 @@ # include "config.h" #endif -#ifndef NO_LOCKING /* whole file */ - #include #include #include @@ -26,11 +24,7 @@ #include #include -#ifndef VMS -# include /* for getpwuid() */ -#else /* VMS */ -# include "vms-pwd.h" -#endif /* VMS */ +#include /* for getpwuid() */ #ifdef HAVE_SYSLOG # include @@ -41,8 +35,24 @@ #include "xscreensaver.h" #include "auth.h" + +#ifdef NO_LOCKING + +Bool lock_init (void) { return 0; } +Bool lock_priv_init (void) { return 0; } +Bool xscreensaver_auth (void *closure, + Bool (*conv_fn) (void *closure, + int nmsgs, + const auth_message *msg, + auth_response **resp), + void (*finished_fn) (void *closure, Bool status)) +{ + return False; +} + +#else /* NO_LOCKING -- whole file */ + extern const char *blurb(void); -extern void check_for_leaks (const char *where); /* blargh */ @@ -58,100 +68,39 @@ extern void check_for_leaks (const char *where); struct auth_methods { const char *name; - Bool (*init) (int argc, char **argv, Bool verbose_p); - Bool (*priv_init) (int argc, char **argv, Bool verbose_p); - Bool (*valid_p) (const char *typed_passwd, Bool verbose_p); - void (*try_unlock) (saver_info *si, Bool verbose_p, - Bool (*valid_p)(const char *typed_passwd, Bool verbose_p)); + Bool (*init) (void); + Bool (*priv_init) (void); + Bool (*valid_p) (void *closure, const char *plaintext); + Bool (*try_unlock) (void *closure, + Bool (*conv_fn) (void *closure, + int nmsgs, + const auth_message *msg, + auth_response **resp)); Bool initted_p; Bool priv_initted_p; }; -#ifdef HAVE_KERBEROS -extern Bool kerberos_lock_init (int argc, char **argv, Bool verbose_p); -extern Bool kerberos_passwd_valid_p (const char *typed_passwd, Bool verbose_p); -#endif -#ifdef HAVE_PAM -extern Bool pam_priv_init (int argc, char **argv, Bool verbose_p); -extern void pam_try_unlock (saver_info *si, Bool verbose_p, - Bool (*valid_p)(const char *typed_passwd, Bool verbose_p)); -#endif -#ifdef PASSWD_HELPER_PROGRAM -extern Bool ext_priv_init (int argc, char **argv, Bool verbose_p); -extern Bool ext_passwd_valid_p (const char *typed_passwd, Bool verbose_p); -#endif -extern Bool pwent_lock_init (int argc, char **argv, Bool verbose_p); -extern Bool pwent_priv_init (int argc, char **argv, Bool verbose_p); -extern Bool pwent_passwd_valid_p (const char *typed_passwd, Bool verbose_p); - -Bool lock_priv_init (int argc, char **argv, Bool verbose_p); -Bool lock_init (int argc, char **argv, Bool verbose_p); -Bool passwd_valid_p (const char *typed_passwd, Bool verbose_p); - -/* The authorization methods to try, in order. - Note that the last one (the pwent version) is actually two auth methods, - since that code tries shadow passwords, and then non-shadow passwords. - (It's all in the same file since the APIs are randomly nearly-identical.) + +/* The authorization methods to try, in order of preference. + The first that initializes successfully is used and others are ignored. */ struct auth_methods methods[] = { # ifdef HAVE_PAM - { "PAM", 0, pam_priv_init, 0, pam_try_unlock, - False, False }, + { "PAM", 0, pam_priv_init, 0, pam_try_unlock, 0, }, # endif # ifdef HAVE_KERBEROS - { "Kerberos", kerberos_lock_init, 0, kerberos_passwd_valid_p, 0, - False, False }, + { "KRB", kerberos_lock_init, 0, kerberos_passwd_valid_p, 0, }, # endif # ifdef PASSWD_HELPER_PROGRAM - { "external", 0, ext_priv_init, ext_passwd_valid_p, 0, - False, False }, + { "EXT", 0, ext_priv_init, ext_passwd_valid_p, 0, }, # endif - { "normal", pwent_lock_init, pwent_priv_init, pwent_passwd_valid_p, 0, - False, False } + { "pwnam", pwent_lock_init, pwent_priv_init, pwent_passwd_valid_p, 0, } }; -# ifdef HAVE_PROC_OOM -/* On some recent Linux systems you can tell the kernel's OOM-killer to - consider the possibility of maybe sometimes not killing you in low-memory - situations. Because that would unlock the screen. And that would be bad. - - Linux >= 2.6.11: echo -17 > /proc/$$/oom_adj <-- ignoring this. - Linux >= 2.6.37: echo -1000 > /proc/$$/oom_score_adj <-- trying this. - */ -static void -oom_assassin_immunity (Bool verbose_p) -{ - char fn[1024]; - struct stat st; - FILE *out; - sprintf (fn, "/proc/%d/oom_score_adj", getpid()); - if (stat(fn, &st) != 0) - { - if (verbose_p) - fprintf (stderr, "%s: OOM: %s does not exist\n", blurb(), fn); - return; - } - out = fopen (fn, "w"); - if (!out) - { - if (verbose_p) - { - char b[2048]; - sprintf (b, "%s: OOM: unable to write %s\n", blurb(), fn); - perror(b); - } - return; - } - fputs ("-1000\n", out); - fclose (out); -} -# endif /* HAVE_PROC_OOM */ - - Bool -lock_priv_init (int argc, char **argv, Bool verbose_p) +lock_priv_init (void) { int i; Bool any_ok = False; @@ -160,26 +109,17 @@ lock_priv_init (int argc, char **argv, Bool verbose_p) if (!methods[i].priv_init) methods[i].priv_initted_p = True; else - methods[i].priv_initted_p = methods[i].priv_init (argc, argv, - verbose_p); + methods[i].priv_initted_p = methods[i].priv_init(); if (methods[i].priv_initted_p) any_ok = True; - else if (verbose_p) - fprintf (stderr, "%s: initialization of %s passwords failed.\n", - blurb(), methods[i].name); } - -# ifdef HAVE_PROC_OOM - oom_assassin_immunity (verbose_p); -# endif - return any_ok; } Bool -lock_init (int argc, char **argv, Bool verbose_p) +lock_init (void) { int i; Bool any_ok = False; @@ -191,70 +131,75 @@ lock_init (int argc, char **argv, Bool verbose_p) if (!methods[i].init) methods[i].initted_p = True; else - methods[i].initted_p = methods[i].init (argc, argv, verbose_p); + methods[i].initted_p = methods[i].init(); if (methods[i].initted_p) any_ok = True; else if (verbose_p) - fprintf (stderr, "%s: initialization of %s passwords failed.\n", + fprintf (stderr, "%s: %s: passwords initialization failed\n", blurb(), methods[i].name); } return any_ok; } -/* A basic auth driver that simply prompts for a password then runs it through - * valid_p to determine whether the password is correct. +/* For those auth methods that have a 'valid_p' function instead of a + 'try_unlock' function, this does a PAM-like conversation that first + prompts for a password and then tests it with the 'valid_p' function. */ -static void -try_unlock_password(saver_info *si, - Bool verbose_p, - Bool (*valid_p)(const char *typed_passwd, Bool verbose_p)) +static Bool +try_valid_p (void *closure, + const char *name, + Bool (*valid_p) (void *closure, const char *typed_passwd), + Bool (*conv_fn) (void *closure, + int nmsgs, + const auth_message *msg, + auth_response **resp)) { - struct auth_message message; - struct auth_response *response = NULL; + auth_message message; + auth_response *response = NULL; + Bool ok = False; - memset(&message, 0, sizeof(message)); + memset (&message, 0, sizeof(message)); if (verbose_p) - fprintf(stderr, "%s: non-PAM password auth.\n", blurb()); + fprintf (stderr, "%s: %s: non-PAM password auth\n", blurb(), name); - /* Call the auth_conv function with "Password:", then feed - * the result into valid_p() - */ + /* Call the auth_conv function with "Password:", then feed the result + into valid_p() */ message.type = AUTH_MSGTYPE_PROMPT_NOECHO; message.msg = "Password:"; - si->unlock_cb(1, &message, &response, si); + ok = conv_fn (closure, 1, &message, &response); + if (!response || !response->response) + ok = False; - if (!response) - return; + if (ok) + ok = valid_p (closure, response->response); - if (valid_p (response->response, verbose_p)) - si->unlock_state = ul_success; /* yay */ - else if (si->unlock_state == ul_cancel || - si->unlock_state == ul_time) - ; /* more specific failures ok */ - else - si->unlock_state = ul_fail; /* generic failure */ + if (response) + { + if (response->response) + free (response->response); + free (response); + } - if (response->response) - free(response->response); - free(response); + return ok; } /* Write a password failure to the system log. */ static void -do_syslog (saver_info *si, Bool verbose_p) +do_syslog (void) { # ifdef HAVE_SYSLOG struct passwd *pw = getpwuid (getuid ()); - char *d = (si->dpy ? DisplayString (si->dpy) : 0); + char *d = getenv ("DISPLAY"); char *u = (pw && pw->pw_name ? pw->pw_name : "???"); int opt = 0; int fac = 0; + int pri = LOG_NOTICE; # ifdef LOG_PID opt = LOG_PID; @@ -270,115 +215,57 @@ do_syslog (saver_info *si, Bool verbose_p) if (!d) d = ""; -# undef FMT -# define FMT "FAILED LOGIN %d ON DISPLAY \"%s\", FOR \"%s\"" - - if (verbose_p) - fprintf (stderr, "%s: syslog: " FMT "\n", blurb(), - si->unlock_failures, d, u); - openlog (progname, opt, fac); - syslog (LOG_NOTICE, FMT, si->unlock_failures, d, u); + syslog (pri, "Failed login on display \"%s\" for \"%s\"", d, u); closelog (); # endif /* HAVE_SYSLOG */ } - -/** - * Runs through each authentication driver calling its try_unlock function. - * Called xss_authenticate() because AIX beat us to the name authenticate(). +/* Runs through each authentication driver calling its try_unlock function. */ -void -xss_authenticate(saver_info *si, Bool verbose_p) +Bool +xscreensaver_auth (void *closure, + Bool (*conv_fn) (void *closure, + int nmsgs, + const auth_message *msg, + auth_response **resp), + void (*finished_fn) (void *closure, Bool status)) { - int i, j; - - si->unlock_state = ul_read; + int i; + Bool ok = False; for (i = 0; i < countof(methods); i++) { if (!methods[i].initted_p) continue; - if (si->cached_passwd != NULL && methods[i].valid_p) - si->unlock_state = (methods[i].valid_p(si->cached_passwd, verbose_p) == True) - ? ul_success : ul_fail; - else if (methods[i].try_unlock != NULL) - methods[i].try_unlock(si, verbose_p, methods[i].valid_p); + if (methods[i].try_unlock) + ok = methods[i].try_unlock (closure, conv_fn); else if (methods[i].valid_p) - try_unlock_password(si, verbose_p, methods[i].valid_p); - else /* Ze goggles, zey do nozing! */ - fprintf(stderr, "%s: authentication method %s does nothing.\n", - blurb(), methods[i].name); - - check_for_leaks (methods[i].name); - - /* If password authentication failed, but the password was NULL - (meaning the user just hit RET) then treat that as "cancel". - This means that if the password is literally NULL, it will - work; but if not, then NULL passwords are treated as cancel. - */ - if (si->unlock_state == ul_fail && - si->cached_passwd && - !*si->cached_passwd) - { - if (verbose_p) - fprintf (stderr, "%s: assuming null password means cancel.\n", - blurb()); - si->unlock_state = ul_cancel; - } - - if (si->unlock_state == ul_success) - { - /* If we successfully authenticated by method N, but attempting - to authenticate by method N-1 failed, mention that (since if - an earlier authentication method fails and a later one succeeds, - something screwy is probably going on.) - */ - if (verbose_p && i > 0) - { - for (j = 0; j < i; j++) - if (methods[j].initted_p) - fprintf (stderr, - "%s: authentication via %s failed.\n", - blurb(), methods[j].name); - fprintf (stderr, - "%s: authentication via %s succeeded.\n", - blurb(), methods[i].name); - } - goto DONE; /* Successfully authenticated! */ - } - else if (si->unlock_state == ul_cancel || - si->unlock_state == ul_time) - { - /* If any auth method gets a cancel or timeout, don't try the - next auth method! We're done! */ - if (verbose_p) - fprintf (stderr, "%s: authentication via %s %s.\n", - blurb(), methods[i].name, - (si->unlock_state == ul_cancel - ? "cancelled" : "timed out")); - goto DONE; - } + ok = try_valid_p (closure, methods[i].name, methods[i].valid_p, + conv_fn); + else + abort(); /* method must have one or the other function */ + + /* Only try the first method that initialized properly. That means that + if PAM initialized correctly, we will never try pwent or Kerberos. + If we did, then typing an incorrect password at PAM would result in a + second password prompt that would only go to pwent. There's no + sensible way to re-use the password typed the first time, if there + even was one. With fingerprint readers or OTP fobs, there might have + been 0, 2, or more passwords entered. */ + break; } - if (verbose_p) - fprintf(stderr, "%s: All authentication mechanisms failed.\n", blurb()); + if (!ok) + do_syslog (); - if (si->unlock_state == ul_fail) - { - /* Note the time of the first failure */ - if (si->unlock_failures == 0) - si->unlock_failure_time = time((time_t *) 0); - si->unlock_failures++; - do_syslog (si, verbose_p); - } + if (finished_fn) + finished_fn (closure, ok); -DONE: - if (si->auth_finished_cb) - si->auth_finished_cb (si); + return ok; } #endif /* NO_LOCKING -- whole file */ diff --git a/driver/prefs.c b/driver/prefs.c index 94e7a0c..a65b679 100644 --- a/driver/prefs.c +++ b/driver/prefs.c @@ -1,5 +1,5 @@ -/* dotfile.c --- management of the ~/.xscreensaver file. - * xscreensaver, Copyright (c) 1998-2020 Jamie Zawinski +/* prefs.c --- reading and writing the ~/.xscreensaver file. + * xscreensaver, Copyright © 1998-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -14,309 +14,20 @@ # include "config.h" #endif -#include - -#ifdef HAVE_UNISTD_H -# include -#endif - #include -#include +#include #include #include #include #include -#include /* for PATH_MAX */ -#include -#include - -#ifndef VMS -# include -#else /* VMS */ -# include "vms-pwd.h" -#endif /* VMS */ - - -/* This file doesn't need the Xt headers, so stub these types out... */ -#undef XtPointer -#define XtAppContext void* -#define XtIntervalId void* -#define XtPointer void* -#define Widget void* - - -/* Just in case there's something pathological about stat.h... */ -#ifndef S_IRUSR -# define S_IRUSR 00400 -#endif -#ifndef S_IWUSR -# define S_IWUSR 00200 -#endif -#ifndef S_IXUSR -# define S_IXUSR 00100 -#endif -#ifndef S_IXGRP -# define S_IXGRP 00010 -#endif -#ifndef S_IXOTH -# define S_IXOTH 00001 +#ifdef HAVE_UNISTD_H +# include #endif - -#include "version.h" +#include "blurb.h" #include "prefs.h" -#include "resources.h" - -/* don't use realpath() on fedora system */ -#ifdef _FORTIFY_SOURCE -#undef HAVE_REALPATH -#endif - - -extern char *progname; -extern char *progclass; -extern const char *blurb (void); - - - -static void get_screenhacks (Display *, saver_preferences *); -static char *format_command (const char *cmd, Bool wrap_p); -static void merge_system_screenhacks (Display *, saver_preferences *, - screenhack **system_list, int count); -static void stop_the_insanity (saver_preferences *p); - - -static char * -chase_symlinks (const char *file) -{ -# ifdef HAVE_REALPATH - if (file) - { -# ifndef PATH_MAX -# ifdef MAXPATHLEN -# define PATH_MAX MAXPATHLEN -# else -# define PATH_MAX 2048 -# endif -# endif - char buf[PATH_MAX]; - if (realpath (file, buf)) - return strdup (buf); - -/* sprintf (buf, "%.100s: realpath %.200s", blurb(), file); - perror(buf);*/ - } -# endif /* HAVE_REALPATH */ - return 0; -} - - -static Bool -i_am_a_nobody (uid_t uid) -{ - struct passwd *p; - - p = getpwnam ("nobody"); - if (! p) p = getpwnam ("noaccess"); - if (! p) p = getpwnam ("daemon"); - - if (! p) /* There is no nobody? */ - return False; - - return (uid == p->pw_uid); -} - - -const char * -init_file_name (void) -{ - static char *file = 0; - - if (!file) - { - uid_t uid = getuid (); - const char *home = getenv("HOME"); - - if (i_am_a_nobody (uid) || !home || !*home) - { - /* If we're running as nobody, then use root's .xscreensaver file - (since ~root/.xscreensaver and ~nobody/.xscreensaver are likely - to be different -- if we didn't do this, then xscreensaver-demo - would appear to have no effect when the luser is running as root.) - */ - struct passwd *p = getpwuid (uid); - uid = 0; - if (!p || !p->pw_name || !*p->pw_name) - { - fprintf (stderr, "%s: couldn't get user info of uid %d\n", - blurb(), getuid ()); - } - else if (!p->pw_dir || !*p->pw_dir) - { - fprintf (stderr, "%s: couldn't get home directory of \"%s\"\n", - blurb(), (p->pw_name ? p->pw_name : "???")); - } - else - { - home = p->pw_dir; - } - } - if (home && *home) - { - const char *name = ".xscreensaver"; - file = (char *) malloc(strlen(home) + strlen(name) + 2); - strcpy(file, home); - if (!*home || home[strlen(home)-1] != '/') - strcat(file, "/"); - strcat(file, name); - } - else - { - file = ""; - } - } - - if (file && *file) - return file; - else - return 0; -} - - -static const char * -init_file_tmp_name (void) -{ - static char *file = 0; - if (!file) - { - const char *name = init_file_name(); - const char *suffix = ".tmp"; - - char *n2 = chase_symlinks (name); - if (n2) name = n2; - if (!name || !*name) - file = ""; - else - { - file = (char *) malloc(strlen(name) + strlen(suffix) + 2); - strcpy(file, name); - strcat(file, suffix); - } - - if (n2) free (n2); - } - - if (file && *file) - return file; - else - return 0; -} - -static int -get_byte_resource (Display *dpy, char *name, char *class) -{ - char *s = get_string_resource (dpy, name, class); - char *s2 = s; - int n = 0; - if (!s) return 0; - - while (isspace(*s2)) s2++; - while (*s2 >= '0' && *s2 <= '9') - { - n = (n * 10) + (*s2 - '0'); - s2++; - } - while (isspace(*s2)) s2++; - if (*s2 == 'k' || *s2 == 'K') n <<= 10; - else if (*s2 == 'm' || *s2 == 'M') n <<= 20; - else if (*s2 == 'g' || *s2 == 'G') n <<= 30; - else if (*s2) - { - LOSE: - fprintf (stderr, "%s: %s must be a number of bytes, not \"%s\".\n", - progname, name, s); - free (s); - return 0; - } - s2++; - if (*s2 == 'b' || *s2 == 'B') s2++; - while (isspace(*s2)) s2++; - if (*s2) goto LOSE; - - free (s); - return n; -} - - -static const char * const prefs[] = { - "timeout", - "cycle", - "lock", - "lockVTs", /* not saved */ - "lockTimeout", - "passwdTimeout", - "visualID", - "installColormap", - "verbose", - "timestamp", - "splash", - "splashDuration", - "quad", - "demoCommand", - "prefsCommand", - "newLoginCommand", - "helpURL", /* not saved */ - "loadURL", /* not saved */ - "newLoginCommand", /* not saved */ - "nice", - "memoryLimit", - "fade", - "unfade", - "fadeSeconds", - "fadeTicks", - "captureStderr", - "captureStdout", /* not saved -- obsolete */ - "logFile", /* not saved */ - "ignoreUninstalledPrograms", - "font", - "dpmsEnabled", - "dpmsQuickOff", - "dpmsStandby", - "dpmsSuspend", - "dpmsOff", - "grabDesktopImages", - "grabVideoFrames", - "chooseRandomImages", - "imageDirectory", - "mode", - "selected", - "textMode", - "textLiteral", - "textFile", - "textProgram", - "textURL", - "", - "programs", - "", - "pointerPollTime", - "pointerHysteresis", - "windowCreationTimeout", - "initialDelay", - "sgiSaverExtension", /* not saved -- obsolete */ - "mitSaverExtension", /* not saved -- obsolete */ - "xidleExtension", /* not saved -- obsolete */ - "GetViewPortIsFullOfLies", - "procInterrupts", - "xinputExtensionDev", - "overlayStderr", - "overlayTextBackground", /* not saved -- X resources only */ - "overlayTextForeground", /* not saved -- X resources only */ - "bourneShell", /* not saved -- X resources only */ - "authWarningSlack", - 0 -}; static char * strip (char *s) @@ -334,85 +45,49 @@ strip (char *s) return s; } - -/* Reading - */ - -static int -handle_entry (XrmDatabase *db, const char *key, const char *value, - const char *filename, int line) -{ - int i; - for (i = 0; prefs[i]; i++) - if (*prefs[i] && !strcasecmp(key, prefs[i])) - { - char *val = strdup(value); - char *spec = (char *) malloc(strlen(progclass) + strlen(prefs[i]) +10); - strcpy(spec, progclass); - strcat(spec, "."); - strcat(spec, prefs[i]); - - XrmPutStringResource (db, spec, val); - - free(spec); - free(val); - return 0; - } - - fprintf(stderr, "%s: %s:%d: unknown option \"%s\"\n", - blurb(), filename, line, key); - return 1; -} - -static int -parse_init_file (saver_preferences *p) +/* Parse the .xscreensaver or XScreenSaver.ad file and run the callback + for each key-value pair. +*/ +int +parse_init_file (const char *name, + void (*handler) (int lineno, + const char *key, const char *val, + void *closure), + void *closure) { - time_t write_date = 0; - const char *name = init_file_name(); int line = 0; struct stat st; FILE *in; int buf_size = 1024; - char *buf; + char *buf = 0; if (!name) return 0; + if (stat (name, &st) != 0) goto FAIL; - if (stat(name, &st) != 0) - { - p->init_file_date = 0; - return 0; - } + buf = (char *) malloc (buf_size); + if (!buf) goto FAIL; in = fopen(name, "r"); if (!in) { - char *buf = (char *) malloc(1024 + strlen(name)); - sprintf(buf, "%s: error reading \"%s\"", blurb(), name); - perror(buf); - free(buf); - return -1; + sprintf (buf, "%s: error reading \"%.100s\"", blurb(), name); + perror (buf); + goto FAIL; } - if (fstat (fileno(in), &st) == 0) + if (fstat (fileno (in), &st) != 0) { - write_date = st.st_mtime; - } - else - { - char *buf = (char *) malloc(1024 + strlen(name)); - sprintf(buf, "%s: couldn't re-stat \"%s\"", blurb(), name); - perror(buf); - free(buf); + sprintf (buf, "%s: couldn't re-stat \"%.100s\"", blurb(), name); + perror (buf); + free (buf); return -1; } - buf = (char *) malloc(buf_size); - while (fgets (buf, buf_size-1, in)) { char *key, *value; - int L = strlen(buf); + int L = strlen (buf); line++; while (L > 2 && @@ -425,13 +100,13 @@ parse_init_file (saver_preferences *p) L -= 2; } buf_size += 1024; - buf = (char *) realloc(buf, buf_size); - if (!buf) exit(1); + buf = (char *) realloc (buf, buf_size); + if (!buf) goto FAIL; line++; if (!fgets (buf + L, buf_size-L-1, in)) break; - L = strlen(buf); + L = strlen (buf); } /* Now handle other backslash escapes. */ @@ -453,7 +128,7 @@ parse_init_file (saver_preferences *p) } } - key = strip(buf); + key = strip (buf); if (*key == '#' || *key == '!' || *key == ';' || *key == '\n' || *key == 0) @@ -462,1314 +137,23 @@ parse_init_file (saver_preferences *p) value = strchr (key, ':'); if (!value) { - fprintf(stderr, "%s: %s:%d: unparsable line: %s\n", blurb(), - name, line, key); + fprintf (stderr, "%s: %s:%d: unparsable line: %s\n", blurb(), + name, line, key); continue; } else { *value++ = 0; - value = strip(value); + value = strip (value); } - if (!p->db) abort(); - handle_entry (&p->db, key, value, name, line); + handler (line, key, value, closure); } fclose (in); - free(buf); - - p->init_file_date = write_date; + free (buf); return 0; -} - - -Bool -init_file_changed_p (saver_preferences *p) -{ - const char *name = init_file_name(); - struct stat st; - - if (!name) return False; - - if (stat(name, &st) != 0) - return False; - - if (p->init_file_date == st.st_mtime) - return False; - - return True; -} - - -/* Writing - */ - -static int -tab_to (FILE *out, int from, int to) -{ - int tab_width = 8; - int to_mod = (to / tab_width) * tab_width; - while (from < to_mod) - { - fprintf(out, "\t"); - from = (((from / tab_width) + 1) * tab_width); - } - while (from < to) - { - fprintf(out, " "); - from++; - } - return from; -} - -static char * -stab_to (char *out, int from, int to) -{ - int tab_width = 8; - int to_mod = (to / tab_width) * tab_width; - while (from < to_mod) - { - *out++ = '\t'; - from = (((from / tab_width) + 1) * tab_width); - } - while (from < to) - { - *out++ = ' '; - from++; - } - return out; -} - -static int -string_columns (const char *string, int length, int start) -{ - int tab_width = 8; - int col = start; - const char *end = string + length; - while (string < end) - { - if (*string == '\n') - col = 0; - else if (*string == '\t') - col = (((col / tab_width) + 1) * tab_width); - else - col++; - string++; - } - return col; -} - - -static void -write_entry (FILE *out, const char *key, const char *value) -{ - char *v = strdup(value ? value : ""); - char *v2 = v; - char *nl = 0; - int col; - Bool programs_p = (!strcmp(key, "programs")); - int tab = (programs_p ? 32 : 16); - Bool first = True; - - fprintf(out, "%s:", key); - col = strlen(key) + 1; - - if (strlen(key) > 14) - col = tab_to (out, col, 20); - - while (1) - { - if (!programs_p) - v2 = strip(v2); - nl = strchr(v2, '\n'); - if (nl) - *nl = 0; - - if (first && programs_p) - { - col = tab_to (out, col, 77); - fprintf (out, " \\\n"); - col = 0; - } - - if (first) - first = False; - else - { - col = tab_to (out, col, 75); - fprintf (out, " \\n\\\n"); - col = 0; - } - - if (!programs_p) - col = tab_to (out, col, tab); - - if (programs_p && - string_columns(v2, strlen (v2), col) + col > 75) - { - int L = strlen (v2); - int start = 0; - int end = start; - while (start < L) - { - while (v2[end] == ' ' || v2[end] == '\t') - end++; - while (v2[end] != ' ' && v2[end] != '\t' && - v2[end] != '\n' && v2[end] != 0) - end++; - if (string_columns (v2 + start, (end - start), col) >= 74) - { - col = tab_to (out, col, 75); - fprintf(out, " \\\n"); - col = tab_to (out, 0, tab + 2); - while (v2[start] == ' ' || v2[start] == '\t') - start++; - } - - col = string_columns (v2 + start, (end - start), col); - while (start < end) - fputc(v2[start++], out); - } - } - else - { - fprintf (out, "%s", v2); - col += string_columns(v2, strlen (v2), col); - } - - if (nl) - v2 = nl + 1; - else - break; - } - - fprintf(out, "\n"); - free(v); -} - -int -write_init_file (Display *dpy, - saver_preferences *p, const char *version_string, - Bool verbose_p) -{ - int status = -1; - const char *name = init_file_name(); - const char *tmp_name = init_file_tmp_name(); - char *n2 = chase_symlinks (name); - struct stat st; - int i, j; - - /* Kludge, since these aren't in the saver_preferences struct as strings... - */ - char *visual_name; - char *programs; - Bool overlay_stderr_p; - char *stderr_font; - FILE *out; - - if (!name) goto END; - - if (n2) name = n2; - - /* Throttle the various timeouts to reasonable values before writing - the file to disk. */ - stop_the_insanity (p); - - - if (verbose_p) - fprintf (stderr, "%s: writing \"%s\".\n", blurb(), name); - - unlink (tmp_name); - out = fopen(tmp_name, "w"); - if (!out) - { - char *buf = (char *) malloc(1024 + strlen(name)); - sprintf(buf, "%s: error writing \"%s\"", blurb(), name); - perror(buf); - free(buf); - goto END; - } - - /* Give the new .xscreensaver file the same permissions as the old one; - except ensure that it is readable and writable by owner, and not - executable. Extra hack: if we're running as root, make the file - be world-readable (so that the daemon, running as "nobody", will - still be able to read it.) - */ - if (stat(name, &st) == 0) - { - mode_t mode = st.st_mode; - mode |= S_IRUSR | S_IWUSR; /* read/write by user */ - mode &= ~(S_IXUSR | S_IXGRP | S_IXOTH); /* executable by none */ - - if (getuid() == (uid_t) 0) /* read by group/other */ - mode |= S_IRGRP | S_IROTH; - - if (fchmod (fileno(out), mode) != 0) - { - char *buf = (char *) malloc(1024 + strlen(name)); - sprintf (buf, "%s: error fchmodding \"%s\" to 0%o", blurb(), - tmp_name, (unsigned int) mode); - perror(buf); - free(buf); - goto END; - } - } - - /* Kludge, since these aren't in the saver_preferences struct... */ - visual_name = get_string_resource (dpy, "visualID", "VisualID"); - programs = 0; - overlay_stderr_p = get_boolean_resource (dpy, "overlayStderr", "Boolean"); - stderr_font = get_string_resource (dpy, "font", "Font"); - - i = 0; - { - char *ss; - char **hack_strings = (char **) - calloc (p->screenhacks_count, sizeof(char *)); - - for (j = 0; j < p->screenhacks_count; j++) - { - hack_strings[j] = format_hack (dpy, p->screenhacks[j], True); - i += strlen (hack_strings[j]); - i += 2; - } - - ss = programs = (char *) malloc(i + 10); - *ss = 0; - for (j = 0; j < p->screenhacks_count; j++) - { - strcat (ss, hack_strings[j]); - free (hack_strings[j]); - ss += strlen(ss); - *ss++ = '\n'; - *ss = 0; - } - free (hack_strings); - } - - { - struct passwd *pw = getpwuid (getuid ()); - char *whoami = (pw && pw->pw_name && *pw->pw_name - ? pw->pw_name - : ""); - time_t now = time ((time_t *) 0); - char *timestr = (char *) ctime (&now); - char *nl = (char *) strchr (timestr, '\n'); - if (nl) *nl = 0; - fprintf (out, - "# %s Preferences File\n" - "# Written by %s %s for %s on %s.\n" - "# https://www.jwz.org/xscreensaver/\n" - "\n", - progclass, progname, version_string, whoami, timestr); - } - - for (j = 0; prefs[j]; j++) - { - char buf[255]; - const char *pr = prefs[j]; - enum pref_type { pref_str, pref_int, pref_bool, pref_byte, pref_time - } type = pref_str; - const char *s = 0; - int i = 0; - Bool b = False; - Time t = 0; - - if (pr && !*pr) - { - fprintf(out, "\n"); - continue; - } - -# undef CHECK -# define CHECK(X) else if (!strcmp(pr, X)) - if (!pr || !*pr) ; - CHECK("timeout") type = pref_time, t = p->timeout; - CHECK("cycle") type = pref_time, t = p->cycle; - CHECK("lock") type = pref_bool, b = p->lock_p; - CHECK("lockVTs") continue; /* don't save, unused */ - CHECK("lockTimeout") type = pref_time, t = p->lock_timeout; - CHECK("passwdTimeout") type = pref_time, t = p->passwd_timeout; - CHECK("visualID") type = pref_str, s = visual_name; - CHECK("installColormap") type = pref_bool, b = p->install_cmap_p; - CHECK("verbose") type = pref_bool, b = p->verbose_p; - CHECK("timestamp") type = pref_bool, b = p->timestamp_p; - CHECK("splash") type = pref_bool, b = p->splash_p; - CHECK("splashDuration") type = pref_time, t = p->splash_duration; -# ifdef QUAD_MODE - CHECK("quad") type = pref_bool, b = p->quad_p; -# else /* !QUAD_MODE */ - CHECK("quad") continue; /* don't save */ -# endif /* !QUAD_MODE */ - CHECK("demoCommand") type = pref_str, s = p->demo_command; - CHECK("prefsCommand") type = pref_str, s = p->prefs_command; -/* CHECK("helpURL") type = pref_str, s = p->help_url; */ - CHECK("helpURL") continue; /* don't save */ -/* CHECK("loadURL") type = pref_str, s = p->load_url_command; */ - CHECK("loadURL") continue; /* don't save */ -/* CHECK("newLoginCommand") type = pref_str, s = p->new_login_command; */ - CHECK("newLoginCommand") continue; /* don't save */ - CHECK("nice") type = pref_int, i = p->nice_inferior; - CHECK("memoryLimit") type = pref_byte, i = p->inferior_memory_limit; - CHECK("fade") type = pref_bool, b = p->fade_p; - CHECK("unfade") type = pref_bool, b = p->unfade_p; - CHECK("fadeSeconds") type = pref_time, t = p->fade_seconds; - CHECK("fadeTicks") type = pref_int, i = p->fade_ticks; - CHECK("captureStderr") type = pref_bool, b = p->capture_stderr_p; - CHECK("captureStdout") continue; /* don't save */ - CHECK("logFile") continue; /* don't save */ - CHECK("ignoreUninstalledPrograms") - type = pref_bool, b = p->ignore_uninstalled_p; - - CHECK("font") type = pref_str, s = stderr_font; - - CHECK("dpmsEnabled") type = pref_bool, b = p->dpms_enabled_p; - CHECK("dpmsQuickOff") type = pref_bool, b = p->dpms_quickoff_p; - CHECK("dpmsStandby") type = pref_time, t = p->dpms_standby; - CHECK("dpmsSuspend") type = pref_time, t = p->dpms_suspend; - CHECK("dpmsOff") type = pref_time, t = p->dpms_off; - - CHECK("grabDesktopImages") type =pref_bool, b = p->grab_desktop_p; - CHECK("grabVideoFrames") type =pref_bool, b = p->grab_video_p; - CHECK("chooseRandomImages")type =pref_bool, b = p->random_image_p; - CHECK("imageDirectory") type =pref_str, s = p->image_directory; - - CHECK("mode") type = pref_str, - s = (p->mode == ONE_HACK ? "one" : - p->mode == BLANK_ONLY ? "blank" : - p->mode == DONT_BLANK ? "off" : - p->mode == RANDOM_HACKS_SAME - ? "random-same" - : "random"); - CHECK("selected") type = pref_int, i = p->selected_hack; - - CHECK("textMode") type = pref_str, - s = (p->tmode == TEXT_URL ? "url" : - p->tmode == TEXT_LITERAL ? "literal" : - p->tmode == TEXT_FILE ? "file" : - p->tmode == TEXT_PROGRAM ? "program" : - "date"); - CHECK("textLiteral") type = pref_str, s = p->text_literal; - CHECK("textFile") type = pref_str, s = p->text_file; - CHECK("textProgram") type = pref_str, s = p->text_program; - CHECK("textURL") type = pref_str, s = p->text_url; - - CHECK("programs") type = pref_str, s = programs; - CHECK("pointerPollTime") type = pref_time, t = p->pointer_timeout; - CHECK("pointerHysteresis")type = pref_int, i = p->pointer_hysteresis; - CHECK("windowCreationTimeout")type=pref_time,t= p->notice_events_timeout; - CHECK("initialDelay") type = pref_time, t = p->initial_delay; - CHECK("sgiSaverExtension") continue; /* don't save */ - CHECK("mitSaverExtension") continue; /* don't save */ - CHECK("xidleExtension") continue; /* don't save */ - CHECK("procInterrupts") type = pref_bool, b = p->use_proc_interrupts; - CHECK("xinputExtensionDev") type = pref_bool, b = p->use_xinput_extension; - CHECK("GetViewPortIsFullOfLies") type = pref_bool, - b = p->getviewport_full_of_lies_p; - CHECK("overlayStderr") type = pref_bool, b = overlay_stderr_p; - CHECK("overlayTextBackground") continue; /* don't save */ - CHECK("overlayTextForeground") continue; /* don't save */ - CHECK("bourneShell") continue; /* don't save */ - CHECK("authWarningSlack") type = pref_int, i = p->auth_warning_slack; - else abort(); -# undef CHECK - - switch (type) - { - case pref_str: - break; - case pref_int: - sprintf(buf, "%d", i); - s = buf; - break; - case pref_bool: - s = b ? "True" : "False"; - break; - case pref_time: - { - unsigned int hour = 0, min = 0, sec = (unsigned int) (t/1000); - if (sec >= 60) - { - min += (sec / 60); - sec %= 60; - } - if (min >= 60) - { - hour += (min / 60); - min %= 60; - } - sprintf (buf, "%u:%02u:%02u", hour, min, sec); - s = buf; - } - break; - case pref_byte: - { - if (i >= (1<<30) && i == ((i >> 30) << 30)) - sprintf(buf, "%dG", i >> 30); - else if (i >= (1<<20) && i == ((i >> 20) << 20)) - sprintf(buf, "%dM", i >> 20); - else if (i >= (1<<10) && i == ((i >> 10) << 10)) - sprintf(buf, "%dK", i >> 10); - else - sprintf(buf, "%d", i); - s = buf; - } - break; - default: - abort(); - break; - } - - if (pr && (!strcmp(pr, "mode") || !strcmp(pr, "textMode"))) - fprintf(out, "\n"); - - write_entry (out, pr, s); - } - - fprintf(out, "\n"); - - if (visual_name) free(visual_name); - if (stderr_font) free(stderr_font); - if (programs) free(programs); - - if (fclose(out) == 0) - { - time_t write_date = 0; - - if (stat(tmp_name, &st) == 0) - { - write_date = st.st_mtime; - } - else - { - char *buf = (char *) malloc(1024 + strlen(tmp_name) + strlen(name)); - sprintf(buf, "%s: couldn't stat \"%s\"", blurb(), tmp_name); - perror(buf); - unlink (tmp_name); - free(buf); - goto END; - } - - if (rename (tmp_name, name) != 0) - { - char *buf = (char *) malloc(1024 + strlen(tmp_name) + strlen(name)); - sprintf(buf, "%s: error renaming \"%s\" to \"%s\"", - blurb(), tmp_name, name); - perror(buf); - unlink (tmp_name); - free(buf); - goto END; - } - else - { - p->init_file_date = write_date; - - /* Since the .xscreensaver file is used for IPC, let's try and make - sure that the bits actually land on the disk right away. */ - sync (); - - status = 0; /* wrote and renamed successfully! */ - } - } - else - { - char *buf = (char *) malloc(1024 + strlen(name)); - sprintf(buf, "%s: error closing \"%s\"", blurb(), name); - perror(buf); - free(buf); - unlink (tmp_name); - goto END; - } - - END: - if (n2) free (n2); - return status; -} - - -/* Parsing the resource database - */ - -void -free_screenhack (screenhack *hack) -{ - if (hack->visual) free (hack->visual); - if (hack->name) free (hack->name); - free (hack->command); - memset (hack, 0, sizeof(*hack)); - free (hack); -} - -static void -free_screenhack_list (screenhack **list, int count) -{ - int i; - if (!list) return; - for (i = 0; i < count; i++) - if (list[i]) - free_screenhack (list[i]); - free (list); -} - - - -/* Populate `saver_preferences' with the contents of the resource database. - Note that this may be called multiple times -- it is re-run each time - the ~/.xscreensaver file is reloaded. - - This function can be very noisy, since it issues resource syntax errors - and so on. - */ -void -load_init_file (Display *dpy, saver_preferences *p) -{ - static Bool first_time = True; - - screenhack **system_default_screenhacks = 0; - int system_default_screenhack_count = 0; - - if (first_time) - { - /* Get the programs resource before the .xscreensaver file has been - parsed and merged into the resource database for the first time: - this is the value of *programs from the app-defaults file. - Then clear it out so that it will be parsed again later, after - the init file has been read. - */ - get_screenhacks (dpy, p); - system_default_screenhacks = p->screenhacks; - system_default_screenhack_count = p->screenhacks_count; - p->screenhacks = 0; - p->screenhacks_count = 0; - } - - if (parse_init_file (p) != 0) /* file might have gone away */ - if (!first_time) return; - - first_time = False; - - p->xsync_p = get_boolean_resource (dpy, "synchronous", "Synchronous"); - p->verbose_p = get_boolean_resource (dpy, "verbose", "Boolean"); - p->timestamp_p = get_boolean_resource (dpy, "timestamp", "Boolean"); - p->lock_p = get_boolean_resource (dpy, "lock", "Boolean"); - p->fade_p = get_boolean_resource (dpy, "fade", "Boolean"); - p->unfade_p = get_boolean_resource (dpy, "unfade", "Boolean"); - p->fade_seconds = 1000 * get_seconds_resource (dpy, "fadeSeconds", "Time"); - p->fade_ticks = get_integer_resource (dpy, "fadeTicks", "Integer"); - p->install_cmap_p = get_boolean_resource (dpy, "installColormap", "Boolean"); - p->nice_inferior = get_integer_resource (dpy, "nice", "Nice"); - p->inferior_memory_limit = get_byte_resource (dpy, "memoryLimit", - "MemoryLimit"); - p->splash_p = get_boolean_resource (dpy, "splash", "Boolean"); -# ifdef QUAD_MODE - p->quad_p = get_boolean_resource (dpy, "quad", "Boolean"); -# endif - p->capture_stderr_p = get_boolean_resource (dpy, "captureStderr", "Boolean"); - p->ignore_uninstalled_p = get_boolean_resource (dpy, - "ignoreUninstalledPrograms", - "Boolean"); - - p->initial_delay = 1000 * get_seconds_resource (dpy, "initialDelay", "Time"); - p->splash_duration = 1000 * get_seconds_resource (dpy, "splashDuration", "Time"); - p->timeout = 1000 * get_minutes_resource (dpy, "timeout", "Time"); - p->lock_timeout = 1000 * get_minutes_resource (dpy, "lockTimeout", "Time"); - p->cycle = 1000 * get_minutes_resource (dpy, "cycle", "Time"); - p->passwd_timeout = 1000 * get_seconds_resource (dpy, "passwdTimeout", "Time"); - p->pointer_timeout = 1000 * get_seconds_resource (dpy, "pointerPollTime", "Time"); - p->pointer_hysteresis = get_integer_resource (dpy, "pointerHysteresis","Integer"); - p->notice_events_timeout = 1000*get_seconds_resource(dpy, - "windowCreationTimeout", - "Time"); - - p->dpms_enabled_p = get_boolean_resource (dpy, "dpmsEnabled", "Boolean"); - p->dpms_quickoff_p = get_boolean_resource (dpy, "dpmsQuickOff", "Boolean"); - p->dpms_standby = 1000 * get_minutes_resource (dpy, "dpmsStandby", "Time"); - p->dpms_suspend = 1000 * get_minutes_resource (dpy, "dpmsSuspend", "Time"); - p->dpms_off = 1000 * get_minutes_resource (dpy, "dpmsOff", "Time"); - - p->grab_desktop_p = get_boolean_resource (dpy, "grabDesktopImages", "Boolean"); - p->grab_video_p = get_boolean_resource (dpy, "grabVideoFrames", "Boolean"); - p->random_image_p = get_boolean_resource (dpy, "chooseRandomImages", "Boolean"); - p->image_directory = get_string_resource (dpy, - "imageDirectory", - "ImageDirectory"); - - p->text_literal = get_string_resource (dpy, "textLiteral", "TextLiteral"); - p->text_file = get_string_resource (dpy, "textFile", "TextFile"); - p->text_program = get_string_resource (dpy, "textProgram", "TextProgram"); - p->text_url = get_string_resource (dpy, "textURL", "TextURL"); - - p->shell = get_string_resource (dpy, "bourneShell", "BourneShell"); - - p->demo_command = get_string_resource(dpy, "demoCommand", "URL"); - p->prefs_command = get_string_resource(dpy, "prefsCommand", "URL"); - p->help_url = get_string_resource(dpy, "helpURL", "URL"); - p->load_url_command = get_string_resource(dpy, "loadURL", "LoadURL"); - p->new_login_command = get_string_resource(dpy, - "newLoginCommand", - "NewLoginCommand"); - p->auth_warning_slack = get_integer_resource(dpy, "authWarningSlack", - "Integer"); - - /* If "*splash" is unset, default to true. */ - { - char *s = get_string_resource (dpy, "splash", "Boolean"); - if (s) - free (s); - else - p->splash_p = True; - } - - /* If "*grabDesktopImages" is unset, default to true. */ - { - char *s = get_string_resource (dpy, "grabDesktopImages", "Boolean"); - if (s) - free (s); - else - p->grab_desktop_p = True; - } - - p->use_xidle_extension = get_boolean_resource (dpy, "xidleExtension","Boolean"); -#if 0 /* obsolete. */ - p->use_sgi_saver_extension = get_boolean_resource (dpy, - "sgiSaverExtension", - "Boolean"); -#endif -#ifdef HAVE_XINPUT - p->use_xinput_extension = get_boolean_resource (dpy, "xinputExtensionDev", - "Boolean"); -#endif -#if 0 /* broken and evil. */ - p->use_mit_saver_extension = get_boolean_resource (dpy, - "mitSaverExtension", - "Boolean"); -#endif - - p->use_proc_interrupts = get_boolean_resource (dpy, - "procInterrupts", "Boolean"); - - p->getviewport_full_of_lies_p = - get_boolean_resource (dpy, "GetViewPortIsFullOfLies", "Boolean"); - - get_screenhacks (dpy, p); /* Parse the "programs" resource. */ - - { - char *s = get_string_resource (dpy, "selected", "Integer"); - if (!s || !*s) - p->selected_hack = -1; - else - p->selected_hack = get_integer_resource (dpy, "selected", "Integer"); - if (s) free (s); - if (p->selected_hack < 0 || p->selected_hack >= p->screenhacks_count) - p->selected_hack = -1; - } - - { - char *s = get_string_resource (dpy, "mode", "Mode"); - if (s && !strcasecmp (s, "one")) p->mode = ONE_HACK; - else if (s && !strcasecmp (s, "blank")) p->mode = BLANK_ONLY; - else if (s && !strcasecmp (s, "off")) p->mode = DONT_BLANK; - else if (s && !strcasecmp (s, "random-same")) p->mode = RANDOM_HACKS_SAME; - else p->mode = RANDOM_HACKS; - if (s) free (s); - } - - { - char *s = get_string_resource (dpy, "textMode", "TextMode"); - if (s && !strcasecmp (s, "url")) p->tmode = TEXT_URL; - else if (s && !strcasecmp (s, "literal")) p->tmode = TEXT_LITERAL; - else if (s && !strcasecmp (s, "file")) p->tmode = TEXT_FILE; - else if (s && !strcasecmp (s, "program")) p->tmode = TEXT_PROGRAM; - else p->tmode = TEXT_DATE; - if (s) free (s); - } - - if (system_default_screenhack_count) /* note: first_time is also true */ - { - merge_system_screenhacks (dpy, p, system_default_screenhacks, - system_default_screenhack_count); - free_screenhack_list (system_default_screenhacks, - system_default_screenhack_count); - system_default_screenhacks = 0; - system_default_screenhack_count = 0; - } - - if (p->debug_p) - { - p->xsync_p = True; - p->verbose_p = True; - p->timestamp_p = True; - p->initial_delay = 0; - } - - /* Throttle the various timeouts to reasonable values after reading the - disk file. */ - stop_the_insanity (p); -} - - -/* If there are any hacks in the system-wide defaults that are not in - the ~/.xscreensaver file, add the new ones to the end of the list. - This does *not* actually save the file. - */ -static void -merge_system_screenhacks (Display *dpy, saver_preferences *p, - screenhack **system_list, int system_count) -{ - /* Yeah yeah, this is an N^2 operation, but I don't have hashtables handy, - so fuck it. */ - - int made_space = 0; - int i; - for (i = 0; i < system_count; i++) - { - int j; - Bool matched_p = False; - - for (j = 0; j < p->screenhacks_count; j++) - { - char *name; - if (!system_list[i]->name) - system_list[i]->name = make_hack_name (dpy, - system_list[i]->command); - - name = p->screenhacks[j]->name; - if (!name) - name = make_hack_name (dpy, p->screenhacks[j]->command); - - matched_p = !strcasecmp (name, system_list[i]->name); - - if (name != p->screenhacks[j]->name) - free (name); - - if (matched_p) - break; - } - - if (!matched_p) - { - /* We have an entry in the system-wide list that is not in the - user's .xscreensaver file. Add it to the end. - Note that p->screenhacks is a single malloc block, not a - linked list, so we have to realloc it. - */ - screenhack *oh = system_list[i]; - screenhack *nh = (screenhack *) malloc (sizeof(screenhack)); - - if (made_space == 0) - { - made_space = 10; - p->screenhacks = (screenhack **) - realloc (p->screenhacks, - (p->screenhacks_count + made_space + 1) - * sizeof(screenhack)); - if (!p->screenhacks) abort(); - } - - nh->enabled_p = oh->enabled_p; - nh->visual = oh->visual ? strdup(oh->visual) : 0; - nh->name = oh->name ? strdup(oh->name) : 0; - nh->command = oh->command ? strdup(oh->command) : 0; - - p->screenhacks[p->screenhacks_count++] = nh; - p->screenhacks[p->screenhacks_count] = 0; - made_space--; - -#if 0 - fprintf (stderr, "%s: noticed new hack: %s\n", blurb(), - (nh->name ? nh->name : make_hack_name (dpy, nh->command))); -#endif - } - } -} - - - -/* Parsing the programs resource. - */ - -screenhack * -parse_screenhack (const char *line) -{ - screenhack *h = (screenhack *) calloc (1, sizeof(*h)); - const char *s; - - h->enabled_p = True; - - while (isspace(*line)) line++; /* skip whitespace */ - if (*line == '-') /* handle "-" */ - { - h->enabled_p = False; - line++; - while (isspace(*line)) line++; /* skip whitespace */ - } - - s = line; /* handle "visual:" */ - while (*line && *line != ':' && *line != '"' && !isspace(*line)) - line++; - if (*line != ':') - line = s; - else - { - h->visual = (char *) malloc (line-s+1); - strncpy (h->visual, s, line-s); - h->visual[line-s] = 0; - if (*line == ':') line++; /* skip ":" */ - while (isspace(*line)) line++; /* skip whitespace */ - } - - if (*line == '"') /* handle "name" */ - { - line++; - s = line; - while (*line && *line != '"') - line++; - h->name = (char *) malloc (line-s+1); - strncpy (h->name, s, line-s); - h->name[line-s] = 0; - if (*line == '"') line++; /* skip "\"" */ - while (isspace(*line)) line++; /* skip whitespace */ - } - - h->command = format_command (line, False); /* handle command */ - return h; -} - - -static char * -format_command (const char *cmd, Bool wrap_p) -{ - int tab = 30; - int col = tab; - char *cmd2 = (char *) calloc (1, 2 * (strlen (cmd) + 1)); - const char *in = cmd; - char *out = cmd2; - while (*in) - { - /* shrink all whitespace to one space, for the benefit of the "demo" - mode display. We only do this when we can easily tell that the - whitespace is not significant (no shell metachars). - */ - switch (*in) - { - case '\'': case '"': case '`': case '\\': - /* Metachars are scary. Copy the rest of the line unchanged. */ - while (*in) - *out++ = *in++, col++; - break; - - case ' ': case '\t': - /* Squeeze all other whitespace down to one space. */ - while (*in == ' ' || *in == '\t') - in++; - *out++ = ' ', col++; - break; - - default: - /* Copy other chars unchanged. */ - *out++ = *in++, col++; - break; - } - } - - *out = 0; - - /* Strip trailing whitespace */ - while (out > cmd2 && isspace (out[-1])) - *(--out) = 0; - - return cmd2; -} - - -/* Returns a new string describing the shell command. - This may be just the name of the program, capitalized. - It also may be something from the resource database (gotten - by looking for "hacks.XYZ.name", where XYZ is the program.) - */ -char * -make_hack_name (Display *dpy, const char *shell_command) -{ - char *s = strdup (shell_command); - char *s2; - char res_name[255]; - - for (s2 = s; *s2; s2++) /* truncate at first whitespace */ - if (isspace (*s2)) - { - *s2 = 0; - break; - } - - s2 = strrchr (s, '/'); /* if pathname, take last component */ - if (s2) - { - s2 = strdup (s2+1); - free (s); - s = s2; - } - - if (strlen (s) > 50) /* 51 is hereby defined as "unreasonable" */ - s[50] = 0; - - sprintf (res_name, "hacks.%s.name", s); /* resource? */ - s2 = get_string_resource (dpy, res_name, res_name); - if (s2) - { - free (s); - return s2; - } - - for (s2 = s; *s2; s2++) /* if it has any capitals, return it */ - if (*s2 >= 'A' && *s2 <= 'Z') - return s; - - if (s[0] >= 'a' && s[0] <= 'z') /* else cap it */ - s[0] -= 'a'-'A'; - if (s[0] == 'X' && s[1] >= 'a' && s[1] <= 'z') /* (magic leading X) */ - s[1] -= 'a'-'A'; - if (s[0] == 'G' && s[1] == 'l' && - s[2] >= 'a' && s[2] <= 'z') /* (magic leading GL) */ - s[1] -= 'a'-'A', - s[2] -= 'a'-'A'; - return s; -} - - -char * -format_hack (Display *dpy, screenhack *hack, Bool wrap_p) -{ - int tab = 32; - int size; - char *h2, *out, *s; - int col = 0; - - char *def_name = make_hack_name (dpy, hack->command); - - /* Don't ever write out a name for a hack if it's the same as the default. - */ - if (hack->name && !strcmp (hack->name, def_name)) - { - free (hack->name); - hack->name = 0; - } - free (def_name); - - size = (2 * (strlen(hack->command) + - (hack->visual ? strlen(hack->visual) : 0) + - (hack->name ? strlen(hack->name) : 0) + - tab)); - h2 = (char *) malloc (size); - out = h2; - - if (!hack->enabled_p) *out++ = '-'; /* write disabled flag */ - - if (hack->visual && *hack->visual) /* write visual name */ - { - if (hack->enabled_p) *out++ = ' '; - *out++ = ' '; - strcpy (out, hack->visual); - out += strlen (hack->visual); - *out++ = ':'; - *out++ = ' '; - } - - *out = 0; - col = string_columns (h2, strlen (h2), 0); - - if (hack->name && *hack->name) /* write pretty name */ - { - int L = (strlen (hack->name) + 2); - if (L + col < tab) - out = stab_to (out, col, tab - L - 2); - else - *out++ = ' '; - *out++ = '"'; - strcpy (out, hack->name); - out += strlen (hack->name); - *out++ = '"'; - *out = 0; - - col = string_columns (h2, strlen (h2), 0); - if (wrap_p && col >= tab) - out = stab_to (out, col, 77); - else - *out++ = ' '; - - if (out >= h2+size) abort(); - } - - *out = 0; - col = string_columns (h2, strlen (h2), 0); - out = stab_to (out, col, tab); /* indent */ - - if (out >= h2+size) abort(); - s = format_command (hack->command, wrap_p); - strcpy (out, s); - out += strlen (s); - free (s); - *out = 0; - - return h2; -} - - -static void -get_screenhacks (Display *dpy, saver_preferences *p) -{ - int i, j; - int start = 0; - int end = 0; - int size; - char *d; - - d = get_string_resource (dpy, "monoPrograms", "MonoPrograms"); - if (d && !*d) { free(d); d = 0; } - if (!d) - d = get_string_resource (dpy, "colorPrograms", "ColorPrograms"); - if (d && !*d) { free(d); d = 0; } - - if (d) - { - fprintf (stderr, - "%s: the `monoPrograms' and `colorPrograms' resources are obsolete;\n\ - see the manual for details.\n", blurb()); - free(d); - } - - d = get_string_resource (dpy, "programs", "Programs"); - - free_screenhack_list (p->screenhacks, p->screenhacks_count); - p->screenhacks = 0; - p->screenhacks_count = 0; - - if (!d || !*d) - return; - - size = strlen (d); - - - /* Count up the number of newlines (which will be equal to or larger than - one less than the number of hacks.) - */ - for (i = j = 0; d[i]; i++) - if (d[i] == '\n') - j++; - j++; - - p->screenhacks = (screenhack **) calloc (j + 1, sizeof (screenhack *)); - - /* Iterate over the lines in `d' (the string with newlines) - and make new strings to stuff into the `screenhacks' array. - */ - p->screenhacks_count = 0; - while (start < size) - { - /* skip forward over whitespace. */ - while (d[start] == ' ' || d[start] == '\t' || d[start] == '\n') - start++; - - /* skip forward to newline or end of string. */ - end = start; - while (d[end] != 0 && d[end] != '\n') - end++; - - /* null terminate. */ - d[end] = 0; - - p->screenhacks[p->screenhacks_count++] = parse_screenhack (d + start); - if (p->screenhacks_count >= i) - abort(); - - start = end+1; - } - - free (d); - - if (p->screenhacks_count == 0) - { - free (p->screenhacks); - p->screenhacks = 0; - } -} - - -/* Make sure all the values in the preferences struct are sane. - */ -static void -stop_the_insanity (saver_preferences *p) -{ - if (p->passwd_timeout <= 0) p->passwd_timeout = 30000; /* 30 secs */ - if (p->timeout < 15000) p->timeout = 15000; /* 15 secs */ - if (p->cycle != 0 && p->cycle < 2000) p->cycle = 2000; /* 2 secs */ - if (p->pointer_timeout <= 0) p->pointer_timeout = 5000; /* 5 secs */ - if (p->notice_events_timeout <= 0) - p->notice_events_timeout = 10000; /* 10 secs */ - if (p->fade_seconds <= 0 || p->fade_ticks <= 0) - p->fade_p = False; - if (! p->fade_p) p->unfade_p = False; - - /* The DPMS settings may have the value 0. - But if they are negative, or are a range less than 10 seconds, - reset them to sensible defaults. (Since that must be a mistake.) - */ - if (p->dpms_standby != 0 && - p->dpms_standby < 10 * 1000) - p->dpms_standby = 2 * 60 * 60 * 1000; /* 2 hours */ - if (p->dpms_suspend != 0 && - p->dpms_suspend < 10 * 1000) - p->dpms_suspend = 2 * 60 * 60 * 1000; /* 2 hours */ - if (p->dpms_off != 0 && - p->dpms_off < 10 * 1000) - p->dpms_off = 4 * 60 * 60 * 1000; /* 4 hours */ - - /* suspend may not be greater than off, unless off is 0. - standby may not be greater than suspend, unless suspend is 0. - */ - if (p->dpms_off != 0 && - p->dpms_suspend > p->dpms_off) - p->dpms_suspend = p->dpms_off; - if (p->dpms_suspend != 0 && - p->dpms_standby > p->dpms_suspend) - p->dpms_standby = p->dpms_suspend; - - /* These fixes above ignores the case - suspend = 0 and standby > off ... - */ - if (p->dpms_off != 0 && - p->dpms_standby > p->dpms_off) - p->dpms_standby = p->dpms_off; - - - if (p->dpms_standby == 0 && /* if *all* are 0, then DPMS is disabled */ - p->dpms_suspend == 0 && - p->dpms_off == 0 && - !(p->dpms_quickoff_p) /* ... but we want to do DPMS quick off */ - ) - p->dpms_enabled_p = False; - - - /* Set watchdog timeout to about half of the cycle timeout, but - don't let it be faster than 1/2 minute or slower than 1 minute. - */ - p->watchdog_timeout = p->cycle * 0.6; - if (p->watchdog_timeout < 27000) p->watchdog_timeout = 27000; /* 27 secs */ - if (p->watchdog_timeout > 57000) p->watchdog_timeout = 57000; /* 57 secs */ - - if (p->pointer_hysteresis < 0) p->pointer_hysteresis = 0; -/* if (p->pointer_hysteresis > 100) p->pointer_hysteresis = 100; */ - - if (p->auth_warning_slack < 0) p->auth_warning_slack = 0; - if (p->auth_warning_slack > 300) p->auth_warning_slack = 300; -} - - -Bool -senesculent_p (void) -{ - /* If you are in here because you're planning on disabling this warning - before redistributing my software, please don't. - - I sincerely request that you do one of the following: - - 1: leave this code intact and this warning in place, -OR- - - 2: Remove xscreensaver from your distribution. - - I would seriously prefer that you not distribute my software at all - than that you distribute one version and then never update it for - years. - - I am *constantly* getting email from users reporting bugs that have - been fixed for literally years who have no idea that the software - they are running is years out of date. Yes, it would be great if we - lived in the ideal world where people checked that they were running - the latest release before they report a bug, but we don't. To most - people, "running the latest release" is synonymous with "running the - latest release that my distro packages for me." - - When they even bother to tell me what version they're running, I - say, "That version is three years old!", and they say "But this is - the latest version my distro ships". Then I say, "your distro - sucks", and they say "but I don't know how to compile from source, - herp derp I eat paste", and *everybody* goes away unhappy. - - It wastes an enormous amount of my time, but worse than that, it - does a grave disservice to the users, who are stuck experiencing - bugs that are already fixed! These users think they are running the - latest release, and they are not. They would like to be running the - actual latest release, but they don't know how, because their distro - makes that very difficult for them. It's terrible for everyone, and - kind of makes me regret ever having released this software in the - first place. - - So seriously. I ask that if you're planning on disabling this - obsolescence warning, that you instead just remove xscreensaver from - your distro entirely. Everybody will be happier that way. Check - out gnome-screensaver instead, I understand it's really nice. - - Of course, my license allows you to ignore me and do whatever the - fuck you want, but as the author, I hope you will have the common - courtesy of complying with my request. - - Thank you! - - jwz, 2014, 2016, 2018. - - PS: In particular, since Debian refuses to upgrade software on any - kind of rational timeline, I have asked that they stop shipping - xscreensaver at all. They have refused. Instead of upgrading the - software, they simply patched out this warning. - - If you want to witness the sad state of the open source peanut - gallery, look no farther than the comments on my blog: - http://jwz.org/b/yiYo - - Many of these people fall back on their go-to argument of, "If it is - legal, it must be right." If you believe in that rhetorical device - then you are a terrible person, and possibly a sociopath. - - There are also the armchair lawyers who say "Well, instead of - *asking* people to do the right thing out of common courtesy, you - should just change your license to prohibit them from acting - amorally." Again, this is the answer of a sociopath, but that aside, - if you devote even a second's thought to this you will realize that - the end result of this would be for distros like Debian to just keep - shipping the last version with the old license and then never - upgrading it again -- which would be the worst possible outcome for - everyone involved, most especially the users. - */ - time_t now = time ((time_t *) 0); /* d */ - struct tm *tm = localtime (&now); /* o */ - const char *s = screensaver_id; /* n */ - char mon[4], year[5]; /* ' */ - int m, y, mrnths; /* t */ - s = strchr (s, ' '); if (!s) abort(); s++; /* */ - s = strchr (s, '('); if (!s) abort(); s++; /* d */ - s = strchr (s, '-'); if (!s) abort(); s++; /* o */ - strncpy (mon, s, 3); /* o */ - mon[3] = 0; /* */ - s = strchr (s, '-'); if (!s) abort(); s++; /* e */ - strncpy (year, s, 4); /* e */ - year[4] = 0; /* t */ - y = atoi (year); /* , */ - if (!strcmp(mon, "Jan")) m = 0; /* */ - else if (!strcmp(mon, "Feb")) m = 1; /* s */ - else if (!strcmp(mon, "Mar")) m = 2; /* t */ - else if (!strcmp(mon, "Apr")) m = 3; /* o */ - else if (!strcmp(mon, "May")) m = 4; /* p */ - else if (!strcmp(mon, "Jun")) m = 5; /* , */ - else if (!strcmp(mon, "Jul")) m = 6; /* */ - else if (!strcmp(mon, "Aug")) m = 7; /* s */ - else if (!strcmp(mon, "Sep")) m = 8; /* t */ - else if (!strcmp(mon, "Oct")) m = 9; /* a */ - else if (!strcmp(mon, "Nov")) m = 10; /* a */ - else if (!strcmp(mon, "Dec")) m = 11; /* a */ - else abort(); /* h */ - mrnths = ((((tm->tm_year + 1900) * 12) + tm->tm_mon) - /* h */ - (y * 12 + m)); /* h */ - /* p */ - return (mrnths >= 17); /* . */ + FAIL: + if (buf) free (buf); + return -1; } diff --git a/driver/prefs.h b/driver/prefs.h index cd1016d..14d5542 100644 --- a/driver/prefs.h +++ b/driver/prefs.h @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1993-2018 Jamie Zawinski +/* xscreensaver, Copyright © 1993-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -12,26 +12,10 @@ #ifndef __XSCREENSAVER_PREFS_H__ #define __XSCREENSAVER_PREFS_H__ -#include "types.h" - -extern void load_init_file (Display *, saver_preferences *); -extern Bool init_file_changed_p (saver_preferences *); -extern int write_init_file (Display *, - saver_preferences *, const char *version_string, - Bool verbose_p); -const char *init_file_name (void); -extern Bool senesculent_p (void); - -extern screenhack *parse_screenhack (const char *line); -extern void free_screenhack (screenhack *); -extern char *format_hack (Display *, screenhack *, Bool wrap_p); -char *make_hack_name (Display *, const char *shell_command); - -/* From dpms.c */ -extern void sync_server_dpms_settings (Display *, Bool enabled_p, - Bool dpms_quickoff_p, - int standby_secs, int suspend_secs, - int off_secs, - Bool verbose_p); +extern int parse_init_file (const char *name, + void (*handler) (int lineno, + const char *key, const char *val, + void *closure), + void *closure); #endif /* __XSCREENSAVER_PREFS_H__ */ diff --git a/driver/prefsw.c b/driver/prefsw.c new file mode 100644 index 0000000..2bbf94f --- /dev/null +++ b/driver/prefsw.c @@ -0,0 +1,1555 @@ +/* prefs.c --- reading and writing the ~/.xscreensaver file. + * xscreensaver, Copyright © 1998-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#ifdef HAVE_UNISTD_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include /* for PATH_MAX */ +#include + +#include +#include +#include + +#include "version.h" +#include "types.h" +#include "prefs.h" +#include "resources.h" +#include "blurb.h" + +/* don't use realpath() on fedora system */ +#ifdef _FORTIFY_SOURCE +# undef HAVE_REALPATH +#endif + + +extern char *progclass; + +static void get_screenhacks (Display *, saver_preferences *); +static char *format_command (const char *cmd, Bool wrap_p); +static void merge_system_screenhacks (Display *, saver_preferences *, + screenhack **system_list, int count); +static void stop_the_insanity (saver_preferences *p); + +static char *format_hack (Display *, screenhack *, Bool wrap_p); + +static char * +chase_symlinks (const char *file) +{ +# ifdef HAVE_REALPATH + if (file) + { +# ifndef PATH_MAX +# ifdef MAXPATHLEN +# define PATH_MAX MAXPATHLEN +# else +# define PATH_MAX 2048 +# endif +# endif + char buf[PATH_MAX]; + if (realpath (file, buf)) + return strdup (buf); + +/* sprintf (buf, "%.100s: realpath %.200s", blurb(), file); + perror(buf);*/ + } +# endif /* HAVE_REALPATH */ + return 0; +} + + +static Bool +i_am_a_nobody (uid_t uid) +{ + struct passwd *p; + + p = getpwnam ("nobody"); + if (! p) p = getpwnam ("noaccess"); + if (! p) p = getpwnam ("daemon"); + + if (! p) /* There is no nobody? */ + return False; + + return (uid == p->pw_uid); +} + + +const char * +init_file_name (void) +{ + static char *file = 0; + + if (!file) + { + uid_t uid = getuid (); + const char *home = getenv("HOME"); + + if (i_am_a_nobody (uid) || !home || !*home) + { + /* If we're running as nobody, then use root's .xscreensaver file + (since ~root/.xscreensaver and ~nobody/.xscreensaver are likely + to be different -- without this, xscreensaver-settings would + appear to have no effect when the luser is running as root.) + */ + struct passwd *p = getpwuid (uid); + if (!p || !p->pw_name || !*p->pw_name) + { + fprintf (stderr, "%s: couldn't get user info of uid %d\n", + blurb(), getuid ()); + } + else if (!p->pw_dir || !*p->pw_dir) + { + fprintf (stderr, "%s: couldn't get home directory of \"%s\"\n", + blurb(), (p->pw_name ? p->pw_name : "???")); + } + else + { + home = p->pw_dir; + } + } + if (home && *home) + { + const char *name = ".xscreensaver"; + file = (char *) malloc(strlen(home) + strlen(name) + 2); + strcpy(file, home); + if (!*home || home[strlen(home)-1] != '/') + strcat(file, "/"); + strcat(file, name); + } + else + { + file = ""; + } + } + + if (file && *file) + return file; + else + return 0; +} + + +static const char * +init_file_tmp_name (void) +{ + static char *file = 0; + if (!file) + { + const char *name = init_file_name(); + const char *suffix = ".tmp"; + + char *n2 = chase_symlinks (name); + if (n2) name = n2; + + if (!name || !*name) + file = ""; + else + { + file = (char *) malloc(strlen(name) + strlen(suffix) + 2); + strcpy(file, name); + strcat(file, suffix); + } + + if (n2) free (n2); + } + + if (file && *file) + return file; + else + return 0; +} + +static const char * const prefs[] = { + "timeout", + "cycle", + "lock", + "lockVTs", /* not saved */ + "lockTimeout", + "passwdTimeout", + "visualID", + "installColormap", + "verbose", + "splash", + "splashDuration", + "quad", + "demoCommand", + "prefsCommand", + "newLoginCommand", + "helpURL", /* not saved */ + "loadURL", /* not saved */ + "newLoginCommand", /* not saved */ + "nice", + "memoryLimit", /* not saved */ + "fade", + "unfade", + "fadeSeconds", + "fadeTicks", /* not saved */ + "logFile", /* not saved */ + "ignoreUninstalledPrograms", + "font", + "dpmsEnabled", + "dpmsQuickOff", + "dpmsStandby", + "dpmsSuspend", + "dpmsOff", + "grabDesktopImages", + "grabVideoFrames", + "chooseRandomImages", + "imageDirectory", + "mode", + "selected", + "textMode", + "textLiteral", + "textFile", + "textProgram", + "textURL", + "dialogTheme", + "", + "programs", + "", + "pointerHysteresis", + "bourneShell", /* not saved -- X resources only */ + "authWarningSlack", + 0 +}; + +static char * +strip (char *s) +{ + char *s2; + while (*s == '\t' || *s == ' ' || *s == '\r' || *s == '\n') + s++; + for (s2 = s; *s2; s2++) + ; + for (s2--; s2 >= s; s2--) + if (*s2 == '\t' || *s2 == ' ' || *s2 == '\r' || *s2 =='\n') + *s2 = 0; + else + break; + return s; +} + + +/* Reading + */ + +static int +handle_entry (XrmDatabase *db, const char *key, const char *value, + const char *filename, int line) +{ + int i; + for (i = 0; prefs[i]; i++) + if (*prefs[i] && !strcasecmp(key, prefs[i])) + { + char *val = strdup(value); + char *spec = (char *) malloc(strlen(progclass) + strlen(prefs[i]) +10); + strcpy(spec, progclass); + strcat(spec, "."); + strcat(spec, prefs[i]); + + XrmPutStringResource (db, spec, val); + + free(spec); + free(val); + return 0; + } + + /* fprintf(stderr, "%s: %s:%d: unknown option \"%s\"\n", + blurb(), filename, line, key); */ + return 1; +} + + +struct parser_closure { + const char *file; + saver_preferences *prefs; +}; + +static void line_handler (int lineno, + const char *key, const char *val, + void *closure) +{ + struct parser_closure *c = (struct parser_closure *) closure; + saver_preferences *p = c->prefs; + if (!p->db) abort(); + handle_entry (&p->db, key, val, c->file, lineno); +} + +static int +parse_init_file_1 (saver_preferences *p) +{ + time_t write_date = 0; + const char *name = init_file_name(); + struct parser_closure C; + struct stat st; + int status; + + if (!name) return 0; + + C.file = name; + C.prefs = p; + + if (stat(name, &st) == 0) + write_date = st.st_mtime; + else + { + p->init_file_date = 0; + return 0; + } + + status = parse_init_file (name, line_handler, &C); + + p->init_file_date = write_date; + return status; +} + + +Bool +init_file_changed_p (saver_preferences *p) +{ + const char *name = init_file_name(); + struct stat st; + + if (!name) return False; + + if (stat(name, &st) != 0) + return False; + + if (p->init_file_date == st.st_mtime) + return False; + + return True; +} + + +/* Writing + */ + +static int +tab_to (FILE *out, int from, int to) +{ + int tab_width = 8; + int to_mod = (to / tab_width) * tab_width; + while (from < to_mod) + { + fprintf(out, "\t"); + from = (((from / tab_width) + 1) * tab_width); + } + while (from < to) + { + fprintf(out, " "); + from++; + } + return from; +} + +static char * +stab_to (char *out, int from, int to) +{ + int tab_width = 8; + int to_mod = (to / tab_width) * tab_width; + while (from < to_mod) + { + *out++ = '\t'; + from = (((from / tab_width) + 1) * tab_width); + } + while (from < to) + { + *out++ = ' '; + from++; + } + return out; +} + +static int +string_columns (const char *string, int length, int start) +{ + int tab_width = 8; + int col = start; + const char *end = string + length; + while (string < end) + { + if (*string == '\n') + col = 0; + else if (*string == '\t') + col = (((col / tab_width) + 1) * tab_width); + else + col++; + string++; + } + return col; +} + + +static void +write_entry (FILE *out, const char *key, const char *value) +{ + char *v = strdup(value ? value : ""); + char *v2 = v; + char *nl = 0; + int col; + Bool programs_p = (!strcmp(key, "programs")); + int tab = (programs_p ? 32 : 16); + Bool first = True; + + fprintf(out, "%s:", key); + col = strlen(key) + 1; + + if (strlen(key) > 14) + col = tab_to (out, col, 20); + + while (1) + { + if (!programs_p) + v2 = strip(v2); + nl = strchr(v2, '\n'); + if (nl) + *nl = 0; + + if (first && programs_p) + { + col = tab_to (out, col, 77); + fprintf (out, " \\\n"); + col = 0; + } + + if (first) + first = False; + else + { + col = tab_to (out, col, 75); + fprintf (out, " \\n\\\n"); + col = 0; + } + + if (!programs_p) + col = tab_to (out, col, tab); + + if (programs_p && + string_columns(v2, strlen (v2), col) + col > 75) + { + int L = strlen (v2); + int start = 0; + int end = start; + while (start < L) + { + while (v2[end] == ' ' || v2[end] == '\t') + end++; + while (v2[end] != ' ' && v2[end] != '\t' && + v2[end] != '\n' && v2[end] != 0) + end++; + if (string_columns (v2 + start, (end - start), col) >= 74) + { + col = tab_to (out, col, 75); + fprintf(out, " \\\n"); + col = tab_to (out, 0, tab + 2); + while (v2[start] == ' ' || v2[start] == '\t') + start++; + } + + col = string_columns (v2 + start, (end - start), col); + while (start < end) + fputc(v2[start++], out); + } + } + else + { + fprintf (out, "%s", v2); + col += string_columns(v2, strlen (v2), col); + } + + if (nl) + v2 = nl + 1; + else + break; + } + + fprintf(out, "\n"); + free(v); +} + +int +write_init_file (Display *dpy, + saver_preferences *p, const char *version_string, + Bool verbose_p) +{ + int status = -1; + const char *name = init_file_name(); + const char *tmp_name = init_file_tmp_name(); + char *n2 = chase_symlinks (name); + struct stat st; + int i, j; + + /* Kludge, since these aren't in the saver_preferences struct as strings... + */ + char *visual_name; + char *programs; + Bool overlay_stderr_p; + char *stderr_font; + FILE *out; + + if (!name) goto END; + + if (n2) name = n2; + + /* Throttle the various timeouts to reasonable values before writing + the file to disk. */ + stop_the_insanity (p); + + + if (verbose_p) + fprintf (stderr, "%s: writing \"%s\"\n", blurb(), name); + + unlink (tmp_name); + out = fopen(tmp_name, "w"); + if (!out) + { + char *buf = (char *) malloc(1024 + strlen(name)); + sprintf(buf, "%s: error writing \"%s\"", blurb(), name); + perror(buf); + free(buf); + goto END; + } + + /* Give the new .xscreensaver file the same permissions as the old one; + except ensure that it is readable and writable by owner, and not + executable. Extra hack: if we're running as root, make the file + be world-readable (so that the daemon, running as "nobody", will + still be able to read it.) + */ + if (stat(name, &st) == 0) + { + mode_t mode = st.st_mode; + mode |= S_IRUSR | S_IWUSR; /* read/write by user */ + mode &= ~(S_IXUSR | S_IXGRP | S_IXOTH); /* executable by none */ + + if (getuid() == (uid_t) 0) /* read by group/other */ + mode |= S_IRGRP | S_IROTH; + + if (fchmod (fileno(out), mode) != 0) + { + char *buf = (char *) malloc(1024 + strlen(name)); + sprintf (buf, "%s: error fchmodding \"%s\" to 0%o", blurb(), + tmp_name, (unsigned int) mode); + perror(buf); + free(buf); + goto END; + } + } + + /* Kludge, since these aren't in the saver_preferences struct... */ + visual_name = get_string_resource (dpy, "visualID", "VisualID"); + programs = 0; + overlay_stderr_p = get_boolean_resource (dpy, "overlayStderr", "Boolean"); + stderr_font = get_string_resource (dpy, "font", "Font"); + + i = 0; + { + char *ss; + char **hack_strings = (char **) + calloc (p->screenhacks_count, sizeof(char *)); + + for (j = 0; j < p->screenhacks_count; j++) + { + hack_strings[j] = format_hack (dpy, p->screenhacks[j], True); + i += strlen (hack_strings[j]); + i += 2; + } + + ss = programs = (char *) malloc(i + 10); + *ss = 0; + for (j = 0; j < p->screenhacks_count; j++) + { + strcat (ss, hack_strings[j]); + free (hack_strings[j]); + ss += strlen(ss); + *ss++ = '\n'; + *ss = 0; + } + free (hack_strings); + } + + { + struct passwd *pw = getpwuid (getuid ()); + char *whoami = (pw && pw->pw_name && *pw->pw_name + ? pw->pw_name + : ""); + time_t now = time ((time_t *) 0); + char *timestr = (char *) ctime (&now); + char *nl = (char *) strchr (timestr, '\n'); + if (nl) *nl = 0; + fprintf (out, + "# %s Preferences File\n" + "# Written by %s %s for %s on %s.\n" + "# https://www.jwz.org/xscreensaver/\n" + "\n", + progclass, progname, version_string, whoami, timestr); + } + + for (j = 0; prefs[j]; j++) + { + char buf[255]; + const char *pr = prefs[j]; + enum pref_type { pref_str, pref_int, pref_bool, pref_byte, pref_time + } type = pref_str; + const char *s = 0; + int i = 0; + Bool b = False; + Time t = 0; + + if (pr && !*pr) + { + fprintf(out, "\n"); + continue; + } + +# undef CHECK +# define CHECK(X) else if (!strcmp(pr, X)) + if (!pr || !*pr) ; + CHECK("timeout") type = pref_time, t = p->timeout; + CHECK("cycle") type = pref_time, t = p->cycle; + CHECK("lock") type = pref_bool, b = p->lock_p; + CHECK("lockVTs") continue; /* don't save, unused */ + CHECK("lockTimeout") type = pref_time, t = p->lock_timeout; + CHECK("passwdTimeout") type = pref_time, t = p->passwd_timeout; + CHECK("visualID") type = pref_str, s = visual_name; + CHECK("installColormap") type = pref_bool, b = p->install_cmap_p; + CHECK("verbose") type = pref_bool, b = p->verbose_p; + CHECK("splash") type = pref_bool, b = p->splash_p; + CHECK("splashDuration") type = pref_time, t = p->splash_duration; + CHECK("quad") continue; /* don't save */ + CHECK("demoCommand") type = pref_str, s = p->demo_command; + CHECK("prefsCommand") continue; /* don't save, unused */ + CHECK("helpURL") continue; /* don't save */ + CHECK("loadURL") continue; /* don't save */ + CHECK("newLoginCommand") continue; /* don't save */ + CHECK("dialogTheme") type = pref_str, s = p->dialog_theme; + CHECK("nice") type = pref_int, i = p->nice_inferior; + CHECK("memoryLimit") continue; /* don't save */ + CHECK("fade") type = pref_bool, b = p->fade_p; + CHECK("unfade") type = pref_bool, b = p->unfade_p; + CHECK("fadeSeconds") type = pref_time, t = p->fade_seconds; + CHECK("fadeTicks") continue; /* don't save */ + CHECK("captureStdout") continue; /* don't save */ + CHECK("logFile") continue; /* don't save */ + CHECK("ignoreUninstalledPrograms") + type = pref_bool, b = p->ignore_uninstalled_p; + + CHECK("font") type = pref_str, s = stderr_font; + + CHECK("dpmsEnabled") type = pref_bool, b = p->dpms_enabled_p; + CHECK("dpmsQuickOff") type = pref_bool, b = p->dpms_quickoff_p; + CHECK("dpmsStandby") type = pref_time, t = p->dpms_standby; + CHECK("dpmsSuspend") type = pref_time, t = p->dpms_suspend; + CHECK("dpmsOff") type = pref_time, t = p->dpms_off; + + CHECK("grabDesktopImages") type =pref_bool, b = p->grab_desktop_p; + CHECK("grabVideoFrames") type =pref_bool, b = p->grab_video_p; + CHECK("chooseRandomImages")type =pref_bool, b = p->random_image_p; + CHECK("imageDirectory") type =pref_str, s = p->image_directory; + + CHECK("mode") type = pref_str, + s = (p->mode == ONE_HACK ? "one" : + p->mode == BLANK_ONLY ? "blank" : + p->mode == DONT_BLANK ? "off" : + p->mode == RANDOM_HACKS_SAME + ? "random-same" + : "random"); + CHECK("selected") type = pref_int, i = p->selected_hack; + + CHECK("textMode") type = pref_str, + s = (p->tmode == TEXT_URL ? "url" : + p->tmode == TEXT_LITERAL ? "literal" : + p->tmode == TEXT_FILE ? "file" : + p->tmode == TEXT_PROGRAM ? "program" : + "date"); + CHECK("textLiteral") type = pref_str, s = p->text_literal; + CHECK("textFile") type = pref_str, s = p->text_file; + CHECK("textProgram") type = pref_str, s = p->text_program; + CHECK("textURL") type = pref_str, s = p->text_url; + + CHECK("programs") type = pref_str, s = programs; + CHECK("pointerHysteresis")type = pref_int, i = p->pointer_hysteresis; + CHECK("overlayStderr") type = pref_bool, b = overlay_stderr_p; + CHECK("overlayTextBackground") continue; /* don't save */ + CHECK("overlayTextForeground") continue; /* don't save */ + CHECK("bourneShell") continue; /* don't save */ + CHECK("authWarningSlack") type = pref_int, i = p->auth_warning_slack; + else + { + fprintf (stderr, "%s: internal error: key %s\n", blurb(), pr); + abort(); + } +# undef CHECK + + switch (type) + { + case pref_str: + break; + case pref_int: + sprintf(buf, "%d", i); + s = buf; + break; + case pref_bool: + s = b ? "True" : "False"; + break; + case pref_time: + { + unsigned int hour = 0, min = 0, sec = (unsigned int) (t/1000); + if (sec >= 60) + { + min += (sec / 60); + sec %= 60; + } + if (min >= 60) + { + hour += (min / 60); + min %= 60; + } + sprintf (buf, "%u:%02u:%02u", hour, min, sec); + s = buf; + } + break; + case pref_byte: + { + if (i >= (1<<30) && i == ((i >> 30) << 30)) + sprintf(buf, "%dG", i >> 30); + else if (i >= (1<<20) && i == ((i >> 20) << 20)) + sprintf(buf, "%dM", i >> 20); + else if (i >= (1<<10) && i == ((i >> 10) << 10)) + sprintf(buf, "%dK", i >> 10); + else + sprintf(buf, "%d", i); + s = buf; + } + break; + default: + abort(); + break; + } + + if (pr && (!strcmp(pr, "mode") || !strcmp(pr, "textMode"))) + fprintf(out, "\n"); + + write_entry (out, pr, s); + } + + fprintf(out, "\n"); + + if (visual_name) free(visual_name); + if (stderr_font) free(stderr_font); + if (programs) free(programs); + + if (fclose(out) == 0) + { + time_t write_date = 0; + + if (stat(tmp_name, &st) == 0) + { + write_date = st.st_mtime; + } + else + { + char *buf = (char *) malloc(1024 + strlen(tmp_name) + strlen(name)); + sprintf(buf, "%s: couldn't stat \"%s\"", blurb(), tmp_name); + perror(buf); + unlink (tmp_name); + free(buf); + goto END; + } + + if (rename (tmp_name, name) != 0) + { + char *buf = (char *) malloc(1024 + strlen(tmp_name) + strlen(name)); + sprintf(buf, "%s: error renaming \"%s\" to \"%s\"", + blurb(), tmp_name, name); + perror(buf); + unlink (tmp_name); + free(buf); + goto END; + } + else + { + p->init_file_date = write_date; + + /* Since the .xscreensaver file is used for IPC, let's try and make + sure that the bits actually land on the disk right away. */ + /* Update 2020: Apparently here in the future, this sometimes takes + 3+ seconds, so let's not. */ + /* sync(); */ + + status = 0; /* wrote and renamed successfully! */ + } + } + else + { + char *buf = (char *) malloc(1024 + strlen(name)); + sprintf(buf, "%s: error closing \"%s\"", blurb(), name); + perror(buf); + free(buf); + unlink (tmp_name); + goto END; + } + + END: + if (n2) free (n2); + return status; +} + + +/* Parsing the resource database + */ + +static void +free_screenhack (screenhack *hack) +{ + if (hack->visual) free (hack->visual); + if (hack->name) free (hack->name); + free (hack->command); + memset (hack, 0, sizeof(*hack)); + free (hack); +} + +static void +free_screenhack_list (screenhack **list, int count) +{ + int i; + if (!list) return; + for (i = 0; i < count; i++) + if (list[i]) + free_screenhack (list[i]); + free (list); +} + + + +/* Populate `saver_preferences' with the contents of the resource database. + Note that this may be called multiple times -- it is re-run each time + the ~/.xscreensaver file is reloaded. + + This function can be very noisy, since it issues resource syntax errors + and so on. + */ +void +load_init_file (Display *dpy, saver_preferences *p) +{ + static Bool first_time = True; + + screenhack **system_default_screenhacks = 0; + int system_default_screenhack_count = 0; + + if (first_time) + { + /* Get the programs resource before the .xscreensaver file has been + parsed and merged into the resource database for the first time: + this is the value of *programs from the app-defaults file. + Then clear it out so that it will be parsed again later, after + the init file has been read. + */ + get_screenhacks (dpy, p); + system_default_screenhacks = p->screenhacks; + system_default_screenhack_count = p->screenhacks_count; + p->screenhacks = 0; + p->screenhacks_count = 0; + } + + if (parse_init_file_1 (p) != 0) /* file might have gone away */ + if (!first_time) return; + + first_time = False; + + p->xsync_p = get_boolean_resource (dpy, "synchronous", "Synchronous"); + p->verbose_p = get_boolean_resource (dpy, "verbose", "Boolean"); + p->lock_p = get_boolean_resource (dpy, "lock", "Boolean"); + p->fade_p = get_boolean_resource (dpy, "fade", "Boolean"); + p->unfade_p = get_boolean_resource (dpy, "unfade", "Boolean"); + p->fade_seconds = 1000 * get_seconds_resource (dpy, "fadeSeconds", "Time"); + p->install_cmap_p = get_boolean_resource (dpy, "installColormap", "Boolean"); + p->nice_inferior = get_integer_resource (dpy, "nice", "Nice"); + p->splash_p = get_boolean_resource (dpy, "splash", "Boolean"); +# ifdef QUAD_MODE + p->quad_p = get_boolean_resource (dpy, "quad", "Boolean"); +# endif + p->ignore_uninstalled_p = get_boolean_resource (dpy, + "ignoreUninstalledPrograms", + "Boolean"); + + p->splash_duration = 1000 * get_seconds_resource (dpy, "splashDuration", "Time"); + p->timeout = 1000 * get_minutes_resource (dpy, "timeout", "Time"); + p->lock_timeout = 1000 * get_minutes_resource (dpy, "lockTimeout", "Time"); + p->cycle = 1000 * get_minutes_resource (dpy, "cycle", "Time"); + p->passwd_timeout = 1000 * get_seconds_resource (dpy, "passwdTimeout", "Time"); + p->pointer_hysteresis = get_integer_resource (dpy, "pointerHysteresis","Integer"); + + p->dpms_enabled_p = get_boolean_resource (dpy, "dpmsEnabled", "Boolean"); + p->dpms_quickoff_p = get_boolean_resource (dpy, "dpmsQuickOff", "Boolean"); + p->dpms_standby = 1000 * get_minutes_resource (dpy, "dpmsStandby", "Time"); + p->dpms_suspend = 1000 * get_minutes_resource (dpy, "dpmsSuspend", "Time"); + p->dpms_off = 1000 * get_minutes_resource (dpy, "dpmsOff", "Time"); + + p->grab_desktop_p = get_boolean_resource (dpy, "grabDesktopImages", "Boolean"); + p->grab_video_p = get_boolean_resource (dpy, "grabVideoFrames", "Boolean"); + p->random_image_p = get_boolean_resource (dpy, "chooseRandomImages", "Boolean"); + p->image_directory = get_string_resource (dpy, + "imageDirectory", + "ImageDirectory"); + + p->text_literal = get_string_resource (dpy, "textLiteral", "TextLiteral"); + p->text_file = get_string_resource (dpy, "textFile", "TextFile"); + p->text_program = get_string_resource (dpy, "textProgram", "TextProgram"); + p->text_url = get_string_resource (dpy, "textURL", "TextURL"); + + p->shell = get_string_resource (dpy, "bourneShell", "BourneShell"); + + p->demo_command = get_string_resource(dpy, "demoCommand", "Command"); + p->help_url = get_string_resource(dpy, "helpURL", "URL"); + p->load_url_command = get_string_resource(dpy, "loadURL", "Command"); + p->new_login_command = get_string_resource(dpy, "newLoginCommand", + "Command"); + p->dialog_theme = get_string_resource(dpy, "dialogTheme", "String"); + p->auth_warning_slack = get_integer_resource(dpy, "authWarningSlack", + "Integer"); + + /* If "*splash" is unset, default to true. */ + { + char *s = get_string_resource (dpy, "splash", "Boolean"); + if (s) + free (s); + else + p->splash_p = True; + } + + /* If "*grabDesktopImages" is unset, default to true. */ + { + char *s = get_string_resource (dpy, "grabDesktopImages", "Boolean"); + if (s) + free (s); + else + p->grab_desktop_p = True; + } + + get_screenhacks (dpy, p); /* Parse the "programs" resource. */ + + { + char *s = get_string_resource (dpy, "selected", "Integer"); + if (!s || !*s) + p->selected_hack = -1; + else + p->selected_hack = get_integer_resource (dpy, "selected", "Integer"); + if (s) free (s); + if (p->selected_hack < 0 || p->selected_hack >= p->screenhacks_count) + p->selected_hack = -1; + } + + { + char *s = get_string_resource (dpy, "mode", "Mode"); + if (s && !strcasecmp (s, "one")) p->mode = ONE_HACK; + else if (s && !strcasecmp (s, "blank")) p->mode = BLANK_ONLY; + else if (s && !strcasecmp (s, "off")) p->mode = DONT_BLANK; + else if (s && !strcasecmp (s, "random-same")) p->mode = RANDOM_HACKS_SAME; + else p->mode = RANDOM_HACKS; + if (s) free (s); + } + + { + char *s = get_string_resource (dpy, "textMode", "TextMode"); + if (s && !strcasecmp (s, "url")) p->tmode = TEXT_URL; + else if (s && !strcasecmp (s, "literal")) p->tmode = TEXT_LITERAL; + else if (s && !strcasecmp (s, "file")) p->tmode = TEXT_FILE; + else if (s && !strcasecmp (s, "program")) p->tmode = TEXT_PROGRAM; + else p->tmode = TEXT_DATE; + if (s) free (s); + } + + if (system_default_screenhack_count) /* note: first_time is also true */ + { + merge_system_screenhacks (dpy, p, system_default_screenhacks, + system_default_screenhack_count); + free_screenhack_list (system_default_screenhacks, + system_default_screenhack_count); + system_default_screenhacks = 0; + system_default_screenhack_count = 0; + } + + if (p->debug_p) + { + p->xsync_p = True; + p->verbose_p = True; + } + + /* Throttle the various timeouts to reasonable values after reading the + disk file. */ + stop_the_insanity (p); +} + + +/* If there are any hacks in the system-wide defaults that are not in + the ~/.xscreensaver file, add the new ones to the end of the list. + This does *not* actually save the file. + */ +static void +merge_system_screenhacks (Display *dpy, saver_preferences *p, + screenhack **system_list, int system_count) +{ + /* Yeah yeah, this is an N^2 operation, but I don't have hashtables handy, + so fuck it. */ + + int made_space = 0; + int i; + for (i = 0; i < system_count; i++) + { + int j; + Bool matched_p = False; + + for (j = 0; j < p->screenhacks_count; j++) + { + char *name; + if (!system_list[i]->name) + system_list[i]->name = make_hack_name (dpy, + system_list[i]->command); + + name = p->screenhacks[j]->name; + if (!name) + name = make_hack_name (dpy, p->screenhacks[j]->command); + + matched_p = !strcasecmp (name, system_list[i]->name); + + if (name != p->screenhacks[j]->name) + free (name); + + if (matched_p) + break; + } + + if (!matched_p) + { + /* We have an entry in the system-wide list that is not in the + user's .xscreensaver file. Add it to the end. + Note that p->screenhacks is a single malloc block, not a + linked list, so we have to realloc it. + */ + screenhack *oh = system_list[i]; + screenhack *nh = (screenhack *) malloc (sizeof(screenhack)); + + if (made_space == 0) + { + made_space = 10; + p->screenhacks = (screenhack **) + realloc (p->screenhacks, + (p->screenhacks_count + made_space + 1) + * sizeof(*p->screenhacks)); + if (!p->screenhacks) abort(); + } + + nh->enabled_p = oh->enabled_p; + nh->visual = oh->visual ? strdup(oh->visual) : 0; + nh->name = oh->name ? strdup(oh->name) : 0; + nh->command = oh->command ? strdup(oh->command) : 0; + + p->screenhacks[p->screenhacks_count++] = nh; + p->screenhacks[p->screenhacks_count] = 0; + made_space--; + +#if 0 + fprintf (stderr, "%s: noticed new hack: %s\n", blurb(), + (nh->name ? nh->name : make_hack_name (dpy, nh->command))); +#endif + } + } +} + + + +/* Parsing the programs resource. + */ + +static screenhack * +parse_screenhack (const char *line) +{ + screenhack *h = (screenhack *) calloc (1, sizeof(*h)); + const char *s; + + h->enabled_p = True; + + while (isspace(*line)) line++; /* skip whitespace */ + if (*line == '-') /* handle "-" */ + { + h->enabled_p = False; + line++; + while (isspace(*line)) line++; /* skip whitespace */ + } + + s = line; /* handle "visual:" */ + while (*line && *line != ':' && *line != '"' && !isspace(*line)) + line++; + if (*line != ':') + line = s; + else + { + h->visual = (char *) malloc (line-s+1); + strncpy (h->visual, s, line-s); + h->visual[line-s] = 0; + if (*line == ':') line++; /* skip ":" */ + while (isspace(*line)) line++; /* skip whitespace */ + } + + if (*line == '"') /* handle "name" */ + { + line++; + s = line; + while (*line && *line != '"') + line++; + h->name = (char *) malloc (line-s+1); + strncpy (h->name, s, line-s); + h->name[line-s] = 0; + if (*line == '"') line++; /* skip "\"" */ + while (isspace(*line)) line++; /* skip whitespace */ + } + + h->command = format_command (line, False); /* handle command */ + return h; +} + + +static char * +format_command (const char *cmd, Bool wrap_p) +{ + int tab = 30; + int col = tab; + char *cmd2 = (char *) calloc (1, 2 * (strlen (cmd) + 1)); + const char *in = cmd; + char *out = cmd2; + while (*in) + { + /* shrink all whitespace to one space, for the benefit of the "demo" + mode display. We only do this when we can easily tell that the + whitespace is not significant (no shell metachars). + */ + switch (*in) + { + case '\'': case '"': case '`': case '\\': + /* Metachars are scary. Copy the rest of the line unchanged. */ + while (*in) + *out++ = *in++, col++; + break; + + case ' ': case '\t': + /* Squeeze all other whitespace down to one space. */ + while (*in == ' ' || *in == '\t') + in++; + *out++ = ' ', col++; + break; + + default: + /* Copy other chars unchanged. */ + *out++ = *in++, col++; + break; + } + } + + *out = 0; + + /* Strip trailing whitespace */ + while (out > cmd2 && isspace (out[-1])) + *(--out) = 0; + + return cmd2; +} + + +/* Returns a new string describing the shell command. + This may be just the name of the program, capitalized. + It also may be something from the resource database (gotten + by looking for "hacks.XYZ.name", where XYZ is the program.) + */ +char * +make_hack_name (Display *dpy, const char *shell_command) +{ + char *s = strdup (shell_command); + char *s2; + char res_name[255]; + + for (s2 = s; *s2; s2++) /* truncate at first whitespace */ + if (isspace (*s2)) + { + *s2 = 0; + break; + } + + s2 = strrchr (s, '/'); /* if pathname, take last component */ + if (s2) + { + s2 = strdup (s2+1); + free (s); + s = s2; + } + + if (strlen (s) > 50) /* 51 is hereby defined as "unreasonable" */ + s[50] = 0; + + sprintf (res_name, "hacks.%s.name", s); /* resource? */ + s2 = get_string_resource (dpy, res_name, res_name); + if (s2) + { + free (s); + return s2; + } + + for (s2 = s; *s2; s2++) /* if it has any capitals, return it */ + if (*s2 >= 'A' && *s2 <= 'Z') + return s; + + if (s[0] >= 'a' && s[0] <= 'z') /* else cap it */ + s[0] -= 'a'-'A'; + if (s[0] == 'X' && s[1] >= 'a' && s[1] <= 'z') /* (magic leading X) */ + s[1] -= 'a'-'A'; + if (s[0] == 'G' && s[1] == 'l' && + s[2] >= 'a' && s[2] <= 'z') /* (magic leading GL) */ + s[1] -= 'a'-'A', + s[2] -= 'a'-'A'; + return s; +} + + +static char * +format_hack (Display *dpy, screenhack *hack, Bool wrap_p) +{ + int tab = 32; + int size; + char *h2, *out, *s; + int col = 0; + + char *def_name = make_hack_name (dpy, hack->command); + + /* Don't ever write out a name for a hack if it's the same as the default. + */ + if (hack->name && !strcmp (hack->name, def_name)) + { + free (hack->name); + hack->name = 0; + } + free (def_name); + + size = (2 * (strlen(hack->command) + + (hack->visual ? strlen(hack->visual) : 0) + + (hack->name ? strlen(hack->name) : 0) + + tab)); + h2 = (char *) malloc (size); + out = h2; + + if (!hack->enabled_p) *out++ = '-'; /* write disabled flag */ + + if (hack->visual && *hack->visual) /* write visual name */ + { + if (hack->enabled_p) *out++ = ' '; + *out++ = ' '; + strcpy (out, hack->visual); + out += strlen (hack->visual); + *out++ = ':'; + *out++ = ' '; + } + + *out = 0; + col = string_columns (h2, strlen (h2), 0); + + if (hack->name && *hack->name) /* write pretty name */ + { + int L = (strlen (hack->name) + 2); + if (L + col < tab) + out = stab_to (out, col, tab - L - 2); + else + *out++ = ' '; + *out++ = '"'; + strcpy (out, hack->name); + out += strlen (hack->name); + *out++ = '"'; + *out = 0; + + col = string_columns (h2, strlen (h2), 0); + if (wrap_p && col >= tab) + out = stab_to (out, col, 77); + else + *out++ = ' '; + + if (out >= h2+size) abort(); + } + + *out = 0; + col = string_columns (h2, strlen (h2), 0); + out = stab_to (out, col, tab); /* indent */ + + if (out >= h2+size) abort(); + s = format_command (hack->command, wrap_p); + strcpy (out, s); + out += strlen (s); + free (s); + *out = 0; + + return h2; +} + + +static void +get_screenhacks (Display *dpy, saver_preferences *p) +{ + int i, j; + int start = 0; + int end = 0; + int size; + char *d = get_string_resource (dpy, "programs", "Programs"); + + free_screenhack_list (p->screenhacks, p->screenhacks_count); + p->screenhacks = 0; + p->screenhacks_count = 0; + + if (!d || !*d) + return; + + size = strlen (d); + + + /* Count up the number of newlines (which will be equal to or larger than + one less than the number of hacks.) + */ + for (i = j = 0; d[i]; i++) + if (d[i] == '\n') + j++; + j++; + + p->screenhacks = (screenhack **) calloc (j + 1, sizeof (screenhack *)); + + /* Iterate over the lines in `d' (the string with newlines) + and make new strings to stuff into the `screenhacks' array. + */ + p->screenhacks_count = 0; + while (start < size) + { + /* skip forward over whitespace. */ + while (d[start] == ' ' || d[start] == '\t' || d[start] == '\n') + start++; + + /* skip forward to newline or end of string. */ + end = start; + while (d[end] != 0 && d[end] != '\n') + end++; + + /* null terminate. */ + d[end] = 0; + + p->screenhacks[p->screenhacks_count++] = parse_screenhack (d + start); + if (p->screenhacks_count >= i) + abort(); + + start = end+1; + } + + free (d); + + if (p->screenhacks_count == 0) + { + free (p->screenhacks); + p->screenhacks = 0; + } +} + + +/* Make sure all the values in the preferences struct are sane. + */ +static void +stop_the_insanity (saver_preferences *p) +{ + if (p->passwd_timeout <= 0) p->passwd_timeout = 30000; /* 30 secs */ + if (p->timeout < 15000) p->timeout = 15000; /* 15 secs */ + if (p->cycle != 0 && p->cycle < 2000) p->cycle = 2000; /* 2 secs */ + if (p->fade_seconds <= 0) + p->fade_p = False; + if (! p->fade_p) p->unfade_p = False; + + /* The DPMS settings may have the value 0. + But if they are negative, or are a range less than 10 seconds, + reset them to sensible defaults. (Since that must be a mistake.) + */ + if (p->dpms_standby != 0 && + p->dpms_standby < 10 * 1000) + p->dpms_standby = 2 * 60 * 60 * 1000; /* 2 hours */ + if (p->dpms_suspend != 0 && + p->dpms_suspend < 10 * 1000) + p->dpms_suspend = 2 * 60 * 60 * 1000; /* 2 hours */ + if (p->dpms_off != 0 && + p->dpms_off < 10 * 1000) + p->dpms_off = 4 * 60 * 60 * 1000; /* 4 hours */ + + /* suspend may not be greater than off, unless off is 0. + standby may not be greater than suspend, unless suspend is 0. + */ + if (p->dpms_off != 0 && + p->dpms_suspend > p->dpms_off) + p->dpms_suspend = p->dpms_off; + if (p->dpms_suspend != 0 && + p->dpms_standby > p->dpms_suspend) + p->dpms_standby = p->dpms_suspend; + + /* These fixes above ignores the case + suspend = 0 and standby > off ... + */ + if (p->dpms_off != 0 && + p->dpms_standby > p->dpms_off) + p->dpms_standby = p->dpms_off; + + if (p->dpms_standby == 0 && /* if *all* are 0, then DPMS is disabled */ + p->dpms_suspend == 0 && + p->dpms_off == 0 && + !p->dpms_quickoff_p) /* ... but we want to do DPMS quick off */ + p->dpms_enabled_p = False; + + + /* Set watchdog timeout to about half of the cycle timeout, but + don't let it be faster than 1/2 minute or slower than 1 minute. + */ + p->watchdog_timeout = p->cycle * 0.6; + if (p->watchdog_timeout < 27000) p->watchdog_timeout = 27000; /* 27 secs */ + if (p->watchdog_timeout > 57000) p->watchdog_timeout = 57000; /* 57 secs */ + + if (p->pointer_hysteresis < 0) p->pointer_hysteresis = 0; + + if (p->auth_warning_slack < 0) p->auth_warning_slack = 0; + if (p->auth_warning_slack > 300) p->auth_warning_slack = 300; +} + + +Bool +senescent_p (void) +{ + /* If you are in here because you're planning on disabling this warning + before redistributing my software, please don't. + + I sincerely request that you do one of the following: + + 1: leave this code intact and this warning in place, -OR- + + 2: Remove xscreensaver from your distribution. + + I would seriously prefer that you not distribute my software at all + than that you distribute one version and then never update it for + years. + + I am *constantly* getting email from users reporting bugs that have + been fixed for literally years who have no idea that the software + they are running is years out of date. Yes, it would be great if we + lived in the ideal world where people checked that they were running + the latest release before they report a bug, but we don't. To most + people, "running the latest release" is synonymous with "running the + latest release that my distro packages for me." + + When they even bother to tell me what version they're running, I + say, "That version is three years old!", and they say "But this is + the latest version my distro ships". Then I say, "your distro + sucks", and they say "but I don't know how to compile from source, + herp derp I eat paste", and *everybody* goes away unhappy. + + It wastes an enormous amount of my time, but worse than that, it + does a grave disservice to the users, who are stuck experiencing + bugs that are already fixed! These users think they are running the + latest release, and they are not. They would like to be running the + actual latest release, but they don't know how, because their distro + makes that very difficult for them. It's terrible for everyone, and + kind of makes me regret ever having released this software in the + first place. + + So seriously. I ask that if you're planning on disabling this + obsolescence warning, that you instead just remove xscreensaver from + your distro entirely. Everybody will be happier that way. Check + out gnome-screensaver instead, I understand it's really nice. + + Of course, my license allows you to ignore me and do whatever the + fuck you want, but as the author, I hope you will have the common + courtesy of complying with my request. + + Thank you! + + jwz, 2014, 2016, 2018, 2021. + + PS: In particular, since Debian refuses to upgrade software on any + kind of rational timeline, I have asked that they stop shipping + xscreensaver at all. They have refused. Instead of upgrading the + software, they simply patched out this warning. + + If you want to witness the sad state of the open source peanut + gallery, look no farther than the comments on my blog: + http://jwz.org/b/yiYo + + Many of these people fall back on their go-to argument of, "If it is + legal, it must be right." If you believe in that rhetorical device + then you are a terrible person, and possibly a sociopath. + + There are also the armchair lawyers who say "Well, instead of + *asking* people to do the right thing out of common courtesy, you + should just change your license to prohibit them from acting + amorally." Again, this is the answer of a sociopath, but that aside, + if you devote even a second's thought to this you will realize that + the end result of this would be for distros like Debian to just keep + shipping the last version with the old license and then never + upgrading it again -- which would be the worst possible outcome for + everyone involved, most especially the users. + + Also, some have incorrectly characterized this as a "time bomb". + It is a software update notification, nothing more. A "time bomb" + makes software stop working. This merely alerts the user that the + security-critical software that they are running is dangerously out + of date. + */ + + time_t now = time ((time_t *) 0); /* d */ + struct tm *tm = localtime (&now); /* o */ + const char *s = screensaver_id; /* n */ + char mon[4], year[5]; /* ' */ + int m, y, mrnths; /* t */ + s = strchr (s, ' '); if (!s) abort(); s++; /* */ + s = strchr (s, '('); if (!s) abort(); s++; /* d */ + s = strchr (s, '-'); if (!s) abort(); s++; /* o */ + strncpy (mon, s, 3); /* o */ + mon[3] = 0; /* */ + s = strchr (s, '-'); if (!s) abort(); s++; /* e */ + strncpy (year, s, 4); /* e */ + year[4] = 0; /* t */ + y = atoi (year); /* , */ + if (!strcmp(mon, "Jan")) m = 0; /* */ + else if (!strcmp(mon, "Feb")) m = 1; /* s */ + else if (!strcmp(mon, "Mar")) m = 2; /* t */ + else if (!strcmp(mon, "Apr")) m = 3; /* o */ + else if (!strcmp(mon, "May")) m = 4; /* p */ + else if (!strcmp(mon, "Jun")) m = 5; /* , */ + else if (!strcmp(mon, "Jul")) m = 6; /* */ + else if (!strcmp(mon, "Aug")) m = 7; /* s */ + else if (!strcmp(mon, "Sep")) m = 8; /* t */ + else if (!strcmp(mon, "Oct")) m = 9; /* a */ + else if (!strcmp(mon, "Nov")) m = 10; /* a */ + else if (!strcmp(mon, "Dec")) m = 11; /* a */ + else abort(); /* h */ + mrnths = ((((tm->tm_year + 1900) * 12) + tm->tm_mon) - /* h */ + (y * 12 + m)); /* h */ + /* p */ + return (mrnths >= 17); /* . */ +} diff --git a/driver/remote.c b/driver/remote.c index 83254e0..123bc28 100644 --- a/driver/remote.c +++ b/driver/remote.c @@ -1,4 +1,4 @@ -/* xscreensaver-command, Copyright (c) 1991-2019 Jamie Zawinski +/* xscreensaver-command, Copyright © 1991-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -33,102 +33,61 @@ #include /* for XGetClassHint() */ #include +#ifdef HAVE_DPMS_EXTENSION +# include +#endif + +#include "blurb.h" +#include "atoms.h" #include "remote.h" +#include "clientmsg.h" #ifdef _VROOT_H_ ERROR! you must not include vroot.h in this file #endif -extern char *progname; -extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_RESPONSE; -extern Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_EXIT; -extern Atom XA_VROOT, XA_SELECT, XA_DEMO, XA_BLANK, XA_LOCK; -extern Atom XA_ACTIVATE, XA_SUSPEND, XA_NEXT, XA_PREV, XA_EXIT; - - -static XErrorHandler old_handler = 0; -static Bool got_badwindow = False; +static Bool error_handler_hit_p = False; static int -BadWindow_ehandler (Display *dpy, XErrorEvent *error) +ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error) { - if (error->error_code == BadWindow) - { - got_badwindow = True; - return 0; - } - else - { - fprintf (stderr, "%s: ", progname); - if (!old_handler) abort(); - return (*old_handler) (dpy, error); - } + error_handler_hit_p = True; + return 0; } - -static Window -find_screensaver_window (Display *dpy, char **version) +/* See comment in xscreensaver.c for why this is here instead of there. + */ +static void +reset_dpms_timer (Display *dpy) { - int i; - Window root = RootWindowOfScreen (DefaultScreenOfDisplay (dpy)); - Window root2, parent, *kids; - unsigned int nkids; - - if (version) *version = 0; - - if (! XQueryTree (dpy, root, &root2, &parent, &kids, &nkids)) - abort (); - if (root != root2) - abort (); - if (parent) - abort (); - if (! (kids && nkids)) - return 0; - for (i = 0; i < nkids; i++) - { - Atom type; - int format; - unsigned long nitems, bytesafter; - unsigned char *v; - int status; - - /* We're walking the list of root-level windows and trying to find - the one that has a particular property on it. We need to trap - BadWindows errors while doing this, because it's possible that - some random window might get deleted in the meantime. (That - window won't have been the one we're looking for.) - */ - XSync (dpy, False); - if (old_handler) abort(); - got_badwindow = False; - old_handler = XSetErrorHandler (BadWindow_ehandler); - status = XGetWindowProperty (dpy, kids[i], - XA_SCREENSAVER_VERSION, - 0, 200, False, XA_STRING, - &type, &format, &nitems, &bytesafter, - &v); - XSync (dpy, False); - XSetErrorHandler (old_handler); - old_handler = 0; +# ifdef HAVE_DPMS_EXTENSION - if (got_badwindow) - { - status = BadWindow; - got_badwindow = False; - } + XErrorHandler old_handler; + int event_number, error_number; + BOOL enabled = False; + CARD16 power = 0; - if (status == Success && type != None) - { - Window ret = kids[i]; - if (version) - *version = (char *) v; - XFree (kids); - return ret; - } - } + XSync (dpy, False); + error_handler_hit_p = False; + old_handler = XSetErrorHandler (ignore_all_errors_ehandler); - if (kids) XFree (kids); - return 0; + if (! DPMSQueryExtension (dpy, &event_number, &error_number)) + goto DONE; + if (! DPMSCapable (dpy)) + goto DONE; + if (! DPMSInfo (dpy, &power, &enabled)) + goto DONE; + if (!enabled) + goto DONE; + + /* Do this even if power == DPMSModeOn to reset the timer */ + DPMSForceLevel (dpy, DPMSModeOn); + + DONE: + XSync (dpy, False); + XSetErrorHandler (old_handler); + +# endif /* HAVE_DPMS_EXTENSION */ } @@ -239,7 +198,7 @@ send_xscreensaver_command (Display *dpy, Atom command, long arg, if (data) free (data); fprintf (stdout, "\n"); fflush (stdout); - fprintf (stderr, "bad status format on root window.\n"); + fprintf (stderr, "bad status format on root window\n"); status = -1; goto DONE; } @@ -301,7 +260,7 @@ send_xscreensaver_command (Display *dpy, Atom command, long arg, if (dataP) XFree (dataP); fprintf (stdout, "\n"); fflush (stdout); - fprintf (stderr, "no saver status on root window.\n"); + fprintf (stderr, "no saver status on root window\n"); status = -1; goto DONE; } @@ -316,7 +275,6 @@ send_xscreensaver_command (Display *dpy, Atom command, long arg, XEvent event; long arg1 = arg; long arg2 = 0; - if (arg < 0) abort(); else if (arg == 0 && command == XA_SELECT) @@ -327,6 +285,9 @@ send_xscreensaver_command (Display *dpy, Atom command, long arg, arg2 = arg; /* since it didn't use to take an argument. */ } + if (command == XA_DEACTIVATE) + reset_dpms_timer (dpy); + event.xany.type = ClientMessage; event.xclient.display = dpy; event.xclient.window = window; @@ -336,10 +297,11 @@ send_xscreensaver_command (Display *dpy, Atom command, long arg, event.xclient.data.l[0] = (long) command; event.xclient.data.l[1] = arg1; event.xclient.data.l[2] = arg2; - if (! XSendEvent (dpy, window, False, 0L, &event)) + + if (! XSendEvent (dpy, window, False, PropertyChangeMask, &event)) { - sprintf (err, "XSendEvent(dpy, 0x%x ...) failed.\n", - (unsigned int) window); + sprintf (err, "XSendEvent(dpy, 0x%x ...) failed\n", + (unsigned int) window); if (error_ret) *error_ret = strdup (err); else @@ -416,10 +378,11 @@ xscreensaver_command_response (Display *dpy, Window window, int format; unsigned long nitems, bytesafter; unsigned char *msg = 0; + XErrorHandler old_handler; XSync (dpy, False); - if (old_handler) abort(); - old_handler = XSetErrorHandler (BadWindow_ehandler); + error_handler_hit_p = False; + old_handler = XSetErrorHandler (ignore_all_errors_ehandler); st2 = XGetWindowProperty (dpy, window, XA_SCREENSAVER_RESPONSE, 0, 1024, True, @@ -428,9 +391,8 @@ xscreensaver_command_response (Display *dpy, Window window, &msg); XSync (dpy, False); XSetErrorHandler (old_handler); - old_handler = 0; - if (got_badwindow) + if (error_handler_hit_p) { if (exiting_p) return 0; @@ -491,109 +453,87 @@ xscreensaver_command_response (Display *dpy, Window window, } -/* Wait until the window has been mapped, blanking the screen. +/* Wait until xscreensaver says the screen is blanked. Catches errors, times out after a few seconds. */ static int -xscreensaver_command_wait_for_blank (Display *dpy, Window window, +xscreensaver_command_wait_for_blank (Display *dpy, Bool verbose_p, char **error_ret) { + Window w = RootWindow (dpy, 0); /* always screen 0 */ time_t start = time((time_t*)0); int max = 10; char err[2048]; - Status status = -1; - while (1) { - XWindowAttributes xgwa; - xgwa.map_state = IsUnmapped; + Atom type; + int format; + unsigned long nitems, bytesafter; + unsigned char *dataP = 0; + time_t now; + struct timeval tv; - if (!window) - got_badwindow = True; - else + /* Wait until the status property on the root window changes to + BLANK or LOCKED. */ + if (XGetWindowProperty (dpy, w, + XA_SCREENSAVER_STATUS, + 0, 999, False, XA_INTEGER, + &type, &format, &nitems, &bytesafter, + &dataP) + == Success + && type == XA_INTEGER + && nitems >= 3 + && dataP) { - XSync (dpy, False); - if (old_handler) abort(); - got_badwindow = False; - old_handler = XSetErrorHandler (BadWindow_ehandler); - status = XGetWindowAttributes (dpy, window, &xgwa); - XSync (dpy, False); - XSetErrorHandler (old_handler); - old_handler = 0; - } + Atom state = ((Atom *) dataP)[0]; - if (got_badwindow) - { - /* If we got a BadWindow, it might be that in the course of - activating, xscreensaver had to destroy and re-create the - window to get one with the proper Visual. So wait for a - new window to come into existence. - */ - if (window && verbose_p > 1) - fprintf (stderr, - "%s: BadWindow 0x%08x waiting for screen to blank\n", - progname, (unsigned int) window); - window = find_screensaver_window (dpy, 0); - if (window && verbose_p > 1) - fprintf (stderr, "%s: new window is 0x%08x.\n", - progname, (unsigned int) window); - got_badwindow = False; + if (verbose_p > 1) + { + PROP32 *status = (PROP32 *) dataP; + int i; + fprintf (stderr, "%s: read status property: 0x%lx: %s", progname, + (unsigned long) w, + (status[0] == XA_LOCK ? "LOCK" : + status[0] == XA_BLANK ? "BLANK" : + status[0] == 0 ? "0" : "???")); + for (i = 1; i < nitems; i++) + fprintf (stderr, ", %lu", status[i]); + fprintf (stderr, "\n"); + } + + if (state == XA_BLANK || state == XA_LOCK) + { + if (verbose_p > 1) + fprintf (stderr, "%s: screen blanked\n", progname); + break; + } } - else if (status == 0) + + now = time ((time_t *) 0); + if (now >= start + max) { - sprintf (err, "error on 0x%08x waiting for screen to blank", - (unsigned int) window); + strcpy (err, "Timed out waiting for screen to blank"); if (error_ret) *error_ret = strdup (err); else fprintf (stderr, "%s: %s\n", progname, err); return -1; } - else if (xgwa.map_state == IsViewable) + else if (verbose_p == 1 && now > start + 3) { - if (verbose_p) - fprintf (stderr, "%s: window 0x%08x mapped.\n", - progname, (unsigned int) window); - return 0; + fprintf (stderr, "%s: waiting for status change\n", progname); + verbose_p++; } - else - { - time_t now = time((time_t*)0); - if (now >= start + max) - { - sprintf (err, "Timed out waiting for screen to blank on 0x%08x", - (unsigned int) window); - if (error_ret) - *error_ret = strdup (err); - else - fprintf (stderr, "%s: %s\n", progname, err); - return -1; - } - else if (verbose_p && now > start+1) - { - fprintf (stderr, "%s: waiting for window 0x%08x to map\n", - progname, (unsigned int) window); - } - } - -# if defined(HAVE_SELECT) - { - struct timeval tv; - tv.tv_sec = 0; - tv.tv_usec = 1000000L / 10; - select (0, 0, 0, 0, &tv); - } -# else - sleep (1); -# endif + tv.tv_sec = 0; + tv.tv_usec = 1000000L / 10; + select (0, 0, 0, 0, &tv); } return 0; } - int xscreensaver_command (Display *dpy, Atom command, long arg, Bool verbose_p, char **error_ret) @@ -614,8 +554,7 @@ xscreensaver_command (Display *dpy, Atom command, long arg, Bool verbose_p, command == XA_NEXT || command == XA_PREV || command == XA_SELECT)) - status = xscreensaver_command_wait_for_blank (dpy, w, verbose_p, - error_ret); + status = xscreensaver_command_wait_for_blank (dpy, verbose_p, error_ret); fflush (stdout); fflush (stderr); @@ -648,7 +587,7 @@ server_xscreensaver_version (Display *dpy, if (version_ret) { unsigned char *v = 0; - XGetWindowProperty (dpy, window, XA_SCREENSAVER_VERSION, 0, 1, + XGetWindowProperty (dpy, window, XA_SCREENSAVER_VERSION, 0, 100, False, XA_STRING, &type, &format, &nitems, &bytesafter, &v); if (v) @@ -681,11 +620,12 @@ server_xscreensaver_version (Display *dpy, { char *o = 0, *p = 0, *c = 0; o = strchr ((char *) id, '('); - if (o) p = strchr (o, '@'); + if (o) p = strrchr (o, '@'); if (p) c = strchr (p, ')'); if (c) { - /* found ID of the form "1234 (user@host)". */ + /* found ID of the form "1234 (user@host)" + or the weirder "1234 (user@crap@host)". */ user = o+1; host = p+1; *p = 0; @@ -695,12 +635,16 @@ server_xscreensaver_version (Display *dpy, } - if (user && *user && *user != '?') + if (!user_ret) + ; + else if (user && *user && *user != '?') *user_ret = strdup (user); else *user_ret = 0; - if (host && *host && *host != '?') + if (!host_ret) + ; + else if (host && *host && *host != '?') *host_ret = strdup (host); else *host_ret = 0; diff --git a/driver/remote.h b/driver/remote.h index e1db351..6b1763f 100644 --- a/driver/remote.h +++ b/driver/remote.h @@ -1,5 +1,4 @@ -/* xscreensaver-command, Copyright (c) 1991-1998 - * by Jamie Zawinski +/* xscreensaver-command, Copyright © 1991-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that diff --git a/driver/screens.c b/driver/screens.c index f319c96..dc87e51 100644 --- a/driver/screens.c +++ b/driver/screens.c @@ -1,5 +1,5 @@ /* screens.c --- dealing with RANDR, Xinerama, and VidMode Viewports. - * xscreensaver, Copyright (c) 1991-2008 Jamie Zawinski + * xscreensaver, Copyright © 1991-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -11,115 +11,114 @@ */ /* There are a bunch of different mechanisms for multiple monitors - * available in X. XScreenSaver needs to care about this for two - * reasons: first, to ensure that all visible areas go black; and - * second, so that the windows of screen savers exactly fill the - * glass of each monitor (instead of one saver spanning multiple - * monitors, or a monitor displaying only a sub-rectangle of the - * screen saver.) + * available in X. XScreenSaver needs to care about this for two reasons: + * first, to ensure that all visible areas go black; and second, so that + * the windows of screen savers exactly fill the glass of each monitor + * (instead of one saver spanning multiple monitors, or a monitor + * displaying only a sub-rectangle of the screen saver.) * * 1) Multi-screen: * - * This is the original way. Each monitor gets its own display - * number. :0.0 is the first one, :0.1 is the next, etc. The - * value of $DISPLAY determines which screen windows open on by - * default. A single app can open windows on multiple screens - * with the same display connection, but windows cannot be moved - * from one screen to another. The mouse can be moved from one - * screen to another, though. Screens may be different depths - * (e.g., one can be TrueColor and one can be PseudoColor.) - * Screens cannot be resized or moved without restarting X. + * This is the original way. Each monitor gets its own display number. + * ":0.0" is the first one, ":0.1" is the next, and so on. The value + * of $DISPLAY determines which screen windows open on by default. A + * single app can open windows on multiple screens with the same + * display connection, but windows cannot be moved from one screen to + * another. The mouse can be moved from one screen to another, though. + * Screens may be different depths (e.g., one can be TrueColor and one + * can be PseudoColor.) Screens cannot be resized or moved without + * restarting X. * - * Everyone hates this way of doing things because of the - * inability to move a window from one screen to another without - * restarting the application. + * Everyone hates this way of doing things because of the inability to + * move a window from one screen to another without restarting the + * application. * * 2) Xinerama: * - * There is a single giant root window that spans all the - * monitors. All monitors are the same depth, and windows can be - * moved around. Applications can learn which rectangles are - * actually visible on monitors by querying the Xinerama server - * extension. (If you don't do that, you end up with dialog - * boxes that try to appear in the middle of the screen actually - * spanning the gap between two monitors.) + * There is a single giant root window that spans all the monitors. + * All monitors are the same depth, and windows can be moved around. + * Applications can learn which rectangles are actually visible on + * monitors by querying the Xinerama server extension. (If you don't + * do that, you end up with dialog boxes that try to appear in the + * middle of the screen actually spanning the gap between two + * monitors.) * - * Xinerama doesn't work with DRI, which means that if you use - * it, you lose hardware acceleration on OpenGL programs. Also, - * screens can't be resized or moved without restarting X. + * Xinerama didn't? work with DRI, which means that Xinerama precluded + * hardware acceleration in OpenGL programs. Also, screens couldn't + * be resized or moved without restarting X. * * 3) Vidmode Viewports: * + * No longer supported as of XScreenSaver 6. + * * With this extension, the root window can be bigger than the - * monitor. Moving the mouse near the edges of the screen - * scrolls around, like a pan-and-scan movie. There can also be - * a hot key for changing the monitor's resolution (zooming - * in/out). + * monitor. Moving the mouse near the edges of the screen scrolls + * around, like a pan-and-scan movie. There was also a hot-key for + * changing the monitor's resolution (zooming in/out). * - * Trying to combine this with Xinerama crashes the server, so - * you can only use this if you have only a single screen, or are - * in old-multi-screen mode. + * Trying to combine this with Xinerama crashes the server, so you + * could only use this if you had only a single screen, or were in old + * multi-screen mode. * - * Also, half the time it doesn't work at all: it tends to lie - * about the size of the rectangle in use. + * Also, half the time it didn't work at all: it tended to lie about + * the size of the rectangle in use. * * 4) RANDR 1.0: * * The first version of the "Resize and Rotate" extension let you * change the resolution of a screen on the fly. The root window * would actually resize. However, it was also incompatible with - * Xinerama (did it crash, or just do nothing? I can't remember) - * so you needed to be in single-screen or old multi-screen mode. - * I believe RANDR could co-exist with Vidmode Viewports, but I'm - * not sure. + * Xinerama (did it crash, or just do nothing? I can't remember) so + * you needed to be in single-screen or old multi-screen mode. I + * believe RANDR could co-exist with Vidmode Viewports, but I'm not + * sure. * * 5) RANDR 1.2: * * Finally, RANDR added the functionality of Xinerama, plus some. * Each X screen (in the sense of #1, "multi-screen") can have a - * number of sub-rectangles that are displayed on monitors, and - * each of those sub-rectangles can be displayed on more than one - * monitor. So it's possible (I think) to have a hybrid of - * multi-screen and Xinerama (e.g., to have two monitors running - * in one depth, and three monitors running in another?) - * Typically though, there will be a single X screen, with - * Xinerama-like division of that large root window onto multiple - * monitors. Also everything's dynamic: monitors can be added, - * removed, and resized at runtime. - * - * I believe that as of RANDR 1.2, the Xinerama extension still - * exists but only as a compatiblity layer: it's actually - * returning data from the RANDR extension. - * - * Though RANDR 1.2 allows the same image to be cloned onto more - * than one monitor, and also allows one monitor to show a - * subsection of something on another monitor (e.g., the - * rectangles can be enclosed or overlap). Since there's no way - * to put seperate savers on those duplicated-or-overlapping - * monitors, xscreensaver just ignores them (which allows them to - * display duplicates or overlaps). + * number of sub-rectangles that are displayed on monitors, and each + * of those sub-rectangles can be displayed on more than one monitor. + * So it's possible (I think) to have a hybrid of multi-screen and + * Xinerama (e.g., to have two monitors running in one depth, and + * three monitors running in another?) Typically though, there will + * be a single X screen with one giant root window underlying the + * rectangles of multiple monitors. Also everything is dynamic: + * monitors can be added, removed, and resized at runtime, with + * notification events. * - * 5a) Nvidia fucks it up: + * RANDR rectangles can overlap, meaning one monitor can mirror + * another, or show a sub-rectangle of another, or just overlap in + * strange ways. The proper way to respond to weird layouts is... not + * always obvious. * - * Nvidia drivers as of Aug 2008 running in "TwinView" mode - * apparently report correct screen geometry via Xinerama, but - * report one giant screen via RANDR. The response from the - * nvidia developers is, "we don't support RANDR, use Xinerama - * instead." Which is a seriously lame answer. So, xscreensaver - * has to query *both* extensions, and make a guess as to which - * is to be believed. + * Also sometimes RANDR says stupid shit like, "You have one screen, + * and it has no available sizes or orientations." * - * 5b) Also sometimes RANDR says stupid shit like, "You have one - * screen, and it has no available orientations or sizes." + * Sometimes RANDR and Xinerama report the same info, and sometimes + * not, so we look at both and see which looks most plausible. * + * Also, Nvidia fucked it up: their drivers that were popular in 2008, + * when running in "TwinView" mode, reported correct sizes via + * Xinerama, but reported one giant screen via RANDR. Nvidia's + * response was, "We don't support RANDR, use Xinerama instead", which + * is another reason that XScreenSaver historically had to query both + * extensions and make a guess. Maybe this is no longer necessary. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif +#include +#include +#include #include +#ifndef HAVE_RANDR_12 +# undef HAVE_RANDR /* RANDR 1.1 is no longer supported */ +#endif + #ifdef HAVE_RANDR # include #endif /* HAVE_RANDR */ @@ -132,37 +131,14 @@ # include #endif /* HAVE_XF86VMODE */ -/* This file doesn't need the Xt headers, so stub these types out... */ -#undef XtPointer -#define XtAppContext void* -#define XrmDatabase void* -#define XtIntervalId void* -#define XtPointer void* -#define Widget void* - -#include "xscreensaver.h" -#include "visual.h" - - -typedef enum { S_SANE, S_ENCLOSED, S_DUPLICATE, S_OVERLAP, - S_OFFSCREEN, S_DISABLED } monitor_sanity; - -/* 'typedef monitor' is in types.h */ -struct _monitor { - int id; - char *desc; - Screen *screen; - int x, y, width, height; - monitor_sanity sanity; /* I'm not crazy you're the one who's crazy */ - int enemy; /* which monitor it overlaps or duplicates */ - char *err; /* msg to print at appropriate later time; - exists only on monitor #0. */ -}; +#include "blurb.h" +#include "screens.h" -static Bool layouts_differ_p (monitor **a, monitor **b); +#undef countof +#define countof(x) (sizeof((x))/sizeof((*x))) -static void +void free_monitors (monitor **monitors) { monitor **m2 = monitors; @@ -231,122 +207,6 @@ xinerama_scan_monitors (Display *dpy, char **errP) #endif /* HAVE_XINERAMA */ -#ifdef HAVE_XF86VMODE - -static monitor ** -vidmode_scan_monitors (Display *dpy, char **errP) -{ - int event, error, nscreens, i; - monitor **monitors; - - /* Note that XF86VidModeGetViewPort() tends to be full of lies on laptops - that have a docking station or external monitor that runs in a different - resolution than the laptop's screen: - - http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=81593 - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=208417 - http://bugs.xfree86.org/show_bug.cgi?id=421 - - Presumably this is fixed by using RANDR instead of VidMode. - */ - -# ifdef HAVE_XINERAMA - /* Attempts to use the VidMode extension when the Xinerama extension is - active can result in a server crash! Yay! */ - if (XQueryExtension (dpy, "XINERAMA", &error, &event, &error)) - return 0; -# endif /* !HAVE_XINERAMA */ - - if (! XF86VidModeQueryExtension (dpy, &event, &error)) - return 0; - - nscreens = ScreenCount (dpy); - monitors = (monitor **) calloc (nscreens + 1, sizeof(*monitors)); - if (!monitors) return 0; - - for (i = 0; i < nscreens; i++) - { - monitor *m = (monitor *) calloc (1, sizeof (monitor)); - XF86VidModeModeLine ml; - int dot; - Screen *screen = ScreenOfDisplay (dpy, i); - - monitors[i] = m; - m->id = i; - m->screen = screen; - - if (! safe_XF86VidModeGetViewPort (dpy, i, &m->x, &m->y)) - m->x = m->y = -1; - - if (XF86VidModeGetModeLine (dpy, i, &dot, &ml)) - { - m->width = ml.hdisplay; - m->height = ml.vdisplay; - } - - /* On a system that has VidMode but does not have RANDR, and that has - "Option Rotate" set, WidthOfScreen/HeightOfScreen are the rotated - size, but XF86VidModeModeLine contains the unrotated size. - Maybe there's something in 'flags' that indicates this? - Or, we can just notice that the aspect ratios are inverted: - */ - if (m->width > 0 && - m->height > 0 && - ((m->width > m->height) != - (WidthOfScreen(screen) > HeightOfScreen(screen)))) - { - int swap = m->width; - m->width = m->height; - m->height = swap; - } - - - /* Apparently, though the server stores the X position in increments of - 1 pixel, it will only make changes to the *display* in some other - increment. With XF86_SVGA on a Thinkpad, the display only updates - in multiples of 8 pixels when in 8-bit mode, and in multiples of 4 - pixels in 16-bit mode. I don't know what it does in 24- and 32-bit - mode, because I don't have enough video memory to find out. - - I consider it a bug that XF86VidModeGetViewPort() is telling me the - server's *target* scroll position rather than the server's *actual* - scroll position. David Dawes agrees, and says they may fix this in - XFree86 4.0, but it's nontrivial. - - He also confirms that this behavior is server-dependent, so the - actual scroll position cannot be reliably determined by the client. - So... that means the only solution is to provide a ``sandbox'' - around the blackout window -- we make the window be up to N pixels - larger than the viewport on both the left and right sides. That - means some part of the outer edges of each hack might not be - visible, but screw it. - - I'm going to guess that 16 pixels is enough, and that the Y dimension - doesn't have this problem. - - The drawback of doing this, of course, is that some of the screenhacks - will still look pretty stupid -- for example, "slidescreen" will cut - off the left and right edges of the grid, etc. - */ -# define FUDGE 16 - if (m->x > 0 && m->x < m->width - ml.hdisplay) - { - /* Not at left edge or right edge: - Round X position down to next lower multiple of FUDGE. - Increase width by 2*FUDGE in case some server rounds up. - */ - m->x = ((m->x - 1) / FUDGE) * FUDGE; - m->width += (FUDGE * 2); - } -# undef FUDGE - } - - return monitors; -} - -#endif /* HAVE_XF86VMODE */ - - #ifdef HAVE_RANDR static monitor ** @@ -354,7 +214,6 @@ randr_scan_monitors (Display *dpy, char **errP) { int event, error, major, minor, nscreens, i, j; monitor **monitors; - Bool new_randr_p = False; if (! XRRQueryExtension (dpy, &event, &error)) return 0; @@ -362,30 +221,17 @@ randr_scan_monitors (Display *dpy, char **errP) if (! XRRQueryVersion (dpy, &major, &minor)) return 0; - if (major <= 0) /* Protocol was still in flux back then -- fuck it. */ - return 0; - -# ifdef HAVE_RANDR_12 - new_randr_p = (major > 1 || (major == 1 && minor >= 2)); -# endif + if (! (major > 1 || (major == 1 && minor >= 2))) + return 0; /* 1.2 ir newer is required */ - if (! new_randr_p) - /* RANDR 1.0 -- no Xinerama-like virtual screens. */ - nscreens = ScreenCount (dpy); - else /* RANDR 1.2 or newer -- built-in Xinerama */ + /* Add up the virtual screens on each X screen. */ + nscreens = 0; + for (i = 0; i < ScreenCount (dpy); i++) { -# ifdef HAVE_RANDR_12 - int xsc = ScreenCount (dpy); - nscreens = 0; - /* Add up the virtual screens on each X screen. */ - for (i = 0; i < xsc; i++) - { - XRRScreenResources *res = - XRRGetScreenResources (dpy, RootWindow (dpy, i)); - nscreens += res->noutput; - XRRFreeScreenResources (res); - } -# endif /* HAVE_RANDR_12 */ + XRRScreenResources *res = + XRRGetScreenResources (dpy, RootWindow (dpy, i)); + nscreens += res->noutput; + XRRFreeScreenResources (res); } if (nscreens <= 0) @@ -401,88 +247,43 @@ randr_scan_monitors (Display *dpy, char **errP) for (i = 0, j = 0; i < ScreenCount (dpy); i++) { Screen *screen = ScreenOfDisplay (dpy, i); - - if (! new_randr_p) /* RANDR 1.0 */ + int k; + XRRScreenResources *res = + XRRGetScreenResources (dpy, RootWindowOfScreen (screen)); + for (k = 0; k < res->noutput; k++, j++) { - XRRScreenConfiguration *rrc; monitor *m = (monitor *) calloc (1, sizeof (monitor)); - monitors[i] = m; + XRROutputInfo *rroi = XRRGetOutputInfo (dpy, res, + res->outputs[k]); + RRCrtc crtc = (rroi->crtc ? rroi->crtc : + rroi->ncrtc ? rroi->crtcs[0] : 0); + XRRCrtcInfo *crtci = (crtc ? XRRGetCrtcInfo(dpy, res, crtc) : 0); + + monitors[j] = m; m->screen = screen; - m->id = i; + m->id = (i * 1000) + j; + m->desc = (rroi->name ? strdup (rroi->name) : 0); - rrc = XRRGetScreenInfo (dpy, RootWindowOfScreen (screen)); - if (rrc) + if (crtci) { - SizeID size = -1; - Rotation rot = ~0; - XRRScreenSize *rrsizes; - int nsizes = 0; - - size = XRRConfigCurrentConfiguration (rrc, &rot); - rrsizes = XRRConfigSizes (rrc, &nsizes); - - if (nsizes <= 0) /* WTF? Shouldn't happen but does. */ - { - m->width = DisplayWidth (dpy, i); - m->height = DisplayHeight (dpy, i); - } - else if (rot & (RR_Rotate_90|RR_Rotate_270)) - { - m->width = rrsizes[size].height; - m->height = rrsizes[size].width; - } - else - { - m->width = rrsizes[size].width; - m->height = rrsizes[size].height; - } - - /* don't free 'rrsizes' */ - XRRFreeScreenConfigInfo (rrc); + /* Note: if the screen is rotated, XRRConfigSizes contains + the unrotated WxH, but XRRCrtcInfo contains rotated HxW. + */ + m->x = crtci->x; + m->y = crtci->y; + m->width = crtci->width; + m->height = crtci->height; } - } - else /* RANDR 1.2 or newer */ - { -# ifdef HAVE_RANDR_12 - int k; - XRRScreenResources *res = - XRRGetScreenResources (dpy, RootWindowOfScreen (screen)); - for (k = 0; k < res->noutput; k++, j++) - { - monitor *m = (monitor *) calloc (1, sizeof (monitor)); - XRROutputInfo *rroi = XRRGetOutputInfo (dpy, res, - res->outputs[k]); - RRCrtc crtc = (rroi->crtc ? rroi->crtc : - rroi->ncrtc ? rroi->crtcs[0] : 0); - XRRCrtcInfo *crtci = (crtc ? XRRGetCrtcInfo(dpy, res, crtc) : 0); - - monitors[j] = m; - m->screen = screen; - m->id = (i * 1000) + j; - m->desc = (rroi->name ? strdup (rroi->name) : 0); - - if (crtci) - { - /* Note: if the screen is rotated, XRRConfigSizes contains - the unrotated WxH, but XRRCrtcInfo contains rotated HxW. - */ - m->x = crtci->x; - m->y = crtci->y; - m->width = crtci->width; - m->height = crtci->height; - } - if (rroi->connection == RR_Disconnected) - m->sanity = S_DISABLED; - /* #### do the same for RR_UnknownConnection? */ + if (rroi->connection == RR_Disconnected) + m->sanity = S_DISABLED; + /* #### do the same for RR_UnknownConnection? */ - if (crtci) - XRRFreeCrtcInfo (crtci); - XRRFreeOutputInfo (rroi); - } - XRRFreeScreenResources (res); -# endif /* HAVE_RANDR_12 */ + if (crtci) + XRRFreeCrtcInfo (crtci); + XRRFreeOutputInfo (rroi); } + XRRFreeScreenResources (res); } /* Work around more fucking brain damage. */ @@ -566,7 +367,7 @@ randr_versus_xinerama_fight (Display *dpy, monitor **randr_monitors, if (!xinerama_monitors) return randr_monitors; - if (! layouts_differ_p (randr_monitors, xinerama_monitors)) + if (! monitor_layouts_differ_p (randr_monitors, xinerama_monitors)) { free_monitors (xinerama_monitors); return randr_monitors; @@ -582,9 +383,8 @@ randr_versus_xinerama_fight (Display *dpy, monitor **randr_monitors, } else { - *errP = append (*errP, - "WARNING: RANDR and Xinerama report different\n" - " screen layouts! Believing RANDR."); + *errP = append (*errP, /* This is "normal" now, I guess. */ + "RANDR and Xinerama report different screen layouts"); free_monitors (xinerama_monitors); return randr_monitors; } @@ -642,7 +442,6 @@ debug_scan_monitors (Display *dpy, char **errP) index = (index+1) % countof(geoms); return monitors; } - #endif /* DEBUG_MULTISCREEN */ @@ -683,42 +482,36 @@ quadruple (monitor **monitors, Bool debug_p, char **errP) #endif /* QUAD_MODE */ -static monitor ** -scan_monitors (saver_info *si) +monitor ** +scan_monitors (Display *dpy) { - saver_preferences *p = &si->prefs; monitor **monitors = 0; char *err = 0; # ifdef DEBUG_MULTISCREEN - if (! monitors) monitors = debug_scan_monitors (si->dpy, &err); + if (! monitors) monitors = debug_scan_monitors (dpy, &err); # endif # ifdef HAVE_RANDR - if (! p->getviewport_full_of_lies_p) - if (! monitors) monitors = randr_scan_monitors (si->dpy, &err); + if (! monitors) monitors = randr_scan_monitors (dpy, &err); # ifdef HAVE_XINERAMA - monitors = randr_versus_xinerama_fight (si->dpy, monitors, &err); + monitors = randr_versus_xinerama_fight (dpy, monitors, &err); # endif # endif /* HAVE_RANDR */ -# ifdef HAVE_XF86VMODE - if (! monitors) monitors = vidmode_scan_monitors (si->dpy, &err); -# endif - # ifdef HAVE_XINERAMA - if (! monitors) monitors = xinerama_scan_monitors (si->dpy, &err); + if (! monitors) monitors = xinerama_scan_monitors (dpy, &err); # endif - if (! monitors) monitors = basic_scan_monitors (si->dpy, &err); + if (! monitors) monitors = basic_scan_monitors (dpy, &err); # ifdef QUAD_MODE if (p->quad_p) monitors = quadruple (monitors, p->debug_p, &err); # endif - if (monitors && err) monitors[0]->err = err; + if (monitors && *monitors && err) monitors[0]->err = err; return monitors; } @@ -778,7 +571,7 @@ plausible_aspect_ratio_p (monitor **monitors) /* Mark the ones that overlap, etc. */ -static void +void check_monitor_sanity (monitor **monitors) { int i, j, count = 0; @@ -862,8 +655,8 @@ check_monitor_sanity (monitor **monitors) } -static Bool -layouts_differ_p (monitor **a, monitor **b) +Bool +monitor_layouts_differ_p (monitor **a, monitor **b) { if (!a || !b) return True; while (1) @@ -886,10 +679,21 @@ layouts_differ_p (monitor **a, monitor **b) } +static int +screen_number (Screen *screen) +{ + Display *dpy = DisplayOfScreen (screen); + int i; + for (i = 0; i < ScreenCount (dpy); i++) + if (ScreenOfDisplay (dpy, i) == screen) + return i; + return 0; +} + + void -describe_monitor_layout (saver_info *si) +describe_monitor_layout (monitor **monitors) { - monitor **monitors = si->monitor_layout; int count = 0; int good_count = 0; int bad_count = 0; @@ -904,7 +708,7 @@ describe_monitor_layout (saver_info *si) count++; } - if (monitors[0]->err) /* deferred error msg */ + if (monitors && *monitors && monitors[0]->err) /* deferred error msg */ { char *token = strtok (monitors[0]->err, "\n"); while (token) @@ -980,115 +784,3 @@ describe_monitor_layout (saver_info *si) blurb()); } } - - -/* Synchronize the contents of si->ssi to the current state of the monitors. - Doesn't change anything if nothing has changed; otherwise, alters and - reuses existing saver_screen_info structs as much as possible. - Returns True if anything changed. - */ -Bool -update_screen_layout (saver_info *si) -{ - monitor **monitors = scan_monitors (si); - int count = 0; - int good_count = 0; - int i, j; - int seen_screens[100] = { 0, }; - - if (! layouts_differ_p (monitors, si->monitor_layout)) - { - free_monitors (monitors); - return False; - } - - free_monitors (si->monitor_layout); - si->monitor_layout = monitors; - check_monitor_sanity (si->monitor_layout); - - while (monitors[count]) - { - if (monitors[count]->sanity == S_SANE) - good_count++; - count++; - } - - if (si->ssi_count == 0) - { - si->ssi_count = 10; - si->screens = (saver_screen_info *) - calloc (sizeof(*si->screens), si->ssi_count); - } - - if (si->ssi_count <= good_count) - { - si->ssi_count = good_count + 10; - si->screens = (saver_screen_info *) - realloc (si->screens, sizeof(*si->screens) * si->ssi_count); - memset (si->screens + si->nscreens, 0, - sizeof(*si->screens) * (si->ssi_count - si->nscreens)); - } - - if (! si->screens) abort(); - - si->nscreens = good_count; - - /* Regenerate the list of GL visuals as needed. */ - if (si->best_gl_visuals) - free (si->best_gl_visuals); - si->best_gl_visuals = 0; - - for (i = 0, j = 0; i < count; i++) - { - monitor *m = monitors[i]; - saver_screen_info *ssi = &si->screens[j]; - Screen *old_screen = ssi->screen; - int sn; - if (monitors[i]->sanity != S_SANE) continue; - - ssi->global = si; - ssi->number = j; - - sn = screen_number (m->screen); - ssi->screen = m->screen; - ssi->real_screen_number = sn; - ssi->real_screen_p = (seen_screens[sn] == 0); - seen_screens[sn]++; - - ssi->default_visual = - get_visual_resource (ssi->screen, "visualID", "VisualID", False); - ssi->current_visual = ssi->default_visual; - ssi->current_depth = visual_depth (ssi->screen, ssi->current_visual); - - /* If the screen changed (or if this is the first time) we need - a new toplevel shell for this screen's depth. - */ - if (ssi->screen != old_screen) - initialize_screen_root_widget (ssi); - - ssi->last_poll_mouse.root_x = -1; - ssi->last_poll_mouse.root_y = -1; - - ssi->x = m->x; - ssi->y = m->y; - ssi->width = m->width; - ssi->height = m->height; - -# ifndef DEBUG_MULTISCREEN - { - saver_preferences *p = &si->prefs; - if (p->debug_p -# ifdef QUAD_MODE - && !p->quad_p -# endif - ) - ssi->width /= 2; - } -# endif - - j++; - } - - si->default_screen = &si->screens[0]; - return True; -} diff --git a/driver/screens.h b/driver/screens.h new file mode 100644 index 0000000..1e3501c --- /dev/null +++ b/driver/screens.h @@ -0,0 +1,37 @@ +/* xscreensaver, Copyright © 1993-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifndef __XSCREENSAVER_SCREENS_H__ +#define __XSCREENSAVER_SCREENS_H__ + +typedef struct _monitor monitor; + +typedef enum { S_SANE, S_ENCLOSED, S_DUPLICATE, S_OVERLAP, + S_OFFSCREEN, S_DISABLED } monitor_sanity; + +struct _monitor { + int id; + char *desc; + Screen *screen; + int x, y, width, height; + monitor_sanity sanity; /* I'm not crazy you're the one who's crazy */ + int enemy; /* which monitor it overlaps or duplicates */ + char *err; /* msg to print at appropriate later time; + exists only on monitor #0. */ +}; + +extern monitor **scan_monitors (Display *); +extern Bool monitor_layouts_differ_p (monitor **a, monitor **b); +extern void free_monitors (monitor **monitors); +extern void describe_monitor_layout (monitor **monitors); +extern void check_monitor_sanity (monitor **monitors); + +#endif /* __XSCREENSAVER_SCREENS_H__ */ diff --git a/driver/screensaver-properties.desktop.in b/driver/screensaver-properties.desktop.in index de42527..9cc17e6 100644 --- a/driver/screensaver-properties.desktop.in +++ b/driver/screensaver-properties.desktop.in @@ -1,5 +1,5 @@ [Desktop Entry] -Exec=xscreensaver-demo +Exec=xscreensaver-settings Icon=xscreensaver Terminal=false _Name=Screensaver diff --git a/driver/setuid.c b/driver/setuid.c index 3ac78e4..164576f 100644 --- a/driver/setuid.c +++ b/driver/setuid.c @@ -1,5 +1,5 @@ /* setuid.c --- management of runtime privileges. - * xscreensaver, Copyright (c) 1993-1998, 2005 Jamie Zawinski + * xscreensaver, Copyright © 1993-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -14,24 +14,20 @@ # include "config.h" #endif -#include /* not used for much... */ - -/* This file doesn't need the Xt headers, so stub these types out... */ -#undef XtPointer -#define XtAppContext void* -#define XrmDatabase void* -#define XtIntervalId void* -#define XtPointer void* -#define Widget void* - -#include "xscreensaver.h" - -#ifndef EPERM -#include +#include +#include +#ifdef HAVE_UNISTD_H +# include #endif +#include #include /* for getpwnam() and struct passwd */ #include /* for getgrgid() and struct group */ +#include + +#include "blurb.h" +#include "auth.h" + static const char * uid_gid_string (uid_t uid, gid_t gid) @@ -49,31 +45,6 @@ uid_gid_string (uid_t uid, gid_t gid) } -void -describe_uids (saver_info *si, FILE *out) -{ - uid_t uid = getuid(); - gid_t gid = getgid(); - uid_t euid = geteuid(); - gid_t egid = getegid(); - char *s1 = strdup (uid_gid_string (uid, gid)); - char *s2 = strdup (uid_gid_string (euid, egid)); - - if (si->orig_uid && *si->orig_uid && - (!!strcmp (si->orig_uid, s1) || - !!strcmp (si->orig_uid, s2))) - fprintf (out, "%s: initial effective uid/gid was %s\n", blurb(), - si->orig_uid); - - fprintf (out, "%s: running as %s", blurb(), s1); - if (uid != euid || gid != egid) - fprintf (out, "; effectively %s", s2); - fprintf(out, "\n"); - free(s1); - free(s2); -} - - /* Returns true if we need to call setgroups(). Without calling setgroups(), the process will retain any supplementary @@ -113,7 +84,7 @@ setgroups_needed_p (uid_t target_group) static int -set_ids_by_number (uid_t uid, gid_t gid, char **message_ret) +set_ids_by_number (uid_t uid, gid_t gid) { int uid_errno = 0; int gid_errno = 0; @@ -121,9 +92,6 @@ set_ids_by_number (uid_t uid, gid_t gid, char **message_ret) struct passwd *p = getpwuid (uid); struct group *g = getgrgid (gid); - if (message_ret) - *message_ret = 0; - /* Rumor has it that some implementations of of setuid() do nothing when called with -1; therefore, if the "nobody" user has a uid of -1, then that would be Really Bad. Rumor further has it that such @@ -150,13 +118,12 @@ set_ids_by_number (uid_t uid, gid_t gid, char **message_ret) if (uid_errno == 0 && gid_errno == 0 && sgs_errno == 0) { - static char buf [1024]; - sprintf (buf, "changed uid/gid to %.100s/%.100s (%ld/%ld).", - (p && p->pw_name ? p->pw_name : "???"), - (g && g->gr_name ? g->gr_name : "???"), - (long) uid, (long) gid); - if (message_ret) - *message_ret = buf; + if (verbose_p) + fprintf (stderr, "%s: changed uid/gid to %.100s/%.100s (%ld/%ld)\n", + blurb(), + (p && p->pw_name ? p->pw_name : "???"), + (g && g->gr_name ? g->gr_name : "???"), + (long) uid, (long) gid); return 0; } else @@ -176,7 +143,7 @@ set_ids_by_number (uid_t uid, gid_t gid, char **message_ret) else { errno = sgs_errno; - perror(buf); + perror (buf); } fprintf (stderr, "%s: effective group list: ", blurb()); @@ -206,11 +173,11 @@ set_ids_by_number (uid_t uid, gid_t gid, char **message_ret) (g && g->gr_name ? g->gr_name : "???"), (long) gid); if (gid_errno == -1) - fprintf(stderr, "%s: unknown error\n", buf); + fprintf (stderr, "%s: unknown error\n", buf); else { errno = gid_errno; - perror(buf); + perror (buf); } } @@ -241,121 +208,63 @@ set_ids_by_number (uid_t uid, gid_t gid, char **message_ret) lock-mode.) *** WARNING: DO NOT DISABLE ANY OF THE FOLLOWING CODE! - If you do so, you will open a security hole. See the sections - of the xscreensaver manual titled "LOCKING AND ROOT LOGINS", - and "USING XDM". + If you do so, you will open a security hole. + Do not log in to an X11 desktop as root. + Log in as a normal users and 'sudo' as needed. */ void -hack_uid (saver_info *si) +disavow_privileges (void) { + uid_t euid = geteuid(); + gid_t egid = getegid(); + uid_t uid = getuid(); + gid_t gid = getgid(); + struct passwd *p; - /* Discard privileges, and set the effective user/group ids to the - real user/group ids. That is, give up our "chmod +s" rights. - */ - { - uid_t euid = geteuid(); - gid_t egid = getegid(); - uid_t uid = getuid(); - gid_t gid = getgid(); - - si->orig_uid = strdup (uid_gid_string (euid, egid)); - - if (uid != euid || gid != egid) - if (set_ids_by_number (uid, gid, &si->uid_message) != 0) - saver_exit (si, 1, 0); - } - - - /* Locking can't work when running as root, because we have no way of - knowing what the user id of the logged in user is (so we don't know - whose password to prompt for.) - - *** WARNING: DO NOT DISABLE THIS CODE! - If you do so, you will open a security hole. See the sections - of the xscreensaver manual titled "LOCKING AND ROOT LOGINS", - and "USING XDM". - */ - if (getuid() == (uid_t) 0) + if (uid != euid || gid != egid) { - si->locking_disabled_p = True; - si->nolock_reason = "running as root"; + if (verbose_p) + fprintf (stderr, "%s: initial effective uid/gid was %s\n", blurb(), + uid_gid_string (euid, egid)); + if (set_ids_by_number (uid, gid) != 0) + exit (1); /* already printed error */ } - - /* If we're running as root, switch to a safer user. This is above and - beyond the fact that we've disabling locking, above -- the theory is - that running graphics demos as root is just always a stupid thing - to do, since they have probably never been security reviewed and are - more likely to be buggy than just about any other kind of program. - (And that assumes non-malicious code. There are also attacks here.) - - *** WARNING: DO NOT DISABLE THIS CODE! - If you do so, you will open a security hole. See the sections - of the xscreensaver manual titled "LOCKING AND ROOT LOGINS", - and "USING XDM". + /* If we're still running as root, or if the user we are running at seems + to be in any way hinky, exit and do not allow password authentication + to continue. */ - if (getuid() == (uid_t) 0) - { - struct passwd *p; - - p = getpwnam ("nobody"); - if (! p) p = getpwnam ("noaccess"); - if (! p) p = getpwnam ("daemon"); - if (! p) - { - fprintf (stderr, - "%s: running as root, and couldn't find a safer uid.\n", - blurb()); - saver_exit(si, 1, 0); - } + uid = getuid (); /* get it again */ + p = getpwuid (uid); - if (set_ids_by_number (p->pw_uid, p->pw_gid, &si->uid_message) != 0) - saver_exit (si, -1, 0); + if (!p || + uid == (uid_t) 0 || + uid == (uid_t) -1 || + uid == (uid_t) -2 || + p->pw_uid == (uid_t) 0 || + p->pw_uid == (uid_t) -1 || + p->pw_uid == (uid_t) -2 || + !p->pw_name || + !*p->pw_name || + !strcmp (p->pw_name, "root") || + !strcmp (p->pw_name, "nobody") || + !strcmp (p->pw_name, "noaccess") || + !strcmp (p->pw_name, "operator") || + !strcmp (p->pw_name, "daemon") || + !strcmp (p->pw_name, "bin") || + !strcmp (p->pw_name, "adm") || + !strcmp (p->pw_name, "sys") || + !strcmp (p->pw_name, "games")) + { + fprintf (stderr, + "%s: running as user \"%s\" -- authentication disallowed\n", + blurb(), + (p && p->pw_name && *p->pw_name + ? p->pw_name + : "")); + exit (1); } - - /* If there's anything even remotely funny looking about the passwd struct, - or if we're running as some other user from the list below (a - non-comprehensive selection of users known to be privileged in some way, - and not normal end-users) then disable locking. If it was possible, - switching to "nobody" would be the thing to do, but only root itself has - the privs to do that. - - *** WARNING: DO NOT DISABLE THIS CODE! - If you do so, you will open a security hole. See the sections - of the xscreensaver manual titled "LOCKING AND ROOT LOGINS", - and "USING XDM". - */ - { - uid_t uid = getuid (); /* get it again */ - struct passwd *p = getpwuid (uid); /* get it again */ - - if (!p || - uid == (uid_t) 0 || - uid == (uid_t) -1 || - uid == (uid_t) -2 || - p->pw_uid == (uid_t) 0 || - p->pw_uid == (uid_t) -1 || - p->pw_uid == (uid_t) -2 || - !p->pw_name || - !*p->pw_name || - !strcmp (p->pw_name, "root") || - !strcmp (p->pw_name, "nobody") || - !strcmp (p->pw_name, "noaccess") || - !strcmp (p->pw_name, "operator") || - !strcmp (p->pw_name, "daemon") || - !strcmp (p->pw_name, "bin") || - !strcmp (p->pw_name, "adm") || - !strcmp (p->pw_name, "sys") || - !strcmp (p->pw_name, "games")) - { - static char buf [1024]; - sprintf (buf, "running as %.100s", - (p && p->pw_name && *p->pw_name - ? p->pw_name : "")); - si->nolock_reason = buf; - si->locking_disabled_p = True; - si->dangerous_uid_p = True; - } - } + if (verbose_p) + fprintf (stderr, "%s: running as user \"%s\"\n", blurb(), p->pw_name); } diff --git a/driver/subprocs.c b/driver/subprocs.c index e251842..2b3453d 100644 --- a/driver/subprocs.c +++ b/driver/subprocs.c @@ -1,5 +1,5 @@ /* subprocs.c --- choosing, spawning, and killing screenhacks. - * xscreensaver, Copyright (c) 1991-2019 Jamie Zawinski + * xscreensaver, Copyright © 1991-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -19,6 +19,8 @@ #include #include /* not used for much... */ +#include +#include /* For XtAppAddSignal */ #ifndef ESRCH # include @@ -35,169 +37,23 @@ # include /* for setrlimit() and RLIMIT_AS */ #endif -#ifdef VMS -# include -# include /* for close */ -# include /* for getpid */ -# define pid_t int -# define fork vfork -#endif /* VMS */ - #include /* for the signal names */ #include -#if !defined(SIGCHLD) && defined(SIGCLD) -# define SIGCHLD SIGCLD -#endif - -#if 0 /* putenv() is declared in stdlib.h on modern linux systems. */ -#ifdef HAVE_PUTENV -extern int putenv (/* const char * */); /* getenv() is in stdlib.h... */ -#endif +#ifdef ENABLE_NLS +# include +# include +# define _(S) gettext(S) +#else +# define _(S) (S) #endif -extern int kill (pid_t, int); /* signal() is in sys/signal.h... */ - -/* This file doesn't need the Xt headers, so stub these types out... */ -#undef XtPointer -#define XtAppContext void* -#define XrmDatabase void* -#define XtIntervalId void* -#define XtPointer void* -#define Widget void* - #include "xscreensaver.h" #include "exec.h" #include "yarandom.h" -#include "visual.h" /* for id_to_visual() */ - -extern saver_info *global_si_kludge; /* I hate C so much... */ - - -/* Used when printing error/debugging messages from signal handlers. - */ -static const char * -no_malloc_number_to_string (long num) -{ - static char string[128] = ""; - int num_digits; - Bool negative_p = False; - - num_digits = 0; - - if (num == 0) - return "0"; - - if (num < 0) - { - negative_p = True; - num = -num; - } - - while ((num > 0) && (num_digits < sizeof(string) - 1)) - { - int digit; - digit = (int) num % 10; - num_digits++; - string[sizeof(string) - 1 - num_digits] = digit + '0'; - num /= 10; - } - - if (negative_p) - { - num_digits++; - string[sizeof(string) - 1 - num_digits] = '-'; - } - - return string + sizeof(string) - 1 - num_digits; -} - -/* Like write(), but runs strlen() on the arg to get the length. */ -static int -write_string (int fd, const char *str) -{ - return write (fd, str, strlen (str)); -} - -static int -write_long (int fd, long n) -{ - const char *str = no_malloc_number_to_string (n); - return write_string (fd, str); -} - - -/* RLIMIT_AS (called RLIMIT_VMEM on some systems) controls the maximum size - of a process's address space, i.e., the maximal brk(2) and mmap(2) values. - Setting this lets you put a cap on how much memory a process can allocate. - - Except the "and mmap()" part kinda makes this useless, since many GL - implementations end up using mmap() to pull the whole frame buffer into - memory (or something along those lines) making it appear processes are - using hundreds of megabytes when in fact they're using very little, and - we end up capping their mallocs prematurely. YAY! - */ -#if defined(RLIMIT_VMEM) && !defined(RLIMIT_AS) -# define RLIMIT_AS RLIMIT_VMEM -#endif - -static void -limit_subproc_memory (int address_space_limit, Bool verbose_p) -{ - -/* This has caused way more problems than it has solved... - Let's just completely ignore the "memoryLimit" option now. - */ -#undef HAVE_SETRLIMIT - -#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_AS) - struct rlimit r; - - if (address_space_limit < 10 * 1024) /* let's not be crazy */ - return; - - if (getrlimit (RLIMIT_AS, &r) != 0) - { - char buf [512]; - sprintf (buf, "%s: getrlimit(RLIMIT_AS) failed", blurb()); - perror (buf); - return; - } - - r.rlim_cur = address_space_limit; - - if (setrlimit (RLIMIT_AS, &r) != 0) - { - char buf [512]; - sprintf (buf, "%s: setrlimit(RLIMIT_AS, {%lu, %lu}) failed", - blurb(), r.rlim_cur, r.rlim_max); - perror (buf); - return; - } - - if (verbose_p) - { - int i = address_space_limit; - char buf[100]; - if (i >= (1<<30) && i == ((i >> 30) << 30)) - sprintf(buf, "%dG", i >> 30); - else if (i >= (1<<20) && i == ((i >> 20) << 20)) - sprintf(buf, "%dM", i >> 20); - else if (i >= (1<<10) && i == ((i >> 10) << 10)) - sprintf(buf, "%dK", i >> 10); - else - sprintf(buf, "%d bytes", i); - - fprintf (stderr, "%s: limited pid %lu address space to %s.\n", - blurb(), (unsigned long) getpid (), buf); - } +#include "visual.h" /* for id_to_visual() */ +#include "atoms.h" -#endif /* HAVE_SETRLIMIT && RLIMIT_AS */ -} - - -/* Management of child processes, and de-zombification. - */ enum job_status { job_running, /* the process is still alive */ @@ -220,10 +76,107 @@ struct screenhack_job { static struct screenhack_job *jobs = 0; -/* for debugging -- nothing calls this, but it's useful to invoke from gdb. +static void clean_job_list (void); +static void await_dying_children (saver_info *si); +static void describe_dead_child (saver_info *, pid_t, int wait_status, + struct rusage); + +static XtSignalId xt_sigterm_id = 0; +static int sigterm_received = 0; + +static XtSignalId xt_sigchld_id = 0; +static int sigchld_received = 0; + + +const char * +signal_name (int signal) +{ + /* sys_signame[], sys_siglist[], strsignal() and sigabbrev_np() + are an unportable mess. */ + switch (signal) { + case SIGHUP: return "SIGHUP"; + case SIGINT: return "SIGINT"; + case SIGQUIT: return "SIGQUIT"; + case SIGILL: return "SIGILL"; + case SIGTRAP: return "SIGTRAP"; +#ifdef SIGABRT + case SIGABRT: return "SIGABRT"; +#endif + case SIGFPE: return "SIGFPE"; + case SIGKILL: return "SIGKILL"; + case SIGBUS: return "SIGBUS"; + case SIGSEGV: return "SIGSEGV"; + case SIGPIPE: return "SIGPIPE"; + case SIGALRM: return "SIGALRM"; + case SIGTERM: return "SIGTERM"; +#ifdef SIGSTOP + case SIGSTOP: return "SIGSTOP"; +#endif +#ifdef SIGCONT + case SIGCONT: return "SIGCONT"; +#endif +#ifdef SIGUSR1 + case SIGUSR1: return "SIGUSR1"; +#endif +#ifdef SIGUSR2 + case SIGUSR2: return "SIGUSR2"; +#endif +#ifdef SIGEMT + case SIGEMT: return "SIGEMT"; +#endif +#ifdef SIGSYS + case SIGSYS: return "SIGSYS"; +#endif + case SIGCHLD: return "SIGCHLD"; +#ifdef SIGPWR + case SIGPWR: return "SIGPWR"; +#endif +#ifdef SIGWINCH + case SIGWINCH: return "SIGWINCH"; +#endif +#ifdef SIGURG + case SIGURG: return "SIGURG"; +#endif +#ifdef SIGIO + case SIGIO: return "SIGIO"; +#endif +#ifdef SIGVTALRM + case SIGVTALRM: return "SIGVTALRM"; +#endif +#ifdef SIGXCPU + case SIGXCPU: return "SIGXCPU"; +#endif +#ifdef SIGXFSZ + case SIGXFSZ: return "SIGXFSZ"; +#endif +#ifdef SIGDANGER + case SIGDANGER: return "SIGDANGER"; +#endif + default: + { + static char buf[50]; + sprintf(buf, "signal %d\n", signal); + return buf; + } + } +} + + +/* Management of child processes, and de-zombification. */ -void show_job_list (void); +static char * +timestring (time_t when) +{ + static char buf[255] = { 0 }; + struct tm tm; + localtime_r (&when, &tm); + sprintf (buf, "%02d:%02d:%02d", tm.tm_hour, tm.tm_min, tm.tm_sec); + return buf; +} + +#ifdef DEBUG +void show_job_list (void); void show_job_list (void) { @@ -231,27 +184,24 @@ show_job_list (void) fprintf(stderr, "%s: job list:\n", blurb()); for (job = jobs; job; job = job->next) { - char b[] = " ??:??:?? "; - char *t = (job->killed ? timestring (job->killed) : - job->launched ? timestring (job->launched) : b); - t += 11; - t[8] = 0; - fprintf (stderr, " %5ld: %2d: (%s) %s %s\n", - (long) job->pid, - job->screen, - (job->status == job_running ? "running" : - job->status == job_stopped ? "stopped" : - job->status == job_killed ? " killed" : - job->status == job_dead ? " dead" : " ???"), - t, job->name); + fprintf (stderr, " %5ld: %2d: (%s) %s %s\n", + (long) job->pid, + job->screen, + (job->status == job_running ? "running" : + job->status == job_stopped ? "stopped" : + job->status == job_killed ? " killed" : + job->status == job_dead ? " dead" : " ???"), + (job->killed ? timestring (job->killed) : + job->launched ? timestring (job->launched) : + "??:??:??"), + job->name); } fprintf (stderr, "\n"); } +#endif /* DEBUG */ -static void clean_job_list (void); - -static struct screenhack_job * +static void make_job (pid_t pid, int screen, const char *cmd) { struct screenhack_job *job = (struct screenhack_job *) malloc (sizeof(*job)); @@ -288,8 +238,6 @@ make_job (pid_t pid, int screen, const char *cmd) job->killed = 0; job->next = jobs; jobs = job; - - return jobs; } @@ -317,8 +265,7 @@ free_job (struct screenhack_job *job) } -/* Cleans out dead jobs from the jobs list -- this must only be called - from the main thread, not from a signal handler. +/* Cleans out dead jobs from the jobs list. */ static void clean_job_list (void) @@ -367,79 +314,8 @@ find_job (pid_t pid) return 0; } -static void await_dying_children (saver_info *si); -#ifndef VMS -static void describe_dead_child (saver_info *, pid_t, int wait_status); -#endif - - -/* Semaphore to temporarily turn the SIGCHLD handler into a no-op. - Don't alter this directly -- use block_sigchld() / unblock_sigchld(). - */ -static int block_sigchld_handler = 0; - - -#ifdef HAVE_SIGACTION - sigset_t -#else /* !HAVE_SIGACTION */ - int -#endif /* !HAVE_SIGACTION */ -block_sigchld (void) -{ -#ifdef HAVE_SIGACTION - struct sigaction sa; - sigset_t child_set; - - memset (&sa, 0, sizeof (sa)); - sa.sa_handler = SIG_IGN; - sigaction (SIGPIPE, &sa, NULL); - - sigemptyset (&child_set); - sigaddset (&child_set, SIGCHLD); - sigprocmask (SIG_BLOCK, &child_set, 0); - -#else /* !HAVE_SIGACTION */ - signal (SIGPIPE, SIG_IGN); -#endif /* !HAVE_SIGACTION */ - - block_sigchld_handler++; - -#ifdef HAVE_SIGACTION - return child_set; -#else /* !HAVE_SIGACTION */ - return 0; -#endif /* !HAVE_SIGACTION */ -} - -void -unblock_sigchld (void) -{ - if (block_sigchld_handler <= 0) - abort(); - - if (block_sigchld_handler <= 1) /* only unblock if count going to 0 */ - { -#ifdef HAVE_SIGACTION - struct sigaction sa; - sigset_t child_set; - - memset(&sa, 0, sizeof (sa)); - sa.sa_handler = SIG_DFL; - sigaction(SIGPIPE, &sa, NULL); - - sigemptyset(&child_set); - sigaddset(&child_set, SIGCHLD); - sigprocmask(SIG_UNBLOCK, &child_set, 0); -#else /* !HAVE_SIGACTION */ - signal(SIGPIPE, SIG_DFL); -#endif /* !HAVE_SIGACTION */ - } - - block_sigchld_handler--; -} - -int +static int kill_job (saver_info *si, pid_t pid, int signal) { saver_preferences *p = &si->prefs; @@ -448,12 +324,6 @@ kill_job (saver_info *si, pid_t pid, int signal) clean_job_list(); - if (in_signal_handler_p) - /* This function should not be called from the signal handler. */ - abort(); - - block_sigchld(); /* we control the horizontal... */ - job = find_job (pid); if (!job || !job->pid || @@ -471,7 +341,6 @@ kill_job (saver_info *si, pid_t pid, int signal) job->killed = time ((time_t *) 0); break; #ifdef SIGSTOP - /* #### there must be a way to do this on VMS... */ case SIGSTOP: job->status = job_stopped; break; case SIGCONT: job->status = job_running; break; #endif /* SIGSTOP */ @@ -492,7 +361,7 @@ kill_job (saver_info *si, pid_t pid, int signal) { if (errno == ESRCH) fprintf (stderr, - "%s: %d: child process %lu (%s) was already dead.\n", + "%s: %d: child process %lu (%s) was already dead\n", blurb(), job->screen, (unsigned long) job->pid, job->name); else { @@ -506,53 +375,148 @@ kill_job (saver_info *si, pid_t pid, int signal) await_dying_children (si); DONE: - unblock_sigchld(); - if (block_sigchld_handler < 0) - abort(); - clean_job_list(); return status; } -#ifdef SIGCHLD -static RETSIGTYPE -sigchld_handler (int sig) +/* We use Xt-style signal handling. A Unix signal fires, and we inform Xt of + that. Then after we return to the top-level command loop on the main + stack, Xt runs our callback function for that signal. Just like Xt timers. + */ +static void +catch_signal (int sig, RETSIGTYPE (*handler) (int)) { - saver_info *si = global_si_kludge; /* I hate C so much... */ - in_signal_handler_p++; - - if (si->prefs.debug_p) +# ifdef HAVE_SIGACTION + struct sigaction a; + a.sa_handler = handler; + sigemptyset (&a.sa_mask); + a.sa_flags = 0; + if (sigaction (sig, &a, 0) < 0) +# else /* !HAVE_SIGACTION */ + if (((long) signal (sig, handler)) == -1L) +# endif /* !HAVE_SIGACTION */ { - /* Don't call fprintf() from signal handlers, as it might malloc. - fprintf(stderr, "%s: got SIGCHLD%s\n", blurb(), - (block_sigchld_handler ? " (blocked)" : "")); - */ - write_string (STDERR_FILENO, blurb()); - write_string (STDERR_FILENO, ": got SIGCHLD"); - - if (block_sigchld_handler) - write_string (STDERR_FILENO, " (blocked)\n"); - else - write_string (STDERR_FILENO, "\n"); + char buf [255]; + sprintf (buf, "%s: couldn't catch signal %s", blurb(), + signal_name (sig)); + perror (buf); + abort(); } +} + + +/* Exiting gracefully. - if (block_sigchld_handler < 0) - abort(); - else if (block_sigchld_handler == 0) + When xscreensaver sends a SIGTERM signal to xscreensaver-gfx, rather + than exiting immediately, we want it to do two things: + + - Send a SIGTERM to each running screenhack. They would *probably* + die of a BadWindow X error once their window was deleted, but this + is cleaner and more immediate. + + - Fade the screens in from black. This might take several seconds. + + Should another signal come in while that is ongoing, we should just + die immediately. + */ + +static RETSIGTYPE +saver_sigterm_handler (int sig) +{ + /* This is the actual signal handler, running on the signal stack. + After firing once, set this signal back to the default behavior. */ + sigterm_received = sig; + catch_signal (sig, SIG_DFL); + + /* The first time a signal fires, inform Xt of that so that it will run + xt_signal_handler(). "XtNoticeSignal is the only Intrinsics function + that can safely be called from a signal handler". */ + if (xt_sigterm_id) + XtNoticeSignal (xt_sigterm_id); +} + + +static void +xt_sigterm_handler (XtPointer data, XtSignalId *id) +{ + /* This runs from the Xt event loop on the main stack, some time after + the signal fired. */ + saver_info *si = (saver_info *) data; + saver_preferences *p = &si->prefs; + static Bool hit_p = False; + int i; + + if (xt_sigterm_id) + XtRemoveSignal (xt_sigterm_id); + xt_sigterm_id = 0; + + if (hit_p) + fprintf (stderr, "%s: second signal: %s: exiting\n", blurb(), + signal_name (sigterm_received)); + else { - block_sigchld(); - await_dying_children (si); - unblock_sigchld(); + hit_p = True; + if (p->verbose_p) + fprintf (stderr, "%s: %s: unblanking\n", blurb(), + signal_name (sigterm_received)); + + /* Kill before unblanking, to stop drawing as soon as possible. */ + for (i = 0; i < si->nscreens; i++) + { + saver_screen_info *ssi = &si->screens[i]; + if (ssi->cycle_id) + { + XtRemoveTimeOut (ssi->cycle_id); + ssi->cycle_id = 0; + ssi->cycle_at = 0; + } + kill_screenhack (ssi); + } + unblank_screen (si); + + if (p->verbose_p) + fprintf (stderr, "%s: %s: exiting\n", blurb(), + signal_name (sigterm_received)); } - init_sigchld(); - in_signal_handler_p--; + /* Exit with the original signal received. */ + kill (getpid(), sigterm_received); + abort(); +} + + +/* SIGCHLD handling. Basically the same deal as SIGTERM. + */ + +static RETSIGTYPE +sigchld_handler (int sig) +{ + /* This is the actual signal handler, running on the signal stack. + After firing once, set this signal to fire again. */ + sigchld_received = sig; +# ifndef HAVE_SIGACTION + catch_signal (SIGCHLD, sigchld_handler); +# endif + + if (xt_sigchld_id) + XtNoticeSignal (xt_sigchld_id); } -#endif /* SIGCHLD */ -#ifndef VMS +static void +xt_sigchld_handler (XtPointer data, XtSignalId *id) +{ + /* This runs from the Xt event loop on the main stack, some time after + the signal fired. */ + saver_info *si = (saver_info *) data; + + if (si->prefs.debug_p) + fprintf(stderr, "%s: got SIGCHLD\n", blurb()); + + await_dying_children (si); /* Their first album was better */ +} + static void await_dying_children (saver_info *si) @@ -561,36 +525,19 @@ await_dying_children (saver_info *si) { int wait_status = 0; pid_t kid; + struct rusage rus; errno = 0; - kid = waitpid (-1, &wait_status, WNOHANG|WUNTRACED); + kid = wait4 (-1, &wait_status, WNOHANG|WUNTRACED, &rus); if (si->prefs.debug_p) { if (kid < 0 && errno) - { - /* Don't call fprintf() from signal handlers, as it might malloc. - fprintf (stderr, "%s: waitpid(-1) ==> %ld (%d)\n", blurb(), - (long) kid, errno); - */ - write_string (STDERR_FILENO, blurb()); - write_string (STDERR_FILENO, ": waitpid(-1) ==> "); - write_long (STDERR_FILENO, (long) kid); - write_string (STDERR_FILENO, " ("); - write_long (STDERR_FILENO, (long) errno); - write_string (STDERR_FILENO, ")\n"); - } + fprintf (stderr, "%s: waitpid(-1) ==> %ld (%d)\n", blurb(), + (long) kid, errno); else - { - /* Don't call fprintf() from signal handlers, as it might malloc. - fprintf (stderr, "%s: waitpid(-1) ==> %ld\n", blurb(), - (long) kid); - */ - write_string (STDERR_FILENO, blurb()); - write_string (STDERR_FILENO, ": waitpid(-1) ==> "); - write_long (STDERR_FILENO, (long) kid); - write_string (STDERR_FILENO, "\n"); - } + fprintf (stderr, "%s: waitpid(-1) ==> %ld\n", blurb(), + (long) kid); } /* 0 means no more children to reap. @@ -600,272 +547,193 @@ await_dying_children (saver_info *si) (kid < 0 && errno != EINTR)) break; - describe_dead_child (si, kid, wait_status); + describe_dead_child (si, kid, wait_status, rus); } } static void -describe_dead_child (saver_info *si, pid_t kid, int wait_status) +describe_dead_child (saver_info *si, pid_t kid, int wait_status, + struct rusage rus) { int i; saver_preferences *p = &si->prefs; struct screenhack_job *job = find_job (kid); const char *name = job ? job->name : ""; int screen_no = job ? job->screen : 0; + char msg[1024]; + *msg = 0; if (WIFEXITED (wait_status)) { int exit_status = WEXITSTATUS (wait_status); - /* Treat exit code as a signed 8-bit quantity. */ if (exit_status & 0x80) exit_status |= ~0xFF; - /* One might assume that exiting with non-0 means something went wrong. - But that loser xswarm exits with the code that it was killed with, so - it *always* exits abnormally. Treat abnormal exits as "normal" (don't - mention them) if we've just killed the subprocess. But mention them - if they happen on their own. - */ - if (!job || - (exit_status != 0 && - (p->verbose_p || job->status != job_killed))) - { - /* Don't call fprintf() from signal handlers, as it might malloc. - fprintf (stderr, - "%s: %d: child pid %lu (%s) exited abnormally (code %d).\n", - blurb(), screen_no, (unsigned long) kid, name, exit_status); - */ - write_string (STDERR_FILENO, blurb()); - write_string (STDERR_FILENO, ": "); - write_long (STDERR_FILENO, (long) screen_no); - write_string (STDERR_FILENO, ": child pid "); - write_long (STDERR_FILENO, (long) kid); - write_string (STDERR_FILENO, " ("); - write_string (STDERR_FILENO, name); - write_string (STDERR_FILENO, ") exited abnormally (code "); - write_long (STDERR_FILENO, (long) exit_status); - write_string (STDERR_FILENO, ").\n"); - } - else if (p->verbose_p) - { - /* Don't call fprintf() from signal handlers, as it might malloc. - fprintf (stderr, "%s: %d: child pid %lu (%s) exited normally.\n", - blurb(), screen_no, (unsigned long) kid, name); - */ - write_string (STDERR_FILENO, blurb()); - write_string (STDERR_FILENO, ": "); - write_long (STDERR_FILENO, (long) screen_no); - write_string (STDERR_FILENO, ": child pid "); - write_long (STDERR_FILENO, (long) kid); - write_string (STDERR_FILENO, " ("); - write_string (STDERR_FILENO, name); - write_string (STDERR_FILENO, ") exited normally.\n"); - } - + sprintf (msg, _("crashed with status %d"), exit_status); + if (p->verbose_p) + fprintf (stderr, + "%s: %d: child pid %lu (%s) exited abnormally" + " with status %d\n", + blurb(), screen_no, (unsigned long) kid, name, exit_status); if (job) job->status = job_dead; } else if (WIFSIGNALED (wait_status)) { - if (p->verbose_p || - !job || - job->status != job_killed || - WTERMSIG (wait_status) != SIGTERM) + const char *sig = signal_name (WTERMSIG (wait_status)); + if (job && + job->status == job_killed && + WTERMSIG (wait_status) == SIGTERM) { - /* Don't call fprintf() from signal handlers, as it might malloc. - fprintf (stderr, "%s: %d: child pid %lu (%s) terminated with %s.\n", - blurb(), screen_no, (unsigned long) kid, name, - signal_name (WTERMSIG(wait_status))); - */ - write_string (STDERR_FILENO, blurb()); - write_string (STDERR_FILENO, ": "); - write_long (STDERR_FILENO, (long) screen_no); - write_string (STDERR_FILENO, ": child pid "); - write_long (STDERR_FILENO, (long) kid); - write_string (STDERR_FILENO, " ("); - write_string (STDERR_FILENO, name); - write_string (STDERR_FILENO, ") terminated with signal "); - write_long (STDERR_FILENO, WTERMSIG(wait_status)); - write_string (STDERR_FILENO, ".\n"); + /* Expected notification after we killed it. */ + sprintf (msg, _("exited normally with %.100s"), sig); + if (p->verbose_p) + fprintf (stderr, "%s: %d: child pid %lu (%s)" + " exited normally with %s\n", + blurb(), screen_no, (unsigned long) kid, name, sig); + } + else + { + /* Unexpected signal. */ + sprintf (msg, _("crashed with %.100s"), sig); + if (p->verbose_p) + fprintf (stderr, "%s: %d: child pid %lu (%s)" + " unexpectedly terminated with %s\n", + blurb(), screen_no, (unsigned long) kid, name, sig); } - if (job) job->status = job_dead; } else if (WIFSTOPPED (wait_status)) { if (p->verbose_p) - { - /* Don't call fprintf() from signal handlers, as it might malloc. - fprintf (stderr, "%s: child pid %lu (%s) stopped with %s.\n", - blurb(), (unsigned long) kid, name, - signal_name (WSTOPSIG (wait_status))); - */ - write_string (STDERR_FILENO, blurb()); - write_string (STDERR_FILENO, ": "); - write_long (STDERR_FILENO, (long) screen_no); - write_string (STDERR_FILENO, ": child pid "); - write_long (STDERR_FILENO, (long) kid); - write_string (STDERR_FILENO, " ("); - write_string (STDERR_FILENO, name); - write_string (STDERR_FILENO, ") stopped with signal "); - write_long (STDERR_FILENO, WSTOPSIG(wait_status)); - write_string (STDERR_FILENO, ".\n"); - } - + fprintf (stderr, "%s: child pid %lu (%s) stopped with %s\n", + blurb(), (unsigned long) kid, name, + signal_name (WSTOPSIG (wait_status))); if (job) job->status = job_stopped; } else { - /* Don't call fprintf() from signal handlers, as it might malloc. + /* Didn't exit, signal or stop; is this even possible? */ + sprintf (msg, _("crashed mysteriously")); fprintf (stderr, "%s: child pid %lu (%s) died in a mysterious way!", blurb(), (unsigned long) kid, name); - */ - write_string (STDERR_FILENO, blurb()); - write_string (STDERR_FILENO, ": "); - write_long (STDERR_FILENO, (long) screen_no); - write_string (STDERR_FILENO, ": child pid "); - write_long (STDERR_FILENO, (long) kid); - write_string (STDERR_FILENO, " ("); - write_string (STDERR_FILENO, name); - write_string (STDERR_FILENO, ") died in a mysterious way!"); if (job) job->status = job_dead; } - /* Clear out the pid so that screenhack_running_p() knows it's dead. +# ifdef LOG_CPU_TIME + if (p->verbose_p && job && job->status == job_dead) + { + long u = rus.ru_utime.tv_usec / 1000 + rus.ru_utime.tv_sec * 1000; + long s = rus.ru_stime.tv_usec / 1000 + rus.ru_stime.tv_sec * 1000; + fprintf (stderr, "%s: %d: CPU used: %.1fu, %.1fs\n", + blurb(), screen_no, u / 1000.0, s / 1000.0); + } +# endif /* LOG_CPU_TIME */ + + /* Clear out the pid so that any_screenhacks_running_p() knows it's dead. */ if (!job || job->status == job_dead) { - for (i = 0; i < si->nscreens; i++) - { - saver_screen_info *ssi = &si->screens[i]; - if (kid == ssi->pid) - ssi->pid = 0; - } -# ifdef HAVE_LIBSYSTEMD - if (kid == si->systemd_pid) - si->systemd_pid = 0; -# endif + for (i = 0; i < si->nscreens; i++) + { + saver_screen_info *ssi = &si->screens[i]; + if (kid == ssi->pid) + { + ssi->pid = 0; + if (*msg) + screenhack_obituary (ssi, name, msg); + } + } } } -#else /* VMS */ -static void await_dying_children (saver_info *si) { return; } -#endif /* VMS */ - void -init_sigchld (void) +init_sigchld (saver_info *si) { -#ifdef SIGCHLD - -# ifdef HAVE_SIGACTION /* Thanks to Tom Kelly */ - - static Bool sigchld_initialized_p = 0; - if (!sigchld_initialized_p) - { - struct sigaction action, old; + static Bool signals_initialized_p = 0; + if (signals_initialized_p) return; + signals_initialized_p = True; - action.sa_handler = sigchld_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = 0; + catch_signal (SIGTERM, saver_sigterm_handler); /* kill */ + catch_signal (SIGINT, saver_sigterm_handler); /* shell ^C */ + catch_signal (SIGQUIT, saver_sigterm_handler); /* shell ^| */ + catch_signal (SIGCHLD, sigchld_handler); - if (sigaction(SIGCHLD, &action, &old) < 0) - { - char buf [255]; - sprintf (buf, "%s: couldn't catch SIGCHLD", blurb()); - perror (buf); - } - sigchld_initialized_p = True; - } - -# else /* !HAVE_SIGACTION */ - - if (((long) signal (SIGCHLD, sigchld_handler)) == -1L) - { - char buf [255]; - sprintf (buf, "%s: couldn't catch SIGCHLD", blurb()); - perror (buf); - } -# endif /* !HAVE_SIGACTION */ -#endif /* SIGCHLD */ + xt_sigchld_id = XtAppAddSignal (si->app, xt_sigchld_handler, si); + xt_sigterm_id = XtAppAddSignal (si->app, xt_sigterm_handler, si); } +static void +hack_subproc_environment (Screen *screen, Window saver_window) +{ + /* Store $DISPLAY into the environment, so that the $DISPLAY variable that + the spawned processes inherit is correct. First, it must be on the same + host and display as the value of -display passed in on our command line + (which is not necessarily the same as what our $DISPLAY variable is.) + Second, the screen number in the $DISPLAY passed to the subprocess should + be the screen on which this particular hack is running -- not the display + specification which the driver itself is using, since the driver ignores + its screen number and manages all existing screens. - + Likewise, store a window ID in $XSCREENSAVER_WINDOW -- this is necessary + in a Xinerama or RANDR world where a single X11 'Screen' spans multiple + monitors, and we want to run a hack on each piece of glass, not spanning + them. In that case, multiple hacks have the same $DISPLAY, screen and + root window. + */ + Display *dpy = DisplayOfScreen (screen); + const char *odpy = DisplayString (dpy); + char *ndpy = (char *) malloc (strlen(odpy) + 20); + char *nssw = (char *) malloc (40); + char *s, *c; -static Bool -select_visual_of_hack (saver_screen_info *ssi, screenhack *hack) -{ - saver_info *si = ssi->global; - saver_preferences *p = &si->prefs; - Bool selected; + strcpy (ndpy, "DISPLAY="); + s = ndpy + strlen(ndpy); + strcpy (s, odpy); - if (hack->visual && *hack->visual) - selected = select_visual(ssi, hack->visual); - else - selected = select_visual(ssi, 0); + /* We have to find the last colon since it is the boundary between + hostname & screen - IPv6 numeric format addresses may have many + colons before that point, and DECnet addresses always have two colons */ + c = strrchr(s,':'); /* skip to last colon */ + if (c != NULL) s = c+1; + while (isdigit(*s)) s++; /* skip over dpy number */ + while (*s == '.') s++; /* skip over dot */ + if (s[-1] != '.') *s++ = '.'; /* put on a dot */ + sprintf(s, "%d", screen_number (screen)); /* put on screen number */ - if (!selected && (p->verbose_p || si->demoing_p)) - fprintf (stderr, - (si->demoing_p - ? "%s: warning, no \"%s\" visual for \"%s\".\n" - : "%s: no \"%s\" visual; skipping \"%s\".\n"), - blurb(), - (hack->visual && *hack->visual ? hack->visual : "???"), - hack->command); + sprintf (nssw, "XSCREENSAVER_WINDOW=0x%lX", (unsigned long) saver_window); - return selected; + if (putenv (ndpy)) + abort (); + if (putenv (nssw)) + abort (); + + /* don't free ndpy/nssw -- some implementations of putenv (BSD 4.4, + glibc 2.0) copy the argument, but some (libc4,5, glibc 2.1.2) + do not. So we must leak it (and/or the previous setting). Yay. + */ } +#ifdef ABORT_TESTER /* Shoot down processes after a bit, for debugging */ static void -print_path_error (const char *program) +abort_debug_timer (XtPointer closure, XtIntervalId *id) { - char buf [512]; - char *cmd = strdup (program); - char *token = strchr (cmd, ' '); - - if (token) *token = 0; - sprintf (buf, "%s: could not execute \"%.100s\"", blurb(), cmd); - free (cmd); - perror (buf); - - if (errno == ENOENT && - (token = getenv("PATH"))) + saver_screen_info *ssi = (saver_screen_info *) closure; + if (ssi->pid) { -# ifndef PATH_MAX -# ifdef MAXPATHLEN -# define PATH_MAX MAXPATHLEN -# else -# define PATH_MAX 2048 -# endif -# endif - char path[PATH_MAX]; - fprintf (stderr, "\n"); - *path = 0; -# if defined(HAVE_GETCWD) - if (! getcwd (path, sizeof(path))) - *path = 0; -# elif defined(HAVE_GETWD) - getwd (path); -# endif - if (*path) - fprintf (stderr, " Current directory is: %s\n", path); - fprintf (stderr, " PATH is:\n"); - token = strtok (strdup(token), ":"); - while (token) - { - fprintf (stderr, " %s\n", token); - token = strtok(0, ":"); - } - fprintf (stderr, "\n"); + fprintf (stderr, "%s: %d: %ld: born to ill\n", blurb(), ssi->number, + (unsigned long) ssi->pid); + kill (ssi->pid, SIGILL); } } +#endif /* ABORT_TESTER */ /* Executes the command in another process. @@ -875,15 +743,10 @@ print_path_error (const char *program) Otherwise, -1 is returned and an error may have been printed to stderr. */ -pid_t +static pid_t fork_and_exec (saver_screen_info *ssi, const char *command) { - return fork_and_exec_1 (ssi->global, ssi, command); -} - -pid_t -fork_and_exec_1 (saver_info *si, saver_screen_info *ssi, const char *command) -{ + saver_info *si = ssi->global; saver_preferences *p = &si->prefs; pid_t forked; @@ -899,35 +762,60 @@ fork_and_exec_1 (saver_info *si, saver_screen_info *ssi, const char *command) case 0: close (ConnectionNumber (si->dpy)); /* close display fd */ - limit_subproc_memory (p->inferior_memory_limit, p->verbose_p); if (ssi) hack_subproc_environment (ssi->screen, ssi->screensaver_window); - if (p->verbose_p) - fprintf (stderr, "%s: %d: spawning \"%s\" in pid %lu.\n", - blurb(), (ssi ? ssi->number : 0), command, - (unsigned long) getpid ()); - exec_command (p->shell, command, p->nice_inferior); - - /* If that returned, we were unable to exec the subprocess. - Print an error message, if desired. - */ - if (! p->ignore_uninstalled_p) - print_path_error (command); - + /* If that returned, we were unable to exec the subprocess. */ exit (1); /* exits child fork */ break; default: /* parent */ - (void) make_job (forked, (ssi ? ssi->number : 0), command); + make_job (forked, (ssi ? ssi->number : 0), command); + if (p->verbose_p) + fprintf (stderr, "%s: %d: forked \"%s\" in pid %lu" + " on window 0x%lx\n", + blurb(), (ssi ? ssi->number : 0), command, + (unsigned long) forked, + (unsigned long) ssi->screensaver_window); break; } +# ifdef ABORT_TESTER + if (forked) + XtAppAddTimeOut (si->app, 1000 * (5 + (5 * ssi->number)), + abort_debug_timer, (XtPointer) ssi); +# endif + return forked; } +static Bool +select_visual_of_hack (saver_screen_info *ssi, screenhack *hack) +{ + saver_info *si = ssi->global; + saver_preferences *p = &si->prefs; + Bool selected; + + if (hack->visual && *hack->visual) + selected = select_visual(ssi, hack->visual); + else + selected = select_visual(ssi, 0); + + if (!selected && (p->verbose_p || si->demoing_p)) + fprintf (stderr, + (si->demoing_p + ? "%s: warning, no \"%s\" visual for \"%s\"\n" + : "%s: no \"%s\" visual; skipping \"%s\"\n"), + blurb(), + (hack->visual && *hack->visual ? hack->visual : "???"), + hack->command); + + return selected; +} + + void spawn_screenhack (saver_screen_info *ssi) { @@ -935,13 +823,21 @@ spawn_screenhack (saver_screen_info *ssi) saver_preferences *p = &si->prefs; XFlush (si->dpy); - if (!monitor_powered_on_p (si)) + if (!monitor_powered_on_p (si->dpy)) { if (si->prefs.verbose_p) fprintf (stderr, "%s: %d: X says monitor has powered down; " - "not launching a hack.\n", blurb(), ssi->number); - return; + "not launching a hack\n", blurb(), ssi->number); + ssi->current_hack = -1; + + /* Hooray, this doesn't actually clear the window if it was OpenGL. */ + XClearWindow (si->dpy, ssi->screensaver_window); + + /* Even though we aren't launching a hack, do launch the cycle timer, + in case the monitor powers back up at some point without us having + un-blanked. */ + goto DONE; } if (p->screenhacks_count) @@ -1015,9 +911,7 @@ spawn_screenhack (saver_screen_info *ssi) if (new_hack < 0) /* don't run a hack */ { ssi->current_hack = -1; - if (si->selection_mode < 0) - si->selection_mode = 0; - return; + goto DONE; } ssi->current_hack = new_hack; @@ -1045,7 +939,7 @@ spawn_screenhack (saver_screen_info *ssi) */ if (p->verbose_p) fprintf(stderr, - "%s: %d: no programs enabled, or no suitable visuals.\n", + "%s: %d: no programs enabled, or no suitable visuals\n", blurb(), ssi->number); return; } @@ -1053,12 +947,6 @@ spawn_screenhack (saver_screen_info *ssi) goto AGAIN; } - /* Turn off "next" and "prev" modes now, but "demo" mode is only - turned off by explicit action. - */ - if (si->selection_mode < 0) - si->selection_mode = 0; - forked = fork_and_exec (ssi, hack->command); switch ((int) forked) { @@ -1066,17 +954,95 @@ spawn_screenhack (saver_screen_info *ssi) case 0: /* child fork (can't happen) */ sprintf (buf, "%s: couldn't fork", blurb()); perror (buf); - restore_real_vroot (si); - saver_exit (si, 1, "couldn't fork"); + exit (1); break; default: ssi->pid = forked; break; } + + XChangeProperty (si->dpy, ssi->screensaver_window, XA_WM_COMMAND, + XA_STRING, 8, PropModeReplace, + (unsigned char *) hack->command, + strlen (hack->command)); + XChangeProperty (si->dpy, ssi->screensaver_window, XA_NET_WM_PID, + XA_CARDINAL, 32, PropModeReplace, + (unsigned char *) &ssi->pid, 1); } - store_saver_status (si); /* store current hack number */ + DONE: + + if (ssi->current_hack < 0) + XDeleteProperty (si->dpy, ssi->screensaver_window, XA_WM_COMMAND); + + store_saver_status (si); /* store current hack numbers */ + + /* Now that the hack has launched, queue a timer to cycle it. */ + if (!si->demoing_p && p->cycle) + { + time_t now = time ((time_t *) 0); + Time how_long = p->cycle; + + /* If we're in "SELECT n" mode, the cycle timer going off will just + restart this same hack again. There's not much point in doing this + every 5 or 10 minutes, but on the other hand, leaving one hack + running for days is probably not a great idea, since they tend to + leak and/or crash. So, restart the thing once an hour. + */ + if (si->selection_mode > 0 && ssi->pid) + how_long = 1000 * 60 * 60; + + /* If there are multiple screens, stagger the restart time of subsequent + screens: they will all change every N minutes, but not at the same + time. But don't let that offset be more than about 5 minutes. + + I originally did this by just adding an offset to the very first + cycle only, but after a few days, the cycles would synchronize again! + Are Xt timers implemented with Huygens pendulums?? So compare this + screen's target time against the previous screen's, and offset it as + needed. + */ + if (ssi->number > 0 && + p->mode != RANDOM_HACKS_SAME) + { + saver_screen_info *prev = &si->screens[ssi->number-1]; + time_t cycle_at = now + how_long / 1000; + time_t prev_at = prev->cycle_at; + + Time max = 1000 * 60 * 60 * 10; + Time off = (how_long > max ? max : how_long) / si->nscreens; + + if (cycle_at < prev_at + off / 1000) + { + time_t old = cycle_at; + cycle_at = prev_at + off / 1000; + how_long = 1000 * (cycle_at - now); + + if (p->verbose_p && cycle_at - old > 2) + fprintf (stderr, "%s: %d: offsetting cycle time by %ld sec\n", + blurb(), ssi->number, + cycle_at - old); + } + } + + if (p->debug_p) + fprintf (stderr, "%s: %d: starting cycle_timer (%ld)\n", + blurb(), ssi->number, how_long); + + if (ssi->cycle_id) + XtRemoveTimeOut (ssi->cycle_id); + ssi->cycle_id = + XtAppAddTimeOut (si->app, how_long, cycle_timer, (XtPointer) ssi); + ssi->cycle_at = now + how_long / 1000; + + if (p->verbose_p) + { + time_t t = time((time_t *) 0) + how_long/1000; + fprintf (stderr, "%s: %d: next cycle in %lu sec at %s\n", + blurb(), ssi->number, how_long/1000, timestring(t)); + } + } } @@ -1087,42 +1053,14 @@ kill_screenhack (saver_screen_info *ssi) if (ssi->pid) kill_job (si, ssi->pid, SIGTERM); ssi->pid = 0; -} - -void -suspend_screenhack (saver_screen_info *ssi, Bool suspend_p) -{ -#ifdef SIGSTOP /* older VMS doesn't have it... */ - saver_info *si = ssi->global; - if (ssi->pid) - kill_job (si, ssi->pid, (suspend_p ? SIGSTOP : SIGCONT)); -#endif /* SIGSTOP */ + /* Hooray, this doesn't actually clear the window if it was OpenGL. */ + XClearWindow (si->dpy, ssi->screensaver_window); } -/* Called when we're exiting abnormally, to kill off the subproc. */ -void -emergency_kill_subproc (saver_info *si) -{ - int i; -#ifdef SIGCHLD - signal (SIGCHLD, SIG_IGN); -#endif /* SIGCHLD */ - - for (i = 0; i < si->nscreens; i++) - { - saver_screen_info *ssi = &si->screens[i]; - if (ssi->pid) - { - kill_job (si, ssi->pid, SIGTERM); - ssi->pid = 0; - } - } -} - Bool -screenhack_running_p (saver_info *si) +any_screenhacks_running_p (saver_info *si) { Bool any_running_p = False; int i; @@ -1130,104 +1068,21 @@ screenhack_running_p (saver_info *si) { saver_screen_info *ssi = &si->screens[i]; if (ssi->pid) any_running_p = True; + /* Consider it running if an error dialog is posted, so that we + don't prematurely clear the window. */ + if (ssi->error_dialog) any_running_p = True; } return any_running_p; } - -/* Environment variables. */ - -/* Modifies $PATH in the current environment, so that if DEFAULT_PATH_PREFIX - is defined, the xscreensaver daemon will search that directory for hacks. +/* Fork "xscreensaver-gl-visual" and wait for it to print the IDs of + the GL visual that should be used on this screen. */ -void -hack_environment (saver_info *si) -{ -#if defined(HAVE_PUTENV) && defined(DEFAULT_PATH_PREFIX) - static const char *def_path = DEFAULT_PATH_PREFIX; - if (def_path && *def_path) - { - const char *opath = getenv("PATH"); - char *npath; - if (! opath) opath = "/bin:/usr/bin"; /* WTF */ - npath = (char *) malloc(strlen(def_path) + strlen(opath) + 20); - strcpy (npath, "PATH="); - strcat (npath, def_path); - strcat (npath, ":"); - strcat (npath, opath); - - if (putenv (npath)) - abort (); - - /* don't free (npath) -- some implementations of putenv (BSD 4.4, - glibc 2.0) copy the argument, but some (libc4,5, glibc 2.1.2) - do not. So we must leak it (and/or the previous setting). Yay. - */ - } -#endif /* HAVE_PUTENV && DEFAULT_PATH_PREFIX */ -} - - -void -hack_subproc_environment (Screen *screen, Window saver_window) -{ - /* Store $DISPLAY into the environment, so that the $DISPLAY variable that - the spawned processes inherit is correct. First, it must be on the same - host and display as the value of -display passed in on our command line - (which is not necessarily the same as what our $DISPLAY variable is.) - Second, the screen number in the $DISPLAY passed to the subprocess should - be the screen on which this particular hack is running -- not the display - specification which the driver itself is using, since the driver ignores - its screen number and manages all existing screens. - - Likewise, store a window ID in $XSCREENSAVER_WINDOW -- this will allow - us to (eventually) run multiple hacks in Xinerama mode, where each hack - has the same $DISPLAY but a different piece of glass. - */ - Display *dpy = DisplayOfScreen (screen); - const char *odpy = DisplayString (dpy); - char *ndpy = (char *) malloc (strlen(odpy) + 20); - char *nssw = (char *) malloc (40); - char *s, *c; - - strcpy (ndpy, "DISPLAY="); - s = ndpy + strlen(ndpy); - strcpy (s, odpy); - - /* We have to find the last colon since it is the boundary between - hostname & screen - IPv6 numeric format addresses may have many - colons before that point, and DECnet addresses always have two colons */ - c = strrchr(s,':'); /* skip to last colon */ - if (c != NULL) s = c+1; - while (isdigit(*s)) s++; /* skip over dpy number */ - while (*s == '.') s++; /* skip over dot */ - if (s[-1] != '.') *s++ = '.'; /* put on a dot */ - sprintf(s, "%d", screen_number (screen)); /* put on screen number */ - - sprintf (nssw, "XSCREENSAVER_WINDOW=0x%lX", (unsigned long) saver_window); - - /* Allegedly, BSD 4.3 didn't have putenv(), but nobody runs such systems - any more, right? It's not Posix, but everyone seems to have it. */ -#ifdef HAVE_PUTENV - if (putenv (ndpy)) - abort (); - if (putenv (nssw)) - abort (); - - /* don't free ndpy/nssw -- some implementations of putenv (BSD 4.4, - glibc 2.0) copy the argument, but some (libc4,5, glibc 2.1.2) - do not. So we must leak it (and/or the previous setting). Yay. - */ -#endif /* HAVE_PUTENV */ -} - - -/* GL crap */ - Visual * get_best_gl_visual (saver_info *si, Screen *screen) { + saver_preferences *p = &si->prefs; pid_t forked; int fds [2]; int in, out; @@ -1238,7 +1093,7 @@ get_best_gl_visual (saver_info *si, Screen *screen) char *av[10]; int ac = 0; - av[ac++] = "xscreensaver-gl-helper"; + av[ac++] = "xscreensaver-gl-visual"; av[ac] = 0; if (pipe (fds)) @@ -1262,18 +1117,13 @@ get_best_gl_visual (saver_info *si, Screen *screen) errout = errfds [1]; } - block_sigchld(); /* This blocks it in the parent and child, to avoid - racing. It is never unblocked in the child before - the child exits, but that doesn't matter. - */ - switch ((int) (forked = fork ())) { case -1: { sprintf (buf, "%s: couldn't fork", blurb()); perror (buf); - saver_exit (si, 1, 0); + exit (1); } case 0: { @@ -1315,11 +1165,17 @@ get_best_gl_visual (saver_info *si, Screen *screen) int result = 0; int wait_status = 0; pid_t pid = -1; - - FILE *f = fdopen (in, "r"); + FILE *f; unsigned long v = 0; char c; + make_job (forked, 0, av[0]); /* Bookkeeping for SIGCHLD */ + + if (p->verbose_p) + fprintf (stderr, "%s: %d: forked \"%s\" in pid %lu\n", + blurb(), 0, av[0], (unsigned long) forked); + + f = fdopen (in, "r"); close (out); /* don't need this one */ *buf = 0; @@ -1336,16 +1192,8 @@ get_best_gl_visual (saver_info *si, Screen *screen) /* Wait for the child to die - wait for this pid only, not others. */ pid = waitpid (forked, &wait_status, 0); if (si->prefs.debug_p) - { - write_string (STDERR_FILENO, blurb()); - write_string (STDERR_FILENO, ": waitpid("); - write_long (STDERR_FILENO, (long) forked); - write_string (STDERR_FILENO, ") ==> "); - write_long (STDERR_FILENO, (long) pid); - write_string (STDERR_FILENO, "\n"); - } - - unblock_sigchld(); /* child is dead and waited, unblock now. */ + fprintf (stderr, "%s: waitpid(%ld) => %ld\n", blurb(), + (long) forked, (long) pid); if (1 == sscanf (buf, "0x%lx %c", &v, &c)) result = (int) v; @@ -1370,7 +1218,7 @@ get_best_gl_visual (saver_info *si, Screen *screen) { Visual *v = id_to_visual (screen, result); if (si->prefs.verbose_p) - fprintf (stderr, "%s: %d: %s: GL visual is 0x%X%s.\n", + fprintf (stderr, "%s: %d: %s: GL visual is 0x%X%s\n", blurb(), screen_number (screen), av[0], result, (v == DefaultVisualOfScreen (screen) @@ -1382,54 +1230,3 @@ get_best_gl_visual (saver_info *si, Screen *screen) abort(); } - - - -/* Restarting the xscreensaver process from scratch. */ - -static char **saved_argv; - -void -save_argv (int argc, char **argv) -{ - saved_argv = (char **) calloc (argc+2, sizeof (char *)); - saved_argv [argc] = 0; - while (argc--) - { - int i = strlen (argv [argc]) + 1; - saved_argv [argc] = (char *) malloc (i); - memcpy (saved_argv [argc], argv [argc], i); - } -} - - -/* Re-execs the process with the arguments in saved_argv. Does not return. - */ -void -restart_process (saver_info *si) -{ - fflush (stdout); - fflush (stderr); - shutdown_stderr (si); - if (si->prefs.verbose_p) - { - int i; - fprintf (stderr, "%s: re-executing", blurb()); - for (i = 0; saved_argv[i]; i++) - fprintf (stderr, " %s", saved_argv[i]); - fprintf (stderr, "\n"); - } - describe_uids (si, stderr); - fprintf (stderr, "\n"); - - fflush (stdout); - fflush (stderr); - execvp (saved_argv [0], saved_argv); /* shouldn't return */ - { - char buf [512]; - sprintf (buf, "%s: could not restart process", blurb()); - perror(buf); - fflush(stderr); - abort(); - } -} diff --git a/driver/test-fade.c b/driver/test-fade.c index 9db773d..31852ef 100644 --- a/driver/test-fade.c +++ b/driver/test-fade.c @@ -1,5 +1,5 @@ /* test-fade.c --- playing with colormap and/or gamma fading. - * xscreensaver, Copyright (c) 2001, 2004 Jamie Zawinski + * xscreensaver, Copyright © 2001-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,30 +21,35 @@ #include +#include #include + #include "xscreensaver.h" +#include "resources.h" +#include "screens.h" #include "fade.h" +#include "atoms.h" -#ifdef HAVE_SGI_VC_EXTENSION -# include -#endif #ifdef HAVE_XF86VMODE_GAMMA # include #endif +#ifdef HAVE_RANDR +# include +#endif XrmDatabase db = 0; -char *progname = 0; char *progclass = "XScreenSaver"; +Bool debug_p = True; -#define SGI_VC_NAME "SGI-VIDEO-CONTROL" #define XF86_VIDMODE_NAME "XFree86-VidModeExtension" +#define RANDR_NAME "RANDR" int main (int argc, char **argv) { - int seconds = 3; - int ticks = 20; - int delay = 1; + double seconds = 3; + double ratio = 1/3.0; + int delay = 2; int op, event, error, major, minor; @@ -52,70 +57,151 @@ main (int argc, char **argv) Widget toplevel_shell = XtAppInitialize (&app, progclass, 0, 0, &argc, argv, 0, 0, 0); Display *dpy = XtDisplay (toplevel_shell); - Colormap *current_maps; - int i; - - XtGetApplicationNameAndClass (dpy, &progname, &progclass); + Screen *screen = ScreenOfDisplay (dpy, 0); + int nwindows, i; + Window windows[100]; + + int x, y; + unsigned int bw, d; + Window root = RootWindow (dpy, 0); + Visual *visual = DefaultVisual (dpy, 0); + Pixmap logo, logo_clipmask; + int logo_npixels; + unsigned long *logo_pixels; + unsigned int logo_width, logo_height; + XSetWindowAttributes attrs; + unsigned long attrmask = 0; + void *state = 0; + + verbose_p += 2; + + progname = argv[0]; + progclass = "XScreenSaver"; db = XtDatabase (dpy); - current_maps = (Colormap *) calloc(sizeof(Colormap), ScreenCount(dpy)); - for (i = 0; i < ScreenCount(dpy); i++) - current_maps[i] = DefaultColormap (dpy, i); + init_xscreensaver_atoms (dpy); + + { + const char * version_number = "test-fade"; + Window daemon_window = + XCreateWindow (dpy, RootWindow (dpy, 0), + 0, 0, 1, 1, 0, + DefaultDepth (dpy, 0), InputOutput, + DefaultVisual (dpy, 0), attrmask, &attrs); + XChangeProperty (dpy, daemon_window, XA_SCREENSAVER_VERSION, XA_STRING, + 8, PropModeReplace, (unsigned char *) version_number, + strlen (version_number)); + } - if (!XQueryExtension (dpy, SGI_VC_NAME, &op, &event, &error)) - fprintf(stderr, "%s: no " SGI_VC_NAME " extension\n", progname); - else - { -# ifdef HAVE_SGI_VC_EXTENSION - if (!XSGIvcQueryVersion (dpy, &major, &minor)) - fprintf(stderr, "%s: unable to get " SGI_VC_NAME " version\n", - progname); - else - fprintf(stderr, "%s: " SGI_VC_NAME " version %d.%d\n", - progname, major, minor); -# else /* !HAVE_SGI_VC_EXTENSION */ - fprintf(stderr, "%s: no support for display's " SGI_VC_NAME - " extension\n", progname); -# endif /* !HAVE_SGI_VC_EXTENSION */ - } if (!XQueryExtension (dpy, XF86_VIDMODE_NAME, &op, &event, &error)) - fprintf(stderr, "%s: no " XF86_VIDMODE_NAME " extension\n", progname); + fprintf(stderr, "%s: no " XF86_VIDMODE_NAME " extension\n", blurb()); else { # ifdef HAVE_XF86VMODE_GAMMA if (!XF86VidModeQueryVersion (dpy, &major, &minor)) fprintf(stderr, "%s: unable to get " XF86_VIDMODE_NAME " version\n", - progname); + blurb()); else fprintf(stderr, "%s: " XF86_VIDMODE_NAME " version %d.%d\n", - progname, major, minor); + blurb(), major, minor); # else /* !HAVE_XF86VMODE_GAMMA */ fprintf(stderr, "%s: no support for display's " XF86_VIDMODE_NAME - " extension\n", progname); + " extension\n", blurb()); # endif /* !HAVE_XF86VMODE_GAMMA */ } + if (!XQueryExtension (dpy, RANDR_NAME, &op, &event, &error)) + fprintf(stderr, "%s: no " RANDR_NAME " extension\n", blurb()); + else + { +# ifdef HAVE_RANDR + if (!XRRQueryVersion (dpy, &major, &minor)) + fprintf(stderr, "%s: unable to get " RANDR_NAME " version\n", + blurb()); + else + fprintf(stderr, "%s: " RANDR_NAME " version %d.%d\n", + blurb(), major, minor); +# else /* !HAVE_RANDR */ + fprintf(stderr, "%s: no support for display's " RANDR_NAME + " extension\n", blurb()); +# endif /* !HAVE_RANDR */ + } + + logo = xscreensaver_logo (screen, visual, root, DefaultColormap (dpy, 0), + WhitePixel (dpy, 0), + &logo_pixels, &logo_npixels, + &logo_clipmask, True); + XGetGeometry (dpy, logo, &root, &x, &y, &logo_width, &logo_height, &bw, &d); + + nwindows = 0; + { + int x, y; + for (y = 0; y < 2; y++) + for (x = 0; x < 2; x++) + { + int win_width = 250; + int win_height = 200; + + attrmask = CWOverrideRedirect; + attrs.override_redirect = True; + windows[nwindows] = + XCreateWindow (dpy, root, + 200 + x * win_width * 1.5, + 200 + y * win_height * 1.5, + win_width, win_height, 0, DefaultDepth (dpy, 0), + InputOutput, visual, + attrmask, &attrs); + XSetWindowBackground (dpy, windows[nwindows], BlackPixel (dpy, 0)); + XClearWindow (dpy, windows[nwindows]); + nwindows++; + } + } + fprintf (stderr, "%s: fading %d screen%s\n", - progname, ScreenCount(dpy), ScreenCount(dpy) == 1 ? "" : "s"); + blurb(), ScreenCount(dpy), ScreenCount(dpy) == 1 ? "" : "s"); while (1) { XSync (dpy, False); - fprintf(stderr, "%s: out...", progname); + fprintf(stderr, "%s: fading out\n\n", blurb()); fflush(stderr); - fade_screens (dpy, current_maps, 0, 0, seconds, ticks, True, False); - fprintf(stderr, "done.\n"); + fade_screens (app, dpy, windows, nwindows, seconds, + True, /* out_p */ + True, /* from_desktop_p */ + &state); + for (i = 0; i < nwindows; i++) + XMapRaised (dpy, windows[i]); + XSync (dpy, False); + fprintf(stderr, "%s: out done\n\n", blurb()); fflush(stderr); + for (i = 0; i < nwindows; i++) + { + XSetWindowBackgroundPixmap (dpy, windows[i], logo); + XClearWindow (dpy, windows[i]); + XSetWindowBackground (dpy, windows[i], BlackPixel (dpy, 0)); + } + XSync (dpy, False); + if (delay) sleep (delay); - fprintf(stderr,"%s: in...", progname); + fprintf(stderr, "%s: fading in\n\n", blurb()); fflush(stderr); - fade_screens (dpy, current_maps, 0, 0, seconds, ticks, False, False); - fprintf(stderr, "done.\n"); + fade_screens (app, dpy, windows, nwindows, + seconds * ratio, + True, /* out_p */ + False, /* from_desktop_p */ + &state); + fade_screens (app, dpy, windows, nwindows, + seconds * ratio, + False, /* out_p */ + False, /* from_desktop_p */ + &state); + XSync (dpy, False); + fprintf(stderr, "%s: in done\n\n", blurb()); fflush(stderr); if (delay) sleep (delay); diff --git a/driver/test-grab.c b/driver/test-grab.c index 03018eb..65313a1 100644 --- a/driver/test-grab.c +++ b/driver/test-grab.c @@ -1,5 +1,5 @@ /* test-uid.c --- playing with grabs. - * xscreensaver, Copyright (c) 1999, 2004 Jamie Zawinski + * xscreensaver, Copyright © 1999-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -24,8 +24,9 @@ #include #include +#include -char *progname = 0; +#include "blurb.h" char *progclass = "XScreenSaver"; #define ALL_POINTER_EVENTS \ @@ -38,38 +39,89 @@ int main (int argc, char **argv) { XtAppContext app; - int kstatus, mstatus; - Cursor cursor = 0; - int delay = 60 * 15; + int kstatus = AlreadyGrabbed, mstatus = AlreadyGrabbed; + Cursor cursor1, cursor2; + int delay1 = 15; + int delay2 = 60 * 15 - delay1; Widget toplevel_shell = XtAppInitialize (&app, progclass, 0, 0, &argc, argv, 0, 0, 0); Display *dpy = XtDisplay (toplevel_shell); Window w = RootWindow (dpy, DefaultScreen(dpy)); - XtGetApplicationNameAndClass (dpy, &progname, &progclass); - - kstatus = XGrabKeyboard (dpy, w, True, - GrabModeSync, GrabModeAsync, - CurrentTime); - fprintf (stderr, "%s: grabbing keyboard on 0x%lx... %s.\n", - progname, (unsigned long) w, - (kstatus == GrabSuccess ? "GrabSuccess" : - kstatus == AlreadyGrabbed ? "AlreadyGrabbed" : - kstatus == GrabInvalidTime ? "GrabInvalidTime" : - kstatus == GrabNotViewable ? "GrabNotViewable" : - kstatus == GrabFrozen ? "GrabFrozen" : - "???")); - - mstatus = XGrabPointer (dpy, w, True, ALL_POINTER_EVENTS, - GrabModeAsync, GrabModeAsync, None, - cursor, CurrentTime); - fprintf (stderr, "%s: grabbing mouse on 0x%lx... %s.\n", - progname, (unsigned long) w, - (mstatus == GrabSuccess ? "GrabSuccess" : - mstatus == AlreadyGrabbed ? "AlreadyGrabbed" : - mstatus == GrabInvalidTime ? "GrabInvalidTime" : - mstatus == GrabNotViewable ? "GrabNotViewable" : - mstatus == GrabFrozen ? "GrabFrozen" : - "???")); + int i; + + Bool grab_kbd_p = True; + Bool grab_mouse_p = True; + Bool mouse_sync_p = True; + Bool kbd_sync_p = True; + + progname = argv[0]; + + cursor1 = XCreateFontCursor (dpy, XC_hand1); + cursor2 = XCreateFontCursor (dpy, XC_gumby); + + for (i = 1; i < argc; i++) + { + const char *oa = argv[i]; + if (argv[i][0] == '-' && argv[i][1] == '-') + argv[i]++; + if (!strcmp (argv[i], "-kbd") || !strcmp (argv[i], "-keyboard")) + grab_mouse_p = False; + else if (!strcmp (argv[i], "-mouse") || !strcmp (argv[i], "-pointer")) + grab_kbd_p = False; + else if (!strcmp (argv[i], "-kbd-sync") || + !strcmp (argv[i], "-keyboard-sync")) + kbd_sync_p = True; + else if (!strcmp (argv[i], "-kbd-async") || + !strcmp (argv[i], "-keyboard-async")) + kbd_sync_p = False; + else if (!strcmp (argv[i], "-mouse-sync") || + !strcmp (argv[i], "-pointer-sync")) + mouse_sync_p = True; + else if (!strcmp (argv[i], "-mouse-async") || + !strcmp (argv[i], "-pointer-async")) + mouse_sync_p = False; + else + { + fprintf (stderr, "%s: unknown option: %s\n", blurb(), oa); + exit (1); + } + } + + if (grab_kbd_p) + { + kstatus = XGrabKeyboard (dpy, w, True, + (mouse_sync_p ? GrabModeSync : GrabModeAsync), + (kbd_sync_p ? GrabModeSync : GrabModeAsync), + CurrentTime); + fprintf (stderr, "%s: grabbing keyboard on 0x%lx (%s, %s)... %s\n", + progname, (unsigned long) w, + (mouse_sync_p ? "sync" : "async"), + (kbd_sync_p ? "sync" : "async"), + (kstatus == GrabSuccess ? "GrabSuccess" : + kstatus == AlreadyGrabbed ? "AlreadyGrabbed" : + kstatus == GrabInvalidTime ? "GrabInvalidTime" : + kstatus == GrabNotViewable ? "GrabNotViewable" : + kstatus == GrabFrozen ? "GrabFrozen" : + "???")); + } + + if (grab_mouse_p) + { + mstatus = XGrabPointer (dpy, w, True, ALL_POINTER_EVENTS, + (mouse_sync_p ? GrabModeSync : GrabModeAsync), + (kbd_sync_p ? GrabModeSync : GrabModeAsync), + None, cursor1, CurrentTime); + fprintf (stderr, "%s: grabbing mouse on 0x%lx (%s, %s)... %s\n", + progname, (unsigned long) w, + (mouse_sync_p ? "sync" : "async"), + (kbd_sync_p ? "sync" : "async"), + (mstatus == GrabSuccess ? "GrabSuccess" : + mstatus == AlreadyGrabbed ? "AlreadyGrabbed" : + mstatus == GrabInvalidTime ? "GrabInvalidTime" : + mstatus == GrabNotViewable ? "GrabNotViewable" : + mstatus == GrabFrozen ? "GrabFrozen" : + "???")); + } XSync(dpy, False); @@ -77,12 +129,34 @@ main (int argc, char **argv) { fprintf (stderr, "%s: sleeping for %d:%02d:%02d...\n", progname, - delay / (60 * 60), - (delay % (60 * 60)) / 60, - delay % 60); - fflush(stderr); - sleep (delay); - XSync(dpy, False); + delay1 / (60 * 60), + (delay1 % (60 * 60)) / 60, + delay1 % 60); + sleep (delay1); + fprintf (stderr, "%s: changing mouse cursor...\n", progname); + + mstatus = XGrabPointer (dpy, w, True, ALL_POINTER_EVENTS, + (mouse_sync_p ? GrabModeSync : GrabModeAsync), + (kbd_sync_p ? GrabModeSync : GrabModeAsync), + None, cursor2, CurrentTime); + XSync (dpy, False); + if (mstatus != GrabSuccess) + fprintf (stderr, "%s: failed: %s\n", progname, + (mstatus == GrabSuccess ? "GrabSuccess" : + mstatus == AlreadyGrabbed ? "AlreadyGrabbed" : + mstatus == GrabInvalidTime ? "GrabInvalidTime" : + mstatus == GrabNotViewable ? "GrabNotViewable" : + mstatus == GrabFrozen ? "GrabFrozen" : + "???")); + + fprintf (stderr, "%s: sleeping for %d:%02d:%02d...\n", + progname, + delay2 / (60 * 60), + (delay2 % (60 * 60)) / 60, + delay2 % 60); + fflush (stderr); + sleep (delay2); + XSync (dpy, False); } exit (0); diff --git a/driver/test-passwd.c b/driver/test-passwd.c index 9b4f98e..2c894ac 100644 --- a/driver/test-passwd.c +++ b/driver/test-passwd.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1998-2017 Jamie Zawinski +/* xscreensaver, Copyright © 1998-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -10,8 +10,6 @@ */ /* This is a kludgy test harness for debugging the password dialog box. - It's somewhat easier to debug it here than in the xscreensaver executable - itself. */ #ifdef HAVE_CONFIG_H @@ -19,288 +17,101 @@ #endif #include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "xscreensaver.h" -#include "resources.h" -#include "version.h" -#include "visual.h" +#include +#include "blurb.h" #include "auth.h" -char *progname = 0; -char *progclass = 0; -XrmDatabase db = 0; -saver_info *global_si_kludge; - -FILE *real_stderr, *real_stdout; - -void monitor_power_on (saver_info *si, Bool on_p) {} -Bool monitor_powered_on_p (saver_info *si) { return True; } -void initialize_screensaver_window (saver_info *si) {} -void raise_window (saver_info *si, Bool i, Bool b, Bool d) {} -Bool blank_screen (saver_info *si) {return False;} -void unblank_screen (saver_info *si) {} -void reset_watchdog_timer(saver_info *si, Bool on_p) {} -Bool select_visual (saver_screen_info *ssi, const char *v) { return False; } -Bool window_exists_p (Display *dpy, Window window) {return True;} -void start_notice_events_timer (saver_info *si, Window w, Bool b) {} -Bool handle_clientmessage (saver_info *si, XEvent *e, Bool u) { return False; } -int BadWindow_ehandler (Display *dpy, XErrorEvent *error) { exit(1); } -const char *signal_name(int signal) { return "???"; } -Bool restore_real_vroot (saver_info *si) { return False; } -void store_saver_status (saver_info *si) {} -void saver_exit (saver_info *si, int status, const char *core) { exit(status);} -int move_mouse_grab (saver_info *si, Window to, Cursor c, int ts) { return 0; } -int mouse_screen (saver_info *si) { return 0; } -void check_for_leaks (const char *where) { } -void shutdown_stderr (saver_info *si) { } -void resize_screensaver_window (saver_info *si) { } -void describe_monitor_layout (saver_info *si) { } -Bool update_screen_layout (saver_info *si) { return 0; } -Bool in_signal_handler_p = 0; -char *timestring (time_t when) { return ""; } - -const char *blurb(void) { return progname; } -Atom XA_SCREENSAVER, XA_DEMO, XA_PREFS; +extern Bool test_auth_conv (void *, int, auth_message *, auth_response **); -void -idle_timer (XtPointer closure, XtIntervalId *id) +Bool +test_auth_conv (void *closure, + int nmsgs, + auth_message *msg, + auth_response **resp) { - saver_info *si = (saver_info *) closure; - XEvent fake_event; - fake_event.type = 0; /* XAnyEvent type, ignored. */ - fake_event.xany.display = si->dpy; - fake_event.xany.window = 0; - XPutBackEvent (si->dpy, &fake_event); -} - -static int -text_auth_conv ( - int num_msg, - const struct auth_message *auth_msgs, - struct auth_response **resp, - saver_info *si) -{ - char *input; - char buf[255]; - struct auth_response *responses; + int page = 1; int i; + nmsgs = 0; + msg = (auth_message *) calloc (100, sizeof(*msg)); - responses = calloc(num_msg, sizeof(struct auth_response)); - if (!responses) - return -1; - - /* The unlock state won't actually be used until this function returns and - * the auth module processes the response, but set it anyway for consistency - */ - si->unlock_state = ul_read; - - for (i = 0; i < num_msg; ++i) - { - printf ("\n%s: %s", progname, auth_msgs[i].msg); - if ( auth_msgs[i].type == AUTH_MSGTYPE_PROMPT_NOECHO - || auth_msgs[i].type == AUTH_MSGTYPE_PROMPT_ECHO) - { - input = fgets (buf, sizeof(buf)-1, stdin); - if (!input || !*input) - exit (0); - if (input[strlen(input)-1] == '\n') - input[strlen(input)-1] = 0; - - responses[i].response = strdup(input); - } - } - - *resp = responses; - - si->unlock_state = ul_finished; - - return 0; -} - - -#ifdef __GNUC__ - __extension__ /* shut up about "string length is greater than the length - ISO C89 compilers are required to support" when including - the .ad file... */ -#endif - -static char *fallback[] = { -#include "XScreenSaver_ad.h" - 0 -}; +# define DIALOG() \ + fprintf (stderr, "\n%s: page %d\n", blurb(), page++); \ + xscreensaver_auth_conv (closure, nmsgs, msg, resp); \ + if (*resp) \ + for (i = 0; i < nmsgs; i++) \ + fprintf (stderr, "%s: resp %d = \"%s\"\n", blurb(), i, \ + ((*resp)[i].response ? (*resp)[i].response : "")); \ + nmsgs = 0 -extern Bool debug_passwd_window_p; /* lock.c kludge */ -int -main (int argc, char **argv) -{ - enum { PASS, SPLASH, TTY } which; - Widget toplevel_shell = 0; - saver_screen_info ssip; - saver_info sip; - saver_info *si = &sip; - saver_preferences *p = &si->prefs; - struct passwd *pw; + msg[nmsgs].type = AUTH_MSGTYPE_INFO; + msg[nmsgs].msg = "1/4 Page One"; + nmsgs++; - memset(&sip, 0, sizeof(sip)); - memset(&ssip, 0, sizeof(ssip)); + msg[nmsgs].type = AUTH_MSGTYPE_INFO; + msg[nmsgs].msg = "2/4 All work and no play makes Jack a dull boy. " + "All work and no play makes Jack a dull boy. "; + nmsgs++; - si->nscreens = 1; - si->screens = si->default_screen = &ssip; - ssip.global = si; + msg[nmsgs].type = AUTH_MSGTYPE_ERROR; + msg[nmsgs].msg = "3/4 Red"; + nmsgs++; - global_si_kludge = si; - real_stderr = stderr; - real_stdout = stdout; + msg[nmsgs].type = AUTH_MSGTYPE_INFO; + msg[nmsgs].msg = "4/4 Greets to Crash Override."; + nmsgs++; + DIALOG(); - si->version = (char *) malloc (5); - memcpy (si->version, screensaver_id + 17, 4); - si->version[4] = 0; - progname = argv[0]; - { - char *s = strrchr(progname, '/'); - if (*s) progname = s+1; - } - if (argc != 2) goto USAGE; - else if (!strcmp (argv[1], "pass")) which = PASS; - else if (!strcmp (argv[1], "splash")) which = SPLASH; - else if (!strcmp (argv[1], "tty")) which = TTY; - else - { - USAGE: - fprintf (stderr, "usage: %s [ pass | splash | tty ]\n", progname); - exit (1); - } - -#ifdef NO_LOCKING - if (which == PASS || which == TTY) - { - fprintf (stderr, "%s: compiled with NO_LOCKING\n", progname); - exit (1); - } -#endif - -#ifndef NO_LOCKING - /* before hack_uid() for proper permissions */ - lock_priv_init (argc, argv, True); - - hack_uid (si); - - if (! lock_init (argc, argv, True)) - { - si->locking_disabled_p = True; - si->nolock_reason = "error getting password"; - } -#endif + msg[nmsgs].type = AUTH_MSGTYPE_INFO; + msg[nmsgs].msg = "1/1 Page Two"; + nmsgs++; + DIALOG(); - progclass = "XScreenSaver"; - if (!setlocale (LC_CTYPE, "")) - fprintf (stderr, "%s: warning: could not set default locale\n", - progname); + msg[nmsgs].type = AUTH_MSGTYPE_INFO; + msg[nmsgs].msg = "1/2 Page Three"; + nmsgs++; + msg[nmsgs].type = AUTH_MSGTYPE_PROMPT_NOECHO; + msg[nmsgs].msg = "2/2 Greets to Crash Override and also Joey"; + nmsgs++; - if (which != TTY) - { - toplevel_shell = XtAppInitialize (&si->app, progclass, 0, 0, - &argc, argv, fallback, - 0, 0); - si->dpy = XtDisplay (toplevel_shell); - p->db = XtDatabase (si->dpy); - si->default_screen->toplevel_shell = toplevel_shell; - si->default_screen->screen = XtScreen(toplevel_shell); - si->default_screen->default_visual = - si->default_screen->current_visual = - DefaultVisualOfScreen(si->default_screen->screen); - si->default_screen->screensaver_window = - RootWindowOfScreen(si->default_screen->screen); - si->default_screen->current_depth = - visual_depth(si->default_screen->screen, - si->default_screen->current_visual); + msg[nmsgs].type = AUTH_MSGTYPE_PROMPT_NOECHO; + msg[nmsgs].msg = "1/3 Page Four"; + nmsgs++; - ssip.width = WidthOfScreen(ssip.screen); - ssip.height = HeightOfScreen(ssip.screen); + msg[nmsgs].type = AUTH_MSGTYPE_INFO; + msg[nmsgs].msg = "2/3 Hack the planet."; + nmsgs++; - db = p->db; - XtGetApplicationNameAndClass (si->dpy, &progname, &progclass); + msg[nmsgs].type = AUTH_MSGTYPE_INFO; + msg[nmsgs].msg = "3/3 Hack the planet."; + nmsgs++; + DIALOG(); - load_init_file (si->dpy, &si->prefs); - } - p->verbose_p = True; + msg[nmsgs].type = AUTH_MSGTYPE_PROMPT_ECHO; + msg[nmsgs].msg = "1/1 Page Five visible text"; + nmsgs++; - pw = getpwuid (getuid ()); - si->user = strdup (pw->pw_name); + msg[nmsgs].type = AUTH_MSGTYPE_PROMPT_ECHO; + msg[nmsgs].msg = "1/3 Page six visible text"; + nmsgs++; -/* si->nscreens = 0; - si->screens = si->default_screen = 0; */ + msg[nmsgs].type = AUTH_MSGTYPE_INFO; + msg[nmsgs].msg = "2/3 Poop."; + nmsgs++; - while (1) - { -#ifndef NO_LOCKING - if (which == PASS) - { - si->unlock_cb = gui_auth_conv; - si->auth_finished_cb = auth_finished_cb; + msg[nmsgs].type = AUTH_MSGTYPE_INFO; + msg[nmsgs].msg = "3/3 \xF0\x9F\x92\xA9 \xF0\x9F\x92\xA9 \xF0\x9F\x92\xA9" + " \xE2\x80\x9C" + " \xE2\xAC\xA4 \xE2\x80\xA2 \xE2\xAD\x98 " + "\xE2\x80\x9D"; + nmsgs++; + DIALOG(); - debug_passwd_window_p = True; - xss_authenticate(si, True); - - if (si->unlock_state == ul_success) - fprintf (stderr, "%s: authentication succeeded\n", progname); - else - fprintf (stderr, "%s: authentication FAILED!\n", progname); - - XSync(si->dpy, False); - fprintf (stderr, "\n######################################\n\n"); - sleep (3); - } - else -#endif - if (which == SPLASH) - { - XEvent event; - make_splash_dialog (si); - XtAppAddTimeOut (si->app, p->splash_duration + 1000, - idle_timer, (XtPointer) si); - while (si->splash_dialog) - { - XtAppNextEvent (si->app, &event); - if (event.xany.window == si->splash_dialog) - handle_splash_event (si, &event); - XtDispatchEvent (&event); - } - XSync (si->dpy, False); - sleep (1); - } -#ifndef NO_LOCKING - else if (which == TTY) - { - si->unlock_cb = text_auth_conv; - - printf ("%s: Authenticating user %s\n", progname, si->user); - xss_authenticate(si, True); - - if (si->unlock_state == ul_success) - printf ("%s: Ok!\n", progname); - else - printf ("%s: Wrong!\n", progname); - } -#endif - else - abort(); - } - - free(si->user); + exit(0); } + diff --git a/driver/test-randr.c b/driver/test-randr.c index 74ead37..1f88d99 100644 --- a/driver/test-randr.c +++ b/driver/test-randr.c @@ -1,5 +1,5 @@ /* test-randr.c --- playing with the Resize And Rotate extension. - * xscreensaver, Copyright (c) 2004-2008 Jamie Zawinski + * xscreensaver, Copyright © 2004-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -30,26 +30,9 @@ #include #include -char *progname = 0; +#include "blurb.h" char *progclass = "XScreenSaver"; -static const char * -blurb (void) -{ - static char buf[255]; - time_t now = time ((time_t *) 0); - char *ct = (char *) ctime (&now); - int n = strlen(progname); - if (n > 100) n = 99; - strncpy(buf, progname, n); - buf[n++] = ':'; - buf[n++] = ' '; - strncpy(buf+n, ct+11, 8); - strcpy(buf+n+9, ": "); - return buf; -} - - static Bool error_handler_hit_p = False; static int @@ -72,15 +55,15 @@ main (int argc, char **argv) Widget toplevel_shell = XtAppInitialize (&app, progclass, 0, 0, &argc, argv, 0, 0, 0); Display *dpy = XtDisplay (toplevel_shell); - XtGetApplicationNameAndClass (dpy, &progname, &progclass); + progname = argv[0]; nscreens = ScreenCount(dpy); if (!XRRQueryExtension(dpy, &event_number, &error_number)) { fprintf(stderr, "%s: XRRQueryExtension(dpy, ...) ==> False\n", blurb()); - fprintf(stderr, "%s: server does not support the RANDR extension.\n", + fprintf(stderr, "%s: server does not support the RANDR extension\n", blurb()); major = -1; } diff --git a/driver/test-screens.c b/driver/test-screens.c index 2fb3e35..141b7ad 100644 --- a/driver/test-screens.c +++ b/driver/test-screens.c @@ -1,5 +1,5 @@ /* test-screens.c --- some test cases for the "monitor sanity" checks. - * xscreensaver, Copyright (c) 2008 Jamie Zawinski + * xscreensaver, Copyright © 2008-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -14,39 +14,20 @@ # include "config.h" #endif +#include +#include +#include #include -/* This file doesn't need the Xt headers, so stub these types out... */ -#undef XtPointer -#define XtAppContext void* -#define XrmDatabase void* -#define XtIntervalId void* -#define XtPointer void* -#define Widget void* - -#include "xscreensaver.h" +#include "blurb.h" #include "visual.h" +#include "screens.h" #undef WidthOfScreen #undef HeightOfScreen #define WidthOfScreen(s) 10240 #define HeightOfScreen(s) 10240 -#undef screen_number -#define screen_number(s) ((int) s) - -#include "screens.c" /* to get at static void check_monitor_sanity() */ - -char *progname = 0; -char *progclass = "XScreenSaver"; - -const char *blurb(void) { return progname; } - -Bool safe_XF86VidModeGetViewPort(Display *d, int i, int *x, int *y) { abort(); } -void initialize_screen_root_widget(saver_screen_info *ssi) { abort(); } -Visual *get_best_gl_visual (saver_info *si, Screen *sc) { abort(); } - - static const char * failstr (monitor_sanity san) { diff --git a/driver/test-uid.c b/driver/test-uid.c index 6a1f9cc..713a3fd 100644 --- a/driver/test-uid.c +++ b/driver/test-uid.c @@ -124,12 +124,12 @@ main (int argc, char **argv) { if (was_numeric) { - fprintf(stderr, "no group numbered %s.\n", group); + fprintf(stderr, "no group numbered %s\n", group); group = ""; } else { - fprintf(stderr, "no group named %s.\n", group); + fprintf(stderr, "no group named %s\n", group); goto NOGROUP; } } @@ -138,14 +138,14 @@ main (int argc, char **argv) { gid_t g2 = gid; if (setgroups(1, &g2) == 0) - fprintf(stderr, " succeeded.\n"); + fprintf(stderr, " succeeded\n"); else perror(" failed"); } fprintf(stderr, "setgid(%ld) \"%s\"", gid, group); if (setgid(gid) == 0) - fprintf(stderr, " succeeded.\n"); + fprintf(stderr, " succeeded\n"); else perror(" failed"); @@ -177,19 +177,19 @@ main (int argc, char **argv) { if (was_numeric) { - fprintf(stderr, "no user numbered \"%s\".\n", user); + fprintf(stderr, "no user numbered \"%s\"\n", user); user = ""; } else { - fprintf(stderr, "no user named %s.\n", user); + fprintf(stderr, "no user named %s\n", user); goto NOUSER; } } fprintf(stderr, "setuid(%ld) \"%s\"", uid, user); if (setuid(uid) == 0) - fprintf(stderr, " succeeded.\n"); + fprintf(stderr, " succeeded\n"); else perror(" failed"); NOUSER: ; diff --git a/driver/test-vp.c b/driver/test-vp.c index bf1a0b1..ded5aca 100644 --- a/driver/test-vp.c +++ b/driver/test-vp.c @@ -1,5 +1,5 @@ /* test-xinerama.c --- playing with XF86VidModeGetViewPort - * xscreensaver, Copyright (c) 2004 Jamie Zawinski + * xscreensaver, Copyright © 2004-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -31,26 +31,9 @@ #include #include -char *progname = 0; +#include "blurb.h" char *progclass = "XScreenSaver"; -static const char * -blurb (void) -{ - static char buf[255]; - time_t now = time ((time_t *) 0); - char *ct = (char *) ctime (&now); - int n = strlen(progname); - if (n > 100) n = 99; - strncpy(buf, progname, n); - buf[n++] = ':'; - buf[n++] = ' '; - strncpy(buf+n, ct+11, 8); - strcpy(buf+n+9, ": "); - return buf; -} - - static Bool error_handler_hit_p = False; static int @@ -129,14 +112,13 @@ main (int argc, char **argv) Widget toplevel_shell = XtAppInitialize (&app, progclass, 0, 0, &argc, argv, 0, 0, 0); Display *dpy = XtDisplay (toplevel_shell); - XtGetApplicationNameAndClass (dpy, &progname, &progclass); if (!XF86VidModeQueryExtension(dpy, &event_number, &error_number)) { fprintf(stderr, "%s: XF86VidModeQueryExtension(dpy, ...) ==> False\n", blurb()); fprintf(stderr, - "%s: server does not support the XF86VidMode extension.\n", + "%s: server does not support the XF86VidMode extension\n", blurb()); exit(1); } diff --git a/driver/test-xdpms.c b/driver/test-xdpms.c index b86aed3..e837d8d 100644 --- a/driver/test-xdpms.c +++ b/driver/test-xdpms.c @@ -1,5 +1,5 @@ /* test-xdpms.c --- playing with the XDPMS extension. - * xscreensaver, Copyright (c) 1998-2011 Jamie Zawinski + * xscreensaver, Copyright © 1998-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -29,42 +29,11 @@ #include #include -#include +/*#include */ -extern Bool DPMSQueryExtension (Display *dpy, int *event_ret, int *error_ret); -extern Bool DPMSCapable (Display *dpy); -extern Status DPMSForceLevel (Display *dpy, CARD16 level); -extern Status DPMSInfo (Display *dpy, CARD16 *power_level, BOOL *state); - -extern Status DPMSGetVersion (Display *dpy, int *major_ret, int *minor_ret); -extern Status DPMSSetTimeouts (Display *dpy, - CARD16 standby, CARD16 suspend, CARD16 off); -extern Bool DPMSGetTimeouts (Display *dpy, - CARD16 *standby, CARD16 *suspend, CARD16 *off); -extern Status DPMSEnable (Display *dpy); -extern Status DPMSDisable (Display *dpy); - - -char *progname = 0; +#include "blurb.h" char *progclass = "XScreenSaver"; -static const char * -blurb (void) -{ - static char buf[255]; - time_t now = time ((time_t *) 0); - char *ct = (char *) ctime (&now); - int n = strlen(progname); - if (n > 100) n = 99; - strncpy(buf, progname, n); - buf[n++] = ':'; - buf[n++] = ' '; - strncpy(buf+n, ct+11, 8); - strcpy(buf+n+9, ": "); - return buf; -} - - static Bool error_handler_hit_p = False; static int @@ -90,13 +59,12 @@ main (int argc, char **argv) Widget toplevel_shell = XtAppInitialize (&app, progclass, 0, 0, &argc, argv, 0, 0, 0); Display *dpy = XtDisplay (toplevel_shell); - XtGetApplicationNameAndClass (dpy, &progname, &progclass); if (!DPMSQueryExtension(dpy, &event_number, &error_number)) { fprintf(stderr, "%s: DPMSQueryExtension(dpy, ...) ==> False\n", blurb()); - fprintf(stderr, "%s: server does not support the XDPMS extension.\n", + fprintf(stderr, "%s: server does not support the XDPMS extension\n", blurb()); exit(1); } @@ -107,7 +75,7 @@ main (int argc, char **argv) if (!DPMSCapable(dpy)) { fprintf(stderr, "%s: DPMSCapable(dpy) ==> False\n", blurb()); - fprintf(stderr, "%s: server says hardware doesn't support DPMS.\n", + fprintf(stderr, "%s: server says hardware doesn't support DPMS\n", blurb()); exit(1); } @@ -158,13 +126,12 @@ main (int argc, char **argv) state == DPMSModeSuspend || state == DPMSModeOff) { - XErrorHandler old_handler; int st; - fprintf(stderr, "%s: monitor is off; turning it on.\n", blurb()); + fprintf(stderr, "%s: monitor is off; turning it on\n", blurb()); XSync (dpy, False); error_handler_hit_p = False; - old_handler = XSetErrorHandler (ignore_all_errors_ehandler); + XSetErrorHandler (ignore_all_errors_ehandler); XSync (dpy, False); st = DPMSForceLevel (dpy, DPMSModeOn); XSync (dpy, False); diff --git a/driver/test-xinerama.c b/driver/test-xinerama.c index 8bafbb0..cd8add4 100644 --- a/driver/test-xinerama.c +++ b/driver/test-xinerama.c @@ -1,5 +1,5 @@ /* test-xinerama.c --- playing with the Xinerama extension. - * xscreensaver, Copyright (c) 2003 Jamie Zawinski + * xscreensaver, Copyright © 2003-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -30,26 +30,9 @@ #include #include -char *progname = 0; +#include "blurb.h" char *progclass = "XScreenSaver"; -static const char * -blurb (void) -{ - static char buf[255]; - time_t now = time ((time_t *) 0); - char *ct = (char *) ctime (&now); - int n = strlen(progname); - if (n > 100) n = 99; - strncpy(buf, progname, n); - buf[n++] = ':'; - buf[n++] = ' '; - strncpy(buf+n, ct+11, 8); - strcpy(buf+n+9, ": "); - return buf; -} - - int main (int argc, char **argv) { @@ -63,13 +46,12 @@ main (int argc, char **argv) Widget toplevel_shell = XtAppInitialize (&app, progclass, 0, 0, &argc, argv, 0, 0, 0); Display *dpy = XtDisplay (toplevel_shell); - XtGetApplicationNameAndClass (dpy, &progname, &progclass); if (!XineramaQueryExtension(dpy, &event_number, &error_number)) { fprintf(stderr, "%s: XineramaQueryExtension(dpy, ...) ==> False\n", blurb()); - fprintf(stderr, "%s: server does not support the Xinerama extension.\n", + fprintf(stderr, "%s: server does not support the Xinerama extension\n", blurb()); exit(1); } @@ -80,7 +62,7 @@ main (int argc, char **argv) if (!XineramaIsActive(dpy)) { fprintf(stderr, "%s: XineramaIsActive(dpy) ==> False\n", blurb()); - fprintf(stderr, "%s: server says Xinerama is turned off.\n", blurb()); + fprintf(stderr, "%s: server says Xinerama is turned off\n", blurb()); exit(1); } else diff --git a/driver/test-xinput.c b/driver/test-xinput.c new file mode 100644 index 0000000..e3a6487 --- /dev/null +++ b/driver/test-xinput.c @@ -0,0 +1,306 @@ +/* test-xinput.c --- playing with the XInput2 extension. + * xscreensaver, Copyright © 2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#ifdef HAVE_UNISTD_H +# include +#endif + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "blurb.h" +#include "xinput.h" + +char *progclass = "XScreenSaver"; +Bool debug_p = True; + +static void +ungrab_timer (XtPointer closure, XtIntervalId *id) +{ + Display *dpy = (Display *) closure; + fprintf (stderr, "\n%s: ungrabbing\n\n", blurb()); + XUngrabKeyboard (dpy, CurrentTime); + XUngrabPointer (dpy, CurrentTime); +} + + +static const char * +grab_string (int status) +{ + switch (status) { + case GrabSuccess: return "GrabSuccess"; + case AlreadyGrabbed: return "AlreadyGrabbed"; + case GrabInvalidTime: return "GrabInvalidTime"; + case GrabNotViewable: return "GrabNotViewable"; + case GrabFrozen: return "GrabFrozen"; + default: + { + static char buf[255]; + sprintf(buf, "unknown status: %d", status); + return buf; + } + } +} + + +int +main (int argc, char **argv) +{ + XtAppContext app; + Widget toplevel_shell; + Display *dpy; + int xi_opcode; + Bool grab_kbd_p = False; + Bool grab_mouse_p = False; + Bool mouse_sync_p = True; + Bool kbd_sync_p = True; + int i; + + progname = argv[0]; + + for (i = 1; i < argc; i++) + { + const char *oa = argv[i]; + if (argv[i][0] == '-' && argv[i][1] == '-') + argv[i]++; + if (!strcmp (argv[i], "-grab")) + grab_kbd_p = grab_mouse_p = True; + else if (!strcmp (argv[i], "-grab-kbd") || + !strcmp (argv[i], "-grab-keyboard")) + grab_kbd_p = True; + else if (!strcmp (argv[i], "-grab-mouse") || + !strcmp (argv[i], "-grab-pointer")) + grab_mouse_p = True; + else if (!strcmp (argv[i], "-kbd-sync") || + !strcmp (argv[i], "-keyboard-sync")) + kbd_sync_p = True; + else if (!strcmp (argv[i], "-kbd-async") || + !strcmp (argv[i], "-keyboard-async")) + kbd_sync_p = False; + else if (!strcmp (argv[i], "-mouse-sync") || + !strcmp (argv[i], "-pointer-sync")) + mouse_sync_p = True; + else if (!strcmp (argv[i], "-mouse-async") || + !strcmp (argv[i], "-pointer-async")) + mouse_sync_p = False; + else + { + fprintf (stderr, "%s: unknown option: %s\n", blurb(), oa); + exit (1); + } + } + + toplevel_shell = XtAppInitialize (&app, progclass, 0, 0, + &argc, argv, 0, 0, 0); + dpy = XtDisplay (toplevel_shell); + if (!dpy) exit(1); + + if (! init_xinput (dpy, &xi_opcode)) + exit (1); + + if (grab_kbd_p || grab_mouse_p) + { + int timeout = 15; + Window w = RootWindow (dpy, 0); + int status; + XColor black = { 0, }; + Pixmap bit = XCreateBitmapFromData (dpy, w, "\000", 1, 1); + Cursor cursor = XCreatePixmapCursor (dpy, bit, bit, &black, &black, 0, 0); + + if (grab_kbd_p) + { + status = XGrabKeyboard (dpy, w, True, + (mouse_sync_p ? GrabModeSync : GrabModeAsync), + (kbd_sync_p ? GrabModeSync : GrabModeAsync), + CurrentTime); + if (status == GrabSuccess) + fprintf (stderr, "%s: grabbed keyboard (%s, %s)\n", blurb(), + (mouse_sync_p ? "sync" : "async"), + (kbd_sync_p ? "sync" : "async")); + else + { + fprintf (stderr, "%s: failed to grab keyboard (%s, %s): %s\n", + blurb(), + (mouse_sync_p ? "sync" : "async"), + (kbd_sync_p ? "sync" : "async"), + grab_string (status)); + exit(1); + } + } + + if (grab_mouse_p) + { + status = XGrabPointer (dpy, w, True, + (ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | LeaveWindowMask | + PointerMotionMask | PointerMotionHintMask | + Button1MotionMask | Button2MotionMask | + Button3MotionMask | Button4MotionMask | + Button5MotionMask | ButtonMotionMask), + (mouse_sync_p ? GrabModeSync : GrabModeAsync), + (kbd_sync_p ? GrabModeSync : GrabModeAsync), + w, cursor, CurrentTime); + if (status == GrabSuccess) + fprintf (stderr, "%s: grabbed mouse (%s, %s)\n", blurb(), + (mouse_sync_p ? "sync" : "async"), + (kbd_sync_p ? "sync" : "async")); + else + { + fprintf (stderr, "%s: failed to grab mouse (%s, %s): %s\n", + blurb(), + (mouse_sync_p ? "sync" : "async"), + (kbd_sync_p ? "sync" : "async"), + grab_string (status)); + exit(1); + } + } + + fprintf (stderr, "%s: ungrabbing in %d seconds\n", blurb(), timeout); + XtAppAddTimeOut (app, 1000 * timeout, ungrab_timer, (XtPointer) dpy); + } + + while (1) + { + XEvent xev; + XIRawEvent *re; + + XtAppNextEvent (app, &xev); + XtDispatchEvent (&xev); + + switch (xev.xany.type) { + case KeyPress: + case KeyRelease: + { + static XComposeStatus compose = { 0, }; + KeySym keysym = 0; + char c[100]; + int n; + n = XLookupString (&xev.xkey, c, sizeof(c)-1, &keysym, &compose); + c[n] = 0; + fprintf (stderr, "%s: X11 Key%s %02x %02x %s \"%s\"\n", blurb(), + (xev.xkey.type == KeyPress ? "Press " : "Release"), + xev.xkey.keycode, xev.xkey.state, + XKeysymToString (keysym), c); + } + break; + case ButtonPress: + case ButtonRelease: + fprintf (stderr, "%s: X11 Button%s %d %d\n", blurb(), + (xev.xany.type == ButtonPress ? "Press " : "Release"), + xev.xbutton.button, xev.xbutton.state); + break; + case MotionNotify: + fprintf (stderr, "%s: X11 MotionNotify %4d, %-4d\n", + blurb(), xev.xmotion.x_root, xev.xmotion.y_root); + break; + case GenericEvent: + break; + case EnterNotify: + case LeaveNotify: + break; + default: + fprintf (stderr, "%s: X11 event %d on 0x%lx\n", + blurb(), xev.xany.type, xev.xany.window); + break; + } + + if (xev.xcookie.type != GenericEvent || + xev.xcookie.extension != xi_opcode) + continue; /* not an XInput event */ + if (!xev.xcookie.data) + XGetEventData (dpy, &xev.xcookie); + if (!xev.xcookie.data) + continue; /* Bogus XInput event */ + + re = xev.xcookie.data; + switch (xev.xcookie.evtype) { + case XI_RawKeyPress: + case XI_RawKeyRelease: + { + /* Fake up an XKeyEvent in order to call XKeysymToString(). */ + XEvent ev2; + Bool ok = xinput_event_to_xlib (xev.xcookie.evtype, + (XIDeviceEvent *) re, + &ev2); + if (!ok) + fprintf (stderr, "%s: unable to translate XInput2 event\n", + blurb()); + else + { + static XComposeStatus compose = { 0, }; + KeySym keysym = 0; + char c[100]; + int n; + n = XLookupString (&ev2.xkey, c, sizeof(c)-1, &keysym, &compose); + c[n] = 0; + fprintf (stderr, "%s: XI_RawKey%s %02x %02x %s \"%s\"\n", + blurb(), + (ev2.xkey.type == KeyPress ? "Press " : "Release"), + ev2.xkey.keycode, ev2.xkey.state, + XKeysymToString (keysym), c); + } + } + break; + case XI_RawButtonPress: + case XI_RawButtonRelease: + fprintf (stderr, "%s: XI_RawButton%s %d\n", blurb(), + (re->evtype == XI_RawButtonPress ? "Press " : "Release"), + re->detail); + break; + case XI_RawMotion: + { + Window root_ret, child_ret; + int root_x, root_y; + int win_x, win_y; + unsigned int mask; + XQueryPointer (dpy, DefaultRootWindow (dpy), + &root_ret, &child_ret, &root_x, &root_y, + &win_x, &win_y, &mask); + fprintf (stderr, "%s: XI_RawMotion %4d, %-4d %7.02f, %-7.02f\n", + blurb(), + root_x, root_y, + re->raw_values[0], re->raw_values[1]); + } + break; + case XI_RawTouchBegin: + fprintf (stderr, "%s: XI_RawTouchBegin\n", blurb()); + break; + case XI_RawTouchEnd: + fprintf (stderr, "%s: XI_RawTouchEnd", blurb()); + break; + case XI_RawTouchUpdate: + fprintf (stderr, "%s: XI_RawTouchUpdate", blurb()); + break; + + default: + fprintf (stderr, "%s: XInput unknown event %d\n", blurb(), + xev.xcookie.evtype); + break; + } + + XFreeEventData (dpy, &xev.xcookie); + } + + exit (0); +} diff --git a/driver/test-xkb.c b/driver/test-xkb.c new file mode 100644 index 0000000..8d26b73 --- /dev/null +++ b/driver/test-xkb.c @@ -0,0 +1,89 @@ +/* test-xkb.c --- playing with the X Keyboard extension. + * xscreensaver, Copyright © 2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#ifdef HAVE_UNISTD_H +# include +#endif + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "blurb.h" + +char *progclass = "XScreenSaver"; + +int +main (int argc, char **argv) +{ + XtAppContext app; + Widget toplevel_shell; + Display *dpy; + int i; + + progname = argv[0]; + + for (i = 1; i < argc; i++) + { + const char *oa = argv[i]; + if (argv[i][0] == '-' && argv[i][1] == '-') + argv[i]++; + if (0) ; + else + { + fprintf (stderr, "%s: unknown option: %s\n", blurb(), oa); + exit (1); + } + } + + toplevel_shell = XtAppInitialize (&app, progclass, 0, 0, + &argc, argv, 0, 0, 0); + dpy = XtDisplay (toplevel_shell); + if (!dpy) exit(1); + + { + XkbStateRec state; + XkbDescPtr desc; + char *group; + Atom name; + + if (XkbGetState (dpy, XkbUseCoreKbd, &state)) + { + fprintf (stderr, "%s: XkbGetState failed\n", progname); + exit (1); + } + desc = XkbGetKeyboard (dpy, XkbAllComponentsMask, XkbUseCoreKbd); + if (!desc || !desc->names) + { + fprintf (stderr, "%s: XkbGetKeyboard failed\n", progname); + exit (1); + } + + name = desc->names->groups[state.group]; + group = (name ? XGetAtomName (dpy, name) : strdup("NULL")); + fprintf (stderr, "%s: kbd name: %s\n", progname, group); + free (group); + } + + exit (0); +} diff --git a/driver/test-yarandom.c b/driver/test-yarandom.c index 6701ff8..e434377 100644 --- a/driver/test-yarandom.c +++ b/driver/test-yarandom.c @@ -21,10 +21,9 @@ #include #include +#include "blurb.h" #include "yarandom.h" -char *progname = 0; - int main (int argc, char **argv) { diff --git a/driver/types.h b/driver/types.h index ebea9e0..d8e4880 100644 --- a/driver/types.h +++ b/driver/types.h @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1993-2020 Jamie Zawinski +/* xscreensaver, Copyright © 1993-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -14,15 +14,6 @@ typedef struct saver_info saver_info; -typedef enum { - ul_read, /* reading input or ready to do so */ - ul_success, /* auth success, unlock */ - ul_fail, /* auth fail */ - ul_cancel, /* user cancelled auth (pw_cancel or pw_null) */ - ul_time, /* timed out */ - ul_finished /* user pressed enter */ -} unlock_state; - typedef struct screenhack screenhack; struct screenhack { Bool enabled_p; @@ -39,44 +30,13 @@ typedef enum { TEXT_DATE, TEXT_LITERAL, TEXT_FILE, TEXT_PROGRAM, TEXT_URL } text_mode; -struct auth_message; -struct auth_response; - -typedef int (*auth_conv_cb_t) ( - int num_msg, - const struct auth_message *msg, - struct auth_response **resp, - saver_info *si); - typedef struct saver_preferences saver_preferences; typedef struct saver_screen_info saver_screen_info; -typedef struct passwd_dialog_data passwd_dialog_data; -typedef struct splash_dialog_data splash_dialog_data; -typedef struct _monitor monitor; - -typedef struct poll_mouse_data poll_mouse_data; -struct poll_mouse_data { - int root_x; - int root_y; - Window child; - unsigned int mask; - time_t time; -}; - -#ifdef HAVE_XINPUT -/* XInputExtension device support */ -#include -typedef struct xinput_dev_info xinput_dev_info; -struct xinput_dev_info { - XDevice *device; - XEventClass press, release, valuator; - poll_mouse_data last_poll_mouse; -}; -#endif /* This structure holds all the user-specified parameters, read from the command line, the resource database, or entered through a dialog box. + It is used by xscreensaver-gfx and xscreensaver-settings; */ struct saver_preferences { @@ -89,23 +49,20 @@ struct saver_preferences { wrote it. */ Bool verbose_p; /* whether to print out lots of status info */ - Bool timestamp_p; /* whether to mark messages with a timestamp */ - Bool capture_stderr_p; /* whether to redirect stdout/stderr */ Bool ignore_uninstalled_p; /* whether to avoid displaying or complaining about hacks that are not on $PATH */ Bool debug_p; /* pay no mind to the man behind the curtain */ - Bool xsync_p; /* whether XSynchronize has been called */ + Bool xsync_p; /* whether to XSynchronize */ Bool lock_p; /* whether to lock as well as save */ Bool fade_p; /* whether to fade to black, if possible */ Bool unfade_p; /* whether to fade from black, if possible */ Time fade_seconds; /* how long that should take */ - int fade_ticks; /* how many ticks should be used */ Bool splash_p; /* whether to do a splash screen at startup */ Bool install_cmap_p; /* whether we should use our own colormap - when using the screen's default visual. */ + when using the screen's default visual */ # ifdef QUAD_MODE Bool quad_p; /* whether to run four savers per monitor */ @@ -118,21 +75,17 @@ struct saver_preferences { int selected_hack; /* in one_hack mode, this is the one */ int nice_inferior; /* nice value for subprocs */ - int inferior_memory_limit; /* setrlimit(LIMIT_AS) value for subprocs */ - Time initial_delay; /* how long to sleep after launch */ Time splash_duration; /* how long the splash screen stays up */ Time timeout; /* how much idle time before activation */ Time lock_timeout; /* how long after activation locking starts */ Time cycle; /* how long each hack should run */ - Time passwd_timeout; /* how much time before pw dialog goes down */ - Time pointer_timeout; /* how often to check mouse position */ - Time notice_events_timeout; /* how long after window creation to select */ + Time passwd_timeout; /* how long before pw dialog goes down */ Time watchdog_timeout; /* how often to re-raise and re-blank screen */ int pointer_hysteresis; /* mouse motions less than N/sec are ignored */ - Bool dpms_enabled_p; /* Whether to power down the monitor */ - Bool dpms_quickoff_p; /* Whether to power down monitor immediately + Bool dpms_enabled_p; /* whether to power down the monitor */ + Bool dpms_quickoff_p; /* whether to power down monitor immediately in "Blank Only" mode */ Time dpms_standby; /* how long until monitor goes black */ Time dpms_suspend; /* how long until monitor power-saves */ @@ -141,7 +94,7 @@ struct saver_preferences { Bool grab_desktop_p; /* These are not used by "xscreensaver" */ Bool grab_video_p; /* itself: they are used by the external */ Bool random_image_p; /* "xscreensaver-getimage" program, and set */ - char *image_directory; /* by the "xscreensaver-demo" configurator. */ + char *image_directory; /* by "xscreensaver-settings". */ text_mode tmode; /* How we generate text to display. */ char *text_literal; /* used when tmode is TEXT_LITERAL. */ @@ -149,21 +102,13 @@ struct saver_preferences { char *text_program; /* used when tmode is TEXT_PROGRAM. */ char *text_url; /* used when tmode is TEXT_URL. */ - Bool use_xidle_extension; /* which extension to use, if possible */ - Bool use_mit_saver_extension; - Bool use_sgi_saver_extension; - Bool use_proc_interrupts; - Bool use_xinput_extension; - - Bool getviewport_full_of_lies_p; /* XFree86 bug #421 */ - char *shell; /* where to find /bin/sh */ char *demo_command; /* How to enter demo mode. */ - char *prefs_command; /* How to edit preferences. */ char *help_url; /* Where the help document resides. */ char *load_url_command; /* How one loads URLs. */ char *new_login_command; /* Command for the "New Login" button. */ + char *dialog_theme; /* Color scheme on the unlock dialog */ int auth_warning_slack; /* Don't warn about login failures if they all happen within this many seconds of @@ -172,188 +117,46 @@ struct saver_preferences { /* This structure holds all the data that applies to the program as a whole, or to the non-screen-specific parts of the display connection. - - The saver_preferences structure (prefs.h) holds all the user-specified - parameters, read from the command line, the resource database, or entered - through a dialog box. + It is used only by xscreensaver-gfx. */ struct saver_info { + + XtAppContext app; + Display *dpy; + char *version; saver_preferences prefs; int nscreens; int ssi_count; saver_screen_info *screens; - saver_screen_info *default_screen; /* ...on which dialogs will appear. */ - monitor **monitor_layout; /* private to screens.c */ + struct _monitor **monitor_layout; /* private to screens.c */ Visual **best_gl_visuals; /* visuals for GL hacks on screen N */ + void *fade_state; /* fade.c private data */ - /* ======================================================================= - global connection info - ======================================================================= */ - - XtAppContext app; - Display *dpy; - - /* ======================================================================= - server extension info - ======================================================================= */ - - Bool using_xidle_extension; /* which extension is being used. */ - Bool using_mit_saver_extension; /* Note that `p->use_*' is the *request*, */ - Bool using_sgi_saver_extension; /* and `si->using_*' is the *reality*. */ - Bool using_proc_interrupts; - -# ifdef HAVE_MIT_SAVER_EXTENSION - int mit_saver_ext_event_number; - int mit_saver_ext_error_number; -# endif -# ifdef HAVE_SGI_SAVER_EXTENSION - int sgi_saver_ext_event_number; - int sgi_saver_ext_error_number; -# endif # ifdef HAVE_RANDR int randr_event_number; int randr_error_number; Bool using_randr_extension; # endif - Bool using_xinput_extension; /* Note that `p->use_*' is the *request*, */ - /* and `si->using_*' is the *reality*. */ -#ifdef HAVE_XINPUT - int xinput_ext_event_number; /* may not be used */ - int xinput_ext_error_number; - int xinput_DeviceButtonPress; /* Extension device event codes. */ - int xinput_DeviceButtonRelease; /* Assigned by server at runtime */ - int xinput_DeviceMotionNotify; - xinput_dev_info *xinput_devices; - int num_xinput_devices; -# endif - - /* ======================================================================= - blanking - ======================================================================= */ - - Bool screen_blanked_p; /* Whether the saver is currently active. */ - Window mouse_grab_window; /* Window holding our mouse grab */ - Window keyboard_grab_window; /* Window holding our keyboard grab */ - int mouse_grab_screen; /* The screen number the mouse grab is on */ - int keyboard_grab_screen; /* The screen number the keyboard grab is on */ - Bool fading_possible_p; /* Whether fading to/from black is possible. */ - Bool throttled_p; /* Whether we should temporarily just blank - the screen, not run hacks. (Deprecated: - users should use "xset dpms force off" - instead.) */ - time_t blank_time; /* The time at which the screen was blanked - (if currently blanked) or unblanked (if - not blanked.) */ - - - /* ======================================================================= - locking and runtime privileges - ======================================================================= */ - - Bool locked_p; /* Whether the screen is currently locked. */ - Bool dbox_up_p; /* Whether the demo-mode or passwd dialogs - are currently visible */ - - Bool locking_disabled_p; /* Sometimes locking is impossible. */ - char *nolock_reason; /* This is why. */ - - char *orig_uid; /* What uid/gid we had at startup, before - discarding privileges. */ - char *uid_message; /* Any diagnostics from our attempt to - discard privileges (printed only in - -verbose mode.) */ - Bool dangerous_uid_p; /* Set to true if we're running as a user id - which is known to not be a normal, non- - privileged user. */ - - Window passwd_dialog; /* The password dialog, if it's up. */ - passwd_dialog_data *pw_data; /* Other info necessary to draw it. */ - - int unlock_failures; /* Counts failed login attempts while the - screen is locked. */ - time_t unlock_failure_time; /* Time of first failed login attempt. */ - time_t unlock_dismiss_time; /* Time lock dialog most recently dismissed. */ - - char *unlock_typeahead; /* If the screen is locked, and the user types - a character, we assume that it is the first - character of the password. It's stored here - for the password dialog to use to populate - itself. */ - - char *user; /* The user whose session is locked. */ - char *cached_passwd; /* Cached password, used to avoid multiple - prompts for password-only auth mechanisms.*/ - unlock_state unlock_state; - - auth_conv_cb_t unlock_cb; /* The function used to prompt for creds. */ - void (*auth_finished_cb) (saver_info *si); - /* Called when authentication has finished, - regardless of success or failure. - May be NULL. */ - - - /* ======================================================================= - demoing - ======================================================================= */ - Bool demoing_p; /* Whether we are demoing a single hack (without UI.) */ - - Window splash_dialog; /* The splash dialog, if its up. */ - splash_dialog_data *sp_data; /* Other info necessary to draw it. */ - - - /* ======================================================================= - timers - ======================================================================= */ - - XtIntervalId lock_id; /* Timer to implement `prefs.lock_timeout' */ - XtIntervalId cycle_id; /* Timer to implement `prefs.cycle' */ - XtIntervalId timer_id; /* Timer to implement `prefs.timeout' */ + Bool emergency_p; /* Restarted because of a crash */ XtIntervalId watchdog_id; /* Timer to implement `prefs.watchdog */ - XtIntervalId check_pointer_timer_id; /* `prefs.pointer_timeout' */ - - XtIntervalId de_race_id; /* Timer to make sure screen un-blanks */ - int de_race_ticks; - - time_t last_activity_time; /* Used only when no server exts. */ - time_t last_wall_clock_time; /* Used to detect laptop suspend. */ - saver_screen_info *last_activity_screen; - - Bool emergency_lock_p; /* Set when the wall clock has jumped - (presumably due to laptop suspend) and we - need to lock down right away instead of - waiting for the lock timer to go off. */ - - - /* ======================================================================= - remote control - ======================================================================= */ int selection_mode; /* Set to -1 if the NEXT ClientMessage has just been received; set to -2 if PREV has just been received; set to N if SELECT or DEMO N has been received. (This is kind of nasty.) */ - - /* ======================================================================= - subprocs - ======================================================================= */ - - XtIntervalId stderr_popup_timer; - -# ifdef HAVE_LIBSYSTEMD - pid_t systemd_pid; -# endif }; + /* This structure holds all the data that applies to the screen-specific parts of the display connection; if the display has multiple screens, there will - be one of these for each screen. - */ + be one of these for each screen. It is used only by xscreensaver-gfx. +*/ struct saver_screen_info { saver_info *global; @@ -370,17 +173,10 @@ struct saver_screen_info { Bool real_screen_p; /* This will be true of exactly one ssi per X screen. */ - Widget toplevel_shell; - - /* ======================================================================= - blanking - ======================================================================= */ - Window screensaver_window; /* The window that will impersonate the root, - when the screensaver activates. Note that - the window stored here may change, as we - destroy and recreate it on different - visuals. */ + Window screensaver_window; /* The window on which hacks are drawn. This + window might be destroyed and re-created as + hacks cycle. */ Colormap cmap; /* The colormap that goes with the window. */ Bool install_cmap_p; /* Whether this screen should have its own colormap installed, for whichever of several @@ -392,55 +188,31 @@ struct saver_screen_info { Visual *default_visual; /* visual to use when none other specified */ - Window real_vroot; /* The original virtual-root window. */ - Window real_vroot_value; /* What was in the __SWM_VROOT property. */ - Cursor cursor; /* A blank cursor that goes with the real root window. */ unsigned long black_pixel; /* Black, allocated from `cmap'. */ - - int blank_vp_x, blank_vp_y; /* Where the virtual-scrolling viewport was - when the screen went blank. We need to - prevent the X server from letting the mouse - bump the edges to scroll while the screen - is locked, so we reset to this when it has - moved, and the lock dialog is up... */ - -# ifdef HAVE_MIT_SAVER_EXTENSION - Window server_mit_saver_window; -# endif + Window error_dialog; /* Error message about crashed savers */ - /* ======================================================================= - demoing - ======================================================================= */ - - Colormap demo_cmap; /* The colormap that goes with the dialogs: - this might be the same as `cmap' so care - must be taken not to free it while it's - still in use. */ - - /* ======================================================================= - timers - ======================================================================= */ + XtIntervalId cycle_id; /* Timer to implement `prefs.cycle' */ + time_t cycle_at; /* When cycle_id will fire */ + int current_hack; /* Index into `prefs.screenhacks' */ + pid_t pid; +}; - poll_mouse_data last_poll_mouse; /* Used only when no server exts. */ - /* ======================================================================= - subprocs - ======================================================================= */ +/* From dpms.c */ +extern void sync_server_dpms_settings (Display *, struct saver_preferences *); - int current_hack; /* Index into `prefs.screenhacks' */ - pid_t pid; - int stderr_text_x; - int stderr_text_y; - int stderr_line_height; - XFontStruct *stderr_font; - GC stderr_gc; - Window stderr_overlay_window; /* Used if the server has overlay planes */ - Colormap stderr_cmap; -}; +const char *init_file_name (void); +extern Bool init_file_changed_p (saver_preferences *); +extern void load_init_file (Display *, saver_preferences *); +extern int write_init_file (Display *, + saver_preferences *, const char *version_string, + Bool verbose_p); +extern Bool senescent_p (void); +char *make_hack_name (Display *, const char *shell_command); #endif /* __XSCREENSAVER_TYPES_H__ */ diff --git a/driver/windows.c b/driver/windows.c index 9e47c45..c9cdf9d 100644 --- a/driver/windows.c +++ b/driver/windows.c @@ -1,5 +1,5 @@ /* windows.c --- turning the screen black; dealing with visuals, virtual roots. - * xscreensaver, Copyright (c) 1991-2020 Jamie Zawinski + * xscreensaver, Copyright © 1991-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -14,41 +14,17 @@ # include "config.h" #endif -#ifdef VMS -# include /* for getpid() */ -# include "vms-gtod.h" /* for gettimeofday() */ -#endif /* VMS */ - -#ifndef VMS -# include /* for getpwuid() */ -#else /* VMS */ -# include "vms-pwd.h" -#endif /* VMS */ - #ifdef HAVE_UNAME # include /* for uname() */ #endif /* HAVE_UNAME */ #include -/* #include / * for CARD32 */ +#include /* for getpwuid() */ #include #include /* for XSetClassHint() */ #include -#include /* for time() */ -#include /* for the signal names */ +#include #include -#include - -/* You might think that to store an array of 32-bit quantities onto a - server-side property, you would pass an array of 32-bit data quantities - into XChangeProperty(). You would be wrong. You have to use an array - of longs, even if long is 64 bits (using 32 of each 64.) - */ -typedef long PROP32; - -#ifdef HAVE_MIT_SAVER_EXTENSION -# include -#endif /* HAVE_MIT_SAVER_EXTENSION */ #ifdef HAVE_XF86VMODE # include @@ -58,1116 +34,98 @@ typedef long PROP32; # include #endif /* HAVE_XINERAMA */ -/* This file doesn't need the Xt headers, so stub these types out... */ -#undef XtPointer -#define XtAppContext void* -#define XrmDatabase void* -#define XtIntervalId void* -#define XtPointer void* -#define Widget void* - #include "xscreensaver.h" +#include "atoms.h" #include "visual.h" +#include "screens.h" #include "fade.h" +#include "resources.h" +#include "xft.h" +#include "font-retry.h" extern int kill (pid_t, int); /* signal() is in sys/signal.h... */ -Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID; -Atom XA_NET_WM_USER_TIME; -Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID; -Atom XA_SCREENSAVER_STATUS; - -extern saver_info *global_si_kludge; /* I hate C so much... */ - -static void maybe_transfer_grabs (saver_screen_info *ssi, - Window old_w, Window new_w, int new_screen); - -#define ALL_POINTER_EVENTS \ - (ButtonPressMask | ButtonReleaseMask | EnterWindowMask | \ - LeaveWindowMask | PointerMotionMask | PointerMotionHintMask | \ - Button1MotionMask | Button2MotionMask | Button3MotionMask | \ - Button4MotionMask | Button5MotionMask | ButtonMotionMask) - - -static const char * -grab_string(int status) -{ - switch (status) - { - case GrabSuccess: return "GrabSuccess"; - case AlreadyGrabbed: return "AlreadyGrabbed"; - case GrabInvalidTime: return "GrabInvalidTime"; - case GrabNotViewable: return "GrabNotViewable"; - case GrabFrozen: return "GrabFrozen"; - default: - { - static char foo[255]; - sprintf(foo, "unknown status: %d", status); - return foo; - } - } -} - -static int -grab_kbd(saver_info *si, Window w, int screen_no) -{ - saver_preferences *p = &si->prefs; - int status = XGrabKeyboard (si->dpy, w, True, - /* I don't really understand Sync vs Async, - but these seem to work... */ - GrabModeSync, GrabModeAsync, - CurrentTime); - if (status == GrabSuccess) - { - si->keyboard_grab_window = w; - si->keyboard_grab_screen = screen_no; - } - - if (p->verbose_p) - fprintf(stderr, "%s: %d: grabbing keyboard on 0x%lx... %s.\n", - blurb(), screen_no, (unsigned long) w, grab_string(status)); - return status; -} - - -static int -grab_mouse (saver_info *si, Window w, Cursor cursor, int screen_no) -{ - saver_preferences *p = &si->prefs; - int status = XGrabPointer (si->dpy, w, True, ALL_POINTER_EVENTS, - GrabModeAsync, GrabModeAsync, w, - cursor, CurrentTime); - if (status == GrabSuccess) - { - si->mouse_grab_window = w; - si->mouse_grab_screen = screen_no; - } - - if (p->verbose_p) - fprintf(stderr, "%s: %d: grabbing mouse on 0x%lx... %s.\n", - blurb(), screen_no, (unsigned long) w, grab_string(status)); - return status; -} - - -static void -ungrab_kbd(saver_info *si) -{ - saver_preferences *p = &si->prefs; - XUngrabKeyboard(si->dpy, CurrentTime); - if (p->verbose_p) - fprintf(stderr, "%s: %d: ungrabbing keyboard (was 0x%lx).\n", - blurb(), si->keyboard_grab_screen, - (unsigned long) si->keyboard_grab_window); - si->keyboard_grab_window = 0; -} - - -static void -ungrab_mouse(saver_info *si) -{ - saver_preferences *p = &si->prefs; - XUngrabPointer(si->dpy, CurrentTime); - if (p->verbose_p) - fprintf(stderr, "%s: %d: ungrabbing mouse (was 0x%lx).\n", - blurb(), si->mouse_grab_screen, - (unsigned long) si->mouse_grab_window); - si->mouse_grab_window = 0; -} - - -/* Apparently there is this program called "rdesktop" which is a windows - terminal server client for Unix. It would seem that this program holds - the keyboard GRABBED the whole time it has focus! This is, of course, - completely idiotic: the whole point of grabbing is to get events when - you do *not* have focus, so grabbing *only when* you have focus is - completely redundant -- unless your goal is to make xscreensaver not - able to ever lock the screen when your program is running. - - If xscreensaver blanks while rdesktop still has a keyboard grab, then - when we try to prompt for the password, we won't get the characters: - they'll be typed into rdesktop. - - Perhaps rdesktop will release its keyboard grab if it loses focus? - What the hell, let's give it a try. If we fail to grab the keyboard - four times in a row, we forcibly set focus to "None" and try four - more times. (We don't touch focus unless we're already having a hard - time getting a grab.) - */ -static void -nuke_focus (saver_info *si, int screen_no) -{ - saver_preferences *p = &si->prefs; - Window focus = 0; - int rev = 0; - - XGetInputFocus (si->dpy, &focus, &rev); - - if (p->verbose_p) - { - char w[255], r[255]; - - if (focus == PointerRoot) strcpy (w, "PointerRoot"); - else if (focus == None) strcpy (w, "None"); - else sprintf (w, "0x%lx", (unsigned long) focus); - - if (rev == RevertToParent) strcpy (r, "RevertToParent"); - else if (rev == RevertToPointerRoot) strcpy (r, "RevertToPointerRoot"); - else if (rev == RevertToNone) strcpy (r, "RevertToNone"); - else sprintf (r, "0x%x", rev); - - fprintf (stderr, "%s: %d: removing focus from %s / %s.\n", - blurb(), screen_no, w, r); - } - - XSetInputFocus (si->dpy, None, RevertToNone, CurrentTime); - XSync (si->dpy, False); -} - - -static void -ungrab_keyboard_and_mouse (saver_info *si) -{ - ungrab_mouse (si); - ungrab_kbd (si); -} - - -static Bool -grab_keyboard_and_mouse (saver_info *si, Window window, Cursor cursor, - int screen_no) -{ - Status mstatus = 0, kstatus = 0; - int i; - int retries = 4; - Bool focus_fuckus = False; - - AGAIN: - - for (i = 0; i < retries; i++) - { - XSync (si->dpy, False); - kstatus = grab_kbd (si, window, screen_no); - if (kstatus == GrabSuccess) - break; - - /* else, wait a second and try to grab again. */ - sleep (1); - } - - if (kstatus != GrabSuccess) - { - fprintf (stderr, "%s: couldn't grab keyboard! (%s)\n", - blurb(), grab_string(kstatus)); - - if (! focus_fuckus) - { - focus_fuckus = True; - nuke_focus (si, screen_no); - goto AGAIN; - } - } - - for (i = 0; i < retries; i++) - { - XSync (si->dpy, False); - mstatus = grab_mouse (si, window, cursor, screen_no); - if (mstatus == GrabSuccess) - break; - - /* else, wait a second and try to grab again. */ - sleep (1); - } - - if (mstatus != GrabSuccess) - fprintf (stderr, "%s: couldn't grab pointer! (%s)\n", - blurb(), grab_string(mstatus)); - - - /* When should we allow blanking to proceed? The current theory - is that a keyboard grab is mandatory; a mouse grab is optional. - - - If we don't have a keyboard grab, then we won't be able to - read a password to unlock, so the kbd grab is mandatory. - (We can't conditionalize this on locked_p, because someone - might run "xscreensaver-command -lock" at any time.) - - - If we don't have a mouse grab, then we might not see mouse - clicks as a signal to unblank -- but we will still see kbd - activity, so that's not a disaster. - - It has been suggested that we should allow blanking if locking - is disabled, and we have a mouse grab but no keyboard grab - (that is: kstatus != GrabSuccess && - mstatus == GrabSuccess && - si->locking_disabled_p) - That would allow screen blanking (but not locking) while the gdm - login screen had the keyboard grabbed, but one would have to use - the mouse to unblank. Keyboard characters would go to the gdm - login field without unblanking. I have not made this change - because I'm not completely convinced it is a safe thing to do. - */ - - if (kstatus != GrabSuccess) /* Do not blank without a kbd grab. */ - { - /* If we didn't get both grabs, release the one we did get. */ - ungrab_keyboard_and_mouse (si); - return False; - } - - return True; /* Grab is good, go ahead and blank. */ -} - - -int -move_mouse_grab (saver_info *si, Window to, Cursor cursor, int to_screen_no) -{ - Window old = si->mouse_grab_window; - - if (old == 0) - return grab_mouse (si, to, cursor, to_screen_no); - else - { - saver_preferences *p = &si->prefs; - int status; - - XSync (si->dpy, False); - XGrabServer (si->dpy); /* ############ DANGER! */ - XSync (si->dpy, False); - - if (p->verbose_p) - fprintf(stderr, "%s: grabbing server...\n", blurb()); - - ungrab_mouse (si); - status = grab_mouse (si, to, cursor, to_screen_no); - - if (status != GrabSuccess) /* Augh! */ - { - sleep (1); /* Note dramatic evil of sleeping - with server grabbed. */ - XSync (si->dpy, False); - status = grab_mouse (si, to, cursor, to_screen_no); - } - - if (status != GrabSuccess) /* Augh! Try to get the old one back... */ - grab_mouse (si, old, cursor, to_screen_no); - - XUngrabServer (si->dpy); - XSync (si->dpy, False); /* ###### (danger over) */ - - if (p->verbose_p) - fprintf(stderr, "%s: ungrabbing server.\n", blurb()); - - return status; - } -} - - -/* Prints an error message to stderr and returns True if there is another - xscreensaver running already. Silently returns False otherwise. */ -Bool -ensure_no_screensaver_running (Display *dpy, Screen *screen) -{ - Bool status = 0; - int i; - Window root = RootWindowOfScreen (screen); - Window root2, parent, *kids; - unsigned int nkids; - XErrorHandler old_handler = XSetErrorHandler (BadWindow_ehandler); - - if (! XQueryTree (dpy, root, &root2, &parent, &kids, &nkids)) - abort (); - if (root != root2) - abort (); - if (parent) - abort (); - for (i = 0; i < nkids; i++) - { - Atom type; - int format; - unsigned long nitems, bytesafter; - unsigned char *version; - - if (XGetWindowProperty (dpy, kids[i], XA_SCREENSAVER_VERSION, 0, 1, - False, XA_STRING, &type, &format, &nitems, - &bytesafter, &version) - == Success - && type != None) - { - unsigned char *id; - if (XGetWindowProperty (dpy, kids[i], XA_SCREENSAVER_ID, 0, 512, - False, XA_STRING, &type, &format, &nitems, - &bytesafter, &id) - != Success - || type == None) - id = (unsigned char *) "???"; - - fprintf (stderr, - "%s: already running on display %s (window 0x%x)\n from process %s.\n", - blurb(), DisplayString (dpy), (int) kids [i], - (char *) id); - status = True; - } - - else if (XGetWindowProperty (dpy, kids[i], XA_WM_COMMAND, 0, 128, - False, XA_STRING, &type, &format, &nitems, - &bytesafter, &version) - == Success - && type != None - && !strcmp ((char *) version, "gnome-screensaver")) - { - fprintf (stderr, - "%s: \"%s\" is already running on display %s (window 0x%x)\n", - blurb(), (char *) version, - DisplayString (dpy), (int) kids [i]); - status = True; - break; - } - } - - if (kids) XFree ((char *) kids); - XSync (dpy, False); - XSetErrorHandler (old_handler); - return status; -} - - - -/* Virtual-root hackery */ - #ifdef _VROOT_H_ ERROR! You must not include vroot.h in this file. #endif -static void -store_vroot_property (Display *dpy, Window win, Window value) -{ -#if 0 - if (p->verbose_p) - fprintf (stderr, - "%s: storing XA_VROOT = 0x%x (%s) = 0x%x (%s)\n", blurb(), - win, - (win == screensaver_window ? "ScreenSaver" : - (win == real_vroot ? "VRoot" : - (win == real_vroot_value ? "Vroot_value" : "???"))), - value, - (value == screensaver_window ? "ScreenSaver" : - (value == real_vroot ? "VRoot" : - (value == real_vroot_value ? "Vroot_value" : "???")))); -#endif - XChangeProperty (dpy, win, XA_VROOT, XA_WINDOW, 32, PropModeReplace, - (unsigned char *) &value, 1); -} - -static void -remove_vroot_property (Display *dpy, Window win) -{ -#if 0 - if (p->verbose_p) - fprintf (stderr, "%s: removing XA_VROOT from 0x%x (%s)\n", blurb(), win, - (win == screensaver_window ? "ScreenSaver" : - (win == real_vroot ? "VRoot" : - (win == real_vroot_value ? "Vroot_value" : "???")))); -#endif - XDeleteProperty (dpy, win, XA_VROOT); -} - -static Bool safe_XKillClient (Display *dpy, XID id); +static void reset_watchdog_timer (saver_info *si); -static void -kill_xsetroot_data_1 (Display *dpy, Window window, - Atom prop, const char *atom_name, - Bool verbose_p) +void +store_saver_status (saver_info *si) { - Atom type; - int format; - unsigned long nitems, bytesafter; - unsigned char *dataP = 0; - - /* If the user has been using xv or xsetroot as a screensaver (to display - an image on the screensaver window, as a kind of slideshow) then the - pixmap and its associated color cells have been put in RetainPermanent - CloseDown mode. Since we're not destroying the xscreensaver window, - but merely unmapping it, we need to free these resources or those - colormap cells will stay allocated while the screensaver is off. (We - could just delete the screensaver window and recreate it later, but - that could cause other problems.) This code does an atomic read-and- - delete of the _XSETROOT_ID property, and if it held a pixmap, then we - cause the RetainPermanent resources of the client which created it - (and which no longer exists) to be freed. - - Update: it seems that Gnome and KDE do this same trick, but with the - properties "ESETROOT_PMAP_ID" and/or "_XROOTPMAP_ID" instead of - "_XSETROOT_ID". So, we'll kill those too. - */ - if (XGetWindowProperty (dpy, window, prop, 0, 1, - True, AnyPropertyType, &type, &format, &nitems, - &bytesafter, &dataP) - == Success - && type != None) - { - Pixmap *pixP = (Pixmap *) dataP; - if (pixP && *pixP && type == XA_PIXMAP && format == 32 && - nitems == 1 && bytesafter == 0) - { - if (verbose_p) - fprintf (stderr, "%s: destroying %s data (0x%lX).\n", - blurb(), atom_name, *pixP); - safe_XKillClient (dpy, *pixP); - } - else - fprintf (stderr, - "%s: deleted unrecognised %s property: \n" - "\t%lu, %lu; type: %lu, format: %d, " - "nitems: %lu, bytesafter %ld\n", - blurb(), atom_name, - (unsigned long) pixP, (pixP ? *pixP : 0), type, - format, nitems, bytesafter); - } -} + /* The contents of XA_SCREENSAVER_STATUS has LOCK/BLANK/0 in the first slot, + the time at which that state began in the second slot, and the ordinal of + the running hacks on each screen (1-based) in subsequent slots. Since + we don't know the blank-versus-lock status here, we leave whatever was + there before unchanged: it will be updated by "xscreensaver". + XA_SCREENSAVER_STATUS is stored on the (real) root window of screen 0. -static void -kill_xsetroot_data (Display *dpy, Window w, Bool verbose_p) -{ - kill_xsetroot_data_1 (dpy, w, XA_XSETROOT_ID, "_XSETROOT_ID", verbose_p); - kill_xsetroot_data_1 (dpy, w, XA_ESETROOT_PMAP_ID, "ESETROOT_PMAP_ID", - verbose_p); - kill_xsetroot_data_1 (dpy, w, XA_XROOTPMAP_ID, "_XROOTPMAP_ID", verbose_p); -} + XA_SCREENSAVER_VERSION and XA_SCREENSAVER_ID are stored on the unmapped + window created by the "xscreensaver" process. ClientMessage events are + sent to that window, and the responses are sent via the + XA_SCREENSAVER_RESPONSE property on it. + These properties are not used on the windows created by "xscreensaver-gfx" + for use by the display hacks. -static void -save_real_vroot (saver_screen_info *ssi) -{ - saver_info *si = ssi->global; + See the different version of this function in xscreensaver.c. + */ Display *dpy = si->dpy; - Screen *screen = ssi->screen; + Window w = RootWindow (dpy, 0); /* always screen 0 */ + Atom type; + unsigned char *dataP = 0; + PROP32 *status = 0; + int format; + unsigned long nitems, bytesafter; + int nitems2 = si->nscreens + 2; int i; - Window root = RootWindowOfScreen (screen); - Window root2, parent, *kids; - unsigned int nkids; - XErrorHandler old_handler; - - /* It's possible that a window might be deleted between our call to - XQueryTree() and our call to XGetWindowProperty(). Don't die if - that happens (but just ignore that window, it's not the one we're - interested in anyway.) - */ - XSync (dpy, False); - old_handler = XSetErrorHandler (BadWindow_ehandler); - XSync (dpy, False); - - ssi->real_vroot = 0; - ssi->real_vroot_value = 0; - if (! XQueryTree (dpy, root, &root2, &parent, &kids, &nkids)) - abort (); - if (root != root2) - abort (); - if (parent) - abort (); - for (i = 0; i < nkids; i++) - { - Atom type; - int format; - unsigned long nitems, bytesafter; - unsigned char *dataP = 0; - Window *vrootP; - int j; - - /* Skip this window if it is the xscreensaver window of any other - screen (this can happen in the Xinerama case.) - */ - for (j = 0; j < si->nscreens; j++) - { - saver_screen_info *ssi2 = &si->screens[j]; - if (kids[i] == ssi2->screensaver_window) - goto SKIP; - } - - if (XGetWindowProperty (dpy, kids[i], XA_VROOT, 0, 1, False, XA_WINDOW, - &type, &format, &nitems, &bytesafter, - &dataP) - != Success) - continue; - if (! dataP) - continue; - - vrootP = (Window *) dataP; - if (ssi->real_vroot) - { - if (*vrootP == ssi->screensaver_window) abort (); - fprintf (stderr, - "%s: more than one virtual root window found (0x%x and 0x%x).\n", - blurb(), (int) ssi->real_vroot, (int) kids [i]); - exit (1); - } - ssi->real_vroot = kids [i]; - ssi->real_vroot_value = *vrootP; - SKIP: - ; - } - - XSync (dpy, False); - XSetErrorHandler (old_handler); - XSync (dpy, False); - if (ssi->real_vroot) - { - remove_vroot_property (si->dpy, ssi->real_vroot); - XSync (dpy, False); - } - - XFree ((char *) kids); -} + /* Read the old property, so we can change just our parts. */ + XGetWindowProperty (dpy, w, + XA_SCREENSAVER_STATUS, + 0, 999, False, XA_INTEGER, + &type, &format, &nitems, &bytesafter, + &dataP); + status = (PROP32 *) calloc (nitems2, sizeof(PROP32)); -static Bool -restore_real_vroot_1 (saver_screen_info *ssi) -{ - saver_info *si = ssi->global; - saver_preferences *p = &si->prefs; - if (p->verbose_p && ssi->real_vroot) - fprintf (stderr, - "%s: restoring __SWM_VROOT property on the real vroot (0x%lx).\n", - blurb(), (unsigned long) ssi->real_vroot); - if (ssi->screensaver_window) - remove_vroot_property (si->dpy, ssi->screensaver_window); - if (ssi->real_vroot) + if (dataP && type == XA_INTEGER && nitems >= 3) { - store_vroot_property (si->dpy, ssi->real_vroot, ssi->real_vroot_value); - ssi->real_vroot = 0; - ssi->real_vroot_value = 0; - /* make sure the property change gets there before this process - terminates! We might be doing this because we have intercepted - SIGTERM or something. */ - XSync (si->dpy, False); - return True; + status[0] = ((PROP32 *) dataP)[0]; + status[1] = ((PROP32 *) dataP)[1]; } - return False; -} -Bool -restore_real_vroot (saver_info *si) -{ - int i; - Bool did_any = False; for (i = 0; i < si->nscreens; i++) { saver_screen_info *ssi = &si->screens[i]; - if (restore_real_vroot_1 (ssi)) - did_any = True; - } - return did_any; -} - - -/* Signal hackery to ensure that the vroot doesn't get left in an - inconsistent state - */ - -const char * -signal_name(int signal) -{ - switch (signal) { - case SIGHUP: return "SIGHUP"; - case SIGINT: return "SIGINT"; - case SIGQUIT: return "SIGQUIT"; - case SIGILL: return "SIGILL"; - case SIGTRAP: return "SIGTRAP"; -#ifdef SIGABRT - case SIGABRT: return "SIGABRT"; -#endif - case SIGFPE: return "SIGFPE"; - case SIGKILL: return "SIGKILL"; - case SIGBUS: return "SIGBUS"; - case SIGSEGV: return "SIGSEGV"; - case SIGPIPE: return "SIGPIPE"; - case SIGALRM: return "SIGALRM"; - case SIGTERM: return "SIGTERM"; -#ifdef SIGSTOP - case SIGSTOP: return "SIGSTOP"; -#endif -#ifdef SIGCONT - case SIGCONT: return "SIGCONT"; -#endif -#ifdef SIGUSR1 - case SIGUSR1: return "SIGUSR1"; -#endif -#ifdef SIGUSR2 - case SIGUSR2: return "SIGUSR2"; -#endif -#ifdef SIGEMT - case SIGEMT: return "SIGEMT"; -#endif -#ifdef SIGSYS - case SIGSYS: return "SIGSYS"; -#endif -#ifdef SIGCHLD - case SIGCHLD: return "SIGCHLD"; -#endif -#ifdef SIGPWR - case SIGPWR: return "SIGPWR"; -#endif -#ifdef SIGWINCH - case SIGWINCH: return "SIGWINCH"; -#endif -#ifdef SIGURG - case SIGURG: return "SIGURG"; -#endif -#ifdef SIGIO - case SIGIO: return "SIGIO"; -#endif -#ifdef SIGVTALRM - case SIGVTALRM: return "SIGVTALRM"; -#endif -#ifdef SIGXCPU - case SIGXCPU: return "SIGXCPU"; -#endif -#ifdef SIGXFSZ - case SIGXFSZ: return "SIGXFSZ"; -#endif -#ifdef SIGDANGER - case SIGDANGER: return "SIGDANGER"; -#endif - default: - { - static char buf[50]; - sprintf(buf, "signal %d\n", signal); - return buf; + status[2 + i] = ssi->current_hack + 1; /* 1-based */ } - } -} - - - -static RETSIGTYPE -restore_real_vroot_handler (int sig) -{ - saver_info *si = global_si_kludge; /* I hate C so much... */ - - signal (sig, SIG_DFL); - if (restore_real_vroot (si)) - fprintf (real_stderr, "\n%s: %s intercepted, vroot restored.\n", - blurb(), signal_name(sig)); -# ifdef HAVE_LIBSYSTEMD - if (si->systemd_pid) /* Kill background xscreensaver-systemd process */ - { - /* We're exiting, so there's no need to do a full kill_job() here, - which will waitpid(). */ - /* kill_job (si, si->systemd_pid, SIGTERM); */ - kill (si->systemd_pid, SIGTERM); - si->systemd_pid = 0; - } -# endif - kill (getpid (), sig); -} - -static void -catch_signal (saver_info *si, int sig, RETSIGTYPE (*handler) (int)) -{ -# ifdef HAVE_SIGACTION - - struct sigaction a; - a.sa_handler = handler; - sigemptyset (&a.sa_mask); - a.sa_flags = 0; - - /* On Linux 2.4.9 (at least) we need to tell the kernel to not mask delivery - of this signal from inside its handler, or else when we execvp() the - process again, it starts up with SIGHUP blocked, meaning that killing - it with -HUP only works *once*. You'd think that execvp() would reset - all the signal masks, but it doesn't. - */ -# if defined(SA_NOMASK) - a.sa_flags |= SA_NOMASK; -# elif defined(SA_NODEFER) - a.sa_flags |= SA_NODEFER; -# endif - if (sigaction (sig, &a, 0) < 0) -# else /* !HAVE_SIGACTION */ - if (((long) signal (sig, handler)) == -1L) -# endif /* !HAVE_SIGACTION */ - { - char buf [255]; - sprintf (buf, "%s: couldn't catch %s", blurb(), signal_name(sig)); - perror (buf); - saver_exit (si, 1, 0); - } -} - -static RETSIGTYPE saver_sighup_handler (int sig); - -void -handle_signals (saver_info *si) -{ - catch_signal (si, SIGHUP, saver_sighup_handler); - - catch_signal (si, SIGINT, restore_real_vroot_handler); - catch_signal (si, SIGQUIT, restore_real_vroot_handler); - catch_signal (si, SIGILL, restore_real_vroot_handler); - catch_signal (si, SIGTRAP, restore_real_vroot_handler); -#ifdef SIGIOT - catch_signal (si, SIGIOT, restore_real_vroot_handler); -#endif - catch_signal (si, SIGABRT, restore_real_vroot_handler); -#ifdef SIGEMT - catch_signal (si, SIGEMT, restore_real_vroot_handler); -#endif - catch_signal (si, SIGFPE, restore_real_vroot_handler); - catch_signal (si, SIGBUS, restore_real_vroot_handler); - catch_signal (si, SIGSEGV, restore_real_vroot_handler); -#ifdef SIGSYS - catch_signal (si, SIGSYS, restore_real_vroot_handler); -#endif - catch_signal (si, SIGTERM, restore_real_vroot_handler); -#ifdef SIGXCPU - catch_signal (si, SIGXCPU, restore_real_vroot_handler); -#endif -#ifdef SIGXFSZ - catch_signal (si, SIGXFSZ, restore_real_vroot_handler); -#endif -#ifdef SIGDANGER - catch_signal (si, SIGDANGER, restore_real_vroot_handler); -#endif -} - - -static RETSIGTYPE -saver_sighup_handler (int sig) -{ - saver_info *si = global_si_kludge; /* I hate C so much... */ - - /* Re-establish SIGHUP handler */ - catch_signal (si, SIGHUP, saver_sighup_handler); - - fprintf (stderr, "%s: %s received: restarting...\n", - blurb(), signal_name(sig)); - - if (si->screen_blanked_p) - { - int i; - for (i = 0; i < si->nscreens; i++) - kill_screenhack (&si->screens[i]); - unblank_screen (si); - XSync (si->dpy, False); - } - - restart_process (si); /* Does not return */ - abort (); -} - - - -void -saver_exit (saver_info *si, int status, const char *dump_core_reason) -{ - saver_preferences *p = &si->prefs; - static Bool exiting = False; - Bool bugp; - Bool vrs; - - if (exiting) - exit(status); - - exiting = True; - - vrs = restore_real_vroot (si); - emergency_kill_subproc (si); - shutdown_stderr (si); - - if (p->verbose_p && vrs) - fprintf (real_stderr, "%s: old vroot restored.\n", blurb()); - -# ifdef HAVE_LIBSYSTEMD - if (si->systemd_pid) /* Kill background xscreensaver-systemd process */ - { - kill_job (si, si->systemd_pid, SIGTERM); - si->systemd_pid = 0; - } -# endif - - fflush(real_stdout); - -#ifdef VMS /* on VMS, 1 is the "normal" exit code instead of 0. */ - if (status == 0) status = 1; - else if (status == 1) status = -1; -#endif - - bugp = !!dump_core_reason; - - if (si->prefs.debug_p && !dump_core_reason) - dump_core_reason = "because of -debug"; - - if (dump_core_reason) - { - /* Note that the Linux man page for setuid() says If uid is - different from the old effective uid, the process will be - forbidden from leaving core dumps. - */ - char cwd[4096]; /* should really be PATH_MAX, but who cares. */ - cwd[0] = 0; - fprintf(real_stderr, "%s: dumping core (%s)\n", blurb(), - dump_core_reason); - - if (bugp) - fprintf(real_stderr, - "%s: see https://www.jwz.org/xscreensaver/bugs.html\n" - "\t\t\tfor bug reporting information.\n\n", - blurb()); - -# if defined(HAVE_GETCWD) - if (!getcwd (cwd, sizeof(cwd))) -# elif defined(HAVE_GETWD) - if (!getwd (cwd)) -# endif - strcpy(cwd, "unknown."); - - fprintf (real_stderr, "%s: current directory is %s\n", blurb(), cwd); - describe_uids (si, real_stderr); - - /* Do this to drop a core file, so that we can get a stack trace. */ - abort(); - } - - exit (status); -} - - -/* Managing the actual screensaver window */ - -Bool -window_exists_p (Display *dpy, Window window) -{ - XErrorHandler old_handler; - XWindowAttributes xgwa; - xgwa.screen = 0; - old_handler = XSetErrorHandler (BadWindow_ehandler); - XGetWindowAttributes (dpy, window, &xgwa); + XChangeProperty (si->dpy, w, XA_SCREENSAVER_STATUS, XA_INTEGER, 32, + PropModeReplace, (unsigned char *) status, nitems2); XSync (dpy, False); - XSetErrorHandler (old_handler); - return (xgwa.screen != 0); -} -static void -store_saver_id (saver_screen_info *ssi) -{ - XClassHint class_hints; - saver_info *si = ssi->global; - unsigned long pid = (unsigned long) getpid (); - char buf[20]; - struct passwd *p = getpwuid (getuid ()); - const char *name, *host; - char *id; -# if defined(HAVE_UNAME) - struct utsname uts; -# endif /* UNAME */ - - /* First store the name and class on the window. - */ - class_hints.res_name = progname; - class_hints.res_class = progclass; - XSetClassHint (si->dpy, ssi->screensaver_window, &class_hints); - XStoreName (si->dpy, ssi->screensaver_window, "screensaver"); - - /* Then store the xscreensaver version number. - */ - XChangeProperty (si->dpy, ssi->screensaver_window, - XA_SCREENSAVER_VERSION, - XA_STRING, 8, PropModeReplace, - (unsigned char *) si->version, - strlen (si->version)); - - /* Now store the XSCREENSAVER_ID property, that says what user and host - xscreensaver is running as. - */ - - if (p && p->pw_name && *p->pw_name) - name = p->pw_name; - else if (p) + if (si->prefs.debug_p && si->prefs.verbose_p) { - sprintf (buf, "%lu", (unsigned long) p->pw_uid); - name = buf; - } - else - name = "???"; - -# if defined(HAVE_UNAME) - { - if (uname (&uts) < 0) - host = "???"; - else - host = uts.nodename; - } -# elif defined(VMS) - host = getenv("SYS$NODE"); -# else /* !HAVE_UNAME && !VMS */ - host = "???"; -# endif /* !HAVE_UNAME && !VMS */ - - id = (char *) malloc (strlen(name) + strlen(host) + 50); - sprintf (id, "%lu (%s@%s)", pid, name, host); - - XChangeProperty (si->dpy, ssi->screensaver_window, - XA_SCREENSAVER_ID, XA_STRING, - 8, PropModeReplace, - (unsigned char *) id, strlen (id)); - free (id); -} - - -void -store_saver_status (saver_info *si) -{ - PROP32 *status; - int size = si->nscreens + 2; - int i; - - status = (PROP32 *) calloc (size, sizeof(PROP32)); - - status[0] = (PROP32) (si->screen_blanked_p || si->locked_p - ? (si->locked_p ? XA_LOCK : XA_BLANK) - : 0); - status[1] = (PROP32) si->blank_time; - - for (i = 0; i < si->nscreens; i++) - { - saver_screen_info *ssi = &si->screens[i]; - status [2 + i] = ssi->current_hack + 1; + int i; + fprintf (stderr, "%s: wrote status property: 0x%lx: %s", blurb(), + (unsigned long) w, + (status[0] == XA_LOCK ? "LOCK" : + status[0] == XA_BLANK ? "BLANK" : + status[0] == 0 ? "0" : "???")); + for (i = 1; i < nitems; i++) + fprintf (stderr, ", %lu", status[i]); + fprintf (stderr, "\n"); } - XChangeProperty (si->dpy, - RootWindow (si->dpy, 0), /* always screen #0 */ - XA_SCREENSAVER_STATUS, - XA_INTEGER, 32, PropModeReplace, - (unsigned char *) status, size); - free (status); -} - - -static Bool error_handler_hit_p = False; - -static int -ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error) -{ - error_handler_hit_p = True; - return 0; -} - - -/* Returns True if successful, False if an X error occurred. - We need this because other programs might have done things to - our window that will cause XChangeWindowAttributes() to fail: - if that happens, we give up, destroy the window, and re-create - it. - */ -static Bool -safe_XChangeWindowAttributes (Display *dpy, Window window, - unsigned long mask, - XSetWindowAttributes *attrs) -{ - XErrorHandler old_handler; - XSync (dpy, False); - error_handler_hit_p = False; - old_handler = XSetErrorHandler (ignore_all_errors_ehandler); - - XChangeWindowAttributes (dpy, window, mask, attrs); - - XSync (dpy, False); - XSetErrorHandler (old_handler); - XSync (dpy, False); - - return (!error_handler_hit_p); -} - - -/* This might not be necessary, but just in case. */ -static Bool -safe_XConfigureWindow (Display *dpy, Window window, - unsigned long mask, XWindowChanges *changes) -{ - XErrorHandler old_handler; - XSync (dpy, False); - error_handler_hit_p = False; - old_handler = XSetErrorHandler (ignore_all_errors_ehandler); - - XConfigureWindow (dpy, window, mask, changes); - - XSync (dpy, False); - XSetErrorHandler (old_handler); - XSync (dpy, False); - - return (!error_handler_hit_p); -} - -/* This might not be necessary, but just in case. */ -static Bool -safe_XDestroyWindow (Display *dpy, Window window) -{ - XErrorHandler old_handler; - XSync (dpy, False); - error_handler_hit_p = False; - old_handler = XSetErrorHandler (ignore_all_errors_ehandler); - - XDestroyWindow (dpy, window); - - XSync (dpy, False); - XSetErrorHandler (old_handler); - XSync (dpy, False); - - return (!error_handler_hit_p); -} - - -static Bool -safe_XKillClient (Display *dpy, XID id) -{ - XErrorHandler old_handler; - XSync (dpy, False); - error_handler_hit_p = False; - old_handler = XSetErrorHandler (ignore_all_errors_ehandler); - - XKillClient (dpy, id); - - XSync (dpy, False); - XSetErrorHandler (old_handler); - XSync (dpy, False); - - return (!error_handler_hit_p); -} - - -#ifdef HAVE_XF86VMODE -Bool -safe_XF86VidModeGetViewPort (Display *dpy, int screen, int *xP, int *yP) -{ - Bool result; - XErrorHandler old_handler; - XSync (dpy, False); - error_handler_hit_p = False; - old_handler = XSetErrorHandler (ignore_all_errors_ehandler); - - result = XF86VidModeGetViewPort (dpy, screen, xP, yP); - - XSync (dpy, False); - XSetErrorHandler (old_handler); - XSync (dpy, False); - - return (error_handler_hit_p - ? False - : result); -} - -/* There is no "safe_XF86VidModeGetModeLine" because it fails with an - untrappable I/O error instead of an X error -- so one must call - safe_XF86VidModeGetViewPort first, and assume that both have the - same error condition. Thank you XFree, may I have another. - */ - -#endif /* HAVE_XF86VMODE */ + free (status); + if (dataP) + XFree (dataP); +} static void @@ -1180,7 +138,8 @@ initialize_screensaver_window_1 (saver_screen_info *ssi) /* This resets the screensaver window as fully as possible, since there's no way of knowing what some random client may have done to us in the meantime. We could just destroy and recreate the window, but that has - its own set of problems... + its own set of problems. (Update: that's exactly what we're doing + these days.) */ XColor black; XSetWindowAttributes attrs; @@ -1214,8 +173,7 @@ initialize_screensaver_window_1 (saver_screen_info *ssi) if (ssi->cmap) { XFreeColors (si->dpy, ssi->cmap, &ssi->black_pixel, 1, 0); - if (ssi->cmap != ssi->demo_cmap && - ssi->cmap != def_cmap) + if (ssi->cmap != def_cmap) XFreeColormap (si->dpy, ssi->cmap); } ssi->cmap = def_cmap; @@ -1226,20 +184,18 @@ initialize_screensaver_window_1 (saver_screen_info *ssi) CWBackPixel | CWBackingPixel | CWBorderPixel); attrs.override_redirect = True; - /* When use_mit_saver_extension or use_sgi_saver_extension is true, we won't - actually be reading these events during normal operation; but we still - need to see Button events for demo-mode to work properly. - */ attrs.event_mask = (KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask); - attrs.backing_store = NotUseful; + attrs.backing_store = Always; attrs.colormap = ssi->cmap; attrs.background_pixel = ssi->black_pixel; attrs.backing_pixel = ssi->black_pixel; attrs.border_pixel = ssi->black_pixel; + printed_visual_info = True; /* Too noisy */ + if (!p->verbose_p || printed_visual_info) ; else if (ssi->current_visual == DefaultVisualOfScreen (ssi->screen)) @@ -1260,56 +216,11 @@ initialize_screensaver_window_1 (saver_screen_info *ssi) } printed_visual_info = True; -#ifdef HAVE_MIT_SAVER_EXTENSION - if (si->using_mit_saver_extension) + if (ssi->error_dialog) { - XScreenSaverInfo *info; - Window root = RootWindowOfScreen (ssi->screen); - -#if 0 - /* This call sets the server screensaver timeouts to what we think - they should be (based on the resources and args xscreensaver was - started with.) It's important that we do this to sync back up - with the server - if we have turned on prematurely, as by an - ACTIVATE ClientMessage, then the server may decide to activate - the screensaver while it's already active. That's ok for us, - since we would know to ignore that ScreenSaverActivate event, - but a side effect of this would be that the server would map its - saver window (which we then hide again right away) meaning that - the bits currently on the screen get blown away. Ugly. */ - - /* #### Ok, that doesn't work - when we tell the server that the - screensaver is "off" it sends us a Deactivate event, which is - sensible... but causes the saver to never come on. Hmm. */ - disable_builtin_screensaver (si, True); -#endif /* 0 */ - -#if 0 - /* #### The MIT-SCREEN-SAVER extension gives us access to the - window that the server itself uses for saving the screen. - However, using this window in any way, in particular, calling - XScreenSaverSetAttributes() as below, tends to make the X server - crash. So fuck it, let's try and get along without using it... - - It's also inconvenient to use this window because it doesn't - always exist (though the ID is constant.) So to use this - window, we'd have to reimplement the ACTIVATE ClientMessage to - tell the *server* to tell *us* to turn on, to cause the window - to get created at the right time. Gag. */ - XScreenSaverSetAttributes (si->dpy, root, - 0, 0, width, height, 0, - current_depth, InputOutput, visual, - attrmask, &attrs); - XSync (si->dpy, False); -#endif /* 0 */ - - info = XScreenSaverAllocInfo (); - XScreenSaverQueryInfo (si->dpy, root, info); - ssi->server_mit_saver_window = info->window; - if (! ssi->server_mit_saver_window) abort (); - XFree (info); + XDestroyWindow (si->dpy, ssi->error_dialog); + ssi->error_dialog = 0; } -#endif /* HAVE_MIT_SAVER_EXTENSION */ if (ssi->screensaver_window) { @@ -1321,10 +232,13 @@ initialize_screensaver_window_1 (saver_screen_info *ssi) changes.height = ssi->height; changes.border_width = 0; - if (! (safe_XConfigureWindow (si->dpy, ssi->screensaver_window, - changesmask, &changes) && - safe_XChangeWindowAttributes (si->dpy, ssi->screensaver_window, - attrmask, &attrs))) + /* XConfigureWindow and XChangeWindowAttributes can fail if a hack did + something weird to the window. In that case, we must destroy and + re-create it. */ + if (! (XConfigureWindow (si->dpy, ssi->screensaver_window, + changesmask, &changes) && + XChangeWindowAttributes (si->dpy, ssi->screensaver_window, + attrmask, &attrs))) { horked_window = ssi->screensaver_window; ssi->screensaver_window = 0; @@ -1338,35 +252,31 @@ initialize_screensaver_window_1 (saver_screen_info *ssi) ssi->x, ssi->y, ssi->width, ssi->height, 0, ssi->current_depth, InputOutput, ssi->current_visual, attrmask, &attrs); - reset_stderr (ssi); + xscreensaver_set_wm_atoms (si->dpy, ssi->screensaver_window, + ssi->width, ssi->height, 0); if (horked_window) { fprintf (stderr, "%s: someone horked our saver window (0x%lx)! Recreating it...\n", blurb(), (unsigned long) horked_window); - maybe_transfer_grabs (ssi, horked_window, ssi->screensaver_window, - ssi->number); - safe_XDestroyWindow (si->dpy, horked_window); - horked_window = 0; + XDestroyWindow (si->dpy, horked_window); } - if (p->verbose_p) - fprintf (stderr, "%s: %d: saver window is 0x%lx.\n", + if (p->verbose_p > 1) + fprintf (stderr, "%s: %d: saver window is 0x%lx\n", blurb(), ssi->number, (unsigned long) ssi->screensaver_window); } - store_saver_id (ssi); /* store window name and IDs */ - if (!ssi->cursor) { - Pixmap bit; - bit = XCreatePixmapFromBitmapData (si->dpy, ssi->screensaver_window, - "\000", 1, 1, - BlackPixelOfScreen (ssi->screen), - BlackPixelOfScreen (ssi->screen), - 1); + Pixmap bit = + XCreatePixmapFromBitmapData (si->dpy, ssi->screensaver_window, + "\000", 1, 1, + BlackPixelOfScreen (ssi->screen), + BlackPixelOfScreen (ssi->screen), + 1); ssi->cursor = XCreatePixmapCursor (si->dpy, bit, bit, &black, &black, 0, 0); XFreePixmap (si->dpy, bit); @@ -1380,6 +290,7 @@ initialize_screensaver_window_1 (saver_screen_info *ssi) XDefineCursor (si->dpy, ssi->screensaver_window, ssi->cursor); } + void initialize_screensaver_window (saver_info *si) { @@ -1389,6 +300,27 @@ initialize_screensaver_window (saver_info *si) } +static void +raise_window (saver_screen_info *ssi) +{ + saver_info *si = ssi->global; + if (ssi->error_dialog) + { + /* Make the error be topmost, and the saver be directly below it. */ + Window windows[2]; + windows[0] = ssi->error_dialog; + windows[1] = ssi->screensaver_window; + XMapRaised (si->dpy, windows[0]); + XRestackWindows (si->dpy, windows, countof(windows)); + } + else + XMapRaised (si->dpy, ssi->screensaver_window); + + if (ssi->cmap) + XInstallColormap (si->dpy, ssi->cmap); +} + + /* Called when the RANDR (Resize and Rotate) extension tells us that the size of the screen has changed while the screen was blanked. Call update_screen_layout() first, then call this to synchronize @@ -1443,8 +375,8 @@ resize_screensaver_window (saver_info *si) xgwa.width, xgwa.height, xgwa.x, xgwa.y, ssi->width, ssi->height, ssi->x, ssi->y); - if (! safe_XConfigureWindow (si->dpy, ssi->screensaver_window, - changesmask, &changes)) + if (! XConfigureWindow (si->dpy, ssi->screensaver_window, + changesmask, &changes)) fprintf (stderr, "%s: %d: someone horked our saver window" " (0x%lx)! Unable to resize it!\n", blurb(), i, (unsigned long) ssi->screensaver_window); @@ -1458,27 +390,10 @@ resize_screensaver_window (saver_info *si) Note that spawn_screenhack() calls select_visual() which may destroy and re-create the window via initialize_screensaver_window_1(). */ - if (si->screen_blanked_p) - { - if (ssi->cmap) - XInstallColormap (si->dpy, ssi->cmap); - XMapRaised (si->dpy, ssi->screensaver_window); - XSync (si->dpy, False); - if (! ssi->pid) - spawn_screenhack (ssi); - - /* Make sure the act of adding a screen doesn't present as - pointer motion (and thus cause an unblank). */ - { - Window root, child; - int x, y; - unsigned int mask; - XQueryPointer (si->dpy, ssi->screensaver_window, &root, &child, - &ssi->last_poll_mouse.root_x, - &ssi->last_poll_mouse.root_y, - &x, &y, &mask); - } - } + raise_window (ssi); + XSync (si->dpy, False); + if (! ssi->pid) + spawn_screenhack (ssi); } /* Kill off any savers running on no-longer-extant monitors. @@ -1491,44 +406,47 @@ resize_screensaver_window (saver_info *si) if (ssi->screensaver_window) { XUnmapWindow (si->dpy, ssi->screensaver_window); - restore_real_vroot_1 (ssi); } } } -void -raise_window (saver_info *si, - Bool inhibit_fade, Bool between_hacks_p, Bool dont_clear) +static void +raise_windows (saver_info *si) { - saver_preferences *p = &si->prefs; int i; + for (i = 0; i < si->nscreens; i++) + { + saver_screen_info *ssi = &si->screens[i]; + raise_window (ssi); + } +} - if (si->demoing_p) - inhibit_fade = True; - - if (si->emergency_lock_p) - inhibit_fade = True; - if (!dont_clear) - initialize_screensaver_window (si); +/* Called only once, before the main loop begins. + */ +void +blank_screen (saver_info *si) +{ + saver_preferences *p = &si->prefs; + Bool user_active_p = False; + int i; - reset_watchdog_timer (si, True); + initialize_screensaver_window (si); + sync_server_dpms_settings (si->dpy, p); - if (p->fade_p && si->fading_possible_p && !inhibit_fade) + if (p->fade_p && + !si->demoing_p && + !si->emergency_p) { Window *current_windows = (Window *) - calloc(sizeof(Window), si->nscreens); - Colormap *current_maps = (Colormap *) - calloc(sizeof(Colormap), si->nscreens); + malloc (si->nscreens * sizeof(*current_windows)); + if (!current_windows) abort(); for (i = 0; i < si->nscreens; i++) { saver_screen_info *ssi = &si->screens[i]; current_windows[i] = ssi->screensaver_window; - current_maps[i] = (between_hacks_p - ? ssi->cmap - : DefaultColormapOfScreen (ssi->screen)); /* Ensure that the default background of the window is really black, not a pixmap or something. (This does not clear the window.) */ XSetWindowBackground (si->dpy, ssi->screensaver_window, @@ -1537,236 +455,98 @@ raise_window (saver_info *si, if (p->verbose_p) fprintf (stderr, "%s: fading...\n", blurb()); - XGrabServer (si->dpy); /* ############ DANGER! */ - - /* Clear the stderr layer on each screen. - */ - if (!dont_clear) - for (i = 0; i < si->nscreens; i++) - { - saver_screen_info *ssi = &si->screens[i]; - if (ssi->stderr_overlay_window) - /* Do this before the fade, since the stderr cmap won't fade - even if we uninstall it (beats me...) */ - clear_stderr (ssi); - } - - /* Note! The server is grabbed, and this will take several seconds - to complete! */ - fade_screens (si->dpy, current_maps, - current_windows, si->nscreens, - p->fade_seconds/1000, p->fade_ticks, True, !dont_clear); - - free(current_maps); - free(current_windows); - current_maps = 0; - current_windows = 0; - - if (p->verbose_p) fprintf (stderr, "%s: fading done.\n", blurb()); - -#ifdef HAVE_MIT_SAVER_EXTENSION - for (i = 0; i < si->nscreens; i++) - { - saver_screen_info *ssi = &si->screens[i]; - if (ssi->server_mit_saver_window && - window_exists_p (si->dpy, ssi->server_mit_saver_window)) - XUnmapWindow (si->dpy, ssi->server_mit_saver_window); - } -#endif /* HAVE_MIT_SAVER_EXTENSION */ - - XUngrabServer (si->dpy); - XSync (si->dpy, False); /* ###### (danger over) */ - } - else - { - for (i = 0; i < si->nscreens; i++) - { - saver_screen_info *ssi = &si->screens[i]; - if (!dont_clear) - XClearWindow (si->dpy, ssi->screensaver_window); - if (!dont_clear || ssi->stderr_overlay_window) - clear_stderr (ssi); - XMapRaised (si->dpy, ssi->screensaver_window); - XSync (si->dpy, False); -#ifdef HAVE_MIT_SAVER_EXTENSION - if (ssi->server_mit_saver_window && - window_exists_p (si->dpy, ssi->server_mit_saver_window)) - XUnmapWindow (si->dpy, ssi->server_mit_saver_window); -#endif /* HAVE_MIT_SAVER_EXTENSION */ - } - } - - for (i = 0; i < si->nscreens; i++) - { - saver_screen_info *ssi = &si->screens[i]; - if (ssi->cmap) - XInstallColormap (si->dpy, ssi->cmap); - } -} - - -int -mouse_screen (saver_info *si) -{ - saver_preferences *p = &si->prefs; - Window pointer_root, pointer_child; - int root_x, root_y, win_x, win_y; - unsigned int mask; - int i; - - if (si->nscreens == 1) - return 0; - - for (i = 0; i < si->nscreens; i++) - { - saver_screen_info *ssi = &si->screens[i]; - if (XQueryPointer (si->dpy, RootWindowOfScreen (ssi->screen), - &pointer_root, &pointer_child, - &root_x, &root_y, &win_x, &win_y, &mask) && - root_x >= ssi->x && - root_y >= ssi->y && - root_x < ssi->x + ssi->width && - root_y < ssi->y + ssi->height) - { - if (p->verbose_p) - fprintf (stderr, "%s: mouse is on screen %d of %d\n", - blurb(), i, si->nscreens); - return i; - } + /* This will take several seconds to complete. */ + user_active_p = fade_screens (si->app, si->dpy, + current_windows, si->nscreens, + p->fade_seconds / 1000.0, + True, /* out_p */ + True, /* from_desktop_p */ + &si->fade_state); + free (current_windows); + + if (!p->verbose_p) + ; + else if (user_active_p) + fprintf (stderr, "%s: fading aborted\n", blurb()); + else + fprintf (stderr, "%s: fading done\n", blurb()); } - /* couldn't figure out where the mouse is? Oh well. */ - return 0; -} - + raise_windows (si); + reset_watchdog_timer (si); -Bool -blank_screen (saver_info *si) -{ - int i; - Bool ok; - Window w; - int mscreen; - - /* Note: we do our grabs on the root window, not on the screensaver window. - If we grabbed on the saver window, then the demo mode and lock dialog - boxes wouldn't get any events. - - By "the root window", we mean "the root window that contains the mouse." - We use to always grab the mouse on screen 0, but that has the effect of - moving the mouse to screen 0 from whichever screen it was on, on - multi-head systems. - */ - mscreen = mouse_screen (si); - w = RootWindowOfScreen(si->screens[mscreen].screen); - ok = grab_keyboard_and_mouse (si, w, - (si->demoing_p ? 0 : si->screens[0].cursor), - mscreen); - - -# if 0 - if (si->using_mit_saver_extension || si->using_sgi_saver_extension) - /* If we're using a server extension, then failure to get a grab is - not a big deal -- even without the grab, we will still be able - to un-blank when there is user activity, since the server will - tell us. */ - /* #### No, that's not true: if we don't have a keyboard grab, - then we can't read passwords to unlock. - */ - ok = True; -# endif /* 0 */ - - if (!ok) - return False; + /* user_active_p means that the user aborted the fade-out -- but that does + not mean that we are necessarily about to exit. If we are locking, then + the user activity will cause the unlock dialog to appear, but + authentication might not succeed. */ for (i = 0; i < si->nscreens; i++) - { - saver_screen_info *ssi = &si->screens[i]; - if (ssi->real_screen_p) - save_real_vroot (ssi); - store_vroot_property (si->dpy, - ssi->screensaver_window, - ssi->screensaver_window); - -#ifdef HAVE_XF86VMODE - { - int ev, er; - if (!XF86VidModeQueryExtension (si->dpy, &ev, &er) || - !safe_XF86VidModeGetViewPort (si->dpy, i, - &ssi->blank_vp_x, - &ssi->blank_vp_y)) - ssi->blank_vp_x = ssi->blank_vp_y = -1; - } -#endif /* HAVE_XF86VMODE */ - } - - raise_window (si, False, False, False); + /* This also queues each screen's cycle_timer. */ + spawn_screenhack (&si->screens[i]); - si->screen_blanked_p = True; - si->blank_time = time ((time_t *) 0); - si->last_wall_clock_time = 0; + /* Turn off "next" and "prev" modes after they have happened once. */ + if (si->selection_mode < 0) + si->selection_mode = 0; - store_saver_status (si); /* store blank time */ - - return True; + /* If we are blanking only, optionally power down monitor right now. */ + if (p->mode == BLANK_ONLY && + p->dpms_quickoff_p) + monitor_power_on (si, False); } +/* Called only once, upon receipt of SIGTERM, just before exiting. + */ void unblank_screen (saver_info *si) { saver_preferences *p = &si->prefs; - Bool unfade_p = (si->fading_possible_p && p->unfade_p); + Bool unfade_p = p->unfade_p; int i; monitor_power_on (si, True); - reset_watchdog_timer (si, False); if (si->demoing_p) unfade_p = False; if (unfade_p) { + double seconds = p->fade_seconds / 1000.0; + double ratio = 1/3.0; Window *current_windows = (Window *) calloc(sizeof(Window), si->nscreens); + Bool interrupted_p = False; for (i = 0; i < si->nscreens; i++) { saver_screen_info *ssi = &si->screens[i]; current_windows[i] = ssi->screensaver_window; - /* Ensure that the default background of the window is really black, - not a pixmap or something. (This does not clear the window.) */ - XSetWindowBackground (si->dpy, ssi->screensaver_window, - ssi->black_pixel); } if (p->verbose_p) fprintf (stderr, "%s: unfading...\n", blurb()); + monitor_power_on (si, True); + + /* When we fade in to the desktop, first fade out from the saver to + black, then fade in from black to the desktop. */ + interrupted_p = fade_screens (si->app, si->dpy, + current_windows, si->nscreens, + seconds * ratio, + True, /* out_p */ + False, /* from_desktop_p */ + &si->fade_state); + if (! interrupted_p) + interrupted_p = fade_screens (si->app, si->dpy, + current_windows, si->nscreens, + seconds * (1-ratio), + False, /* out_p */ + False, /* from_desktop_p */ + &si->fade_state); + free (current_windows); - XSync (si->dpy, False); - XGrabServer (si->dpy); /* ############ DANGER! */ - XSync (si->dpy, False); - - /* Clear the stderr layer on each screen. - */ - for (i = 0; i < si->nscreens; i++) - { - saver_screen_info *ssi = &si->screens[i]; - clear_stderr (ssi); - } - - XUngrabServer (si->dpy); - XSync (si->dpy, False); /* ###### (danger over) */ - - fade_screens (si->dpy, 0, - current_windows, si->nscreens, - p->fade_seconds/1000, p->fade_ticks, - False, False); - - free(current_windows); - current_windows = 0; - - if (p->verbose_p) fprintf (stderr, "%s: unfading done.\n", blurb()); + if (p->verbose_p) + fprintf (stderr, "%s: unfading done%s\n", blurb(), + (interrupted_p ? " (interrupted)" : "")); } else { @@ -1777,118 +557,33 @@ unblank_screen (saver_info *si) { Colormap c = DefaultColormapOfScreen (ssi->screen); /* avoid technicolor */ + XSetWindowBackground (si->dpy, ssi->screensaver_window, + BlackPixelOfScreen (ssi->screen)); XClearWindow (si->dpy, ssi->screensaver_window); if (c) XInstallColormap (si->dpy, c); } XUnmapWindow (si->dpy, ssi->screensaver_window); } } - - - /* If the focus window does has a non-default colormap, then install - that colormap as well. (On SGIs, this will cause both the root map - and the focus map to be installed simultaneously. It'd be nice to - pick up the other colormaps that had been installed, too; perhaps - XListInstalledColormaps could be used for that?) - */ - { - Window focus = 0; - int revert_to; - XSync (si->dpy, False); - XGetInputFocus (si->dpy, &focus, &revert_to); - if (focus && focus != PointerRoot && focus != None) - { - XErrorHandler old_handler = XSetErrorHandler (BadWindow_ehandler); - XWindowAttributes xgwa; - xgwa.colormap = 0; - if (XGetWindowAttributes (si->dpy, focus, &xgwa) && - xgwa.colormap && - xgwa.colormap != DefaultColormapOfScreen (xgwa.screen)) - XInstallColormap (si->dpy, xgwa.colormap); - XSetErrorHandler (old_handler); - } - } - - - for (i = 0; i < si->nscreens; i++) - { - saver_screen_info *ssi = &si->screens[i]; - kill_xsetroot_data (si->dpy, ssi->screensaver_window, p->verbose_p); - } - - store_saver_status (si); /* store unblank time */ - ungrab_keyboard_and_mouse (si); - restore_real_vroot (si); - - /* Unmap the windows a second time, dammit -- just to avoid a race - with the screen-grabbing hacks. (I'm not sure if this is really - necessary; I'm stabbing in the dark now.) - */ - for (i = 0; i < si->nscreens; i++) - XUnmapWindow (si->dpy, si->screens[i].screensaver_window); - - si->screen_blanked_p = False; - si->blank_time = time ((time_t *) 0); - si->last_wall_clock_time = 0; - - store_saver_status (si); /* store unblank time */ -} - - -/* Transfer any grabs from the old window to the new. - Actually I think none of this is necessary, since we always - hold our grabs on the root window, but I wrote this before - re-discovering that... - */ -static void -maybe_transfer_grabs (saver_screen_info *ssi, - Window old_w, Window new_w, - int new_screen_no) -{ - saver_info *si = ssi->global; - - /* If the old window held our mouse grab, transfer the grab to the new - window. (Grab the server while so doing, to avoid a race condition.) - */ - if (old_w == si->mouse_grab_window) - { - XGrabServer (si->dpy); /* ############ DANGER! */ - ungrab_mouse (si); - grab_mouse (si, ssi->screensaver_window, - (si->demoing_p ? 0 : ssi->cursor), - new_screen_no); - XUngrabServer (si->dpy); - XSync (si->dpy, False); /* ###### (danger over) */ - } - - /* If the old window held our keyboard grab, transfer the grab to the new - window. (Grab the server while so doing, to avoid a race condition.) - */ - if (old_w == si->keyboard_grab_window) - { - XGrabServer (si->dpy); /* ############ DANGER! */ - ungrab_kbd(si); - grab_kbd(si, ssi->screensaver_window, ssi->number); - XUngrabServer (si->dpy); - XSync (si->dpy, False); /* ###### (danger over) */ - } } static Visual * get_screen_gl_visual (saver_info *si, int real_screen_number) { - int i; int nscreens = ScreenCount (si->dpy); if (! si->best_gl_visuals) - si->best_gl_visuals = (Visual **) - calloc (nscreens + 1, sizeof (*si->best_gl_visuals)); + { + int i; + si->best_gl_visuals = (Visual **) + calloc (nscreens + 1, sizeof (*si->best_gl_visuals)); - for (i = 0; i < nscreens; i++) - if (! si->best_gl_visuals[i]) - si->best_gl_visuals[i] = - get_best_gl_visual (si, ScreenOfDisplay (si->dpy, i)); + for (i = 0; i < nscreens; i++) + if (! si->best_gl_visuals[i]) + si->best_gl_visuals[i] = + get_best_gl_visual (si, ScreenOfDisplay (si->dpy, i)); + } if (real_screen_number < 0 || real_screen_number >= nscreens) abort(); return si->best_gl_visuals[real_screen_number]; @@ -1926,28 +621,21 @@ select_visual (saver_screen_info *ssi, const char *visual_name) if (visual_name && *visual_name) { - if (!strcmp(visual_name, "default-i") || - !strcmp(visual_name, "Default-i") || - !strcmp(visual_name, "Default-I") - ) + if (!strcasecmp(visual_name, "default-i")) { visual_name = "default"; install_cmap_p = True; } - else if (!strcmp(visual_name, "default-n") || - !strcmp(visual_name, "Default-n") || - !strcmp(visual_name, "Default-N")) + else if (!strcasecmp(visual_name, "default-n")) { visual_name = "default"; install_cmap_p = False; } - else if (!strcmp(visual_name, "gl") || - !strcmp(visual_name, "Gl") || - !strcmp(visual_name, "GL")) + else if (!strcasecmp(visual_name, "GL")) { new_v = get_screen_gl_visual (si, ssi->real_screen_number); if (!new_v && p->verbose_p) - fprintf (stderr, "%s: no GL visuals.\n", progname); + fprintf (stderr, "%s: no GL visuals\n", blurb()); } if (!new_v) @@ -1979,8 +667,10 @@ select_visual (saver_screen_info *ssi, const char *visual_name) if (p->verbose_p) { +#if 0 fprintf (stderr, "%s: %d: visual ", blurb(), ssi->number); describe_visual (stderr, ssi->screen, new_v, install_cmap_p); +#endif #if 0 fprintf (stderr, "%s: from ", blurb()); describe_visual (stderr, ssi->screen, ssi->current_visual, @@ -1988,39 +678,334 @@ select_visual (saver_screen_info *ssi, const char *visual_name) #endif } - reset_stderr (ssi); ssi->current_visual = new_v; ssi->current_depth = visual_depth(ssi->screen, new_v); ssi->cmap = 0; ssi->screensaver_window = 0; initialize_screensaver_window_1 (ssi); - - /* stderr_overlay_window is a child of screensaver_window, so we need - to destroy that as well (actually, we just need to invalidate and - drop our pointers to it, but this will destroy it, which is ok so - long as it happens before old_w itself is destroyed.) */ - reset_stderr (ssi); - - raise_window (si, True, True, False); - store_vroot_property (si->dpy, - ssi->screensaver_window, ssi->screensaver_window); - - /* Transfer any grabs from the old window to the new. */ - maybe_transfer_grabs (ssi, old_w, ssi->screensaver_window, ssi->number); + raise_window (ssi); /* Now we can destroy the old window without horking our grabs. */ XDestroyWindow (si->dpy, old_w); - if (p->verbose_p) - fprintf (stderr, "%s: %d: destroyed old saver window 0x%lx.\n", + if (p->verbose_p > 1) + fprintf (stderr, "%s: %d: destroyed old saver window 0x%lx\n", blurb(), ssi->number, (unsigned long) old_w); if (old_c && - old_c != DefaultColormapOfScreen (ssi->screen) && - old_c != ssi->demo_cmap) + old_c != DefaultColormapOfScreen (ssi->screen)) XFreeColormap (si->dpy, old_c); } return got_it; } + + +/* Synchronize the contents of si->ssi to the current state of the monitors. + Doesn't change anything if nothing has changed; otherwise, alters and + reuses existing saver_screen_info structs as much as possible. + Returns True if anything changed. + */ +Bool +update_screen_layout (saver_info *si) +{ + monitor **monitors = scan_monitors (si->dpy); + int count = 0; + int good_count = 0; + int i, j; + int seen_screens[100] = { 0, }; + + if (! monitor_layouts_differ_p (monitors, si->monitor_layout)) + { + free_monitors (monitors); + return False; + } + + free_monitors (si->monitor_layout); + si->monitor_layout = monitors; + check_monitor_sanity (si->monitor_layout); + + while (monitors[count]) + { + if (monitors[count]->sanity == S_SANE) + good_count++; + count++; + } + + if (si->ssi_count == 0) + { + si->ssi_count = 10; + si->screens = (saver_screen_info *) + calloc (sizeof(*si->screens), si->ssi_count); + } + + if (si->ssi_count <= good_count) + { + si->ssi_count = good_count + 10; + si->screens = (saver_screen_info *) + realloc (si->screens, sizeof(*si->screens) * si->ssi_count); + memset (si->screens + si->nscreens, 0, + sizeof(*si->screens) * (si->ssi_count - si->nscreens)); + } + + if (! si->screens) abort(); + + si->nscreens = good_count; + + /* Regenerate the list of GL visuals as needed. */ + if (si->best_gl_visuals) + free (si->best_gl_visuals); + si->best_gl_visuals = 0; + + for (i = 0, j = 0; i < count; i++) + { + monitor *m = monitors[i]; + saver_screen_info *ssi = &si->screens[j]; + int sn; + if (monitors[i]->sanity != S_SANE) continue; + + ssi->global = si; + ssi->number = j; + + sn = screen_number (m->screen); + ssi->screen = m->screen; + ssi->real_screen_number = sn; + ssi->real_screen_p = (seen_screens[sn] == 0); + seen_screens[sn]++; + + ssi->default_visual = + get_visual_resource (ssi->screen, "visualID", "VisualID", False); + ssi->current_visual = ssi->default_visual; + ssi->current_depth = visual_depth (ssi->screen, ssi->current_visual); + + ssi->x = m->x; + ssi->y = m->y; + ssi->width = m->width; + ssi->height = m->height; + +# ifndef DEBUG_MULTISCREEN + { + saver_preferences *p = &si->prefs; + if (p->debug_p +# ifdef QUAD_MODE + && !p->quad_p +# endif + ) + ssi->width /= 2; + } +# endif + + j++; + } + + return True; +} + + +/* When the screensaver is active, this timer will periodically change + the running program. Each screen has its own timer. + */ +void +cycle_timer (XtPointer closure, XtIntervalId *id) +{ + saver_screen_info *ssi = (saver_screen_info *) closure; + saver_info *si = ssi->global; + + if (ssi->error_dialog) + { + XDestroyWindow (si->dpy, ssi->error_dialog); + ssi->error_dialog = 0; + } + + maybe_reload_init_file (si); + kill_screenhack (ssi); + raise_window (ssi); + + /* We could do a fade-out of just this screen here; but that would only work + if the fade method is SHM, not gamma or colormap. It would also only + look right if the cycle timers never fire at the same time, which is + currently the case. */ + + XSync (si->dpy, False); + spawn_screenhack (ssi); /* This also re-adds the cycle_id timer */ +} + + +/* Called when a screenhack has exited unexpectedly. + We print a notification on the window, and in a little while, launch + a new hack (rather than waiting for the cycle timer to fire). + */ +void +screenhack_obituary (saver_screen_info *ssi, + const char *name, const char *error) +{ + saver_info *si = ssi->global; + saver_preferences *p = &si->prefs; + Time how_long = p->cycle; + Time max = 1000 * 60; /* Message stays up no longer than this */ + Window window; + Visual *visual; + XSetWindowAttributes attrs; + XWindowChanges changes; + unsigned long attrmask; + XftFont *font; + XftColor fg; + XftDraw *xftdraw; + XGlyphInfo overall; + XGCValues gcv; + GC gc; + char *fn, *cn; + char buf[255]; + int x, y, pad; + int bw = 4; + Colormap cmap; + + /* Restart the cycle timer, to take down the error dialog and launch + a new hack. + */ + if (how_long > max) + how_long = max; + if (ssi->cycle_id) + XtRemoveTimeOut (ssi->cycle_id); + ssi->cycle_id = + XtAppAddTimeOut (si->app, how_long, cycle_timer, (XtPointer) ssi); + ssi->cycle_at = time ((time_t *) 0) + how_long / 1000; + if (p->verbose_p) + fprintf (stderr, "%s: %d: cycling in %lu sec\n", blurb(), ssi->number, + how_long / 1000); + + /* Render an error message while we wait. + + We can't just render text on top of ssi->screensaver_window because + if there was an OpenGL hack running on it, Xlib graphics might not + show up at all. Likewise, creating a sub-window doesn't work. + So it must be a top-level override-redirect window atop the saver. + */ + cmap = ssi->cmap ? ssi->cmap : DefaultColormapOfScreen (ssi->screen); + window = ssi->error_dialog; + if (window) XDestroyWindow (si->dpy, window); + attrs.override_redirect = True; + attrs.background_pixel = ssi->black_pixel; + attrs.border_pixel = ssi->black_pixel; + attrs.backing_store = Always; + attrs.colormap = cmap; + attrmask = (CWOverrideRedirect | CWBackPixel | CWBorderPixel | + CWBackingStore | CWColormap); + visual = ssi->current_visual; + window = ssi->error_dialog = + XCreateWindow (si->dpy, RootWindowOfScreen (ssi->screen), + 0, 0, 1, 1, 0, ssi->current_depth, InputOutput, visual, + attrmask, &attrs); + + fn = get_string_resource (si->dpy, "errorFont", "Font"); + cn = get_string_resource (si->dpy, "errorColor", "Color"); + if (!fn || !*fn) fn = strdup ("monospace bold 16"); + if (!cn || !*cn) cn = strdup ("#FF0000"); + + font = load_xft_font_retry (si->dpy, screen_number (ssi->screen), fn); + XftColorAllocName (si->dpy, visual, cmap, cn, &fg); + xftdraw = XftDrawCreate (si->dpy, window, visual, cmap); + + gcv.foreground = + get_pixel_resource (si->dpy, cmap, "errorColor", "Color"); + gcv.line_width = bw; + gc = XCreateGC (si->dpy, window, GCForeground | GCLineWidth, &gcv); + + sprintf (buf, "\"%.100s\" %.100s", name, error); + + XftTextExtentsUtf8 (si->dpy, font, (FcChar8 *) buf, strlen(buf), &overall); + x = (ssi->width - overall.width) / 2; + y = (ssi->height - overall.height) / 2 + font->ascent; + pad = bw + font->ascent * 2; + + attrmask = CWX | CWY | CWWidth | CWHeight; + changes.x = ssi->x + x - pad; + changes.y = ssi->y + y - (font->ascent + pad); + changes.width = overall.width + pad * 2; + changes.height = font->ascent + font->descent + pad * 2; + XConfigureWindow (si->dpy, window, attrmask, &changes); + xscreensaver_set_wm_atoms (si->dpy, window, changes.width, changes.height, + ssi->screensaver_window); + XMapRaised (si->dpy, window); + XClearWindow (si->dpy, window); + + XDrawRectangle (si->dpy, window, gc, gcv.line_width/2, gcv.line_width/2, + changes.width - gcv.line_width, + changes.height - gcv.line_width); + + x = pad; + y = font->ascent + pad; + XftDrawStringUtf8 (xftdraw, &fg, font, x, y, (FcChar8 *) buf, strlen (buf)); + XSync (si->dpy, False); + + XFreeGC (si->dpy, gc); + XftDrawDestroy (xftdraw); + /* XftColorFree (si->dpy, visual, cmap, &fg); */ + XftFontClose (si->dpy, font); + free (fn); + free (cn); +} + + +/* This timer goes off every few minutes to try and clean up anything that has + gone wrong. It raises the windows, in case some other window has been + mapped on top of them, and re-sets the server's DPMS settings. + + Maybe we should respond to Expose events to detect when another window has + raised above us and re-raise ourselves sooner. But that would result in us + fighting against "xscreensaver-auth" which tries very hard to be on top. + */ +static void +watchdog_timer (XtPointer closure, XtIntervalId *id) +{ + saver_info *si = (saver_info *) closure; + saver_preferences *p = &si->prefs; + + /* If the DPMS settings on the server have changed, change them back to + what ~/.xscreensaver says they should be. */ + sync_server_dpms_settings (si->dpy, p); + + if (si->prefs.debug_p) + fprintf (stderr, "%s: watchdog timer raising screen\n", blurb()); + + raise_windows (si); + + if (any_screenhacks_running_p (si) && + !monitor_powered_on_p (si->dpy)) + { + int i; + if (si->prefs.verbose_p) + fprintf (stderr, + "%s: monitor has powered down; killing running hacks\n", + blurb()); + for (i = 0; i < si->nscreens; i++) + kill_screenhack (&si->screens[i]); + } + + /* Re-schedule this timer. The watchdog timer defaults to a bit less + than the hack cycle period, but is never longer than one hour. + */ + si->watchdog_id = 0; + reset_watchdog_timer (si); +} + + +static void +reset_watchdog_timer (saver_info *si) +{ + saver_preferences *p = &si->prefs; + + if (si->watchdog_id) + { + XtRemoveTimeOut (si->watchdog_id); + si->watchdog_id = 0; + } + + if (p->watchdog_timeout <= 0) return; + si->watchdog_id = XtAppAddTimeOut (si->app, p->watchdog_timeout, + watchdog_timer, (XtPointer) si); + if (p->debug_p) + fprintf (stderr, "%s: restarting watchdog_timer (%ld, %ld)\n", + blurb(), p->watchdog_timeout, si->watchdog_id); +} diff --git a/driver/xdpyinfo.c b/driver/xdpyinfo.c index 9f67966..4bb071c 100644 --- a/driver/xdpyinfo.c +++ b/driver/xdpyinfo.c @@ -34,9 +34,14 @@ in this Software without prior written authorization from The Open Group. * -DHAVE_XRECORD */ +#include +#include +#include + #include #include #include /* for CARD32 */ +#include #include #ifdef HAVE_XIE #include @@ -69,18 +74,16 @@ in this Software without prior written authorization from The Open Group. char *ProgramName; Bool queryExtensions = False; -static int StrCmp(a, b) - char **a, **b; +static int StrCmp(const void *a, const void *b) { - return strcmp(*a, *b); + return strcmp(*((char **)a), *((char **)b)); } #ifdef HAVE_GLX /* Added by jwz, 11-Nov-99 */ static void -print_glx_versions (dpy) - Display *dpy; +print_glx_versions (Display *dpy) { /* Note: with Mesa 3.0, this lies: it prints the info from the client's GL library, rather than the info from the GLX server. @@ -100,9 +103,7 @@ print_glx_versions (dpy) } static void -print_glx_visual_info (dpy, vip) - Display *dpy; - XVisualInfo *vip; +print_glx_visual_info (Display *dpy, XVisualInfo *vip) { int status, value = False; @@ -271,8 +272,7 @@ struct overlay_list static struct overlay_list *overlays = 0; static void -find_overlay_info (dpy) - Display *dpy; +find_overlay_info (Display *dpy) { int screen; Atom OVERLAY = XInternAtom (dpy, "SERVER_OVERLAY_VISUALS", False); @@ -307,8 +307,7 @@ find_overlay_info (dpy) } static void -print_overlay_visual_info (vip) - XVisualInfo *vip; +print_overlay_visual_info (XVisualInfo *vip) { int i; int vis = vip->visualid; @@ -327,7 +326,7 @@ print_overlay_visual_info (vip) if (ov->transparency == 1) printf ("transparent pixel %lu\n", (unsigned long) ov->value); else if (ov->transparency == 2) - printf ("transparent mask 0x%x\n", (unsigned long) ov->value); + printf ("transparent mask 0x%lx\n", (unsigned long) ov->value); else printf ("opaque\n"); } @@ -335,9 +334,8 @@ print_overlay_visual_info (vip) #endif /* HAVE_OVERLAY */ -void -print_extension_info (dpy) - Display *dpy; +static void +print_extension_info (Display *dpy) { int n = 0; char **extlist = XListExtensions (dpy, &n); @@ -367,9 +365,8 @@ print_extension_info (dpy) } } -void -print_display_info (dpy) - Display *dpy; +static void +print_display_info (Display *dpy) { char dummybuf[40]; char *cp; @@ -393,7 +390,7 @@ print_display_info (dpy) req_size = XExtendedMaxRequestSize (dpy); if (!req_size) req_size = XMaxRequestSize (dpy); printf ("maximum request size: %ld bytes\n", req_size * 4); - printf ("motion buffer size: %d\n", XDisplayMotionBufferSize (dpy)); + printf ("motion buffer size: %ld\n", XDisplayMotionBufferSize (dpy)); switch (BitmapBitOrder (dpy)) { case LSBFirst: cp = "LSBFirst"; break; @@ -470,9 +467,8 @@ print_display_info (dpy) printf ("number of screens: %d\n", ScreenCount (dpy)); } -void -print_visual_info (vip) - XVisualInfo *vip; +static void +print_visual_info (XVisualInfo *vip) { char errorbuf[40]; /* for sprintfing into */ char *class = NULL; /* for printing */ @@ -507,10 +503,15 @@ print_visual_info (vip) vip->bits_per_rgb); } -void -print_screen_info (dpy, scr) - Display *dpy; - int scr; +static int print_event_mask ( + char *buf, /* string to write into */ + int lastcol, /* strlen(buf)+1 */ + int indent, /* amount by which to indent */ + long mask); /* event mask */ + + +static void +print_screen_info (Display *dpy, int scr) { Screen *s = ScreenOfDisplay (dpy, scr); /* opaque structure */ XVisualInfo viproto; /* fill in for getting info */ @@ -565,7 +566,7 @@ print_screen_info (dpy, scr) printf (" default colormap: 0x%lx\n", DefaultColormap (dpy, scr)); printf (" default number of colormap cells: %d\n", DisplayCells (dpy, scr)); - printf (" preallocated pixels: black %d, white %d\n", + printf (" preallocated pixels: black %lu, white %lu\n", BlackPixel (dpy, scr), WhitePixel (dpy, scr)); printf (" options: backing-store %s, save-unders %s\n", (DoesBackingStore (s) == NotUseful) ? no : @@ -637,11 +638,11 @@ static struct _event_table { { "OwnerGrabButtonMask ", OwnerGrabButtonMask }, { NULL, 0 }}; -int print_event_mask (buf, lastcol, indent, mask) - char *buf; /* string to write into */ - int lastcol; /* strlen(buf)+1 */ - int indent; /* amount by which to indent */ - long mask; /* event mask */ +static int print_event_mask ( + char *buf, /* string to write into */ + int lastcol, /* strlen(buf)+1 */ + int indent, /* amount by which to indent */ + long mask) /* event mask */ { struct _event_table *etp; int len; @@ -673,11 +674,9 @@ int print_event_mask (buf, lastcol, indent, mask) return (bitsfound); } -void -print_standard_extension_info(dpy, extname, majorrev, minorrev) - Display *dpy; - char *extname; - int majorrev, minorrev; +static void +print_standard_extension_info(Display *dpy, char *extname, + int majorrev, int minorrev) { int opcode, event, error; @@ -692,10 +691,8 @@ print_standard_extension_info(dpy, extname, majorrev, minorrev) printf("\n"); } -int -print_multibuf_info(dpy, extname) - Display *dpy; - char *extname; +static int +print_multibuf_info(Display *dpy, char *extname) { int i, j; /* temp variable: iterator */ int nmono, nstereo; /* count */ @@ -850,10 +847,8 @@ print_sync_info(dpy, extname) } #endif /* HAVE_XSYNC */ -int -print_shape_info(dpy, extname) - Display *dpy; - char *extname; +static int +print_shape_info(Display *dpy, char *extname) { int majorrev, minorrev; @@ -979,9 +974,8 @@ ExtensionPrintInfo known_extensions[] = int num_known_extensions = sizeof known_extensions / sizeof known_extensions[0]; -void -print_known_extensions(f) - FILE *f; +static void +print_known_extensions(FILE *f) { int i; for (i = 0; i < num_known_extensions; i++) @@ -990,9 +984,8 @@ print_known_extensions(f) } } -void -mark_extension_for_printing(extname) - char *extname; +static void +mark_extension_for_printing(char *extname) { int i; @@ -1015,9 +1008,8 @@ mark_extension_for_printing(extname) } } -void -print_marked_extensions(dpy) - Display *dpy; +static void +print_marked_extensions(Display *dpy) { int i; for (i = 0; i < num_known_extensions; i++) @@ -1035,7 +1027,7 @@ print_marked_extensions(dpy) } } -static void usage () +static void usage (void) { fprintf (stderr, "usage: %s [options]\n", ProgramName); fprintf (stderr, "-display displayname\tserver to query\n"); @@ -1047,15 +1039,11 @@ static void usage () exit (1); } -int main (argc, argv) - int argc; - char *argv[]; +int main (int argc, char *argv[]) { Display *dpy; /* X connection */ char *displayname = NULL; /* server to contact */ int i; /* temp variable: iterator */ - Bool multibuf = False; - int mbuf_event_base, mbuf_error_base; ProgramName = argv[0]; @@ -1077,7 +1065,7 @@ int main (argc, argv) dpy = XOpenDisplay (displayname); if (!dpy) { - fprintf (stderr, "%s: unable to open display \"%s\".\n", + fprintf (stderr, "%s: unable to open display \"%s\"\n", ProgramName, XDisplayName (displayname)); exit (1); } diff --git a/driver/xinput.c b/driver/xinput.c new file mode 100644 index 0000000..3b21db0 --- /dev/null +++ b/driver/xinput.c @@ -0,0 +1,381 @@ +/* xscreensaver, Copyright © 1991-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include + +#include +#include +#include + +#include "blurb.h" +#include "xinput.h" + +extern Bool debug_p; + +#undef countof +#define countof(x) (sizeof((x))/sizeof((*x))) + + +/* Initialize the XInput2 extension. Returns True on success. + */ +Bool +init_xinput (Display *dpy, int *opcode_ret) +{ + int nscreens = ScreenCount (dpy); + XIEventMask evmasks[1]; + unsigned char mask1[(XI_LASTEVENT + 7)/8]; + int major, minor; + int xi_opcode, ev, err; + int i; + int ndevs = 0; + XIDeviceInfo *devs; + + if (!XQueryExtension (dpy, "XInputExtension", &xi_opcode, &ev, &err)) + { + fprintf (stderr, "%s: XInput extension missing\n", blurb()); + return False; + } + + major = 2; /* Desired version */ + minor = 2; + if (XIQueryVersion (dpy, &major, &minor) != Success) + { + fprintf (stderr, "%s: server only supports XInput %d.%d\n", + blurb(), major, minor); + return False; + } + + if (verbose_p) + fprintf (stderr, "%s: XInput version %d.%d\n", blurb(), major, minor); + + memset (mask1, 0, sizeof(mask1)); + + XISetMask (mask1, XI_RawMotion); + XISetMask (mask1, XI_RawKeyPress); + XISetMask (mask1, XI_RawKeyRelease); + XISetMask (mask1, XI_RawButtonPress); + XISetMask (mask1, XI_RawButtonRelease); + XISetMask (mask1, XI_RawTouchBegin); + XISetMask (mask1, XI_RawTouchUpdate); + XISetMask (mask1, XI_RawTouchEnd); + + /* If we use XIAllDevices instead, we get double events. */ + evmasks[0].deviceid = XIAllMasterDevices; + evmasks[0].mask_len = sizeof(mask1); + evmasks[0].mask = mask1; + + for (i = 0; i < nscreens; i++) + { + Window root = RootWindow (dpy, i); + if (XISelectEvents (dpy, root, evmasks, countof(evmasks)) != Success) + { + fprintf (stderr, "%s: XISelectEvents failed\n", blurb()); + return False; + } + } + + XFlush (dpy); + + devs = XIQueryDevice (dpy, XIAllDevices, &ndevs); + if (!ndevs) + { + fprintf (stderr, "%s: XInput: no devices\n", blurb()); + return False; + } + + if (verbose_p) + for (i = 0; i < ndevs; i++) + { + XIDeviceInfo *d = &devs[i]; + fprintf (stderr, "%s: device %2d/%d: %s: %s\n", + blurb(), d->deviceid, d->attachment, + (d->use == XIMasterPointer ? "MP" : + d->use == XIMasterKeyboard ? "MK" : + d->use == XISlavePointer ? "SP" : + d->use == XISlaveKeyboard ? "SK" : + d->use == XIFloatingSlave ? "FS" : "??"), + d->name); + } + + XIFreeDeviceInfo (devs); + *opcode_ret = xi_opcode; + return True; +} + + +/* Convert an XInput2 event to corresponding old-school Xlib event. + Returns true on success. + */ +Bool +xinput_event_to_xlib (int evtype, XIDeviceEvent *in, XEvent *out) +{ + Display *dpy = in->display; + Bool ok = False; + + int root_x = 0, root_y = 0; + unsigned int mods = 0; + + /* The closest thing to actual documentation on XInput2 seems to be a series + of blog posts by Peter Hutterer. There's basically nothing about it on + www.x.org. In http://who-t.blogspot.com/2009/07/xi2-recipes-part-4.html + he says: + + "XIDeviceEvent [...] contains the state of the modifier keys [...] + The base modifiers are the ones currently pressed, latched the ones + pressed until a key is pressed that's configured to unlatch it (e.g. + some shift-capslock interactions have this behaviour) and finally + locked modifiers are the ones permanently active until unlocked + (default capslock behaviour in the US layout). The effective modifiers + are a bitwise OR of the three above - which is essentially equivalent + to the modifiers state supplied in the core protocol events." + + However, I'm seeing random noise in the various XIDeviceEvent.mods fields. + Nonsensical values like base = 0x6045FB3D. So, let's poll the actual + modifiers from XQueryPointer. This can race: maybe the modifier state + changed between when the server generated the keyboard event, and when + we receive it and poll. However, if an actual human is typing and + releasing their modifier keys on such a tight timeframe... that's + probably already not going well. + + I'm also seeing random noise in the event_xy and root_xy fields in + motion events. So just always use XQueryPointer. + */ + switch (evtype) { + case XI_RawKeyPress: + case XI_RawKeyRelease: + case XI_RawButtonPress: + case XI_RawButtonRelease: + case XI_RawMotion: + { + Window root_ret, child_ret; + int win_x, win_y; + int i; + for (i = 0; i < ScreenCount (dpy); i++) /* query on correct screen */ + if (XQueryPointer (dpy, RootWindow (dpy, i), + &root_ret, &child_ret, &root_x, &root_y, + &win_x, &win_y, &mods)) + break; + } + default: break; + } + + switch (evtype) { + case XI_RawKeyPress: + case XI_RawKeyRelease: + out->xkey.type = (evtype == XI_RawKeyPress ? KeyPress : KeyRelease); + out->xkey.display = in->display; + out->xkey.window = in->event; + out->xkey.root = in->root; + out->xkey.subwindow = in->child; + out->xkey.time = in->time; + out->xkey.x = root_x; + out->xkey.y = root_y; + out->xkey.x_root = root_x; + out->xkey.y_root = root_y; + out->xkey.state = mods; + out->xkey.keycode = in->detail; + ok = True; + break; + case XI_RawButtonPress: + case XI_RawButtonRelease: + out->xbutton.type = (evtype == XI_RawButtonPress + ? ButtonPress : ButtonRelease); + out->xbutton.display = in->display; + out->xbutton.window = in->event; + out->xbutton.root = in->root; + out->xbutton.subwindow = in->child; + out->xbutton.time = in->time; + out->xbutton.x = root_x; + out->xbutton.y = root_y; + out->xbutton.x_root = root_x; + out->xbutton.y_root = root_y; + out->xbutton.state = mods; + out->xbutton.button = in->detail; + ok = True; + break; + case XI_RawMotion: + out->xmotion.type = MotionNotify; + out->xmotion.display = in->display; + out->xmotion.window = in->event; + out->xmotion.root = in->root; + out->xmotion.subwindow = in->child; + out->xmotion.time = in->time; + out->xmotion.x = root_x; + out->xmotion.y = root_y; + out->xmotion.x_root = root_x; + out->xmotion.y_root = root_y; + out->xmotion.state = mods; + ok = True; + break; + default: + break; + } + + return ok; +} + + +static void +print_kbd_event (XEvent *xev, XComposeStatus *compose, Bool x11_p) +{ + if (debug_p) /* Passwords show up in plaintext! */ + { + KeySym keysym = 0; + char c[100]; + char M[100], *mods = M; + int n = XLookupString (&xev->xkey, c, sizeof(c)-1, &keysym, compose); + const char *ks = keysym ? XKeysymToString (keysym) : "NULL"; + c[n] = 0; + if (*c == '\n') strcpy (c, "\\n"); + else if (*c == '\r') strcpy (c, "\\r"); + else if (*c == '\t') strcpy (c, "\\t"); + + *mods = 0; + if (xev->xkey.state & ShiftMask) strcat (mods, "-Sh"); + if (xev->xkey.state & LockMask) strcat (mods, "-Lk"); + if (xev->xkey.state & ControlMask) strcat (mods, "-C"); + if (xev->xkey.state & Mod1Mask) strcat (mods, "-M1"); + if (xev->xkey.state & Mod2Mask) strcat (mods, "-M2"); + if (xev->xkey.state & Mod3Mask) strcat (mods, "-M3"); + if (xev->xkey.state & Mod4Mask) strcat (mods, "-M4"); + if (xev->xkey.state & Mod5Mask) strcat (mods, "-M5"); + if (*mods) mods++; + if (!*mods) strcat (mods, "0"); + + fprintf (stderr, "%s: %s 0x%02X %s %s \"%s\"\n", blurb(), + (x11_p + ? (xev->xkey.type == KeyPress + ? "X11 KeyPress " + : "X11 KeyRelease ") + : (xev->xkey.type == KeyPress + ? "XI_RawKeyPress " + : "XI_RawKeyRelease")), + xev->xkey.keycode, mods, ks, c); + } + else /* Log only that the KeyPress happened. */ + { + fprintf (stderr, "%s: X11 Key%s\n", blurb(), + (xev->xkey.type == KeyPress ? "Press " : "Release")); + } +} + + +void +print_xinput_event (Display *dpy, XEvent *xev, const char *desc) +{ + XIRawEvent *re; + + switch (xev->xany.type) { + case KeyPress: + case KeyRelease: + { + static XComposeStatus compose = { 0, }; + print_kbd_event (xev, &compose, True); + } + break; + + case ButtonPress: + case ButtonRelease: + fprintf (stderr, "%s: X11 Button%s %d %d\n", blurb(), + (xev->xany.type == ButtonPress ? "Press " : "Release"), + xev->xbutton.button, xev->xbutton.state); + break; + + case MotionNotify: + fprintf (stderr, "%s: X11 MotionNotify %4d, %-4d" + " %s\n", + blurb(), xev->xmotion.x_root, xev->xmotion.y_root, + (desc ? desc : "")); + break; + default: + break; + } + + if (xev->xany.type != GenericEvent) + return; /* not an XInput event */ + + if (!xev->xcookie.data) + XGetEventData (dpy, &xev->xcookie); + + re = xev->xcookie.data; + if (!re) return; /* Bogus XInput event */ + + switch (re->evtype) { + case XI_RawKeyPress: + case XI_RawKeyRelease: + if (debug_p) + { + /* Fake up an XKeyEvent in order to call XKeysymToString(). */ + XEvent ev2; + Bool ok = xinput_event_to_xlib (xev->xcookie.evtype, + (XIDeviceEvent *) re, + &ev2); + if (!ok) + fprintf (stderr, "%s: unable to translate XInput2 event\n", blurb()); + else + { + static XComposeStatus compose = { 0, }; + print_kbd_event (&ev2, &compose, False); + } + break; + } + else + fprintf (stderr, "%s: XI RawKey%s\n", blurb(), + (re->evtype == XI_RawKeyPress ? "Press " : "Release")); + break; + + case XI_RawButtonPress: + case XI_RawButtonRelease: + fprintf (stderr, "%s: XI RawButton%s %d\n", blurb(), + (re->evtype == XI_RawButtonPress ? "Press " : "Release"), + re->detail); + break; + + case XI_RawMotion: + if (verbose_p > 1) + { + Window root_ret, child_ret; + int root_x, root_y; + int win_x, win_y; + unsigned int mask; + XQueryPointer (dpy, DefaultRootWindow (dpy), + &root_ret, &child_ret, &root_x, &root_y, + &win_x, &win_y, &mask); + fprintf (stderr, + "%s: XI_RawMotion %4d, %-4d %7.02f, %-7.02f%s\n", + blurb(), root_x, root_y, re->raw_values[0], re->raw_values[1], + (desc ? desc : "")); + } + break; + + /* Touch-screens, possibly trackpads or tablets. */ + case XI_RawTouchBegin: + fprintf (stderr, "%s: XI RawTouchBegin\n", blurb()); + break; + case XI_RawTouchEnd: + fprintf (stderr, "%s: XI RawTouchEnd\n", blurb()); + break; + case XI_RawTouchUpdate: + if (verbose_p > 1) + fprintf (stderr, "%s: XI RawTouchUpdate\n", blurb()); + break; + + default: + fprintf (stderr, "%s: unknown XInput event %d\n", blurb(), re->type); + break; + } +} diff --git a/driver/xinput.h b/driver/xinput.h new file mode 100644 index 0000000..2ee20ee --- /dev/null +++ b/driver/xinput.h @@ -0,0 +1,19 @@ +/* xscreensaver, Copyright © 1991-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + */ + +#ifndef __XSCREENSAVER_XINPUT_H__ +#define __XSCREENSAVER_XINPUT_H__ + +extern Bool init_xinput (Display *dpy, int *opcode_ret); +extern Bool xinput_event_to_xlib (int evtype, XIDeviceEvent *in, XEvent *out); +extern void print_xinput_event (Display *, XEvent *, const char *desc); + +#endif /* __XSCREENSAVER_XINPUT_H__ */ diff --git a/driver/xscreensaver-auth.c b/driver/xscreensaver-auth.c new file mode 100644 index 0000000..4344d20 --- /dev/null +++ b/driver/xscreensaver-auth.c @@ -0,0 +1,340 @@ +/* xscreensaver, Copyright © 1991-2021 Jamie Zawinski + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. No representations are made about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * XScreenSaver Daemon, version 6. + * + * This is "xscreensaver-auth" -- When the screen is locked and there is + * user activity, this program is launched to pop up a dialog, authenticate + * the user, and eventually exit with a status code indicating success or + * failure. See the comment atop xscreensaver.c for details of the division + * of powers. + * + * Flow of control within xscreensaver-auth: + * + * - Privileged password initialization (e.g. read /etc/shadow as root) + * - Disavow privileges + * - Unprivileged password initialization + * - Connect to X server + * - xss_authenticate (passwd.c) + * - Tries PAM, Kerberos, pwent, shadow passwords (passwd-*.c) until + * one of them works. Non-PAM methods are wrapped to act like PAM. + * - pam_conv calls our "conversation" function zero or more times. + * That function is expected to present messages to the user and/or + * to prompt the user to answer a question, wait for the answer, and + * return it. There might be only one question (the password) or + * there might be others, even multiple passwords. + * - xscreensaver_auth_conv (dialog.c) is our conversation function. + * - First time it is called, it creates the window. + * - Subsequent times, it reuses that window. + * - Runs an X11 event loop waiting for the user to complete + * or timeout, then returns the entered strings. + * - pam_conv takes the user input and returns success/failure. + * - xscreensaver_auth_finished is called to pop up a final dialog to + * present any error messages. + * - Exit with appropriate code. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef ENABLE_NLS +# include +# include +#endif + +#include "xscreensaver.h" +#include "version.h" +#include "atoms.h" +#include "yarandom.h" +#include "resources.h" +#include "visual.h" +#include "auth.h" + +#ifdef __GNUC__ + __extension__ /* shut up about "string length is greater than the length + ISO C89 compilers are required to support" when including + the .ad file... */ +#endif + +static char *defaults[] = { +#include "XScreenSaver_ad.h" + 0 +}; + + +char *progclass = 0; +Bool debug_p = False; + + +#ifdef HAVE_PROC_OOM +/* Linux systems have an "out-of-memory killer" that will nuke random procs in + low-memory situations. You'd think it would pick the process using the + most memory, but most of the time it seems to pick the process that would + be most comically inconvenient, such as your screen locker, or crond. + + Since killing "xscreensaver" unlocks the screen... that would be bad. + + This program, "xscreensaver-auth", is the part of the XScreenSaver daemon + that might need to be setuid for other reasons, so we handle the OOM killer + here. We could instead handle OOM in the "xscreensaver" program, but then + that program would *also* need to be setuid. + + So instead, "xscreensaver-auth" sets OOM immunity on its *parent* process. + That means that if you run it by hand, it will apply that immunity to the + parent shell. Maybe that's bad? I think I don't care. + + Linux >= 2.6.11: echo -17 > /proc/$$/oom_adj + Linux >= 2.6.37: echo -1000 > /proc/$$/oom_score_adj + + "An aircraft company discovered that it was cheaper to fly its planes with + less fuel on board. On rare occasions, however, the amount of fuel was + insufficient, and the plane would crash. In emergency cases, a passenger + was selected and thrown out of the plane. When necessary, the procedure + was repeated." + + https://lwn.net/Articles/104179/ + + The OOM killer preferentially kills processes whose *children* use a lot of + memory, and processes that are niced. So if a display mode uses a lot of + memory, the OOM-killer is more likely to shoot down the XScreenSaver + *daemon* than just that screenhack! + + To disable the OOM-killer entirely: + + echo 2 > /proc/sys/vm/overcommit_memory + echo vm.overcommit_memory = 2 >> /etc/sysctl.conf + */ +static void +oom_assassin_immunity (void) +{ +# define OOM_VAL "-1000" + char fn[1024]; + struct stat st; + FILE *fd; + pid_t pid = getppid(); /* our parent, not us */ + + sprintf (fn, "/proc/%d/oom_score_adj", pid); + if (stat(fn, &st) != 0) + { + if (verbose_p) + fprintf (stderr, "%s: OOM: %s does not exist\n", blurb(), fn); + return; + } + fd = fopen (fn, "w"); + if (!fd) goto FAIL; + if (fputs (OOM_VAL "\n", fd) <= 0) goto FAIL; + if (fclose (fd) != 0) goto FAIL; + + if (verbose_p) + fprintf (stderr, "%s: OOM: echo " OOM_VAL " > %s\n", blurb(), fn); + return; + + FAIL: + { + char buf[1024]; + const char *b = blurb(); + sprintf (buf, "%.40s: OOM: %.200s", b, fn); + perror (buf); + if (getuid() == geteuid()) + fprintf (stderr, + "%s: To prevent the kernel from randomly unlocking\n" + "%s: your screen via the out-of-memory killer,\n" + "%s: \"%s\" must be setuid root.\n", + b, b, b, progname); + } +} +#endif /* HAVE_PROC_OOM */ + + +int +main (int argc, char **argv) +{ + Display *dpy; + XtAppContext app; + Widget root_widget; + char *dpy_str = getenv ("DISPLAY"); + Bool xsync_p = False; + Bool splash_p = False; + Bool init_p = False; + int i; + +# undef ya_rand_init + ya_rand_init (0); + + /* For Xt and X resource database purposes, this program is + "xscreensaver", not "xscreensaver-auth". + */ + { + char *s = strrchr(argv[0], '/'); + if (s) s++; + else s = argv[0]; + if (strlen(s) > 20) /* keep it short. */ + s[20] = 0; + progname = s; + } + + progclass = "XScreenSaver"; + argv[0] = "xscreensaver"; + + if (! dpy_str) dpy_str = ":0"; + + for (i = 1; i < argc; i++) + { + const char *oa = argv[i]; + /* XScreenSaver predates the "--arg" convention. */ + if (argv[i][0] == '-' && argv[i][1] == '-') + argv[i]++; + + if (!strcmp (argv[i], "-v") || !strcmp (argv[i], "-verbose")) + verbose_p++; + else if (!strcmp (argv[i], "-vv")) verbose_p += 2; + else if (!strcmp (argv[i], "-vvv")) verbose_p += 3; + else if (!strcmp (argv[i], "-vvvv")) verbose_p += 4; + else if (!strcmp (argv[i], "-q") || !strcmp (argv[i], "-quiet")) + verbose_p = False; + else if (!strcmp (argv[i], "-debug")) + /* Does nothing else at the moment but warn that "xscreensaver" + is logging keystrokes to stderr. */ + debug_p = True; + else if (!strcmp (argv[i], "-d") || + !strcmp (argv[i], "-dpy") || + !strcmp (argv[i], "-disp") || + !strcmp (argv[i], "-display")) + { + dpy_str = argv[++i]; + if (!dpy_str) goto HELP; + } + else if (!strcmp (argv[i], "-sync") || + !strcmp (argv[i], "-synch") || + !strcmp (argv[i], "-synchronize") || + !strcmp (argv[i], "-synchronise")) + xsync_p = True; + else if (!strcmp (argv[i], "-splash")) + splash_p = True; + else if (!strcmp (argv[i], "-init")) + init_p = True; + else if (!strcmp (argv[i], "-h") || !strcmp (argv[i], "-help")) + { + HELP: + fprintf (stderr, + "\n" + "\txscreensaver-auth is launched by the xscreensaver daemon\n" + "\tto authenticate the user by prompting for a password.\n" + "\tDo not run this directly.\n" + "\n" + "\tOptions:\n" + "\t\t--dpy host:display.screen\n" + "\t\t--verbose --sync --splash --init\n" + "\n" + "\tRun 'xscreensaver-settings' to configure.\n" + "\n"); + exit (1); + } + else + { + fprintf (stderr, "\n%s: unknown option: %s\n", blurb(), oa); + goto HELP; + } + } + + if (!splash_p && init_p) + { + const char *v = XSCREENSAVER_VERSION; + if (strstr (v, "a") || strstr (v, "b")) + splash_p = True; /* Not optional for alpha and beta releases */ + } + +# ifdef HAVE_PROC_OOM + if (splash_p || init_p) + oom_assassin_immunity (); +# endif + + if (!splash_p && !init_p) + lock_priv_init (); + + if (!splash_p && init_p) + exit (0); + + disavow_privileges (); + + if (!splash_p) + lock_init (); + + /* Setting the locale is necessary for XLookupString to return multi-byte + characters, enabling their use in passwords. + */ +# ifdef ENABLE_NLS + { + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + textdomain (GETTEXT_PACKAGE); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + if (!setlocale (LC_ALL, "")) + fprintf (stderr, "%s: warning: could not set default locale\n", + progname); + } +# endif /* ENABLE_NLS */ + + + /* Copy the -dpy arg to $DISPLAY for subprocesses. */ + { + char *s = (char *) malloc (strlen(dpy_str) + 20); + sprintf (s, "DISPLAY=%s", dpy_str); + putenv (s); + /* free (s); */ /* some versions of putenv do not copy */ + } + + /* Open the display */ + { + XrmOptionDescRec options; + argc = 1; /* Xt does not receive any of our command-line options. */ + root_widget = XtAppInitialize (&app, progclass, &options, 0, + &argc, argv, defaults, 0, 0); + } + + dpy = XtDisplay (root_widget); + if (xsync_p) XSynchronize (dpy, True); + init_xscreensaver_atoms (dpy); + + if (splash_p) + { + xscreensaver_splash (root_widget); + exit (0); + } + else if (xscreensaver_auth ((void *) root_widget, + xscreensaver_auth_conv, + xscreensaver_auth_finished)) + { + if (verbose_p) + fprintf (stderr, "%s: authentication succeeded\n", blurb()); + exit (200); + } + else + { + if (verbose_p) + fprintf (stderr, "%s: authentication failed\n", blurb()); + exit (-1); + } + + /* On timeout, xscreensaver_auth did exit(0) */ +} diff --git a/driver/xscreensaver-auth.man b/driver/xscreensaver-auth.man new file mode 100644 index 0000000..1655602 --- /dev/null +++ b/driver/xscreensaver-auth.man @@ -0,0 +1,27 @@ +.TH XScreenSaver 1 "06-Jan-2021 (6.00)" "X Version 11" +.SH NAME +xscreensaver - extensible screen saver and screen locking framework +.SH SYNOPSIS +.B xscreensaver-auth +[\-display \fIhost:display.screen\fP] +.SH DESCRIPTION +The +.BR xscreensaver (1) +daemon launches this program to prompt the user for their password. +Do not run this program directly. +.SH SEE ALSO +.BR xscreensaver (1), +.BR xscreensaver\-settings (1), +.BR xscreensaver\-gfx (MANSUFFIX), +.BR xscreensaver\-systemd (MANSUFFIX). +.SH COPYRIGHT +Copyright \(co 2021 by Jamie Zawinski. +Permission to use, copy, modify, distribute, and sell this software +and its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation. No representations are made about the +suitability of this software for any purpose. It is provided "as is" +without express or implied warranty. +.SH AUTHOR +Jamie Zawinski diff --git a/driver/xscreensaver-command.c b/driver/xscreensaver-command.c index 4a4f0b4..0dab564 100644 --- a/driver/xscreensaver-command.c +++ b/driver/xscreensaver-command.c @@ -1,4 +1,4 @@ -/* xscreensaver-command, Copyright (c) 1991-2019 Jamie Zawinski +/* xscreensaver-command, Copyright © 1991-2021 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -31,30 +31,15 @@ #include /* only needed to get through xscreensaver.h */ - -/* You might think that to read an array of 32-bit quantities out of a - server-side property, you would pass an array of 32-bit data quantities - into XGetWindowProperty(). You would be wrong. You have to use an array - of longs, even if long is 64 bits (using 32 of each 64.) - */ -typedef long PROP32; - +#include "blurb.h" #include "remote.h" #include "version.h" +#include "atoms.h" #ifdef _VROOT_H_ ERROR! you must not include vroot.h in this file #endif -char *progname; - -Atom XA_VROOT; -Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_RESPONSE; -Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO, XA_EXIT; -Atom XA_BLANK, XA_LOCK, XA_ACTIVATE, XA_SUSPEND, XA_NEXT, XA_PREV; -static Atom XA_DEACTIVATE, XA_CYCLE; -static Atom XA_RESTART, XA_PREFS, XA_THROTTLE, XA_UNTHROTTLE; - static char *screensaver_version; # ifdef __GNUC__ __extension__ /* don't warn about "string length is greater than the @@ -72,10 +57,8 @@ usage: %s -