pax_global_header00006660000000000000000000000064134216243040014511gustar00rootroot0000000000000052 comment=c2e5b42c18f8319df8dd26bda781dba0d7361b4c xscreensaver-5.42+dfsg1/000077500000000000000000000000001342162430400151535ustar00rootroot00000000000000xscreensaver-5.42+dfsg1/INSTALL000066400000000000000000000172301342162430400162070ustar00rootroot00000000000000Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. xscreensaver-5.42+dfsg1/Makefile.in000066400000000000000000000273611342162430400172310ustar00rootroot00000000000000# Makefile.in --- xscreensaver, Copyright (c) 1999-2014 Jamie Zawinski. # the `../configure' script generates `Makefile' from this file. @SET_MAKE@ srcdir = @srcdir@ VPATH = @srcdir@ SHELL = /bin/sh SUBDIRS = utils jwxyz hacks/images hacks hacks/glx 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 \ intltool-merge.in intltool-extract.in intltool-update.in \ xscreensaver.spec \ OSX/xscreensaver.xcodeproj/project.pbxproj TAR = tar MAKE_SUBDIR = for dir in $(SUBDIRS); do (cd $$dir; $(MAKE) $@) || exit 5; done MAKE_SUBDIR2 = for dir in $(SUBDIRS2); do (cd $$dir; $(MAKE) $@) || exit 5; done default:: @+$(MAKE_SUBDIR) all:: @+$(MAKE_SUBDIR) install:: @+$(MAKE_SUBDIR) install-program:: @+$(MAKE_SUBDIR) install-man:: @+$(MAKE_SUBDIR) install-strip:: @+$(MAKE_SUBDIR) uninstall:: @$(MAKE_SUBDIR) uninstall-program:: @$(MAKE_SUBDIR) uninstall-man:: @$(MAKE_SUBDIR) depend:: @$(MAKE_SUBDIR) distdepend:: @$(MAKE) update_spec_version @$(MAKE_SUBDIR2) @cd po ; $(MAKE) update-po TAGS:: tags tags:: @$(MAKE_SUBDIR) 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) dist:: tar # This really makes me sick... tar:: @ \ sh config.status ; \ rm -f configure ; \ $(MAKE) configure ; \ $(MAKE) version-date distdepend ; \ VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' utils/version.h` ; \ NAME="xscreensaver-$$VERS" ; \ rm -rf $$NAME ; ln -s . $$NAME ; \ FILES= ; \ ADIR=archive/ ; \ for subdir in $(SUBDIRS2) ; do \ d=`pwd` ; \ cd $$subdir ; \ FILES="$$FILES `$(MAKE) echo_tarfiles \ | grep -v '^.*make\[' \ | sed \"s|^|$$subdir/|g;s| | $$subdir/|g\" \ ` "; \ cd $$d ; 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 # This also makes me sick... # autoconf generates a configure script that begins with a very hard to read, # nearly impossible to customize --help blurb. This horrid set of regexps # go through and clean up the help text, by inserting whitespace and ripping # out options we don't use. Odds are good that this will fail with any version # of autoconf other than the ones I've tried (2.12 and 2.13.) # configure:: aclocal autoconf autoheader @TMP=configure.$$$$ ; \ echo "munging configure's --help message..." ; \ ( perl -e ' \ my $$file=""; \ 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/^ --oldincludedir=.*$$/ \ --x-includes=DIR X include files are in DIR\n \ --x-libraries=DIR X library files are in DIR/m; \ \ s@mandir=.\$$\{prefix}/man.@mandir=\\\$${datadir}/man@; \ \ s@rm -f conftest@rm -rf conftest@g; \ \ print;' \ < configure \ > $$TMP && \ cat $$TMP > configure ) ; \ rm -f $$TMP bump-version:: @ \ SRC=utils/version.h ; \ VERS=`sed -n 's/[^0-9]*\([0-9]\)\.\([0-9][^. ]*\).*/\1 \2/p' $$SRC` ; \ 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'`; \ ADIR=archive/ ; \ if [ ! -f $${ADIR}xscreensaver-$$MAJOR.$$MINOR.tar.gz ]; then \ echo "WARNING: $${ADIR}xscreensaver-$$MAJOR.$$MINOR.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.";\ fi ; \ /bin/echo -n "Bumping $$MAJOR.$$MINOR to $$MAJOR.$$NEW ($$D), 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; \ cat $$TMP > $$SRC ; \ rm -f $$TMP; \ echo "overwrote $$SRC"; \ ls -lFd $$SRC bump_version:: bump-version tick-version:: bump-version tick_version:: bump-version version-date:: @ \ SRC=utils/version.h ; \ D=`date '+%d-%b-%Y'`; \ 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 \ cat $$TMP > $$SRC ; \ echo "done." ; \ fi ; \ rm -f $$TMP 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` ; \ /bin/echo -n "Updating $$S to \"$$VERS\"... " ; \ T=/tmp/xs.$$$$ ; \ sed "s/^\(%define.version[^0-9]*\)\(.*\)/\1$$VERS/" \ < $$S > $$T ; \ if cmp -s $$S $$T ; then \ echo "unchanged." ; \ else \ cat $$T > $$S ; \ echo "done." ; \ fi ; \ rm $$T rpm:: @ \ VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' utils/version.h` ; \ DIR=`pwd`/rpm_build ; \ ARCH=`rpm --showrc | sed -n 's/^build arch *: //p'` ; \ ADIR=archive/ ; \ TGZ=xscreensaver-$$VERS.tar.gz ; \ if [ ! -f $${ADIR}$$TGZ ]; then \ echo "$${ADIR}$$TGZ does not exist! Did you forget to \`make tar'?" ; \ exit 1 ; \ fi ; \ rm -rf /var/tmp/xscreensaver-$$VERS-root ; \ rm -rf $$DIR ; \ mkdir $$DIR ; \ ( cd $$DIR; mkdir BUILD RPMS RPMS/$$ARCH SOURCES SPECS SRPMS ) ; \ cp -p $${ADIR}$$TGZ $$DIR/SOURCES/ ; \ rpmbuild --define "_topdir $$DIR" \ --define "USE_GL yes" \ -v -ba xscreensaver.spec ; \ echo '' ; \ echo 'RPM build complete' ; \ echo '' ; \ rm -f $$DIR/$$TGZ ; \ rm -rf $$DIR/BUILD/xscreensaver-$$VERS ; \ mv $$DIR/SRPMS/xscreensaver*-$$VERS-*.rpm . ; \ mv $$DIR/RPMS/$$ARCH/xscreensaver*-$$VERS-*.rpm . ; \ rm -rf $$DIR ; \ echo '' ; \ ls -lFG xscreensaver*-$$VERS-*.rpm dmg:: $(MAKE) -C OSX release dmg apk:: $(MAKE) -C android apk www:: @ \ DEST=$$HOME/www/xscreensaver ; \ VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][^. ]*\).*/\1/p' utils/version.h` ; \ HEAD="xscreensaver-$$VERS" ; \ ADIR=archive/ ; \ BNAME="$$HEAD.tar.gz" ; \ NAME="$$ADIR$$BNAME" ; \ DNAME="$$DEST/$$HEAD.tar.gz" ; \ BNAME2="$$HEAD.dmg" ; \ NAME2="$$ADIR$$BNAME2" ; \ DNAME2="$$DEST/$$HEAD.dmg" ; \ BNAME3="$$HEAD.apk" ; \ NAME3="$$ADIR$$BNAME3" ; \ DNAME3="$$DEST/$$HEAD.apk" ; \ \ if ! git diff --quiet ; then \ echo "uncommitted changes exist!" ; \ exit 1 ; \ fi ; \ \ $(MAKE) -C OSX updates.xml ; \ \ if [ ! -f $$NAME ]; then \ echo "$$NAME does not exist! Did you forget to \`make tar'?" ; \ exit 1 ; \ fi ; \ if [ ! -f $$NAME2 ]; then \ echo "$$NAME2 does not exist! Did you forget to \`make dmg'?" ; \ exit 1 ; \ fi ; \ if [ ! -f $$NAME3 ]; then \ echo "$$NAME3 does not exist! Did you forget to \`make apk'?" ; \ exit 1 ; \ fi ; \ chmod a-w $$NAME ; \ if [ -f $$DNAME ]; then \ /bin/echo -n "WARNING: $$DNAME already exists! Overwrite? "; \ read line; \ if [ "x$$line" != "xyes" -a "x$$line" != "xy" ]; then \ exit 1 ; \ fi ; \ fi ; \ if [ -f $$DNAME2 ]; then \ /bin/echo -n "WARNING: $$DNAME2 already exists! Overwrite? "; \ read line; \ if [ "x$$line" != "xyes" -a "x$$line" != "xy" ]; then \ exit 1 ; \ fi ; \ fi ; \ if [ -f $$DNAME3 ]; then \ /bin/echo -n "WARNING: $$DNAME3 already exists! Overwrite? "; \ read line; \ if [ "x$$line" != "xyes" -a "x$$line" != "xy" ]; then \ exit 1 ; \ fi ; \ fi ; \ \ git tag -a "v$$VERS" -m "$$VERS" ; \ git commit -m "$$VERS" . ; \ \ ( cd $$DEST ; git pull ) ; \ \ cp -p $$NAME $$DNAME ; \ cp -p $$NAME2 $$DNAME2 ; \ cp -p $$NAME3 $$DNAME3 ; \ chmod u+w $$DNAME $$DNAME2 $$DNAME3 ; \ cp -p OSX/updates.xml $$DEST ; \ cd $$DEST ; \ \ TMP=/tmp/xd.$$$$ ; \ sed "s/xscreensaver-5\.[0-9][0-9ab]*/$$HEAD/g" download.html > $$TMP ; \ echo '' ; \ diff -U0 download.html $$TMP ; \ echo '' ; \ \ for EXT in tar.gz dmg ; do \ OLDEST=`ls xscreensaver*.$$EXT | \ fgrep -v 5.14 | \ fgrep -v 5.34 | \ head -n 1` ; \ /bin/echo -n "Delete $$DEST/$$OLDEST? "; \ read line; \ if [ "x$$line" = "xyes" -o "x$$line" = "xy" ]; then \ set -x ; \ rm $$OLDEST ; \ git rm $$OLDEST ; \ set +x ; \ fi ; \ done ; \ set -x ; \ cat $$TMP > download.html ; \ rm -f $$TMP ; \ \ git add $$BNAME $$BNAME2 $$BNAME3 ; \ \ $(MAKE) -C ../ xscreensaver/changelog.html xscreensaver/screenshots/index.html; \ git diff changelog.html ; \ set +x ; \ \ /bin/echo -n "Ok? "; \ read line; \ if [ "x$$line" != "xyes" -a "x$$line" != "xy" ]; then \ exit 1 ; \ fi ; \ \ git tag -a "v$$VERS" -m "$$VERS" ; \ git commit -m "$$VERS" . ; \ git push ; \ 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 xscreensaver-5.42+dfsg1/README000066400000000000000000002174051342162430400160440ustar00rootroot00000000000000 XScreenSaver a collection of free screen savers for X11, macOS, iOS and Android By Jamie Zawinski and many others https://www.jwz.org/xscreensaver/ =============================================================================== This is the XScreenSaver source code distribution. It is strongly recommended 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 make make install If you are on an "apt"-based system, "apt-get build-dep xscreensaver" might install most of the compilation dependencies. To compile for macOS X or iOS: 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. =============================================================================== XScreenSaver has an extensive manual -- please read it! =============================================================================== 5.42 * macOS: Fixed Sparkle auto-updater. 5.41 * X11: Those new font-loading fallback heuristics work again. Oops. * iOS, Android: Plugged many memory leaks at exit. * New hack, `handsy'. * Fixed `noof' from displaying minimalistically. * Rewrote `unknownpleasures' to be faster, and a true waterfall graph. * BSOD Solaris improved. DVD added. * Linux: If the xscreensaver daemon is setuid, then we can implore the kernel's out-of-memory killer to pretty please not unlock the screen. * macOS: Upgraded Sparkle (the "Check for Updates" library). * macOS: Screen saver settings work again on 10.14. 5.40 * New hacks, `filmleader', `vfeedback'. * New hack, `glitchpeg' (X11 and macOS only). * GLPlanet blends between day and night maps at the dusk terminator. * DymaxionMap can display arbitrary map images, and animate sunlight across the flattened globe. * Tessellimage can draw either Delaunay or Voronoi tilings. * XAnalogTV includes test cards. * Android: These hacks work now: `blitspin', `bumps', `cityflow', `endgame', `esper', `flipscreen3d', `gleidescope', `glslideshow', `jigglypuff', `queens', `tessellimage', `xanalogtv', `xmatrix', `zoom'. 5.39 * New hacks, `razzledazzle', `peepers', `crumbler' and `maze3d'. * More heuristics for using RSS feeds as image sources. * Android: Image loading works. * Built-in image assets are now PNG instead of XPM or XBM. * X11: Better font-loading fallback heuristics on systems with a terrible selection of installed fonts. * macOS: Retina display-related bug fixes. 5.38 * New hack, `esper'. * macOS: Support for Retina displays. * X11: `webcollage' now works with ImageMagick instead of with pbmtools if `webcollage-helper' is not installed. * `bsod' now accepts Dunning-Krugerrands. * Android: These hacks work now: `anemone', `anemotaxis', `atlantis', `bouboule', `celtic', `compass', `crackberg', `epicycle', `fuzzyflakes', `goop', `kumppa' `munch', `pacman', `polyominoes', `slip'. * Android: Thick lines work better for: `anemone', `anemotaxis', `celtic', `compass', `deluxe', `epicycle', `fuzzyflakes', `pacman'. * Android: Assorted performance improvements, especially for `kumppa' and `slip'. * Android TV: Daydreams work. * iOS: Tweaks for iPhone X. * Lots of xlockmore-derived hacks now have animated erase routines. * `crystal' works properly on non-X11 systems. * `m6502' now includes `texture.asm'. * X11: Try harder to find sensible fonts for the password dialog. 5.37 * New hack, `vigilance'. * Added Mac Software Update and VMware to `bsod'. * macOS: Grabbing the desktop works again. * macOS: Pinch to zoom. * Android: Both Daydreams and Live Wallpapers are implemented. * Updated `webcollage' for recent changes. * Various bug fixes. 5.36 * New hacks, `discoball', `cubetwist', `cubestack', `splodesic' and `hexstrut'. * macOS: loading image files works in `dymaxionmap', `glplanet', `lavalite', `pulsar', `gleidescope' and `extrusion'. * Several new programs in `m6502'. * `rotzoomer -mode circle'. * Better titles in `photopile'. 5.35 * New hacks, `dymaxionmap', `unicrud', `energystream', `raverhoop' and `hydrostat'. * Added Windows 10 to `bsod'. * X11: ignore WM_USER_TIME property changes with days-old timestamps. Thanks, KDE. * macOS, iOS: Better fonts in `bsod' and `memscroller'. * macOS 10.8 or later and iOS 6.0 or later are now required, since Xcode 6 can no longer build executables that work on older OSes. * Many, many Android improvements. * iOS: Fixed rotation to work with the new iOS 8+ API. * X11: `pong' is now playable. 5.34 * Fixed a crash when hot-swapping monitors while locked. * Fixed some incorrect output from `xscreensaver-command -watch'. * Various macOS and iOS performance improvements. 5.33 * New hacks, `splitflap' and `romanboy'. * Better detection of user activity on modern GNOME systems. * Sonar now does asynchronous host name resolution. * Improved Unicode support. * Updated `webcollage' for recent changes. * Various minor fixes. 5.32 * Fixed some X11 compilation problems. * Fixed display size and shake gestures on iOS. * macOS/iOS Performance improvements. 5.31 * New hacks, `geodesicgears', `binaryring' and `cityflow'. * UTF-8 text support (instead of only Latin1) and antialiased text on X11 with Xft (instead of only on macOS/iOS) in `fontglide', `noseguy', `fliptext', `starwars', and `winduprobot'. The other text-displaying hacks (`apple2', `phosphor', `xmatrix', and `gltext') also now accept UTF-8 input, though they convert it to Latin1 or ASCII. * `glplanet' now has both day and night maps, and a sharp terminator. * Fixed `webcollage' on macOS. * Fixed a transparency glitch in `winduprobot'. * `lockward' works on iOS. * Text and image loading work on macOS 10.10. * Rotation works properly on iOS 8. * Added a search field on iOS. * Preliminary, unfinished support for Android. 5.30 * New hack, `winduprobot'. * Many improvements to `lament', including Leviathan. * Fixed the normals in `flyingtoasters': shading is correct now. * Implemented TEXTURE_GEN in GLES: flying toast is now toasted on iOS. * Make cel-shading sort-of work in `skytentacles' on iOS. * Fixed dragging-to-rotate on rotated iOS devices, I think. * Dragging has inertia now. * Most hacks respond to mouse-clicks, double-taps and swipes as meaning "do something different now". * Reworked OpenGL fonts. * The macOS auto-update installer wasn't working. This time for sure? * Various minor fixes. 5.29 * Downgraded to Xcode 5.0.2 to make it possible to build savers that will still run on 10.6 and 10.7. Sigh. * Updated `webcollage' for recent changes. 5.28 * Fixed some compilation problems and intermittent crashes. * Turned off the macOS 10.6 enable_gc hack. It didn't work. 5.27 * New hacks, `tessellimage' and `projectiveplane'. * Added support for pthreads, because Dave Odell is a madman. * Updated `webcollage' for recent changes. * Minor iOS tweaks to the `analogtv' hacks. * X11: Don't assume Suspend = 0 implies "No DPMS". * Minor updates to `boxed' and `klein'. * Fixed possible crash in `apple2', `noseguy', `xmatrix', `shadebobs'. * Fixed possible crash in macOS preferences. * macOS Performance improvements. * Plugged some leaks. 5.26 * More auto-updater tweaks. 5.25 * Try harder to bypass Quarrantine and Gatekeeper in macOS installer. * Some files were missing from the tarball. 5.24 * Added "Automatically check for updates" option on macOS. * Updated feed-loading for recent Flickr changes. * Updated `webcollage' for recent Google changes. * Added Instagram and Bing as `webcollage' image sources. * Updated to latest autoconf. * Bug fixes. 5.23 * New hack, `geodesic'. * iOS and macOS: huge XCopyArea performance improvements. * More heuristics for using RSS feeds as image sources. * Improved Wikipedia parser. * Updated `webcollage' for recent Flickr changes. * Added Android to `bsod'. * macOS: Added a real installer. * iOS and macOS: fixed a font-metrics bug. * iOS: Fixed aspect ratio bug in non-rotating apps when launched in landscape mode. * Made `quasicrystal' work on weak graphics cards. * iOS: fixed `ifs'. * Better compression on icons, plists and XML files: smaller distribution and installation footprint. * Reverted that DEACTIVATE change. Bad idea. * `Phosphor' now supports amber as well as green. 5.22 * New hacks, `kaleidocycle', `quasicrystal', `unknownpleasures' and `hexadrop'. * Performance improvements for `interference'. * Fixed possible crashes in `apple2', `maze', `pacman', `polyominoes', `fireworkx', `engine'. * Fix for `bumps' in 64 bit. * Fixed preferences crash on old iOS 5 devices. * Fixed "Shake to Randomize"; display name of saver. * Fixed weirdness with "Frame Rate" sliders on iOS. * Fixed rotation problems with `pacman', `decayscreen'. * Better dragging in `fluidballs'. * Ignore rotation in hacks that don't benefit from it. * Ignore DEACTIVATE messages when locked, instead of popping up the password dialog box. 5.21 * Changed default text source from Twitter to Wikipedia, since Twitter now requires a login to get any feeds. * New version of `fireworkx'. * Minor fixes to `distort', `fontglide', `xmatrix'. * New macOS crash in `bsod'. * New mode in `lcdscrub'. 5.20 * Support for iPhone 5 screen size. * Fixed modifier key handing in Apple2.app and Phosphor.app on macOS. * Various minor bug fixes. 5.19 * macOS 10.8.0 compatibility. * iOS performance improvements. 5.18 * iOS responds to shake gestures to randomize. * iOS can load images from your Photo Library. * iOS has clickable Wikipedia links in Settings panels. * Made `pipes' be ridiculously less efficient, but spin. * Added better mouse control to `rubik', `cube21', `crackberg', and `julia'. * Cosmetic improvements to `queens' and `endgame'. * `sonar' can now ping local subnet on DHCP. * Most savers now resize/rotate properly. * Various fixes. 5.17 * More iOS tweaks. * Fixed some compilation problems. * Enlarged the texture image for `lament'. 5.16 * Ported to iPhone and iPad. * XInput devices now also ignore small mouse motions. * Loading images via RSS feeds is much improved. * Various minor fixes. 5.15 * New hacks, `hilbert', `companioncube' and `tronbit'. * Image-manipulating hacks can now load from RSS or Atom feeds: `imageDirectory' may contain a URL. * Updated `webcollage' for recent search engine changes. * `phosphor' and `apple2' can now be run as standalone terminal emulator applications on macOS. * `photopile' sped up. * New molecule in `molecule'. * "Upgraded" to XCode 4.0, which means that macOS 10.4 PPC builds are impossible, and Intel is now required. * Turned on LC_CTYPE on Linux; maybe Japanese password entry works now? 5.14 * Fixed crash in Blank Only Mode when DPMS disabled. * Added "Quick Power-off in Blank Only Mode" option. * BSOD GLaDOS. 5.13 * Optionally enabled full-scene OpenGL antialiasing. Set the resource `*multiSample' to true if doing so doesn't kill performance with your video hardware. * New version of `glhanoi'. * Image-loading hacks that display the file name now also display the sub-directory (xscreensaver-getimage now returns relative paths under imageDirectory). * Passwords that contain UTF-8 non-Latin1 chars are now typeable. * Numerous minor stability fixes. 5.12 * Big speed improvement on macOS for heavy XCopyArea users (`xmatrix', `moire2', `phosphor', etc.) * Plugged a bad macOS-only Pixmap leak. * Kludged around the macOS pty bug that caused text to be truncated in phosphor, starwars, apple2, etc. * New molecule in `molecule'. * `glhanoi' now supports an arbitrary number of poles. * Turned on "New Login" button by default. * Added support for XInput-style alternate input devices. 5.11 * New versions of `photopile', `strange'. * Worked around macOS 10.6 garbage collector bug that caused the screen saver process to become enormous. * Fixed flicker in `pipes', `cubestorm', and `noof'. * Fixed EXIF rotation on macOS 10.6. * Fixed desktop-grabbing when screen locked on macOS. * Minor fixes to `circuit', `polyhedra', `tangram', `gears', `pinion', `substrate', `xanalogtv'. * Fixed some leaks in `xanalogtv' and `apple2'. * Better seeding of the RNG. 5.10 * Fixed some crashes and color problems on macOS 10.6. * Retired `hypercube' and `hyperball', which are redundant with `polytopes'. 5.09 * Ported to macOS 10.6, including various 64-bit fixes. * New hack, `rubikblocks'. * Fixed another potential RANDR crash. * Use correct proxy server on macOS. * `molecule' now correctly displays PDB 3.2 files. * Updates to `mirrorblob', `glhanoi', and `sonar'. * Rewritten version of `klein' hack. * New hack, `surfaces', incorporating objects from old `klein' hack, plus new ones. * Merged `juggle' and `juggler3d' hacks. * Fixed compilation under gcc 4.4.0 (strict aliasing). * Fixed intermittent failure in `xscreensaver-command'. 5.08 * New hack, `photopile'. * Rewrote `sonar' and `jigsaw' as OpenGL programs. * Minor tweaks to `maze', `m6502', `hypnowheel', and `timetunnel'. * Savers that load images now obey EXIF rotation tags. * Arrgh, more RANDR noise! Fixes this time for rotated screens, and for systems where RANDR lies and says the screen size is 0x0. * When the password dialog has timed out or been cancelled, don't pop it right back up a second time. * Password timeouts/cancels don't count as "failed logins". * Retired some of the older, less interesting savers: say goodbye to `bubbles', `critical', `flag', `forest', `glforestfire', `lmorph', `laser', `lightning', `lisa', `lissie', `rotor', `sphere', `spiral', `t3d', `vines', `whirlygig', and `worm'. * Merged `munch' and `mismunch'. * Updated `webcollage' to use twitpic.com as well. 5.07 * Xinerama/RANDR tweaks for old-style multi-screen. * Added bumpy skin and cel shading to `skytentacles'. * `flipflop' can load images onto the tiles. * Fixed the bouncing ball in `stairs'. * Added the missing Utah Teapotahedron to `polyhedra'. * `blitspin' works with color images on macOS now. * Added transparency to `stonerview'. * Improved layout of the preferences dialogs: they should all now be usable even on ridiculously tiny laptop screens. * macOS preferences text fields now prevent you from entering numbers that are out of range. * Added "Reset to Defaults" button on X11. * Added relevant Wikipedia links to many of the screen saver descriptions. * All hacks support the `-fps' option, not just GL ones. * The `-fps' option now shows CPU load. 5.06 * Xinerama/RANDR fixes: this time for sure. It should now work to add/remove monitors or resize screens at any time. * New hack, `skytentacles'. * New version of `gleidescope'. * Added the `-log' option to the xscreensaver daemon, since a truly shocking number of Linux users seem to have no idea how to redirect output to a file. * Added `-duration' arg to most image-loading hacks, so that they pick a new image every few minutes. * Added an ATM crash to `bsod'. 5.05 * New hacks, `cubicgrid', `hypnowheel', and `lcdscrub' (which isn't really a screen saver). * Updates to `m6502' and `gears'. * Fixed double-buffering problems in `cubestorm' and `noof'. * Better handling of horizontal scroll wheels. * Attempt to work around latest Xinerama braindamage: if the server reports overlapping screens, use the largest non-overlapping rectangles available. * Don't warning about receipt of bogus ClientMessages, since Gnome's just never going to stop sending those. * Worked around macOS 10.5 perl bug that caused the text-displaying hacks to fail on some systems. * Hopefully fixed font-related System Preferences crashes in macOS savers. * The recent PAM changes broke the "Caps Lock" warning in the password dialog, the failed login warnings, and syslogging. Fixed all that. 5.04 * Fixed a possible crash in the unlock dialog (more fallout from the recent PAM changes...) * New hacks, `moebiusgears', `abstractile', and `lockward'. * Rewrote `gears' to use better (involute) gear models, and to be more random. * Minor updates to `cwaves', `voronoi', `deco', `glcells', `rd-bomb', `fireworkx' and `webcollage'. * `pong' can now display the current time as the score. * `xmatrix -mode pipe' works better. * Minor tweaks for compilation on macOS 10.5.0. 5.03 * New hacks, `cwaves', `glcells', `m6502', and `voronoi'. * Minor fixes to `bsod'. * Fixed possible crash with PAM USB-dongle auth. * Updated `webcollage' to track recent Google Images and Flickr changes. 5.02 * Reworked PAM code to support fingerprint readers, etc. * Ported `webcollage' to macOS. * Added macOS 10.2 and 10.3 kernel panics to `bsod'. * Fixed a Xinerama crash when changing the screen count. * New blobbier `mirrorblob'. * Minor updates to `lisa', `bsod', `ifs', `hypertorus', `polytopes', `circuit', `endgame', `crackberg', `flipflop', `flipscreen3d', `fliptext', and `carousel'. * Enabled multi-threaded OpenGL on macOS. 5.01 * Backed out recent locale-related changes, since they broke far more things than they fixed. * Fail gracefully with ridiculously small window sizes. * `xflame' and `flag' ignore bitmap option on macOS. * `speedmine' prefs work on macOS. * Better explosions in `boxed'. * More dynamic motion in `sproingies'. * More options in `flipflop'. * Minor updates to `topblock'. * Various other minor fixes. 5.00 * Ported to macOS! (10.4.0 or newer) * API change: instead of providing a single screenhack() function that does not return, screen savers using the screenhack.h framework must now provide "init" and "draw one frame" functions instead. All bundled savers have been updated; third-party patches will need work. * All image-loading happens asynchronously. * xscreensaver-getimage-file caches the contents of the image directory for a few hours, so consecutive runs won't have to re-list the whole directory tree. * New hacks, `topblock' and `glschool'. * Removed `xteevee' (superceded by `xanalogtv'). * Added variable-sized puzzle pieces to `jigsaw'. * Changes to the defaults and command-line options of many hacks to make the .xml files more consistent. * Reap zombies in `glslideshow' and `carousel'. * `sonar' works without setuid on macOS (dgram icmp). * `xmatrix -mode pipe' displays the text of a subprocess. * `endgame' has higher resolution chess-piece models. * `webcollage' takes a -directory option to get images from a local directory. * The RPM spec file no longer auto-restarts xscreensaver when a new version is installed. Restart it manually. 4.24 * New versions of `cube21', `glsnake', `celtic'. * Backed out a DPMS-related patch that cause desktop flickering with some X servers. * Fixed startup crash in getgroups() when running setuid. * Default to not displaying stderr on the saver window. * Fixed bad free() in "Documentation" button. * Don't try to run hacks that aren't installed. * Minor fixes to various XML config files and man pages. 4.23 * New hacks, `glhanoi', `cube21', `timetunnel', `juggler3d', and `celtic'. * New versions of `tangram', `webcollage', `hypertorus', `polytopes', and `ripples'. * `sonar' is now quiet about unresolvable hosts. * Minor corrections to BASIC code in `apple2'. * xscreensaver-demo now provides an RPM clue when none of the hacks seem to be installed. * Don't install `ant' by default, since there is some Java tool of that name, which was causing confusion. And also it's boring. * Made screen grabbing work again on macOS 10.4.2. * No longer prints bogus warnings about ClientMessages intended for the window manager. * Ignore unprintable characters in passwd entry field. * Fixed yet another cross-host-display image-loading endian problem. * `xscreensaver-command -watch' and `-time' now work on 64-bit machines. 4.22 * Fixed a bug in the new mouse-motion code that caused the screen to never blank on multi-head non-Xinerama systems. Oops. * New hacks, `interaggregate', `antmaze', `tangram', and `crackberg'. * Minor tweaks to `fiberlamp', `ifs', `slidescreen', `zoom', `sonar', `fireworkx', `whirlwindwarp', `bubble3d', and `rd-bomb'. * Added motion blur to `blinkbox'. * `bsod' now includes Longhorn's "RSOD", and OS/2. * Fixed `-wireframe' usage in most hacks and man pages. 4.21 * New hack: `fliptext'. * Changed default configure installation directories: /usr/bin/ for xscreensaver, etc.; /usr/libexec/xscreensaver/ for hacks; /usr/share/xscreensaver/config/ for xml files. * All the text-manipulating screen savers can have their text source configured via `xscreensaver-demo' now. * xscreensaver.spec now builds three RPMs: base (no hacks); extras (2d hacks); and gl-extras. * Added `-program' and `-front' option to `gltext'. * Added `-shells' to `molecule'. * Fixed text-alpha glitch in `carousel'. * New `pacman': the ghosts can be killed now. * Fixed a bug in screen-grabbing GL hacks where images would be tiled instead of scaled on machines that can't do large textures. * `webcollage' can hit Flickr now. * New (rewritten) implementation of `ifs'. * The unlock dialog can be made to have a "New Login" button that will 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 disabled" mode. * If a bad password is typed while CapsLock is on, the unlock dialog says "CapsLock?" instead of "Sorry". * Mouse motion only counts as activity if the mouse moved more than 10 pixels (so the screen won't unblank every time you bump your desk.) * New mode option "random-same": if you have multiple monitors, this will run the *same* randomly chosen hack on each screen, instead of different ones on each. 4.20 * New hacks, `fiberlamp', `boing', `boxfit', and `carousel'. * Rewrote `glslideshow' again: should be faster now. * Sped up loading of images in GL programs. * `starwars' uses texture-mapped fonts now. * New `bsod' modes: tru64, hppa, and nvidia. * Updates to `webcollage', `juggle', `pinion', `fireworkx', `sonar', `extrusion', `substrate', and `pong'. 4.19 * New hacks, `substrate', `intermomentary', `fireworkx', and `pinion'. * New version of `flow'. * Made /proc/interrupts work again on Linux 2.6. * Made `analogtv' not hog the CPU. * Made analogtv-based hacks work properly on PPC/ARM. * Fixed a bad memory leak in `piecewise'. * Minor updates to `sonar', `molecule', `glmatrix', `galaxy', and `webcollage'. * Removed support for GTK 1.x (everyone uses 2.x now.) 4.18 * Oops, pay no attention to the man behind the curtain. 4.17 * New hacks, `anemotaxis' and `memscroller'. * Fixed a bad bug that caused `vidwhacker' to never die. * Fixed normals and lighting in `polyhedra'. * Don't reuse the window when changing hacks (to work around bugs in some GL implementations.) * Made `xscreensaver-getimage-file' skip thumbnail-sized images. * Fixed endian problem in `barcode' on non-x86. * Updates to `webcollage', `apple2', `fuzzyflakes', `atunnel', and `pacman'. * Timing tweaks to `bubble3d', `bouncingcow', `engine', `gltext', `lavalite', `molecule', `spotlight', `sballs', `boxed', `blinkbox', and `circuit'. * Configure updates for Fedora core 2 / xorg 6.7.0. * Compile without warnings under gcc 3.3.3. * I give up: don't blank or lock the screen if we can't get a keyboard grab. In that case, both choices are bad. 4.16 * New hacks, `polyhedra', `fuzzyflakes', `antinspect', and `providence'. * Minor updates to `webcollage', `bsod', `endgame', `antspotlight', `xmatrix', and `glmatrix'. * Added support for the RANDR (Resize and Rotate) extension to detect when the size of the desktop has been changed while xscreensaver is already running. * Possibly-futile attempt to work around "rdesktop" focus/grab idiocy. * Made `xscreensaver-getimage -file' still work even if imageDirectory is unset. * Convert Latin1 to ASCII in `starwars' and `phosphor' (since the GLUT font only has ASCII glyphs.) * Fixed randomization in `noof'. * Added "GetViewPortIsFullOfLies" preference to work around longstanding XFree86 bug #421. * Made `sonar' subnet pinging work properly on bigendian machines (e.g., PPC.) 4.15 * New hacks, `wormhole', `mismunch', `noof', and `pacman'. * `phosphor' and `apple2' include vt100 emulators now: this means you can do "phosphor -program top", or can use either program as an xterm replacement: "apple2 -text -fast -program 'xemacs -nw'". * `analogtv' (and related) fill the screen better. * The '-gradient' option works in `atlantis' now. * Minor updates to `blinkbox', `queens', `endgame', `glmatrix', `mirrorblob', `blocktube', and `molecule'. * Integrated SuSE's "external passwd helper" support. * Marginally better /tmp handling in various programs. * Updated config defaults for xplanet 1.0.3. * Portability fixes. 4.14 * New hacks, `fontglide', `apple2', `xanalogtv', `pong', `gleidescope', `mirrorblob', and `blinkbox'. * New version of `glsnake' (with many more models.) * Another Windows crash in `bsod'; also HVX/GCOS6/TPS6. * New version of `endgame'. * Screen grabbing works on macOS. * Various minor fixes. 4.13 * On Xinerama systems, xscreensaver now runs one hack on each monitor (just like in "real" multi-head mode) instead of running one hack stretching across all the screens. Note that for this to work with any 3rd party screensavers, they must update their "vroot.h" file. * `webcollage' and `vidwhacker' display images using `xscreensaver-getimage' now. * Added `ljlatest' script for use with `starwars' and `phosphor'. 4.12 * New GL hacks, `flipflop', `antspotlight', and `polytopes'. * Added VMS to `bsod'. * Compile without warnings in "gcc -pedantic". * Updates to `webcollage' and `queens'. * Fixed a bug that could cause PAM to hang. 4.11 * New hacks, `hypertorus', `cubestorm', `glknots', `blocktube', and `glmatrix'. * Updates to `cloudlife', `engine', `xmatrix', and `sonar'. * Rewrote `glslideshow': it should work on somewhat wimpier video cards now. * Various portability tweaks. 4.10 * New hacks, `cloudlife' and `klein'. * Added Apple ][+, HPUX, and OS/390 sessions to `bsod'. * Added some Matrix Reloaded text to `xmatrix'. * Updates to `webcollage', `eruption', `jigglypuff', `metaballs', and `endgame'. * Completely ignore the `memoryLimit' setting now, since it was still causing people GL grief. * Various minor fixes. 4.09 * New hacks, `flyingtoasters', `bouncingcow', `jigglypuff', and `glslideshow'. * More models in `engine'. * Rewrote `xscreensaver-getimage' to remove reliance on external image loaders (xv, chbg, xloadimage, etc.) and to reduce flicker when loading files. * Made `gflux' and `flipscreen3d' be mouse-spinnable. 4.08 * New hacks, `atunnels' and `piecewise'. * Physics improvement in `fluidballs'. * Various fixes for XDarwin systems (X11 on macOS.) * Added -clock option to `barcode'. * Minor fixes to `endgame', `flurry', `flipscreen3d', and `gflux'. 4.07 * New hacks, `flurry', `metaballs', `eruption', `popsquares', and `barcode'. * Minor updates to `maze' for high density mazes. * Added double buffering to `fluidballs' and `whirlygig'. * Bug fixes for running xscreensaver to a remote XFree86 display (which nobody would ever do...) * Updated `webcollage' (faster Alta Vista searching.) * Updated `glplanet' so the sun sets in the west. * Updated `sproingies' with smooth, unsegmented surfaces. * Fixed Perl version-sensitivity in `xscreensaver-getimage-file'. * Fixed GTK2 scrolling bug in `xscreensaver-demo'. 4.06 * New hack, `glblur' (disabled by default, since it requires fast OpenGL texture support.) * New hack, `halftone'. * Updates to `endgame', `queens', `bumps', `glplanet', `engine', and `circuit'. * New version of `menger' that uses far fewer polygons. * Fixed minor bug in `critical' that could cause some bogus X servers to crash. * Better labels in `molecule': the labels now appear to be attached to the atoms, instead of floating in front of the whole scene. * Fixed bug that could rarely cause GL hacks to fail to double-buffer (causing intermittent flickering.) * Fixed a relative-URL-parsing bug in `webcollage'. * Fixed a bug that (sometimes) caused the window manager close box to kill `xscreensaver-demo' with a crash instead of a graceful exit. * Updated xscreensaver.pam to the Red Hat 7.3 way. * More Gnome2-related configure crap. * Updated to latest `config.guess' and `config.sub'. * Fixed occasional core dump in `distort'. * Added a Linux fsck failure and kernel panic to `bsod'. * Added macOS kernel panic to `bsod'. * Fixed a bug in `bsod' (all bsod bugs are ironic.) * Fixed a bug that caused `xscreensaver-gl-helper' to print a nonsense visual ID with some versions of `printf': this could cause GL programs to display incorrectly (e.g., flickery.) 4.05 * More `configure' tweaks to try and get things working on systems that both Gtk 1.x and 2.x installed. * New hack, `endgame'. * Minor updates to `gltext'. 4.04 * Support for GTK 2.x / GNOME 2.x. * The `configure' script will now use `pkg-config' if you have it, in preference to `gtk-config', etc. * New hacks, `lavalite', `queens', and `anemone'. * Minor updates to `spheremonics', `gltext', `xmatrix'. * You can use the mouse to manually spin most of the GL hacks now (when they are displaying in a window.) * 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 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. * `webcollage' can now be used in conjunction with `driftnet' to display images snooped from your local ethernet instead of obtained from search engines. * Added man pages for all the hacks that didn't have them. 4.03 * New hack, `spheremonics'. * Minor updates to `webcollage', `cage', `moebius', `morph3d', `boxed', `circuit', and `helix'. * `pulsar' and `extrusion' can now load texture JPEGs. * `rubik' now does non-square cubes. * `fluidballs' now does various sizes of balls. * `menger' and `sierpinski3d' now also show polygon counts in -fps mode. * `molecule' displays real subscripts in the formulae. * GTK internationalization/localization support. * Better detection of the various versions of libxml. * Upgraded to autoconf 2.53 (from 2.13.) 4.02 * Plugged a few minor leaks in `xscreensaver' and `xscreensaver-demo'. * New hacks, `cubenetic' and `fluidballs'. * Sped up `pipes'. * Fixed sphere projection error in `glplanet'; installed a better image of earth. * Added Win2K and MacOS 1 crashes to `bsod'. * Put back previous (better) version of `forest' that was accidentially downgraded in the last release. * New version of `bumps'. * Made FPS computation in GL hacks more efficient: it will influence the results less, thus resulting in higher (but more accurate) reported frame rates. 4.01 * New hacks: `twang', `glsnake', `boxed', `sballs', and `glforestfire'. * New hacks `apollonian', `euler2d', `juggle', `polyominoes' and `thornbird', from xlockmore. * Merged recent xlockmore changes into `ant', `braid', `demon', `discrete', `drift', `fadeplot', `forest', `grav', `hopalong', `ifs', `laser', `lightning', `lisa', `lissie', `loop', `mountain', `penrose', `rotor', `sierpinski', `slip', `sphere', `spiral', `strange', and `vines'. * Fixed the `gltext' bug that sometimes caused horizontal lines to vanish again. This time for sure. * Sped up `webcollage' by adding a C helper program to replace the PPM pipeline. It also pastes images semi-transparently now. * Added support for the gdk_pixbuf library: if this lib is available, then `blitspin', `xflame', and `flag' can load GIF, JPEG, and PNG images in addition to XPM and XBM. * Fixed a rare race condition where the desktop-grabbing hacks could sometimes leave the screen wedged, if the user moved the mouse exactly when they were grabbing the screen image (it would un-wedge the next time the saver timed out or was activated.) * Fixed incorrect colors in the screen-grabbing GL hacks (`gflux' and `flipscreen3d'.) * Made SIGHUP restart the daemon process (though using `xscreensaver-command -restart' is still the preferred way.) * Tweaks to `xspirograph'. * Minor configure and portability tweaks. 4.00 * Redesigned `xscreensaver-demo' GUI: it now includes small-preview and per-hack configuration dialogs. * Added three new modes of operation: `One Screen Saver', `Blank Screen', and `Don't Blank' (in addition to the historical `Random Screen Saver'). * Configure now defaults to installing the hacks in /lib/xscreensaver/ instead of /bin/. (Most distros already did it this way.) * New GL hacks, `menger', `engine', `flipscreen3d'. * Made `sierpinski3d' be more colorful. * New versions of `xmatrix' and `nerverot'. * Fixed a bug in `starwars' that made the font be drawn with thin lines in -root mode. * Fixed a bad colormap bug in `crystal' that could make *subsequent* hacks malfunction! * Made `gflux' able to grab screen images (`-mode grab'). * Updated `webcollage' for recent search engine changes. * Removed most command-line options to `xscreensaver': just edit the ~/.xscreensaver file instead. * Improved behavior on multi-screen and Xinerama systems: the mouse now stays on the screen where the user left it, and the password and splash dialogs always appear on the screen that has the mouse. * Made the splash dialog use more Gtk-like colors; made it have only two buttons, "Settings" and "Help". * Made `sonar' understand `.ssh/known_hosts2' format files, and be better about stripping out illegal addresses. 3.34 * Turned `memoryLimit' off by default, sigh. Apparently some versions of the GL libraries (appear to) allocate hundreds of megs for every GL program, so `memoryLimit' was causing GL programs to malfunction or crash on those systems. * Improved fading on TrueColor XFree86 4.1.x systems. * New GL hack, `circuit'. * Added `fuzz' mode to `decayscreen'. * New version of `whirlygig'. * Added links to `xplanet' and `sphereEversion'. * Fixed rare race condition that could make `sonar' hang. * Fixed potential crash in `speedmine'. * Made `xscreensaver-demo' not crash when imageDirectory was set to a non-existent directory. * Made `xscreensaver-getimage-video' invoke XawTV's `streamer' program better. * Made `phosphor' and `starwars' deal with CR, LF, or CRLF line endings. * Changes for Cygwin compilation environments. * Made `sonar' compile on systems that can't ping. * Configure changes for HPUX 10.20. * Made PAM code work on Red Had 4.2 systems. * Made `xscreensaver-command -deactivate' work when the saver is not active: what that does is reset the idle timer, as if keyboard input had been detected. This was added for the benefit of people writing DVD-playing software: they can now prevent the screensaver from kicking in by sending a -deactivate message once a minute while the movie is playing and not paused. * Various minor portability tweaks. 3.33 * New hacks, `speedmine' and `whirlygig'. * Sped up `pyro', made the explosions look a bit better. * Added better stars to `glplanet' and `starwars'. * Many internal changes to `webcollage'. * Some new options to `attraction'. * Minor fix to `noseguy' to avoid un-erased pixels. * Rewrote the screen-eraser effects so that they complete in the same amount of time regardless of how slow your X server is (some of them were glacial on servers with slow blitting.) * Fixed a potential free memory reference that could sometimes cause a crash at startup. * Possibly fixed a problem that could cause the daemon to crash with an X error. I was never able to reproduce this problem, but I think I might have figured out what caused it. * Worked around a problem that caused PAM authentication to fail on some Red Hat 7.x systems. * Added a `memoryLimit' parameter that controls the amount of memory a graphics hack may allocate: if they try to allocate more than this, malloc() will fail (and they will exit or (safely) crash, rather than hogging memory.) Default is 50M. * Made `gnome-help-browser' be the default way to display man pages in `xscreensaver-demo', if running on a GNOME system. 3.32 * The image-manipulating hacks (`slidescreen', etc.) can now operate on randomly chosen image files from disk, or on frames captured from the system's video input, instead of (or in addition to) manipulating images of the desktop. * Rewrote `vidwhacker' to use the new image-grabbing mechanism. * Made fading work on TrueColor XFree86 4.x systems. * Fixed a subtle rendering bug in `atlantis' (the fish were inside out!) * Made `atlantis' have a texture simulating light reflections from the surface of the ocean. * Fixed up label placement in `molecule'. * Better color bars in `xteevee'. * Made `install-strip' not try to strip scripts. 3.31 * Put in more sensible defaults for DPMS, and updated the documentation to reflect the fact that all your DPMS settings are now belong to xscreensaver. * Fixed the `xscreensaver.spec' file so that `--force' is no longer needed. * New versions of `rotzoomer' and `nerverot'. * Fixed an OSF/1 compilation problem in `molecule'. 3.30 * New hacks, `molecule', `dangerball', and `rotzoomer'. * New version of `gflux'. * Made `gltext' able to display the current time. * Fixed a floating-point-precision problem in `gltext' that sometimes caused horizontal lines to vanish. * Removed the `-window-id' option from the hacks: it never worked right, and was unnecessary. * Made the `starwars' hack use thicker lines, antialias the text, and fade out at the far edge instead of just dropping off. * Fixed an SHM segment leak in `moire'. 3.29 * Better rendering of the new logo. * New hack, `gltext'. * Added `-planetary' option to `gears', to draw a different kind of gear system. * Made motion and rotation be smoother in `gears', `glplanet', `moebius', `rubik', and `sierpinski3d'. * Improved coloration in `sierpinski3d'. * Made the GL hacks react to window size changes. * Made most of the GL hacks take a -fps option (like `pulsar' did), so you can use them to benchmark your 3D hardware. * Fixed the previous fix to `sonar'. * Minor fix to `nerverot'. Made sonar able to ping hosts on DEC OSF1. * Eliminated a bogus "didn't get enough colors" warning in some of the hacks. 3.28 * New logo for xscreensaver! * New hacks, `starwars' and `stonerview'. * Made the motion of the bouncing ball in `stairs' be a little less jerky. * Made newly-added screenhacks be added to .xscreensaver automatically: if there are hacks in the app-defaults file that are not also in ~/.xscreensaver, they will be added to the end of the list. * Redid the `Screensaver Options' part of the control panel; xscreensaver now lets you configure your DPMS settings. * Fixed some Makefile problems with non-GL builds. * Fixed detection of MesaGL for version 3.3. * Better workaround to Red Hat 7.0's broken gcc. * Added Sparc Solaris kernel panic to `bsod'. 3.27 * New hacks: `zoom' and `whirlwindwarp'. * Fixed a free-memory-reference bug in `sonar'. * Better error handling when there are no suitable GL visuals. * Added diagnostic dialog when xscreensaver-demo is unable to launch xscreensaver (e.g., when running as root.) * Fixed a bug that caused screenhack argument changes to be ignored when xscreensaver-demo was running as root (if "root" and "nobody" have different home directories.) * Made the programs default to ":0" if $DISPLAY is unset. * Made the `-verbose' output include information about which server extensions were supported at compile time. * Worked around Red Hat 7.0's broken gcc 2.96. * Updated default delays on the GL hacks to look better on machines with super-fast 3D hardware. * Install `screensaver-properties-capplet' to work around the usual egregious GNOME lossage. 3.26 * Added "enabled" checkboxes in the list of hacks in xscreensaver-demo (Gtk version only.) * New hacks `hyperball', `xrayswarm', and `gflux'. * New versions of `nerverot', `galaxy', and `hypercube'. * Small fixes to `phosphor', `shadebobs', `xflame', and `sonar'. * Added external helper program `xscreensaver-gl-helper' to figure out which X visual to use for OpenGL programs. * Configure updates for XFree86 4.0, and for BSD. * Made it be more tolerant of bogus /etc/group files. * When installing the PAM config file, first try to just copy an existing "xdm" or "login" config file, so that xscreensaver does authentication in the same way as the rest of the system. 3.25 * New hack, `nerverot'. * Added BSD kernel panic to `bsod'. * New version of `shadebobs'. * New version of `petri'. * Updated `webcollage' to handle recent Altavista URL format changes; made it search the AP photo gallery. * Revamped command-line options of `sonar' and made it properly handle subnets. * The `bubbles' hack can now trickle up or down the screen. * The `xsublim' hack can now read its text from programs. * Support for GLE version 3 in `extrusion'. * Fixed compilation problems in `maze'. * Fixed a rare crash in `flow'. * Fixes for minor installation problems. 3.24 * Added `-ignorant' option to `maze' hack. * Updates to `critical', `bsod', `xflame', and `flow'. * Added support for Kerberos 5 (via its Kerberos 4 compatibility layer.) * Fixed a bad leak in `xteevee'. * Updated `webcollage' to handle recent Altavista URL format changes. * Removed xscreensaver-demo's `Ok' and `Cancel' buttons, since they were confusing people: all changes are now instantanious. * Made xscreensaver-demo install itself into the Gnome Control Center. 3.23 * Fixed some misplaced text fields in the Motif version of xscreensaver-demo; fixed a crash in the Gtk version that would happen if the programs list was empty. * Fixed a recently-introduced bug in `pulsar'. * Made `sierpinski3d' use solid tetrahedrons instead of points. * Added `-trace' option to `xmatrix'. * Added new hacks `xteevee' and `xspirograph'. 3.22 * Fixed some bugs in xscreensaver-demo. * Rewrote the Motif version of xscreensaver-demo to match the new Gtk version. * The Athena toolkit is no longer supported. 3.21 * Tweaked the xscreensaver-demo UI (Gtk only.) * Fixed a few visual selection bugs. I think the proper GL visual should be used with nVidia systems now. * Made the Makefiles obey $install_prefix. * Made the `xscreensaver.spec' file able to generate both GL and non-GL packages simultaneously. 3.20 * Added new hacks `ripples' and `sierpinski3d'. * Made `xscreensaver-command -exit' be silent when no screen saver was running (instead of complaining.) * Made `webcollage' and `vidwhacker' use `xloadimage' when available (in addition to `xli' and `xv'.) * Improved memory usage in `petri' and gave it a hard cap on how much memory it can allocate. * Added `-watch' option to `xscreensaver-command'. * Made `xscreensaver-demo' come up with the most-recently-run hack selected by default. * Rewrote the Gtk version of `xscreensaver-demo'. It's a lot easier to use now. * Extended the format of the programs list in the .xscreensaver file, for the benefit of the new capabilities of `xscreensaver-demo'. NOTE: you might want to delete your ~/.xscreensaver file and allow it to be re-created! The old one should still work, but xscreensaver-demo won't be as pretty. 3.19 * Fixed gcc dependencies in `bumps' and `ccurve'. * New hack, `extrusion'. * Some of the web sites that `webcollage' was using as its sources changed formats; tweaked it to understand the current layouts. * Added typeahead in the password dialog: if the screen is locked, and you unlock it by typing a character, that key will be automatically inserted in the password dialog (unless it is Return, Enter, Space, or a non-printing key like Shift.) * Made `xmatrix' take a `-small' option, since some folks with tiny screens prefer a smaller font. 3.18 * New versions of `shadebobs', `lmorph', and `distort'. * Added `ccurve', `blaster', and `bumps' hacks. * Replaced `forest' hack with a rewritten version. * Worked around a Xinerama server bug. * Fixed a bug I introduced in 3.10 that caused some hacks to print out superfluous warnings about not having gotten enough colors. * Made `sproingies' obey the `-delay' option. * Fixed a portability bug in `shadebobs'. * Made `webcollage' and `vidwhacker' use `xli' in preference to `xv', if it is available. * Added a new source of images to `webcollage'. * If running under KDE, xscreensaver will add itself to KDE's list of screensavers (via xscreensaver.kss.) * Improved detection of GL libraries. * Made the password dialog include the date and time. 3.17 * New version of `webcollage' -- deals better with corrupted images, and can use an http proxy. * New hack, `xsublim' (run it in the background, rather than adding it to the programs list.) * The xscreensaver daemon was leaking a file descriptor each time you edited your .xscreensaver file. Fixed. 3.16 * New version of `shadebobs'. * Improved image selection in `webcollage', and sped it up slightly. * Made configure find the right version of perl. * Rewrote the CGI part of `webcollage'. * `make clean' was deleting some things it shouldn't. * Fixed a typo in the default programs list. 3.15 * Added `webcollage' and `shadebobs' hacks. * Added a `-stdout' arg to `vidwhacker' so that it can be used in a pipeline. * Made `petri' use less memory. 3.14 * Various improvements to the Gtk port. * Turned off PAM by default on Solaris, since PAM seems generally to be misconfigured out-of-the-box. * Made the `--without-gtk' configure option work. * Made configure check the Gtk version number, since it requires 1.2. * Fixed a bug in the code that attempted to prevent changes of screen resolution while the screen is locked. * Fixed a race condition in `xscreensaver-demo' that could cause an X error at startup. * Added `-transparent' option to `deluxe'. * Added `petri' hack. 3.13 * Ported `xscreensaver-demo' to Gtk. * Made it possible to build Motif, Gtk, and Athena versions of `xscreensaver-demo' in the same directory without reconfiguring. * Made `xscreensaver-demo' chase symlinks before writing the .xscreensaver file, so that if .xscreensaver is itself a symlink, the underlying file will be replaced instead. * Some Makefile and configure tweaks for Solaris and FreeBSD. * Made it possible to set the fire color in `xflame'. * Made transparency work in TrueColor (for `goop' and `qix'.) * Fixed a multi-head bug introduced by the virtual viewports stuff. 3.12 * Made it so that you can't scroll the screen while the lock dialog is up (with XFree86 virtual viewports.) * Fixed a bug in `flag' that caused bob's chin to get cut off after a few iterations. 3.11 * Made `xjack' be black-on-white-ish, so that it looks less like a computer screen and more like the typewritten paper it's supposed to be. * New version of `pulsar'. * Fixed Solaris compilation problem in `phosphor'. * Made xscreensaver notice XFree86's virtual root window hack, so that if the X server's root window is larger than the monitor's displayable resolution, the screen saver will limit itself to the area that actually appears on the screen. * Made the xscreensaver daemon do a better job of picking the visual class that should be used for GL programs. Less user intervention should be needed now: you can use the logical visual name `GL' instead of having to figure out by hand which one to use. * Oops, the visual was defaulting to "best" instead of "default", because the .xscreensaver file was not being loaded quite early enough. * Made configure figure out how to build icmp ping support into the `sonar' hack automatically. * Made warnings about not being able to read shadow passwords not be printed if compiled with PAM support. * Improved PAM startup diagnostics. * Worked around the Solaris PAM bug that was causing crashes there, so now PAM is turned on by default. * Made configure detect the number of arguments that pam_strerror() takes, since on Linux, this apparently changed between 2.0 and 2.2, sigh. * Made the /proc/interrupts kludge look for "PS/2 Mouse" as well as "keyboard". * 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.'') * Added `-throttle' option to `xscreensaver-command'. 3.10 * Added `phosphor', `xmatrix', and `pulsar' hacks. * Fixed a bug in the color allocator that sometimes caused `starfish' to fall back to monochrome. * Reduced the amount of code that runs before root privileges are disavowed: "normal" and "shadow" passwords now do some initialization as root, but the PAM and Kerberos authorization schemes will be initialized while running as "nobody". Supposedly this closes a potential security hole when using Kerberos. * Added some more sanity checking to configure. 3.09 * Added `compass', `squiral', `xflame', `wander', `spotlight', and `critical' hacks. * Added some new modes to `decayscreen'. * Made `deluxe' work in monochrome. * Generalized usage of the Double-Buffer server extension in several hacks (`compass', `deluxe', `interference', `kumppa', and `moire2'.) * Fixed another visual-depth problem in `rd-bomb'. * The screen saver will now defer blanking if neither the keyboard nor the mouse could be grabbed. Instead, it will just try again in a few minutes. This fixes a bad interaction between xscreensaver and programs like VMware that hold the mouse and keyboard grabbed for a long time. * Added a new erase mode (expanding spiral.) 3.08 * Fixed some bugs in my port of `t3d'. * Added `penetrate' and `deluxe' hacks. * When linking against Motif 2.x, also link against XPM. * Added support for using /proc/interrupts for idle detection on Linux. Now xscreensaver shouldn't kick in when the user is active on a non-X virtual console. * Upgraded to autoconf 2.13. 3.07 * Configure tweaks (sometimes -lXmu wasn't getting linked in properly; check for _Xsetlocale in -lXintl.) * Portability fixes for sonar.c. * Fixed a compilation problem when you have GL but don't have XPM. * Made configure notice when MesaGL requires -lpthread. * Made `flame' ignore SIGFPE (not sure if this is the right fix; it seems only to be needed on FreeBSD.) * Kludged `rd-bomb' work on visuals that are of depth 24 but that *do not* support pixmaps of depth 32. * Fixed `halo' to work properly in TrueColor. * Changed `xscreensaver.spec' to install the hacks in /usr/X11R6/lib/xscreensaver/ by default, since that's where recent Red Hat distributions put them. * Added `t3d' hack. * Updated versions of `crystal', `hopalong', and `flow' from xlockmore. * Imported `demon' and `loop' modes from xlockmore. 3.06 * Oops, the "default-n" visual descriptor was broken; it was always installing a colormap if the `installColormap' preference was set, meaning that `xearth', `xv' and friends were using the wrong colors on 8-bit systems. * Turned off HAVE_PING in `sonar', since it compiles on some Linux systems, but not others of similar vintage... 3.05 * Fixed an off-by-1 in `distort'. * Added `sonar' hack. * New version of `glplanet' (with stars.) * Made all hacks exit when you type `q' or `ESC' at them, and made them obey the WM_DELETE_WINDOW ClientMessage. * Fixed a nonfatal buffer overrun in lament (note: lament still doesn't work with MesaGL 3.0: it dies in lambda_textured_triangle1(), which is Mesa's bug, not mine.) 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 a password more than 8 characters long anyway. FTSOHPUX. 3.03 * Made locking work when passwd aging is enabled. * Added support for PAM (Pluggable Authentication Modules.) It is still turned off by default, though, since it doesn't seem to work on Solaris 2.6, and has been behaving erratically on Red Hat 5.1. * Made each possible authentication method be tried in turn until one succeeds; this means that Kerberos is being used, we will first check Kerberos, and if that fails, will then consult the local password file. Likewise with PAM. * Save and restore the bits under the passwd dialog, to avoid leaving a black rectangle behind when unlocking is cancelled. 3.02 * Not everyone has sys/select.h, sigh... 3.01 * Some fixes to `reflect'. * Configure tweaks. * Made it log unsuccessful attempts to unlock the screen to syslog. * Fixed a bug where `xscreensaver-demo' could be seeing a different programs list than `xscreensaver' did. 3.00 * The xscreensaver daemon no longer links against Motif or Athena: demo-mode and the preferences panel are no longer built in to the daemon, but are now handled by an external program, `xscreensaver-demo'. (I decided that this, along with the recent addition of the `.xscreensaver' config file, justified bumping the version number to 3.00, since this is a fairly major architectural change.) * Lines in the `*programs' resource may now begin with the character "-", meaning "don't run this hack." In this way, it's possible to disable a hack without throwing away the information about it (making it easier to change your mind later.) Eventually the preferences/demo mode GUI should represent this as a checkbox or something. * Fixed a short race condition where it was possible for xscreensaver to die with a BadWindow error if it was blanking the screen just as another window was being deleted. * Made it possible to disable specific modes in `bsod'. 2.34 * Fixed a bug that was making `pipes' generate way too many valves. Made the viewpoint in `pipes' be selected randomly instead of always being -10 degrees. * Fixed a bug in the XSHM code, in the case where the server supports the XSHM extension but is not the same machine as the client. * Made `rd-bomb' default to taking up the whole screen. * Made it not try to do fading/unfading if no PseudoColor visuals exist. * Initial attempt at supporting VT-locking (doesn't work yet.) * Eliminated the `captureStdout' resource; now `captureStderr' controls both streams. * Added `-capture-stderr' and `-no-capture-stderr' command-line arguments. * Added `glplanet' hack. * When a hack is selected with `xscreensaver-command -select', that hack will be used until further notice (until the saver turns off, or another activation command is issued.) 2.33 * Made `xscreensaver-command' print error messages: the xscreensaver daemon now responds to ClientMessage events by writing a response message on a window property, instead of just writing to its stderr. * Made the ~/.xscreensaver file be automatically reloaded when the file date changes. * The password dialog and splash screen no longer depend on Motif or Athena. This should clear up a number of focus problems, and is the first step on the path toward moving all of the Motif/Athena/whatever code out of the xscreensaver daemon, and into external processes. * Don't complain about LessTif 0.86 any more, since the new password dialog makes that problem go away. * Configure tweaks for Irix 6.5, SunOS 5.something. * New `-reflect' option to `distort'. 2.32 * Added reading and writing of a ~/.xscreensaver file, so that the Preferences panel can save its settings. * New version of `rubik'. * Added `-select N' argument to `xscreensaver-command'. * Oops, left out some of the `bubbles3d' files... 2.31 * The cursor was invisible in the password dialog. Fixed. * Made configure warn against MesaGL 2.6. * Fixed X error at startup when using non-default visual. * New version of `crystal', `ant', and `atlantis' from xlockmore. * New hack, `bubble3d'. * Added some new modes to `bsod'. 2.30 * Changed the order in which -lSM and -lICE are linked to be after Motif instead of before (Lesstif on Irix needs this.) 2.29 * Work around a bash bug in configure. * Tweaked HPUX paths again. FTSOHPUX. * Made configure recommend against LessTif 0.86, due to a bug in that version that causes a security hole in the screen locking code. LessTif 0.87 will fix it. * Made all of the `--with' options to `configure' accept a directory option as well (so that --with-motif=/FOO will add -I/FOO/include -L/FOO/lib). I believe this is the Configure Party Line of how do to such things. * Fixed a bug where the mouse was left un-grabbed after the first time the graphics hack was changed (simplified all of the mouse-grabbing logic.) * Maybe possibly perhaps made `vidwhacker' really not leave stray xv windows around. This time for sure. * Added a new erase mode (random dots fizzling out.) * Added `-prefs' argument to `xscreensaver-command', that brings up the Preferences dialog directly (it seems that nobody ever noticed the `Preferences' button on the Demo Mode dialog, maybe this will help.) * Added a splash screen. Turn it off with *splash:false. 2.28 * Better macsbug text in `bsod'. * New version of `distort' with many new modes. * Plugged a leak in `coral'. * Tweaked configure for HPUX. * Removed some compiler warnings. * More consistent usage of stderr versus stdout. * More diagnostics should an X error occur. * Fixed a possible crash in SGI-specific unfading code. 2.27 * Improved version of `distort'. * Made `lament' compile against OpenGL 1.0 (though it still requires 1.1 to work properly.) * Updated my email address and home page. 2.25 * Improved motion in `rd-bomb'. * Added XSHM (shared memory extension) support to the `distort', `interference', `moire', `rd-bomb', and `swirl' hacks, which speeds them up a bit. * Added `lament' hack. 2.24 * Tweaked the order of the -L options again. * Cleaned up configure's `--help' message. * Added `kumppa' hack. * Smarter maze-solving algorithm in `maze'. * Took `xlyap' out of the default list of hacks, since it's just incredibly buggy (and slow.) Maybe someday someone will fix it... * Added `distort' hack, but didn't add it to the default list (yet) because it's still too slow. * Made the Athena demo dialog look more like the Motif version; it has a text-entry field now, too. * Made the Athena password dialog echo asterisks, like Motif does, instead of using a flyspeck font. * Some random configure tweaks. * 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 user's "*background" resource show through. Fixed it in a different way. 2.22 * Added support for the DPMS server extension (Display Power Management System.) * Made configure advertize the `--enable-subdir' option a little more, since that seemed to cause some people stress. Also, made that directory be built into the xscreensaver executable, as a hardcoded prefix to $PATH. (Might help, shouldn't hurt.) * Made configure prefer the two-arg gettimeofday to the one-arg version, since AIX doesn't have any prototypes. * Made it work with Xaw3d (the 3D Athena library.) * Made `make install' create directories as necessary. * New version of lmorph from Sverre. * Added `crystal' and `discreet' hacks from xlockmore. * Added a new mode to `bsod'. 2.21 * Made `xscreensaver-command -time' use different words. (It now describes the two states as "screen blanked since..." and "screen non-blanked since..." instead of "active since..." and "inactive since..." which a lot of people interpreted as meaning the opposite of what was intended.) * Improved some error messages, in the hopes of making the distinction between the xscreensaver and xscreensaver-command programs more obvious. * Rewrote (and reorganized) parts of the xscreensaver and xscreensaver-command manual pages. * Renamed xscreensaver's `-lock' command-line option to be `-lock-mode', to avoid confusion with the `-lock' option to 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 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...) 2.20 * Fixed a bug that caused the mouse to sometimes not be grabbed properly (meaning the window manager menu could pop up over the demo-mode display.) * Fixed a bug that made the stderr output sometimes get printed twice. * Fixed a bug that made the demo-mode scrollbar move too fast. * Protected against a possible buffer overflow. * Made `vidwhacker' not leave stray xv windows around. * New version of `ant' so that Bagley doesn't calve. * Make configure on AIX get XShm from the right library. 2.19 * One file was missing from the tar file. 2.18 * Oops, atlantis wasn't being built by default. * Added `epicycle' hack. * Added `interference' hack. * Added `truchet' hack. * Added `bsod' hack. * Added some new modes to `vidwhacker'. 2.17 * Added a -window-id argument to most hacks, so that they can draw on arbitrary externally-provided windows. * Synched with xlockmore 4.11a01. * Added `flow' hack. * Added `atlantis' GL hack. * Renamed `puzzle' hack to `jigsaw', since xlock already had a different mode called `puzzle'. * Made it self-configure properly when Motif 2.1.0 is being used (requires -lXp now, sigh...) 2.16 * Made `flag' able to do XPM images. * New look for the xscreensaver logo (`xroger'). * Fixed compilation error on Suns with adjunct passwords. * Got multi-architecture builds working again. * Some configure tweaks for building on HPUX and Solaris. * Fixed bug in decayscreen. * Fixed typo in passwd.c. * Made `cynosure' not die when colormap is full. 2.15 * Added `cynosure' hack. * Added `moire2' hack. * Tweaked `erase.c' some more. * Made unfading a bit smoother. * Added `vidwhacker' hack (not installed by default.) * Added `stairs' hack. * Split `escher' into `cage' and `moebius', as per xlockmore. * Changed subprocess handling to use sigaction() instead of signal() if it's available (this is necessary for SCO but should work fine on other systems too.) * Various other tweaks. 2.14 * Better fix for the Motif drag-and-die lossage. * Put in some kludges to work around a LessTif bug. * XScreenSaver is known to work with LessTif 0.82 now. * Made fading work on high-end SGI video hardware. * Fixed another SGI-specific bug in screen grabbing; will the madness never cease? * Fixed another crash in `xlyap'. 2.13 * Made `decayscreen' do directions other than down. * Improved `puzzle'. * Fixed a crash in `xlyap'. * Added CDE info to the man page, removed `cde.txt'. * Configure tweaks for Zippy. * Turned off the signal handling in `bubbles' because it was sometimes failing to die. * Added `hacks/xscreensaver-sgigl.c' to make it possible to run SGI's ElectroPaint hack (/usr/demos/bin/ep) with xscreensaver. Finally! * Fixed a buffer overrun in the locking code that some wily, malicious cracker must have slipped in. * Disabled Motif drag-and-drool in the dialog box buttons, since it's broken in some old versions of Motif. 2.12 * Added `README.debugging'. * Added `puzzle' hack. * Added `xlyap' hack. * Added `default-n' as a visual name, so that one can have -install on by default, but turn it off for certain poorly-behaved hacks (like xv.) * Added support for grabbing frames of external video (on SGI) to the screen-grabbing hacks (decayscreen, slidescreen, slip, blitspin, and puzzle.) * Improved look of tiles in `slidescreen'; fixed its color allocation problem. 2.11 * Tweaked `blitspin', added it to the default list. * Added `lissie', `mountain', `triangle', `worm', `rotor', and `ant' from xlockmore. * Updated `sierpinski', `galaxy', and `lisa'. * Thickened the lines in `braid' and `lmorph'. * Updated VMS makefiles. * Renamed `fract' to `vines'. * Added `xjack' hack. * Made a few more hacks use erase.c, and added a few more wipe styles. * Fixed compilation problem with Sun's version of OpenGL. * Added ability to use sigaction() instead of signal() to work around a SCO kernel bug. 2.10 * Fixed colormap bugs in `rd-bomb'; sped up `coral'. * Configure tweaks for *BSD. 2.08 * New hacks `rd-bomb' and `coral'. * New version of `maze' with some new algorithms. * New colorized version of `rocks'. * Fixed a bug in qix on 64-bit machines. * Fixed a bug in the -time option. * Fixed a bug in configure related to LessTif. 2.07 * Minor header tweaks in windows.c and flag.c. * Made multi-architecture ($VPATH) builds work properly. * Merged new GL stuff from xlockmore (rubik, morph3d.) * Fixed intermittent crashes in `imsmap' and `munch'. * Added `fadeplot' hack from xlockmore. 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. 2.04 * HP configure tweaks. Detect and warn about LessTif. * Fixed low-color behavior of `goop', `pyro', `starfish', `greynetic', `flame', `halo', and `moire'. 2.03 * Fixed flicker in `pipes'. Fixed 3d in `bouboule'. * Added `munch' hack. * Added basic dependencies to the Makefile.in files. 2.02 * Fixes for compiling with the MIT saver extension. * Made the yow/fortune program be a configure option. * Various configure tweaks. 2.01 * Added `goop' and `starfish' hacks. * Added colomap cycling to `halo'. * Made `attraction' use the new colormap allocator. * Added better $PATH diagnostics. * There was a bug in frand! Color selection should be much improved now. 2.00 * Converted to use `configure' instead of `imake'. * ANSI C is now required. * Added Kerberos locking support, from Nat Lanza. * Made the stderr text use overlay planes, if possible. * Reworked the xlockmore compatibility stuff again. * Added `gears', `superquadrics', `escher', `pipes', and `sproingies' hacks (depend on OpenGL.) 1.34 * Fixed some bugs, made fading be a little smoother. 1.33 * Made it work with multi-headed displays. * Generalized sub-process management (Unix sucks!) * Added interactive mouse frobbing to Julia. * Added (untested) support for HPUX shadow passwords. * Made normal non-shadow passwords be checked if the shadow passwords aren't accessible for some reason. 1.32 * Removed *colorPrograms and *monoPrograms resources: made it possible to specify the desired visual on a per-hack basis. * Cleaned up / restructured the driver: no more globals. * Made the Motif and Athena dialogs share more code. * Probably fixed some Athena colormap-installation bugs. * Fixed screen grabbing (cmap) on SGI 12-bit PseudoColor. * Fixed divide-by-zero in bright random colormaps. * Added an improved version of xlock's `flag' hack. * Made unfading work better, and not flicker on SGIs. * Added `sphere', `forest', `lisa' hacks from xlockmore. * Added (untested) support for SunOS Adjunct passwords. 1.31 * Improved colors and colormap cycling of many hacks. * Cleaned up xlockmore compatibility layer. * Made `blitspin' able to grab an image off the screen. * Ported `swirl' and `bouboule' hacks from xlockmore. * Made the driver more careful about not leaving bits on the screen, or allowing other windows to raise themselves: it now re-blanks the screen every so often. * Added `-time' option to `xscreensaver-command'. * Improved SGI screen-grabbing some more: now it can grab TrueColor screens into PseudoColor windows and have the colors still come out semi-reasonably. 1.30 * Made `slidescreen' and `decayscreen' work better on SGIs when windows of different visuals are present, by using the XReadDisplay() extension to get a true 24-bit image out of the frame buffer. * Made `noseguy' be in color, if compiled with XPM. * Ported `braid', `drift', `fract', `galaxy', `grav', `ifs', `julia', `laser', `lightning', `penrose', `sierpinski', `slip', `spiral', and `strange' hacks from xlockmore. * Merged `hopalong' hack with a more recent version. * Added `cde.txt'. 1.28 * Added `deco', `moire', and `kaleidescope' hacks. * Merged in support for non-Motif locking and demo mode. * Made `blitspin' and `bubbles' work in TrueColor. * Fixed a stupid bug I introduced in `imsmap'. * Added `poly' and `gravity' options to `qix'. 1.27 * Added support for SGI SCREEN_SAVER extension. * Made `fade' and `unfade' work on 8-bit SGIs. * Made the dialog boxes more Motify. * Added `bubbles' hack. 1.26 * Added `lmorph' hack. * Added viscosity and mouse-control to attraction. * Fixed possible bad color choices in qix and attraction. * Added ramp-mode to halo. * Added a new RNG, which is faster and more portable than using the RNG in libc. * Made locking work on SCO. * Various other minor tweaks that I don't remember. 1.25 * Made it capture the stdout/stderr of its subprocesses and present them on the screensaver window itself. * Made demo mode work correctly with non-default visuals and color maps, instead of always using the defaults. * Added -visual argument to all included screenhacks. * Support for the R6 MIT-SCREEN-SAVER server extension. * Made the demo mode list scroll properly. * Added `pedal' hack. 1.24 * Fixed some private-colormap oddities in slidescreen, decayscreen, and xroger. Fixed apparent conservation- of-mass problem in pyro; made the shrapnel round. 1.23 * Minor tweaks for IRIX5; fixed locking race condition. 1.22 * Minor tweaks for X11R6. * Fixes for non-default visuals. 1.21 * Fixed bug in color blitspin; added default image. * Added diagnostics to noseguy. Fixed off-by-one error in flame. * Added some missing casts. 1.19 * Added `flame' hack. * Fixed a minor Motif dialog text field bug. * Fixed yet another XPointer-not-defined-in-R4 bug. 1.18 * Added support for shadow password files. * Fixed some Motif-related locking bugs. * Added diagnostics when locking is disabled. * Made blitspin able to use the XPM library. * Added `decayscreen' hack. 1.17 * Added `halo' hack. 1.16 * Portability fixes. 1.15 * Broke the driver up into more source files. * Moved the hacks into their own directory. * Made all `time' parameters accept the 00:00:00 syntax, so that even the parameters which are normally read as minutes can be specified in seconds. * Added colormap cycling to `imsmap'. * Made hyper work with K&R compilers. 1.14 * Added `orbit' option to `attraction' hack. * Added `lock-timeout' option. * Cleaned up options of `maze' hack. 1.09 * Added demo mode, and locking. * Added `maze' hack. * Added `norotate' option to `rocks' hack. 1.05 * Works when run from XDM before anyone logs in. * Sped up `imsmap'. * Can use `xv' as a slideshow without using up colormap entries while the screen is not blanked. * 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. xscreensaver-5.42+dfsg1/README.VMS000066400000000000000000000044341342162430400165040ustar00rootroot00000000000000OpenVMS 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) xscreensaver-5.42+dfsg1/README.hacking000066400000000000000000000224631342162430400174450ustar00rootroot00000000000000 ========================================================================== Writing new XScreenSaver modules ========================================================================== Any program that can be made to render on an X window created by another process can be used as a screen saver. Just get the window ID out of $XSCREENSAVER_WINDOW, draw on that, and you're done. In theory, you can write a screen saver in any language you like. In practice, however, languages other than C or C++ tend not to allow you to draw to windows that they did not create themselves. Unfortunately, this means that if you want to write a screen saver, you must write it in C. Given that you're going to be writing in C, you might as well take advantage of the various utility functions that I have written to make that easier. Writing a new screen saver in C using the frameworks included with xscreensaver simplifies things enormously. Generally, the best way to learn how to do something is to find a similar program, and play around with it until you understand it. Another approach is to not worry about understanding it, but to just hack it out. Either way, your best bet is probably to start with one of the existing xscreensaver demos, included in the "hacks/" directory, rename the file, and edit it until it does what you want. The "Greynetic" and "Deluxe" hacks are probably good ones to start with, since they are so very simple. For OpenGL programs, "DangerBall" is a good example. ========================================================================== Requirements for inclusion with the XScreenSaver collection ========================================================================== If you come up with anything, send it to me! If it's good, I'd love to include it in the xscreensaver distribution. However, there are a few requirements for me to distribute it: - Write in portable ANSI C. No C++. No nonstandard libraries. - Write a .man page describing all command-line options. - Write an .xml file describing the graphical configuration dialog box. - Include a BSD-like copyright/license notice at the top of each source file (preferably, just use the one from "screenhack.h", and include your name and the current year). The GNU GPL is not compatible with the rest of XScreenSaver. ========================================================================== The XScreenSaver API ========================================================================== - Start with #include "screenhack.h" - Define 2 global variables: yoursavername_defaults -- Default values for the resources you use. yoursavername_options -- The command-line options you accept. - Define 5 functions: yoursavername_init -- Return an object holding your global state. yoursavername_draw -- Draw a single frame, quickly. yoursavername_free -- Free everything you've allocated. yoursavername_reshape -- Called when the window is resized. yoursavername_event -- Called when a keyboard or mouse event happens. The "event" function will only be called when running in a window (not as a screen saver). The "reshape" event will be called when the window size changes, or (as a screen saver) when the display size changes as a result of a RANDR event (e.g., plugging in a new monitor). It's ok for both the "event" and "resize" functions to do nothing. - All other functions should be static. - The last line of the file should be XSCREENSAVER_MODULE ("YourSaverName", yoursavername) - Finally, edit the Makefile to add a rule for your program. Just cut-and-paste one of the existing rules. Your "draw" must not run for more than a fraction of a second without returning. This means "don't call usleep()". Everything has to be a state machine. You may not store global state in global variables, or in function-local static variables. All of your runtime state must be encapsulted in the "state" object created by your "init" function. If you use global or static variables, your screen saver will not work properly on macOS. Do not call XSync() or XFlush(). If you think you need to do that, it probably means that you are you are relying on the speed of the graphics card for timing, which probably means that your "draw" function is taking too long. ========================================================================== The xlockmore API ========================================================================== Some of the display modes that come with xscreensaver were ported from xlock, and so, for historical reasons, they follow a slightly different programming convention. For newly-written Xlib programs, you'd be better off following the pattern used in hacks like "Deluxe" than in hacks like "Flag". The xlockmore ones are the ones that begin with "#ifdef STANDALONE" and #include "xlockmore.h". But, all OpenGL screen savers have to follow the xlockmore API. The xlockmore API is similar to the XScreenSaver API, in that you define (roughly) the same set of functions, but the naming conventions are slightly different. Instead of "hackname_init", it's "init_hackname", and it should be preceeded with the pseudo-declaration ENTRYPOINT. One annoying mis-feature of the xlockmore API is that it *requires* you to make use of global variables for two things: first, for each of your command line options; and second, for an array that holds your global state objects. These are the only exceptions to the "never use global variables" rule. There are a few important differences between the original xlockmore API and XScreenSaver's implementation: - XScreenSaver does not use refresh_hackname or change_hackname. - XScreenSaver provides two additional hooks not present in xlockmore: reshape_hackname, and hackname_handle_event. These are respectively equivalent to hackname_reshape and hackname_event in the XScreenSaver API. - Under Xlib, MI_CLEARWINDOW doesn't clear the window immediately. Instead, due to double buffering on macOS/iOS/Android, it waits until after init_hackname or draw_hackname returns before clearing. Make sure not to issue any Xlib drawing calls immediately after a call to MI_CLEARWINDOW, as these will be erased. To clear the window immediately, just use XClearWindow. ========================================================================== Programming Tips ========================================================================== - Your screen saver should look reasonable at 20-30 frames per second. That is, do not assume that your "draw" function will be called more than 20 times a second. Even if you return a smaller requested delay than that, you might not get it. Likewise, if your "draw" function takes longer than 1/20th of a second to run, your screen saver may be consuming too much CPU. - Don't make assumptions about the depth of the display, or whether it is colormapped. You must allocate all your colors explicitly: do not assume you can construct an RGB value and use that as a pixel value directly. In particular, you can't make assumptions about whether pixels are RGB, RGBA, ARGB, ABGR, or even whether they are 32, 24, 16 or 8 bits. Use the utility routines provided by "utils/colors.h" to simplify color allocation. - It is better to eliminate flicker by double-buffering to a Pixmap than by erasing and re-drawing objects. Do not use drawing tricks involving XOR. - If you use double-buffering, have a resource to turn it off. (MacOS, iOS and Android have double-buffering built in, so you'd end up triple-buffering.) - Understand the differences between Pixmaps and XImages, and keep in mind which operations are happening in client memory and which are in server memory, and which cause latency due to server round-trips. Sometimes using the Shared Memory extension can be helpful, but probably not as often as you might think. - On modern machines, OpenGL will always run faster than Xlib. It's also more portable. Consider writing in OpenGL whenever possible. - Free any memory you allocate. While screen savers under X11 have their memory freed automatically when their process is killed by the XScreenSaver daemon, under iOS and Android screen savers exist in long-lived processes where no such cleanup takes place. Consider Valgrind or gcc -fsanitize=leak to find memory leaks. ========================================================================== macOS, iOS and Android ========================================================================== Though XScreenSaver started its life as an X11 program, it also now runs on macOS, iOS and Android, due to a maniacal collection of compatibility shims. If you do your development on an X11 system, and follow the usual XScreenSaver APIs, you shouldn't need to do anything special for it to also work on macOS and on phones. See the READMEs in the OSX/ and android/ directories for instructions on compiling for those platforms. 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. ========================================================================== xscreensaver-5.42+dfsg1/aclocal.m4000066400000000000000000000664031342162430400170240ustar00rootroot00000000000000# generated automatically by aclocal 1.16.1 -*- Autoconf -*- # Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) # Copyright (C) 1995-2002 Free Software Foundation, Inc. # Copyright (C) 2001-2003,2004 Red Hat, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General # Public License, this file may be distributed as part of a program # that contains a configuration script generated by Autoconf, under # the same distribution terms as the rest of that program. # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU Public License # but which still want to provide support for the GNU gettext functionality. # # Macro to add for using GNU gettext. # Ulrich Drepper , 1995, 1996 # # Modified to never use included libintl. # Owen Taylor , 12/15/1998 # # Major rework to remove unused code # Owen Taylor , 12/11/2002 # # Added better handling of ALL_LINGUAS from GNU gettext version # written by Bruno Haible, Owen Taylor 5/30/3002 # # Modified to require ngettext # Matthias Clasen 08/06/2004 # Increment this whenever this file is changed. #serial 1 # We need this here as well, since someone might use autoconf-2.5x # to configure GLib then an older version to configure a package # using AM_GLIB_GNU_GETTEXT AC_PREREQ(2.53) dnl dnl We go to great lengths to make sure that aclocal won't dnl try to pull in the installed version of these macros dnl when running aclocal in the glib directory. dnl m4_copy([AC_DEFUN],[glib_DEFUN]) m4_copy([AC_REQUIRE],[glib_REQUIRE]) dnl dnl At the end, if we're not within glib, we'll define the public dnl definitions in terms of our private definitions. dnl # GLIB_LC_MESSAGES #-------------------- glib_DEFUN([GLIB_LC_MESSAGES], [AC_CHECK_HEADERS([locale.h]) if test $ac_cv_header_locale_h = yes; then AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, [AC_TRY_LINK([#include ], [return LC_MESSAGES], am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) if test $am_cv_val_LC_MESSAGES = yes; then AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your file defines LC_MESSAGES.]) fi fi]) # GLIB_PATH_PROG_WITH_TEST #---------------------------- dnl GLIB_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) glib_DEFUN([GLIB_PATH_PROG_WITH_TEST], [# Extract the first word of "$2", so it can be a program name with args. set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in /*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in ifelse([$5], , $PATH, [$5]); do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" dnl If no 4th arg is given, leave the cache variable unset, dnl so AC_PATH_PROGS will keep looking. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" ])dnl ;; esac])dnl $1="$ac_cv_path_$1" if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then AC_MSG_RESULT([$]$1) else AC_MSG_RESULT(no) fi AC_SUBST($1)dnl ]) dnl Checks for special options needed on Mac OS X. dnl Defines INTL_MACOSX_LIBS. dnl dnl Copied from intlmacosx.m4 in gettext, GPL. dnl Copyright (C) 2004-2013 Free Software Foundation, Inc. glib_DEFUN([glib_gt_INTL_MACOSX], [ dnl Check for API introduced in Mac OS X 10.2. AC_CACHE_CHECK([for CFPreferencesCopyAppValue], [gt_cv_func_CFPreferencesCopyAppValue], [gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[CFPreferencesCopyAppValue(NULL, NULL)]])], [gt_cv_func_CFPreferencesCopyAppValue=yes], [gt_cv_func_CFPreferencesCopyAppValue=no]) LIBS="$gt_save_LIBS"]) if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) fi dnl Check for API introduced in Mac OS X 10.3. AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent], [gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[CFLocaleCopyCurrent();]])], [gt_cv_func_CFLocaleCopyCurrent=yes], [gt_cv_func_CFLocaleCopyCurrent=no]) LIBS="$gt_save_LIBS"]) if test $gt_cv_func_CFLocaleCopyCurrent = yes; then AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1], [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi AC_SUBST([INTL_MACOSX_LIBS]) ]) # GLIB_WITH_NLS #----------------- glib_DEFUN([GLIB_WITH_NLS], dnl NLS is obligatory [USE_NLS=yes AC_SUBST(USE_NLS) gt_cv_have_gettext=no CATOBJEXT=NONE XGETTEXT=: INTLLIBS= glib_gt_INTL_MACOSX AC_CHECK_HEADER(libintl.h, [gt_cv_func_dgettext_libintl="no" libintl_extra_libs="" # # First check in libc # AC_CACHE_CHECK([for ngettext in libc], gt_cv_func_ngettext_libc, [AC_TRY_LINK([ #include ], [return !ngettext ("","", 1)], gt_cv_func_ngettext_libc=yes, gt_cv_func_ngettext_libc=no) ]) if test "$gt_cv_func_ngettext_libc" = "yes" ; then AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc, [AC_TRY_LINK([ #include ], [return !dgettext ("","")], gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no) ]) fi if test "$gt_cv_func_ngettext_libc" = "yes" ; then AC_CHECK_FUNCS(bind_textdomain_codeset) fi # # If we don't have everything we want, check in libintl # if test "$gt_cv_func_dgettext_libc" != "yes" \ || test "$gt_cv_func_ngettext_libc" != "yes" \ || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then AC_CHECK_LIB(intl, bindtextdomain, [AC_CHECK_LIB(intl, ngettext, [AC_CHECK_LIB(intl, dgettext, gt_cv_func_dgettext_libintl=yes)])]) if test "$gt_cv_func_dgettext_libintl" != "yes" ; then AC_MSG_CHECKING([if -liconv is needed to use gettext]) AC_MSG_RESULT([]) AC_CHECK_LIB(intl, ngettext, [AC_CHECK_LIB(intl, dcgettext, [gt_cv_func_dgettext_libintl=yes libintl_extra_libs=-liconv], :,-liconv)], :,-liconv) fi # # If we found libintl, then check in it for bind_textdomain_codeset(); # we'll prefer libc if neither have bind_textdomain_codeset(), # and both have dgettext and ngettext # if test "$gt_cv_func_dgettext_libintl" = "yes" ; then glib_save_LIBS="$LIBS" LIBS="$LIBS -lintl $libintl_extra_libs" unset ac_cv_func_bind_textdomain_codeset AC_CHECK_FUNCS(bind_textdomain_codeset) LIBS="$glib_save_LIBS" if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then gt_cv_func_dgettext_libc=no else if test "$gt_cv_func_dgettext_libc" = "yes" \ && test "$gt_cv_func_ngettext_libc" = "yes"; then gt_cv_func_dgettext_libintl=no fi fi fi fi if test "$gt_cv_func_dgettext_libc" = "yes" \ || test "$gt_cv_func_dgettext_libintl" = "yes"; then gt_cv_have_gettext=yes fi if test "$gt_cv_func_dgettext_libintl" = "yes"; then INTLLIBS="-lintl $libintl_extra_libs $INTL_MACOSX_LIBS" fi if test "$gt_cv_have_gettext" = "yes"; then AC_DEFINE(HAVE_GETTEXT,1, [Define if the GNU gettext() function is already present or preinstalled.]) GLIB_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl if test "$MSGFMT" != "no"; then glib_save_LIBS="$LIBS" LIBS="$LIBS $INTLLIBS" AC_CHECK_FUNCS(dcgettext) MSGFMT_OPTS= AC_MSG_CHECKING([if msgfmt accepts -c]) GLIB_RUN_PROG([$MSGFMT -c -o /dev/null],[ msgid "" msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Project-Id-Version: test 1.0\n" "PO-Revision-Date: 2007-02-15 12:01+0100\n" "Last-Translator: test \n" "Language-Team: C \n" "MIME-Version: 1.0\n" "Content-Transfer-Encoding: 8bit\n" ], [MSGFMT_OPTS=-c; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AC_SUBST(MSGFMT_OPTS) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) GLIB_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr], [CATOBJEXT=.gmo DATADIRNAME=share], [case $host in *-*-solaris*) dnl On Solaris, if bind_textdomain_codeset is in libc, dnl GNU format message catalog is always supported, dnl since both are added to the libc all together. dnl Hence, we'd like to go with DATADIRNAME=share and dnl and CATOBJEXT=.gmo in this case. AC_CHECK_FUNC(bind_textdomain_codeset, [CATOBJEXT=.gmo DATADIRNAME=share], [CATOBJEXT=.mo DATADIRNAME=lib]) ;; *-*-openbsd*) CATOBJEXT=.mo DATADIRNAME=share ;; *) CATOBJEXT=.mo DATADIRNAME=lib ;; esac]) LIBS="$glib_save_LIBS" INSTOBJEXT=.mo else gt_cv_have_gettext=no fi fi ]) if test "$gt_cv_have_gettext" = "yes" ; then AC_DEFINE(ENABLE_NLS, 1, [always defined to indicate that i18n is enabled]) fi dnl Test whether we really found GNU xgettext. if test "$XGETTEXT" != ":"; then dnl If it is not GNU xgettext we define it as : so that the dnl Makefiles still can work. if $XGETTEXT --omit-header /dev/null 2> /dev/null; then : ; else AC_MSG_RESULT( [found xgettext program is not GNU xgettext; ignore it]) XGETTEXT=":" fi fi # We need to process the po/ directory. POSUB=po AC_OUTPUT_COMMANDS( [case "$CONFIG_FILES" in *po/Makefile.in*) sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile esac]) dnl These rules are solely for the distribution goal. While doing this dnl we only have to keep exactly one list of the available catalogs dnl in configure.ac. for lang in $ALL_LINGUAS; do GMOFILES="$GMOFILES $lang.gmo" POFILES="$POFILES $lang.po" done dnl Make all variables we use known to autoconf. AC_SUBST(CATALOGS) AC_SUBST(CATOBJEXT) AC_SUBST(DATADIRNAME) AC_SUBST(GMOFILES) AC_SUBST(INSTOBJEXT) AC_SUBST(INTLLIBS) AC_SUBST(PO_IN_DATADIR_TRUE) AC_SUBST(PO_IN_DATADIR_FALSE) AC_SUBST(POFILES) AC_SUBST(POSUB) ]) # AM_GLIB_GNU_GETTEXT # ------------------- # Do checks necessary for use of gettext. If a suitable implementation # of gettext is found in either in libintl or in the C library, # it will set INTLLIBS to the libraries needed for use of gettext # and AC_DEFINE() HAVE_GETTEXT and ENABLE_NLS. (The shell variable # gt_cv_have_gettext will be set to "yes".) It will also call AC_SUBST() # on various variables needed by the Makefile.in.in installed by # glib-gettextize. dnl AU_DEFUN([GLIB_GNU_GETTEXT], [AC_REQUIRE([AC_PROG_CC])dnl GLIB_LC_MESSAGES GLIB_WITH_NLS if test "$gt_cv_have_gettext" = "yes"; then if test "x$ALL_LINGUAS" = "x"; then LINGUAS= else AC_MSG_CHECKING(for catalogs to be installed) 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 AC_MSG_RESULT($LINGUAS) fi dnl Construct list of names of catalog files to be constructed. if test -n "$LINGUAS"; then for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done fi fi dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly dnl find the mkinstalldirs script in another subdir but ($top_srcdir). dnl Try to locate is. MKINSTALLDIRS= if test -n "$ac_aux_dir"; then MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" fi if test -z "$MKINSTALLDIRS"; then MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" fi AC_SUBST(MKINSTALLDIRS) dnl Generate list of files to be processed by xgettext which will dnl be included in po/Makefile. 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 ], [[$0: This macro is deprecated. You should use upstream gettext instead.]]) # AM_GLIB_DEFINE_LOCALEDIR(VARIABLE) # ------------------------------- # Define VARIABLE to the location where catalog files will # be installed by po/Makefile. glib_DEFUN([GLIB_DEFINE_LOCALEDIR], [glib_REQUIRE([GLIB_GNU_GETTEXT])dnl glib_save_prefix="$prefix" glib_save_exec_prefix="$exec_prefix" glib_save_datarootdir="$datarootdir" test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix=$prefix datarootdir=`eval echo "${datarootdir}"` if test "x$CATOBJEXT" = "x.mo" ; then localedir=`eval echo "${libdir}/locale"` else localedir=`eval echo "${datadir}/locale"` fi prefix="$glib_save_prefix" exec_prefix="$glib_save_exec_prefix" datarootdir="$glib_save_datarootdir" AC_DEFINE_UNQUOTED($1, "$localedir", [Define the location where the catalogs will be installed]) ]) dnl dnl Now the definitions that aclocal will find dnl ifdef(glib_configure_ac,[],[ AC_DEFUN([AM_GLIB_GNU_GETTEXT],[GLIB_GNU_GETTEXT($@)]) AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)]) ])dnl # GLIB_RUN_PROG(PROGRAM, TEST-FILE, [ACTION-IF-PASS], [ACTION-IF-FAIL]) # # Create a temporary file with TEST-FILE as its contents and pass the # file name to PROGRAM. Perform ACTION-IF-PASS if PROGRAM exits with # 0 and perform ACTION-IF-FAIL for any other exit status. AC_DEFUN([GLIB_RUN_PROG], [cat >conftest.foo <<_ACEOF $2 _ACEOF if AC_RUN_LOG([$1 conftest.foo]); then m4_ifval([$3], [$3], [:]) m4_ifvaln([$4], [else $4])dnl echo "$as_me: failed input was:" >&AS_MESSAGE_LOG_FD sed 's/^/| /' conftest.foo >&AS_MESSAGE_LOG_FD fi]) dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml]) # serial 42 IT_PROG_INTLTOOL AC_DEFUN([IT_PROG_INTLTOOL], [ AC_PREREQ([2.50])dnl AC_REQUIRE([AM_NLS])dnl case "$am__api_version" in 1.[01234]) AC_MSG_ERROR([Automake 1.5 or newer is required to use intltool]) ;; *) ;; esac INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | 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 "$1"; then AC_MSG_CHECKING([for intltool >= $1]) AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found]) test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.]) fi AC_PATH_PROG(INTLTOOL_UPDATE, [intltool-update]) AC_PATH_PROG(INTLTOOL_MERGE, [intltool-merge]) AC_PATH_PROG(INTLTOOL_EXTRACT, [intltool-extract]) if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then AC_MSG_ERROR([The intltool scripts were not found. Please install intltool.]) fi if test -z "$AM_DEFAULT_VERBOSITY"; then AM_DEFAULT_VERBOSITY=1 fi AC_SUBST([AM_DEFAULT_VERBOSITY]) INTLTOOL_V_MERGE='$(INTLTOOL__v_MERGE_$(V))' INTLTOOL__v_MERGE_='$(INTLTOOL__v_MERGE_$(AM_DEFAULT_VERBOSITY))' INTLTOOL__v_MERGE_0='@echo " ITMRG " [$]@;' AC_SUBST(INTLTOOL_V_MERGE) AC_SUBST(INTLTOOL__v_MERGE_) AC_SUBST(INTLTOOL__v_MERGE_0) 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' AC_SUBST(INTLTOOL_V_MERGE_OPTIONS) AC_SUBST(intltool__v_merge_options_) AC_SUBST(intltool__v_merge_options_0) 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 $< [$]@' _IT_SUBST(INTLTOOL_DESKTOP_RULE) _IT_SUBST(INTLTOOL_DIRECTORY_RULE) _IT_SUBST(INTLTOOL_KEYS_RULE) _IT_SUBST(INTLTOOL_PROP_RULE) _IT_SUBST(INTLTOOL_OAF_RULE) _IT_SUBST(INTLTOOL_PONG_RULE) _IT_SUBST(INTLTOOL_SERVER_RULE) _IT_SUBST(INTLTOOL_SHEET_RULE) _IT_SUBST(INTLTOOL_SOUNDLIST_RULE) _IT_SUBST(INTLTOOL_UI_RULE) _IT_SUBST(INTLTOOL_XAM_RULE) _IT_SUBST(INTLTOOL_KBD_RULE) _IT_SUBST(INTLTOOL_XML_RULE) _IT_SUBST(INTLTOOL_XML_NOMERGE_RULE) _IT_SUBST(INTLTOOL_CAVES_RULE) _IT_SUBST(INTLTOOL_SCHEMAS_RULE) _IT_SUBST(INTLTOOL_THEME_RULE) _IT_SUBST(INTLTOOL_SERVICE_RULE) _IT_SUBST(INTLTOOL_POLICY_RULE) # Check the gettext tools to make sure they are GNU AC_PATH_PROG(XGETTEXT, xgettext) AC_PATH_PROG(MSGMERGE, msgmerge) AC_PATH_PROG(MSGFMT, msgfmt) AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) fi xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`" mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`" mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`" if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then AC_MSG_ERROR([GNU gettext tools not found; required for intltool]) fi # Substitute ALL_LINGUAS so we can use it in po/Makefile AC_SUBST(ALL_LINGUAS) IT_PO_SUBDIR([po]) ]) # IT_PO_SUBDIR(DIRNAME) # --------------------- # All po subdirs have to be declared with this macro; the subdir "po" is # declared by IT_PROG_INTLTOOL. # AC_DEFUN([IT_PO_SUBDIR], [AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS. dnl dnl The following CONFIG_COMMANDS should be executed at the very end dnl of config.status. AC_CONFIG_COMMANDS_PRE([ AC_CONFIG_COMMANDS([$1/stamp-it], [ if [ ! grep "^# INTLTOOL_MAKEFILE$" "$1/Makefile.in" > /dev/null ]; then AC_MSG_ERROR([$1/Makefile.in.in was not created by intltoolize.]) fi rm -f "$1/stamp-it" "$1/stamp-it.tmp" "$1/POTFILES" "$1/Makefile.tmp" >"$1/stamp-it.tmp" [sed '/^#/d s/^[[].*] *// /^[ ]*$/d '"s|^| $ac_top_srcdir/|" \ "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES" ] [sed '/^POTFILES =/,/[^\\]$/ { /^POTFILES =/!d r $1/POTFILES } ' "$1/Makefile.in" >"$1/Makefile"] rm -f "$1/Makefile.tmp" mv "$1/stamp-it.tmp" "$1/stamp-it" ]) ])dnl ]) # _IT_SUBST(VARIABLE) # ------------------- # Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST # AC_DEFUN([_IT_SUBST], [ AC_SUBST([$1]) m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])]) ] ) # deprecated macros AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL]) # A hint is needed for aclocal from Automake <= 1.9.4: # AC_DEFUN([AC_PROG_INTLTOOL], ...) # nls.m4 serial 5 (gettext-0.18) dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016 Free Software dnl Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl dnl This file can be used in projects which are not available under dnl the GNU General Public License or the GNU Library General Public dnl License but which still want to provide support for the GNU gettext dnl functionality. dnl Please note that the actual code of the GNU gettext library is covered dnl by the GNU Library General Public License, and the rest of the GNU dnl gettext package is covered by the GNU General Public License. dnl They are *not* in the public domain. dnl Authors: dnl Ulrich Drepper , 1995-2000. dnl Bruno Haible , 2000-2003. AC_PREREQ([2.50]) AC_DEFUN([AM_NLS], [ AC_MSG_CHECKING([whether NLS is requested]) dnl Default is enabled NLS AC_ARG_ENABLE([nls], [ --disable-nls do not use Native Language Support], USE_NLS=$enableval, USE_NLS=yes) AC_MSG_RESULT([$USE_NLS]) AC_SUBST([USE_NLS]) ]) # Copyright (C) 2006-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) xscreensaver-5.42+dfsg1/ax_pthread.m4000066400000000000000000000326761342162430400175520ustar00rootroot00000000000000# =========================================================================== # 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 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) 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). # 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" 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_RESULT([$ax_pthread_ok]) if test x"$ax_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # 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). # 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. ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # 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) case ${host_os} in 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: ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" ;; darwin*) ax_pthread_flags="-pthread $ax_pthread_flags" ;; 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. 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 case $flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; -*) AC_MSG_CHECKING([whether pthreads work with $flag]) PTHREAD_CFLAGS="$flag" ;; pthread-config) AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) if test x"$ax_pthread_config" = xno; then continue; fi 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" ;; 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. AC_LINK_IFELSE([AC_LANG_PROGRAM([#include static void routine(void *a) { a = 0; } static void *start_routine(void *a) { return a; }], [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) /* ; */])], [ax_pthread_ok=yes], []) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" AC_MSG_RESULT([$ax_pthread_ok]) if test "x$ax_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # 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" # 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 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]) ]) AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: compile with *_r variant if test "x$GCC" != xyes; then case $host_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])])]) ;; esac fi fi test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" AC_SUBST([PTHREAD_LIBS]) AC_SUBST([PTHREAD_CFLAGS]) AC_SUBST([PTHREAD_CC]) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: 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 ax_pthread_ok=no $2 fi AC_LANG_POP ])dnl AX_PTHREAD xscreensaver-5.42+dfsg1/config.guess000077500000000000000000001262061342162430400175020ustar00rootroot00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-03-08' # 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 # 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 to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2018 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." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 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 # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # 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= ;' # 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 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 case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval "$set_cc_for_build" cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #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 ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # 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 || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in 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'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval "$set_cc_for_build" if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) 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}" exit ;; *: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.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) 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` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # 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`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp 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 echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) 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/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) 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/[^.]*//'`" 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" 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 (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi 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/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) 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/-/_/'`" 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` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && 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 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) 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 ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) 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/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) 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` case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "$HP_ARCH" = "" ]; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (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 ] then eval "$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 # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) 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/ /_/'` 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/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; *:FreeBSD:*:*) 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/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; prep*:SunOS:5.*:*) 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,/.*$,,'`" 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" exit ;; i*86:Minix:*:*) echo "$UNAME_MACHINE"-pc-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) eval "$set_cc_for_build" if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #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; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level 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" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) 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 echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. 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}" 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/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 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` /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 \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; 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` /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 \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$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 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 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 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&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` 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 exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: xscreensaver-5.42+dfsg1/config.h-vms000066400000000000000000000246141342162430400174030ustar00rootroot00000000000000/* 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 xscreensaver-5.42+dfsg1/config.h.in000066400000000000000000000401461342162430400172030ustar00rootroot00000000000000/* config.h.in. Generated from configure.in 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. */ /* Define this to allow the root password to unlock the screen. */ #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. */ #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. */ #undef HAVE_ADJUNCT_PASSWD /* Define to 1 if you have the `bind_textdomain_codeset' function. */ #undef HAVE_BIND_TEXTDOMAIN_CODESET /* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework. */ #undef HAVE_CFLOCALECOPYCURRENT /* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework. */ #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.) */ #undef HAVE_CRAPPLET /* Define this if HAVE_CRAPPLET is defined, and the function capplet_widget_changes_are_immediate() is available. */ #undef HAVE_CRAPPLET_IMMEDIATE /* Define to 1 if you have the header file. */ #undef HAVE_CRYPT_H /* Define to 1 if you have the `dcgettext' function. */ #undef HAVE_DCGETTEXT /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* 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.) */ #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(). */ #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. */ #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. */ #undef HAVE_GDK_PIXBUF /* Define this if you have the gdk_pixbuf_apply_embedded_orientation function (gdk-pixbuf 2.12). */ #undef HAVE_GDK_PIXBUF_APPLY_EMBEDDED_ORIENTATION /* Define to 1 if you have the `getaddrinfo' function. */ #undef HAVE_GETADDRINFO /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD /* Define this if you have the getifaddrs() function. */ #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. */ #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.) */ #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. */ #undef HAVE_GLBINDTEXTURE /* Define this if you have the -lgle and -lmatrix libraries (GL extrusion.) */ #undef HAVE_GLE /* Define this if you have the -lgle from GLE version 3 */ #undef HAVE_GLE3 /* Define this if you have Gtk (any version.) */ #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. */ #undef HAVE_HPUX_PASSWD /* Define this if you do pings with a `struct icmp' and an `icmp_id' slot. */ #undef HAVE_ICMP /* Define this if you do pings with a `struct icmphdr' and an `un.echo.id' slot. */ #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. */ #undef HAVE_JPEGLIB /* Define this to target the OpenGL ES 1.x API instead of OpenGL 1.3. */ #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. */ #undef HAVE_KERBEROS /* Define this if you have Kerberos 5, meaning we need to use the Kerberos 4 compatibility layer. */ #undef HAVE_KERBEROS5 /* Define if your file defines LC_MESSAGES. */ #undef HAVE_LC_MESSAGES /* 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. */ #undef HAVE_LIBPNG /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H /* 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 /* Define this if you have Motif. */ #undef HAVE_MOTIF /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* 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) */ #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. */ #undef HAVE_PAM /* Define this if you have pam_fail_delay function. see driver/passwd-pam.c. */ #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. */ #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 . */ #undef HAVE_PROC_OOM /* Define this if your system supports POSIX threads. */ #undef HAVE_PTHREAD /* Have PTHREAD_PRIO_INHERIT. */ #undef HAVE_PTHREAD_PRIO_INHERIT /* Define to 1 if you have the header file. */ #undef HAVE_PTY_H /* 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.) */ #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. */ #undef HAVE_READ_DISPLAY_EXTENSION /* Define to 1 if you have the `realpath' function. */ #undef HAVE_REALPATH /* Define this to enable recording of videos. */ #undef HAVE_RECORD_ANIM /* Define to 1 if you have the `sbrk' function. */ #undef HAVE_SBRK /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE /* Define to 1 if you have the `setpriority' function. */ #undef HAVE_SETPRIORITY /* 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.) */ #undef HAVE_SHADOW_PASSWD /* Define to 1 if you have the `sigaction' function. */ #undef HAVE_SIGACTION /* Define to 1 if you have the `sigtimedwait' function. */ #undef HAVE_SIGTIMEDWAIT /* Define to 1 if you have the `sqrtf' function. */ #undef HAVE_SQRTF /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if `sa_len' is a member of `struct sockaddr'. */ #undef HAVE_STRUCT_SOCKADDR_SA_LEN /* Define to 1 if you have the `syslog' function. */ #undef HAVE_SYSLOG /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define to 1 if you have the `uname' function. */ #undef HAVE_UNAME /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* 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.) */ #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.) */ #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. */ #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.) */ #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.) */ #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.) */ #undef HAVE_XINPUT /* Define this if you have the XmComboBox Motif widget (Motif 2.0.) */ #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(). */ #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 /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #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. */ #undef PAM_SERVICE_NAME /* Define if you have PAM and 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'). */ #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. */ #undef XPointer /* Define to 1 if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to `int' if does not define. */ #undef mode_t /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to `int' if or does not define. */ #undef socklen_t xscreensaver-5.42+dfsg1/config.sub000066400000000000000000001064551342162430400171460ustar00rootroot00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-03-08' # 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 # 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 to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2018 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." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 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 ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -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*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. 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 ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # 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 ;; 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 ;; 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 ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec 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 ;; 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 ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; 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 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-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 ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-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 ;; i*86v32) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) 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 ;; 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 ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) 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 ;; 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 ;; 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 ;; pbd) basic_machine=sparc-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 ;; 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/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; 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/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh5el) basic_machine=sh5le-unknown ;; simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; x64) basic_machine=x86_64-pc ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; none) basic_machine=none-none 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) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases that might get confused # with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) -es1800*) os=-ose ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* | -hcos* \ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -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* | -superux* | -rtmk* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ | -midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -xray | -os68k* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4*) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $basic_machine in arm*) os=-eabi ;; *) os=-elf ;; esac ;; -nacl*) ;; -ios) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; pru-*) os=-elf ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # 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*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac echo "$basic_machine$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: xscreensaver-5.42+dfsg1/configure000077500000000000000000017746401342162430400171050ustar00rootroot00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes 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 # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done 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 # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } 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 # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' 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'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. 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 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="driver/subprocs.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS DEPEND_DEFINES DEPEND_FLAGS DEPEND APPDEFAULTS ANIM_LIBS ANIM_OBJS GTK_EXTRA_OBJS HACK_CONF_DIR PO_DATADIR GTK_DATADIR HACKDIR_FULL HACKDIR NOGNOME GNOME22 GNOME24 JWZGLES_OBJS GLE_KLUDGE GLE_EXES GL_KLUDGE GL_MEN GL_UTIL_EXES SUID_EXES RETIRED_GL_EXES 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 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 DEFAULT_IMAGES_P NEW_LOGIN_COMMAND_P NEW_LOGIN_COMMAND COMMENT_PAM_CHECK_ACCOUNT HAVE_PAM_FAIL_DELAY INSTALL_PAM NEED_SETUID INSTALL_DIRS SETUID_HACKS INSTALL_SETUID PASSWD_LIBS XINERAMA_LIBS XDPMS_LIBS GLE_LIBS GL_LIBS PTY_LIBS HACK_LIBS JPEG_LIBS PNG_LIBS XML_LIBS GTK_LIBS MOTIF_LIBS SAVER_LIBS ALL_DEMO_PROGRAMS PREFERRED_DEMO_PROGRAM INCLUDES gnome_url_show_program gnome_open_program pkg_config login_manager_tmp MKINSTALLDIRS POSUB POFILES PO_IN_DATADIR_FALSE PO_IN_DATADIR_TRUE INTLLIBS INSTOBJEXT GMOFILES DATADIRNAME CATOBJEXT CATALOGS MSGFMT_OPTS INTL_MACOSX_LIBS GETTEXT_PACKAGE ALL_LINGUAS GMSGFMT MSGFMT MSGMERGE XGETTEXT INTLTOOL_POLICY_RULE INTLTOOL_SERVICE_RULE INTLTOOL_THEME_RULE INTLTOOL_SCHEMAS_RULE INTLTOOL_CAVES_RULE INTLTOOL_XML_NOMERGE_RULE INTLTOOL_XML_RULE INTLTOOL_KBD_RULE INTLTOOL_XAM_RULE INTLTOOL_UI_RULE INTLTOOL_SOUNDLIST_RULE INTLTOOL_SHEET_RULE INTLTOOL_SERVER_RULE INTLTOOL_PONG_RULE INTLTOOL_OAF_RULE INTLTOOL_PROP_RULE INTLTOOL_KEYS_RULE INTLTOOL_DIRECTORY_RULE INTLTOOL_DESKTOP_RULE intltool__v_merge_options_0 intltool__v_merge_options_ INTLTOOL_V_MERGE_OPTIONS INTLTOOL__v_MERGE_0 INTLTOOL__v_MERGE_ INTLTOOL_V_MERGE AM_DEFAULT_VERBOSITY INTLTOOL_EXTRACT INTLTOOL_MERGE INTLTOOL_UPDATE USE_NLS X_EXTRA_LIBS X_LIBS X_PRE_LIBS X_CFLAGS XMKMF PERL EGREP GREP SET_MAKE INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM CPP PTHREAD_CFLAGS PTHREAD_LIBS PTHREAD_CC ax_pthread_config OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking with_x_app_defaults with_pthread enable_largefile with_x enable_nls with_hackdir enable_subdir with_configdir with_dpms_ext with_xinerama_ext with_xinput_ext with_xf86vmode_ext with_xf86gamma_ext with_randr_ext with_proc_interrupts with_proc_oom enable_locking enable_root_passwd with_pam with_pam_service_name enable_pam_check_account_type with_kerberos with_shadow with_passwd_helper with_login_manager with_gtk with_motif with_gl with_gle with_gles with_png with_pixbuf with_jpeg with_xft with_xshm_ext with_xdbe_ext with_readdisplay with_image_directory with_text_file with_browser with_setuid_hacks with_record_animation ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP XMKMF' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= 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 .` || as_fn_error $? "working directory cannot be determined" 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 # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as 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 -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -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', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --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 X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi 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. --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) --with-pthread Enables POSIX threads, for SMP support. 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-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-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: --with-gtk Use the Gtk toolkit for the user interface. --with-motif Use the Motif toolkit for the user interface (no longer supported.) 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-jpeg Include support for the JPEG library. --with-xft Include support for the X Freetype library. --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-record-animation Include code for generating MP4 videos. Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor XMKMF Path to xmkmf, Makefile generator for X Window System Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -rf conftest.$ac_objext if { { ac_try="$ac_compile" 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_compile") 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_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # 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_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_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" 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_cpp conftest.$ac_ext") 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; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -rf conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* 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 $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` 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 || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 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. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF 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 ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## 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 ac_config_headers="$ac_config_headers config.h" echo "current directory: `pwd`" echo "command line was: $0 $@" ############################################################################### # # Autoheader 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.]) # 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. # ############################################################################### ############################################################################### # # 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 create directory trees. # ############################################################################### ############################################################################### # # Function to check whether gettimeofday() exists, and how to call it. # This may define HAVE_GETTIMEOFDAY and GETTIMEOFDAY_TWO_ARGS. # ############################################################################### ############################################################################### # # Function to find perl5 (defines PERL and PERL_VERSION.) # ############################################################################### # M4 sucks!! perl sucks too!! 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. # ############################################################################### # Try and find the app-defaults directory. # It sucks that autoconf doesn't do this already... # ############################################################################### # # 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. # ############################################################################### # 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_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. # (But not the -L directories!) # # 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. # ############################################################################### ############################################################################### # # 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_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: 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 : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: 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' 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 -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; 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_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$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_CC="${ac_tool_prefix}gcc" $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 fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; 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_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_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_ac_ct_CC="gcc" $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 fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" 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 CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; 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_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$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_CC="${ac_tool_prefix}cc" $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 fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; 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_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no 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 if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $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 $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$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_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$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_CC="$ac_tool_prefix$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 fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe 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_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_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_ac_ct_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 fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" 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 CC=$ac_ct_CC fi 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 See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" 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_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -rf conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" 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_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } 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; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done 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 $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -rf conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -rf conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { 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; } if { ac_try='./conftest$ac_cv_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 cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes 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 $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -rf conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -rf conftest.o conftest.obj if { { ac_try="$ac_compile" 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_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -rf conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -rf conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : 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 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. # 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. # This affects CC, LIBS, and CFLAGS, instead of defining new variables. # Check whether --with-pthread was given. if test "${with_pthread+set}" = set; then : withval=$with_pthread; with_pthread="$withval"; with_pthread_req="$withval" else with_pthread=yes fi if test "$with_pthread" = yes; then # AX_PTHREAD might want a different compiler. 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 /* 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 pthread_join (); int main () { return pthread_join (); ; return 0; } _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 # 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). # 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. ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # 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) case ${host_os} in 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: ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" ;; darwin*) ax_pthread_flags="-pthread $ax_pthread_flags" ;; 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. { $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 /* end confdefs.h. */ int foo(void); int main () { foo() ; 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; } else ax_pthread_extra_flags= { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } 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 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 "$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" ;; 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 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 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; } _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" { $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 PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # 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" # 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 cat >>confdefs.h <<_ACEOF #define PTHREAD_CREATE_JOINABLE $attr_name _ACEOF fi { $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 { $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 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 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 "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # 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_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 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 test -n "$PTHREAD_CC" && break done test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" ;; esac ;; #( *) : ;; esac ;; esac fi fi test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" # 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 # Needs ac_original_cc. 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" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler works on ANSI C" >&5 $as_echo_n "checking whether the compiler works on ANSI C... " >&6; } if test "$cross_compiling" = yes; then : as_fn_error $? "Couldn't build even a trivial ANSI C program: check CC." "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ main(int ac, char **av) { return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; 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; } as_fn_error $? "Couldn't build even a trivial ANSI C program: check CC." "$LINENO" 5 fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi 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 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 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 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: 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 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 _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 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 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 : 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 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 : 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 { $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 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 ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=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 "#define const /**/" >>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 : $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 _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; } 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 ;; 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; } 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 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 done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi 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; } # 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}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $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 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: $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 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 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 { $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 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_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 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_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 _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi 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 _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : 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 #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 : 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 fi fi 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 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 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 fi 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 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 _ACEOF fi 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 _ACEOF fi 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 cat >>confdefs.h <<_ACEOF #define size_t unsigned int _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_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void 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}: 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 : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=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}: 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 () { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_sys_wait_h=yes else 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_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 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 cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_ac_Header=yes" else eval "$as_ac_Header=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; } 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 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 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" 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" 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 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 '' 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" 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" fi fi { $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; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_gettimeofday_args=2 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct timeval tv; gettimeofday(&tv); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_gettimeofday_args=1 else ac_gettimeofday_args=0 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_gettimeofday_args=$ac_gettimeofday_args fi ac_gettimeofday_args=$ac_cv_gettimeofday_args if test "$ac_gettimeofday_args" = 1 ; then $as_echo "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h { $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 $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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5 $as_echo "unknown" >&6; } fi # 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 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 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 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 { $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 /* 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_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]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done 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_n "(cached) " >&6 else while :; do 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 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_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 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 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 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 : $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 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_have_icmp=yes else 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_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 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 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 : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { 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_have_getifaddrs=yes else 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_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 : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { socklen_t socklen; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_socklen_t=yes else ac_cv_type_socklen_t=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_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; } 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 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 : $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 /* 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 int main () { XrmInitialize () ; 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= 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 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 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; } 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 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 # 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. */ int main () { ; 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. */ int main () { ; 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 # 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. */ /* 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 : 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_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_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" 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. */ /* 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 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. */ /* 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_nsl_gethostbyname=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 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 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 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 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 ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_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 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 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" 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 : $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 : 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 ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $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 shmat (); int main () { return shmat (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ipc_shmat=yes 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 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" fi 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. */ /* 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 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" fi LDFLAGS=$ac_save_LDFLAGS fi if test "$have_x" != yes; then as_fn_error $? "Couldn't find X11 headers/libs. Try \`$0 --help'." "$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 : $as_echo_n "(cached) " >&6 else case $INTLTOOL_UPDATE in [\\/]* | ?:[\\/]*) ac_cv_path_INTLTOOL_UPDATE="$INTLTOOL_UPDATE" # 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_INTLTOOL_UPDATE="$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_UPDATE=$ac_cv_path_INTLTOOL_UPDATE if test -n "$INTLTOOL_UPDATE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_UPDATE" >&5 $as_echo "$INTLTOOL_UPDATE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $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 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_INTLTOOL_MERGE+:} false; then : $as_echo_n "(cached) " >&6 else case $INTLTOOL_MERGE in [\\/]* | ?:[\\/]*) ac_cv_path_INTLTOOL_MERGE="$INTLTOOL_MERGE" # 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_INTLTOOL_MERGE="$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_MERGE=$ac_cv_path_INTLTOOL_MERGE if test -n "$INTLTOOL_MERGE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_MERGE" >&5 $as_echo "$INTLTOOL_MERGE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $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 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_INTLTOOL_EXTRACT+:} false; then : $as_echo_n "(cached) " >&6 else case $INTLTOOL_EXTRACT in [\\/]* | ?:[\\/]*) ac_cv_path_INTLTOOL_EXTRACT="$INTLTOOL_EXTRACT" # 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_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. set dummy xgettext; 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_XGETTEXT+:} false; then : $as_echo_n "(cached) " >&6 else case $XGETTEXT in [\\/]* | ?:[\\/]*) ac_cv_path_XGETTEXT="$XGETTEXT" # 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_XGETTEXT="$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 XGETTEXT=$ac_cv_path_XGETTEXT if test -n "$XGETTEXT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 $as_echo "$XGETTEXT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $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 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_MSGMERGE+:} false; then : $as_echo_n "(cached) " >&6 else case $MSGMERGE in [\\/]* | ?:[\\/]*) ac_cv_path_MSGMERGE="$MSGMERGE" # 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_MSGMERGE="$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 MSGMERGE=$ac_cv_path_MSGMERGE if test -n "$MSGMERGE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5 $as_echo "$MSGMERGE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $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 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_MSGFMT+:} false; then : $as_echo_n "(cached) " >&6 else case $MSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_MSGFMT="$MSGFMT" # 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_MSGFMT="$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 MSGFMT=$ac_cv_path_MSGFMT if test -n "$MSGFMT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 $as_echo "$MSGFMT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $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 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_GMSGFMT+:} false; then : $as_echo_n "(cached) " >&6 else case $GMSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # 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_GMSGFMT="$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 test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 $as_echo "$GMSGFMT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $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 xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`" mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`" mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`" if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then as_fn_error $? "GNU gettext tools not found; required for intltool" "$LINENO" 5 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 do : ac_fn_c_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default" if test "x$ac_cv_header_locale_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LOCALE_H 1 _ACEOF fi done if test $ac_cv_header_locale_h = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LC_MESSAGES" >&5 $as_echo_n "checking for LC_MESSAGES... " >&6; } if ${am_cv_val_LC_MESSAGES+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { return LC_MESSAGES ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : am_cv_val_LC_MESSAGES=yes else am_cv_val_LC_MESSAGES=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_val_LC_MESSAGES" >&5 $as_echo "$am_cv_val_LC_MESSAGES" >&6; } if test $am_cv_val_LC_MESSAGES = yes; then $as_echo "#define HAVE_LC_MESSAGES 1" >>confdefs.h fi 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 : $as_echo_n "(cached) " >&6 else gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { CFPreferencesCopyAppValue(NULL, NULL) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : gt_cv_func_CFPreferencesCopyAppValue=yes else gt_cv_func_CFPreferencesCopyAppValue=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 $as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then $as_echo "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyCurrent" >&5 $as_echo_n "checking for CFLocaleCopyCurrent... " >&6; } if ${gt_cv_func_CFLocaleCopyCurrent+:} false; then : $as_echo_n "(cached) " >&6 else gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { CFLocaleCopyCurrent(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : gt_cv_func_CFLocaleCopyCurrent=yes else gt_cv_func_CFLocaleCopyCurrent=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 $as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; } if test $gt_cv_func_CFLocaleCopyCurrent = yes; then $as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then 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" libintl_extra_libs="" # # First check in libc # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ngettext in libc" >&5 $as_echo_n "checking for ngettext in libc... " >&6; } if ${gt_cv_func_ngettext_libc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { return !ngettext ("","", 1) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : gt_cv_func_ngettext_libc=yes else gt_cv_func_ngettext_libc=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_ngettext_libc" >&5 $as_echo "$gt_cv_func_ngettext_libc" >&6; } if test "$gt_cv_func_ngettext_libc" = "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgettext in libc" >&5 $as_echo_n "checking for dgettext in libc... " >&6; } if ${gt_cv_func_dgettext_libc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { return !dgettext ("","") ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : gt_cv_func_dgettext_libc=yes else gt_cv_func_dgettext_libc=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_dgettext_libc" >&5 $as_echo "$gt_cv_func_dgettext_libc" >&6; } fi if test "$gt_cv_func_ngettext_libc" = "yes" ; then for ac_func in bind_textdomain_codeset do : ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset" if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_BIND_TEXTDOMAIN_CODESET 1 _ACEOF fi done fi # # If we don't have everything we want, check in libintl # if test "$gt_cv_func_dgettext_libc" != "yes" \ || test "$gt_cv_func_ngettext_libc" != "yes" \ || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bindtextdomain in -lintl" >&5 $as_echo_n "checking for bindtextdomain in -lintl... " >&6; } if ${ac_cv_lib_intl_bindtextdomain+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $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 bindtextdomain (); int main () { return bindtextdomain (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_bindtextdomain=yes else ac_cv_lib_intl_bindtextdomain=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_intl_bindtextdomain" >&5 $as_echo "$ac_cv_lib_intl_bindtextdomain" >&6; } if test "x$ac_cv_lib_intl_bindtextdomain" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ngettext in -lintl" >&5 $as_echo_n "checking for ngettext in -lintl... " >&6; } if ${ac_cv_lib_intl_ngettext+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $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 ngettext (); int main () { return ngettext (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_ngettext=yes else ac_cv_lib_intl_ngettext=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_intl_ngettext" >&5 $as_echo "$ac_cv_lib_intl_ngettext" >&6; } if test "x$ac_cv_lib_intl_ngettext" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgettext in -lintl" >&5 $as_echo_n "checking for dgettext in -lintl... " >&6; } if ${ac_cv_lib_intl_dgettext+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $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 dgettext (); int main () { return dgettext (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_dgettext=yes else ac_cv_lib_intl_dgettext=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_intl_dgettext" >&5 $as_echo "$ac_cv_lib_intl_dgettext" >&6; } if test "x$ac_cv_lib_intl_dgettext" = xyes; then : gt_cv_func_dgettext_libintl=yes fi 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; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 $as_echo "" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ngettext in -lintl" >&5 $as_echo_n "checking for ngettext in -lintl... " >&6; } if ${ac_cv_lib_intl_ngettext+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl -liconv $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 ngettext (); int main () { return ngettext (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_ngettext=yes else ac_cv_lib_intl_ngettext=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_intl_ngettext" >&5 $as_echo "$ac_cv_lib_intl_ngettext" >&6; } if test "x$ac_cv_lib_intl_ngettext" = xyes; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dcgettext in -lintl" >&5 $as_echo_n "checking for dcgettext in -lintl... " >&6; } if ${ac_cv_lib_intl_dcgettext+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl -liconv $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 dcgettext (); int main () { return dcgettext (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_dcgettext=yes else ac_cv_lib_intl_dcgettext=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_intl_dcgettext" >&5 $as_echo "$ac_cv_lib_intl_dcgettext" >&6; } if test "x$ac_cv_lib_intl_dcgettext" = xyes; then : gt_cv_func_dgettext_libintl=yes libintl_extra_libs=-liconv else : fi else : fi fi # # If we found libintl, then check in it for bind_textdomain_codeset(); # we'll prefer libc if neither have bind_textdomain_codeset(), # and both have dgettext and ngettext # if test "$gt_cv_func_dgettext_libintl" = "yes" ; then glib_save_LIBS="$LIBS" LIBS="$LIBS -lintl $libintl_extra_libs" unset ac_cv_func_bind_textdomain_codeset for ac_func in bind_textdomain_codeset do : ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset" if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_BIND_TEXTDOMAIN_CODESET 1 _ACEOF fi done LIBS="$glib_save_LIBS" if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then gt_cv_func_dgettext_libc=no else if test "$gt_cv_func_dgettext_libc" = "yes" \ && test "$gt_cv_func_ngettext_libc" = "yes"; then gt_cv_func_dgettext_libintl=no fi fi fi fi if test "$gt_cv_func_dgettext_libc" = "yes" \ || test "$gt_cv_func_dgettext_libintl" = "yes"; then gt_cv_have_gettext=yes fi if test "$gt_cv_func_dgettext_libintl" = "yes"; then INTLLIBS="-lintl $libintl_extra_libs $INTL_MACOSX_LIBS" fi if test "$gt_cv_have_gettext" = "yes"; then $as_echo "#define HAVE_GETTEXT 1" >>confdefs.h # 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 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_MSGFMT+:} false; then : $as_echo_n "(cached) " >&6 else case "$MSGFMT" in /*) ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then ac_cv_path_MSGFMT="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" ;; esac fi MSGFMT="$ac_cv_path_MSGFMT" if test "$MSGFMT" != "no"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 $as_echo "$MSGFMT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "$MSGFMT" != "no"; then glib_save_LIBS="$LIBS" LIBS="$LIBS $INTLLIBS" for ac_func in dcgettext do : ac_fn_c_check_func "$LINENO" "dcgettext" "ac_cv_func_dcgettext" if test "x$ac_cv_func_dcgettext" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DCGETTEXT 1 _ACEOF fi done MSGFMT_OPTS= { $as_echo "$as_me:${as_lineno-$LINENO}: checking if msgfmt accepts -c" >&5 $as_echo_n "checking if msgfmt accepts -c... " >&6; } cat >conftest.foo <<_ACEOF msgid "" msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Project-Id-Version: test 1.0\n" "PO-Revision-Date: 2007-02-15 12:01+0100\n" "Last-Translator: test \n" "Language-Team: C \n" "MIME-Version: 1.0\n" "Content-Transfer-Encoding: 8bit\n" _ACEOF if { { $as_echo "$as_me:${as_lineno-$LINENO}: \$MSGFMT -c -o /dev/null conftest.foo"; } >&5 ($MSGFMT -c -o /dev/null conftest.foo) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then MSGFMT_OPTS=-c; { $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; } echo "$as_me: failed input was:" >&5 sed 's/^/| /' conftest.foo >&5 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 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_GMSGFMT+:} false; then : $as_echo_n "(cached) " >&6 else case $GMSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # 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_GMSGFMT="$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 test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 $as_echo "$GMSGFMT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $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 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_XGETTEXT+:} false; then : $as_echo_n "(cached) " >&6 else case "$XGETTEXT" in /*) ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then ac_cv_path_XGETTEXT="$ac_dir/$ac_word" break fi fi done IFS="$ac_save_ifs" test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" ;; esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test "$XGETTEXT" != ":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 $as_echo "$XGETTEXT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : CATOBJEXT=.gmo DATADIRNAME=share else case $host in *-*-solaris*) ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset" if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then : CATOBJEXT=.gmo DATADIRNAME=share else CATOBJEXT=.mo DATADIRNAME=lib fi ;; *-*-openbsd*) CATOBJEXT=.mo DATADIRNAME=share ;; *) CATOBJEXT=.mo DATADIRNAME=lib ;; esac fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$glib_save_LIBS" INSTOBJEXT=.mo else gt_cv_have_gettext=no fi fi 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" ############################################################################### # # Check for -lXmu (some fucked up vendors don't ship it...) # ############################################################################### have_xmu=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_compile "$LINENO" "X11/Xmu/Error.h" "ac_cv_header_X11_Xmu_Error_h" "#include #include #include " if test "x$ac_cv_header_X11_Xmu_Error_h" = xyes; then : have_xmu=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 ############################################################################### # # 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*) { $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 : $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 /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_sunos_xmu_bug=no else ac_cv_sunos_xmu_bug=yes 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 else ac_save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -static" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_ld_static=yes else ac_cv_ld_static=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_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 fi ############################################################################### # # Handle the --with-hackdir option # ############################################################################### have_hackdir=yes with_hackdir_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" else with_hackdir=yes fi 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= # 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 ############################################################################### # # Handle the --with-configdir option # Help for --with-x-app-defaults option added. # ############################################################################### 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 ############################################################################### # # 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 # 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) ;; /*) { $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}: 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 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 { $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_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 if test "$with_dpms" = yes; then # first check for dpms.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/dpms.h" "ac_cv_header_X11_extensions_dpms_h" "#include #include " if test "x$ac_cv_header_X11_extensions_dpms_h" = xyes; then : have_dpms=yes fi CPPFLAGS="$ac_save_CPPFLAGS" # 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_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 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_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_lib_Xext_DPMSInfo=yes else ac_cv_lib_Xext_DPMSInfo=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 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" # 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_lib_Xdpms_DPMSInfo=yes else ac_cv_lib_Xdpms_DPMSInfo=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" 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 ############################################################################### # # Check for the XINERAMA server extension. # ############################################################################### have_xinerama=no with_xinerama_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" else with_xinerama=yes fi case "$with_xinerama" 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 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 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 $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_xinerama_req="yes" with_xinerama=$with_xinerama_req ;; *) echo "" 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 # first check for Xinerama.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/Xinerama.h" "ac_cv_header_X11_extensions_Xinerama_h" "#include " 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 XINERAMA code in the libraries if test "$have_xinerama" = yes; then # first look in -lXext have_xinerama=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 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 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 XineramaQueryScreens (); int main () { return XineramaQueryScreens (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xext_XineramaQueryScreens=yes else 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_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 CPPFLAGS="$ac_save_CPPFLAGS" 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 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 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="-lXinerama -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 XineramaQueryScreens (); int main () { return XineramaQueryScreens (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xinerama_XineramaQueryScreens=yes else 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_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 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_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 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 XListInputDevices in -lXi" >&5 $as_echo_n "checking for XListInputDevices in -lXi... " >&6; } if ${ac_cv_lib_Xi_XListInputDevices+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXi -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 XListInputDevices (); int main () { return XListInputDevices (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xi_XListInputDevices=yes else ac_cv_lib_Xi_XListInputDevices=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" 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_xinput" = yes; then $as_echo "#define HAVE_XINPUT 1" >>confdefs.h 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 # 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_xf86vmode=yes fi case "$with_xf86vmode" 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 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 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 # replace the directory string with "yes". with_xf86vmode_req="yes" with_xf86vmode=$with_xf86vmode_req ;; *) 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 VIDMODE_LIBS="" 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" # if that succeeded, then check for the -lXxf86vm if test "$have_xf86vmode" = yes; then have_xf86vmode=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 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 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 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 # Check whether --with-xf86gamma-ext was given. if test "${with_xf86gamma_ext+set}" = set; then : withval=$with_xf86gamma_ext; with_xf86gamma="$withval"; with_xf86gamma_req="$withval" else with_xf86gamma=yes fi case "$with_xf86gamma" in yes) ;; no) ;; /*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xf86gamma headers" >&5 $as_echo_n "checking for xf86gamma headers... " >&6; } d=$with_xf86gamma/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 xf86gamma libs" >&5 $as_echo_n "checking for xf86gamma libs... " >&6; } d=$with_xf86gamma/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_xf86gamma_req="yes" with_xf86gamma=$with_xf86gamma_req ;; *) echo "" echo "error: argument to --with-xf86gamma-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_xf86gamma" = yes; then # first check for xf86vmode.h, if we haven't already if test "$have_xf86vmode" = yes; then have_xf86gamma=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" "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_xf86gamma=yes fi CPPFLAGS="$ac_save_CPPFLAGS" fi # if that succeeded, then check for the -lXxf86vm if test "$have_xf86gamma" = yes; then have_xf86gamma=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 XF86VidModeSetGamma in -lXxf86vm" >&5 $as_echo_n "checking for XF86VidModeSetGamma in -lXxf86vm... " >&6; } if ${ac_cv_lib_Xxf86vm_XF86VidModeSetGamma+:} false; then : $as_echo_n "(cached) " >&6 else 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 XF86VidModeSetGamma (); int main () { return XF86VidModeSetGamma (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xxf86vm_XF86VidModeSetGamma=yes else ac_cv_lib_Xxf86vm_XF86VidModeSetGamma=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_XF86VidModeSetGamma" >&5 $as_echo "$ac_cv_lib_Xxf86vm_XF86VidModeSetGamma" >&6; } if test "x$ac_cv_lib_Xxf86vm_XF86VidModeSetGamma" = xyes; then : have_xf86gamma=yes else true fi CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" fi # check for the Ramp versions of the functions too. if test "$have_xf86gamma" = yes; then have_xf86gamma_ramp=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 XF86VidModeSetGammaRamp in -lXxf86vm" >&5 $as_echo_n "checking for XF86VidModeSetGammaRamp in -lXxf86vm... " >&6; } if ${ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp+:} false; then : $as_echo_n "(cached) " >&6 else 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 XF86VidModeSetGammaRamp (); int main () { return XF86VidModeSetGammaRamp (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp=yes else ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp=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_XF86VidModeSetGammaRamp" >&5 $as_echo "$ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp" >&6; } if test "x$ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp" = xyes; then : have_xf86gamma_ramp=yes else true fi CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" fi # if those tests succeeded, then we've really got the functions. if test "$have_xf86gamma" = yes; then $as_echo "#define HAVE_XF86VMODE_GAMMA 1" >>confdefs.h fi if test "$have_xf86gamma_ramp" = yes; then $as_echo "#define HAVE_XF86VMODE_GAMMA_RAMP 1" >>confdefs.h 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 # 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_randr=yes fi case "$with_randr" 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 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 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 $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_randr_req="yes" with_randr=$with_randr_req ;; *) echo "" 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 # first check for Xrandr.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/Xrandr.h" "ac_cv_header_X11_extensions_Xrandr_h" "#include " 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 XRR code in the libraries if test "$have_randr" = 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 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="-lXrender -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 XRenderSetSubpixelOrder (); int main () { return XRenderSetSubpixelOrder (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xrender_XRenderSetSubpixelOrder=yes else 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_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 CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" # first look for RANDR in -lXext have_randr=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 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="-lXext $xrender_libs -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 XRRGetScreenInfo (); int main () { return XRRGetScreenInfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xext_XRRGetScreenInfo=yes else 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_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 CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" # if that failed, look in -lXrandr if test "$have_randr" = 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` 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_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXrandr $xrender_libs -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 XRRGetScreenInfo (); int main () { return XRRGetScreenInfo (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xrandr_XRRGetScreenInfo=yes else 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_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 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_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_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_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 XF86MiscSetGrabKeysState in -lXxf86misc" >&5 $as_echo_n "checking for XF86MiscSetGrabKeysState in -lXxf86misc... " >&6; } if ${ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lXxf86misc -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 XF86MiscSetGrabKeysState (); int main () { return XF86MiscSetGrabKeysState (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState=yes else ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState=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 else true fi CPPFLAGS="$ac_save_CPPFLAGS" 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 fi ############################################################################### # # Check for HP XHPDisableReset and XHPEnableReset. # ############################################################################### { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XHPDisableReset in X11/XHPlib.h" >&5 $as_echo_n "checking for XHPDisableReset in X11/XHPlib.h... " >&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 _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "XHPDisableReset" >/dev/null 2>&1; then : $as_echo "#define HAVE_XHPDISABLERESET 1" >>confdefs.h SAVER_LIBS="-lXhp11 $SAVER_LIBS" { $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; } fi rm -rf conftest* CPPFLAGS="$ac_save_CPPFLAGS" ############################################################################### # # Check for /proc/interrupts. # ############################################################################### have_proc_interrupts=no with_proc_interrupts_req=unspecified # Check whether --with-proc-interrupts was given. 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 fi 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether /proc/interrupts contains keyboard data" >&5 $as_echo_n "checking whether /proc/interrupts contains keyboard data... " >&6; } if ${ac_cv_have_proc_interrupts+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_have_proc_interrupts=no if grep 'keyboard\|i8042' /proc/interrupts >/dev/null 2>&1 ; then ac_cv_have_proc_interrupts=yes fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_proc_interrupts" >&5 $as_echo "$ac_cv_have_proc_interrupts" >&6; } have_proc_interrupts=$ac_cv_have_proc_interrupts fi if test "$have_proc_interrupts" = yes; then $as_echo "#define HAVE_PROC_INTERRUPTS 1" >>confdefs.h 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 # Check whether --with-proc-oom was given. if test "${with_proc_oom+set}" = set; then : withval=$with_proc_oom; with_proc_oom="$withval"; with_proc_oom_req="$withval" 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) # without a proper /proc filesystem. # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether /proc/$$/oom_score_adj exists" >&5 $as_echo_n "checking whether /proc/$$/oom_score_adj exists... " >&6; } if ${ac_cv_have_proc_oom+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_have_proc_oom=no if test -f /proc/$$/oom_score_adj; then ac_cv_have_proc_oom=yes fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_proc_oom" >&5 $as_echo "$ac_cv_have_proc_oom" >&6; } have_proc_oom=$ac_cv_have_proc_oom if test "$have_proc_oom" = yes; then $as_echo "#define HAVE_PROC_OOM 1" >>confdefs.h 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 # ############################################################################### # 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. # ############################################################################### 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 # 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" 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 fi case "$with_pam" 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 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 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 $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_pam_req="yes" with_pam=$with_pam_req ;; *) echo "" 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_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 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 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" 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. */ /* 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 # 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. */ /* 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 fi 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. */ /* 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 PASSWD_LIBS="${PASSWD_LIBS} -lrt" 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 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" 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 # 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 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 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 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi ############################################################################### # # Check for Kerberos. # ############################################################################### have_kerberos=no have_kerberos5=no with_kerberos_req=unspecified # 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_kerberos=yes fi case "$with_kerberos" 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 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 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 $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_kerberos_req="yes" with_kerberos=$with_kerberos_req ;; *) echo "" 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" = 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 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 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_kerberos=yes else 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_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 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 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_kerberos5=yes else 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_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 : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lkrb4 $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 krb_get_tf_realm (); int main () { return krb_get_tf_realm (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_krb4_krb_get_tf_realm=yes else 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_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 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 X 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="-lcrypt $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 (); 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 : PASSWD_LIBS="$PASSWD_LIBS -lcrypt" 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 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 : 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 : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lresolv $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 res_search (); int main () { return res_search (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_resolv_res_search=yes else 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_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... # ############################################################################### need_setuid=no 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 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 : $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 #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 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_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 #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 else 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_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 # 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="-lprot -lx $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 getprpwnam (); int main () { return getprpwnam (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_prot_getprpwnam=yes else 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_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="-lsecurity $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 getprpwnam (); int main () { return getprpwnam (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_security_getprpwnam=yes else 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_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 ############################################################################### # # 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 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_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsec $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 bigcrypt (); int main () { return bigcrypt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_sec_bigcrypt=yes else ac_cv_lib_sec_bigcrypt=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" fi 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 { $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 if test -f /etc/master.passwd ; then ac_cv_master_passwd=yes else ac_cv_master_passwd=no fi 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 fi fi ############################################################################### # # Check for traditional (ha!) shadow passwords. # ############################################################################### 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 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 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 need_setuid=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 : $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 getspnam (); int main () { return getspnam (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_c_getspnam=yes else 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 "$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 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 getspnam (); int main () { return getspnam (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_gen_getspnam=yes else 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 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 { $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. */ /* 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 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 ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypt $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 (); 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 # 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 $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 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 # 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" else with_passwd_helper=no fi # 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) : ;; /*) 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". # ############################################################################### 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' # 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 # 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 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_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 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_4" fi fi ;; /*) # 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 ;; *) # 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 : $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="" 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" { $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 -lgtk (and Gnome stuff) # ############################################################################### have_gtk=no with_gtk_req=unspecified # Check whether --with-gtk was given. if test "${with_gtk+set}" = set; then : withval=$with_gtk; with_gtk="$withval"; with_gtk_req="$withval" 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 /*) gtk_dir="$with_gtk" ;; *) gtk_dir="" ;; esac case "$with_gtk" in yes) ;; no) ;; /*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gtk headers" >&5 $as_echo_n "checking for Gtk headers... " >&6; } d=$with_gtk/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 Gtk libs" >&5 $as_echo_n "checking for Gtk libs... " >&6; } d=$with_gtk/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_gtk_req="yes" with_gtk=$with_gtk_req ;; *) echo "" echo "error: argument to --with-gtk 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_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 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gtk includes" >&5 $as_echo_n "checking for Gtk includes... " >&6; } if ${ac_cv_gtk_config_cflags+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_gtk_config_cflags=`$pkg_config --cflags $pkgs` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gtk_config_cflags" >&5 $as_echo "$ac_cv_gtk_config_cflags" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gtk libs" >&5 $as_echo_n "checking for Gtk libs... " >&6; } if ${ac_cv_gtk_config_libs+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_gtk_config_libs=`$pkg_config --libs $pkgs` fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gtk_config_libs" >&5 $as_echo "$ac_cv_gtk_config_libs" >&6; } 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" $as_echo "#define HAVE_GTK 1" >>confdefs.h $as_echo "#define HAVE_GTK2 1" >>confdefs.h $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 if test "$have_gtk" = yes; then for ac_prog in gnome-open 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_gnome_open_program+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$gnome_open_program"; then ac_cv_prog_gnome_open_program="$gnome_open_program" # 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_gnome_open_program="$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 fi fi gnome_open_program=$ac_cv_prog_gnome_open_program if test -n "$gnome_open_program"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gnome_open_program" >&5 $as_echo "$gnome_open_program" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$gnome_open_program" && break done for ac_prog in gnome-url-show 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_gnome_url_show_program+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$gnome_url_show_program"; then ac_cv_prog_gnome_url_show_program="$gnome_url_show_program" # 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_gnome_url_show_program="$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 fi fi gnome_url_show_program=$ac_cv_prog_gnome_url_show_program if test -n "$gnome_url_show_program"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gnome_url_show_program" >&5 $as_echo "$gnome_url_show_program" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$gnome_url_show_program" && break done fi ############################################################################### # # Check for -lXm. # ############################################################################### have_motif=no with_motif_req=unspecified # Check whether --with-motif was given. if test "${with_motif+set}" = set; then : withval=$with_motif; with_motif="$withval"; with_motif_req="$withval" else with_motif=no fi case "$with_motif" in yes) ;; no) ;; /*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Motif headers" >&5 $as_echo_n "checking for Motif headers... " >&6; } d=$with_motif/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 Motif libs" >&5 $as_echo_n "checking for Motif libs... " >&6; } d=$with_motif/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_motif_req="yes" with_motif=$with_motif_req ;; *) echo "" echo "error: argument to --with-motif 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_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_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" "Xm/Xm.h" "ac_cv_header_Xm_Xm_h" "#include #include #include " if test "x$ac_cv_header_Xm_Xm_h" = xyes; then : have_motif=yes $as_echo "#define HAVE_MOTIF 1" >>confdefs.h MOTIF_LIBS="$MOTIF_LIBS -lXm" fi CPPFLAGS="$ac_save_CPPFLAGS" fi if test "$have_motif" = 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" "Xm/ComboBox.h" "ac_cv_header_Xm_ComboBox_h" "#include #include #include " if test "x$ac_cv_header_Xm_ComboBox_h" = xyes; then : $as_echo "#define HAVE_XMCOMBOBOX 1" >>confdefs.h fi CPPFLAGS="$ac_save_CPPFLAGS" fi ############################################################################### # # Checking whether Motif is really Lesstif. # ############################################################################### have_lesstif=no if test "$have_motif" = yes ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Motif is really LessTif" >&5 $as_echo_n "checking whether Motif is really LessTif... " >&6; } if ${ac_cv_have_lesstif+:} 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 () { long vers = LesstifVersion; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_have_lesstif=yes else ac_cv_have_lesstif=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_have_lesstif" >&5 $as_echo "$ac_cv_have_lesstif" >&6; } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking LessTif version number" >&5 $as_echo_n "checking LessTif version number... " >&6; } if ${ac_cv_lesstif_version_string+:} 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` if test "$cross_compiling" = yes; then : ac_cv_lesstif_version=unknown ac_cv_lesstif_version_string=unknown else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #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); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ltv=`cat conftest-lt` ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'` ac_cv_lesstif_version_string=`echo $ltv | sed 's/.* //'` else ac_cv_lesstif_version=unknown ac_cv_lesstif_version_string=unknown fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi CPPFLAGS="$ac_save_CPPFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lesstif_version_string" >&5 $as_echo "$ac_cv_lesstif_version_string" >&6; } rm -rf 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking Motif version number" >&5 $as_echo_n "checking Motif version number... " >&6; } if ${ac_cv_motif_version_string+:} 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` if test "$cross_compiling" = yes; then : ac_cv_motif_version=unknown ac_cv_motif_version_string=unknown else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #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); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : mtv=`cat conftest-mt` ac_cv_motif_version=`echo $mtv | sed 's/ .*//'` ac_cv_motif_version_string=`echo $mtv | sed 's/.* //'` else ac_cv_motif_version=unknown ac_cv_motif_version_string=unknown fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext 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 ############################################################################### # # 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 -lXintl (for _Xsetlocale.) # ############################################################################### have_xintl=no if test "$have_motif" = 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" 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 _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. */ /* 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 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 else 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 ############################################################################### # # Check for -lGL or -lMesaGL. # ############################################################################### have_gl=no ac_have_mesa_gl=no with_gl_req=unspecified gl_halfassed=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_gl=yes fi 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 CPPFLAGS="$ac_save_CPPFLAGS" if test "$have_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_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 fi 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 # 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 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 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 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" { $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='' # 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 { $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. */ /* 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 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" fi 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_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 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. */ /* 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" fi CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" fi if test "$gl_lib_1" = "" ; 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_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 /* 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 : ac_cv_lib_GL_glXCreateContext=yes else ac_cv_lib_GL_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_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" 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 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 { $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 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>&5 | grep configure:` # M4 sucks!! mglv=`echo "$mglv" | sed -n \ 's/^configure: *\([0-9][0-9]*\) *\([0-9].*\)$/\1.\2/p'` rm -rf 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!! maj=`echo "$mglv" | sed -n 's/^\([0-9][0-9]*\)\..*$/\1/p'` min=`echo "$mglv" | sed -n 's/^.*\.\([0-9][0-9]*\).*$/\1/p'` 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 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 # Check for OpenGL 1.1 features. # 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 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 fi 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 GLE_LIBS="" 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 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" 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 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. */ /* 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_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 CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" 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_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 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. */ /* 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 CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" 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" # 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 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="-lmatrix $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 uview_direction_d (); int main () { return uview_direction_d (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_matrix_uview_direction_d=yes else 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_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_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 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 # Check whether --with-gles was given. if test "${with_gles+set}" = set; then : withval=$with_gles; with_gles="$withval"; with_gles_req="$withval" else with_gles=no fi case "$with_gles" 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 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 JWZGLES libs" >&5 $as_echo_n "checking for JWZGLES libs... " >&6; } d=$with_gles/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_gles_req="yes" with_gles=$with_gles_req ;; *) echo "" echo "error: argument to --with-gles 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_gles" = yes; then have_gles=yes $as_echo "#define HAVE_JWZGLES 1" >>confdefs.h 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" exit 1 fi ############################################################################### # # Check for -lpng # ############################################################################### have_png=no with_png_req=unspecified png_halfassed=no # 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_png=yes fi case "$with_png" 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 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 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 $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_png_req="yes" with_png=$with_png_req ;; *) echo "" 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_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_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" "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" 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" # 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 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="-lpng $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 png_create_read_struct (); int main () { return png_create_read_struct (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_png_png_create_read_struct=yes else 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_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 CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" 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 # 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_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 ;; *) 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 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 { $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 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.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" 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" # 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_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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for gdk_pixbuf usability..." >&5 $as_echo "checking for gdk_pixbuf usability..." >&6; } # library A... 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 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" # 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" 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. */ /* 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 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 CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" 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 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 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 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 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_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 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 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" "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" 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" # 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 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="-ljpeg $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 jpeg_start_compress (); int main () { return jpeg_start_compress (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_jpeg_jpeg_start_compress=yes else 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_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 CPPFLAGS="$ac_save_CPPFLAGS" LDFLAGS="$ac_save_LDFLAGS" # LIBS="$ac_save_LIBS" fi fi ############################################################################### # # Check for -lXft # ############################################################################### have_xutf8drawstring=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 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 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 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 fi have_xft=no with_xft_req=unspecified xft_halfassed=no # 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 fi case "$with_xft" 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 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 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 $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_xft_req="yes" with_xft=$with_xft_req ;; *) echo "" 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 "$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 { $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 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" have_xft=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" "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 CPPFLAGS="$ac_save_CPPFLAGS" 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 { $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 \! -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 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 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 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 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 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 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 fi 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` 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" 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" # 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 -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="-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 forkpty (); int main () { return forkpty (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_c_forkpty=yes else 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_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 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 with_xshm=yes fi 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 CPPFLAGS="$ac_save_CPPFLAGS" fi # if that succeeded, then check for sys/shm.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/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 # 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" # 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 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="-lXextSam -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 XShmQueryExtension (); int main () { return XShmQueryExtension (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_XextSam_XShmQueryExtension=yes else 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_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" 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 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 # 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 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 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/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 # 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_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="" #### 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" 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 # 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 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 ;; 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 # Check whether --with-browser was given. if test "${with_browser+set}" = set; then : withval=$with_browser; with_browser="$withval"; with_browser_req="$withval" else with_browser=no 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" ############################################################################### # # 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" # 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 # replace the directory string with "yes". setuid_hacks_req="yes" setuid_hacks=$setuid_hacks_req ;; *) 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 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" # Check whether --with-record-animation was given. if test "${with_record_animation+set}" = set; then : withval=$with_record_animation; record_anim="$withval" else record_anim="$record_anim_default" fi case "$record_anim" in yes) ;; no) ;; /*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for record animation headers" >&5 $as_echo_n "checking for record animation headers... " >&6; } d=$record_anim/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 record animation libs" >&5 $as_echo_n "checking for record animation libs... " >&6; } d=$record_anim/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". record_anim_req="yes" record_anim=$record_anim_req ;; *) echo "" echo "error: argument to --with-record-animation 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 "$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 as_fn_error $? "--with-record-animation requires GDK-Pixbuf" "$LINENO" 5 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabling --with-record-animation" >&5 $as_echo "enabling --with-record-animation" >&6; } $as_echo "#define HAVE_RECORD_ANIM 1" >>confdefs.h 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 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. # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for locale directory" >&5 $as_echo_n "checking for locale directory... " >&6; } 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 { $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'` # 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. # ############################################################################### 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" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done 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 ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C 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 # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' 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. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done 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"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. 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. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac 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" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "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/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" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; 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 # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # 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 # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF 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 do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $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 esac ;; "po/stamp-it":C) if ! grep "^# INTLTOOL_MAKEFILE$" "po/Makefile.in" > /dev/null ; then as_fn_error $? "po/Makefile.in.in was not created by intltoolize." "$LINENO" 5 fi rm -f "po/stamp-it" "po/stamp-it.tmp" "po/POTFILES" "po/Makefile.tmp" >"po/stamp-it.tmp" sed '/^#/d s/^[[].*] *// /^[ ]*$/d '"s|^| $ac_top_srcdir/|" \ "$srcdir/po/POTFILES.in" | sed '$!s/$/ \\/' >"po/POTFILES" sed '/^POTFILES =/,/[^\\]$/ { /^POTFILES =/!d r po/POTFILES } ' "po/Makefile.in" >"po/Makefile" rm -f "po/Makefile.tmp" mv "po/stamp-it.tmp" "po/stamp-it" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF 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 # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi ############################################################################### # # 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_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 "$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 "" as_fn_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." "$LINENO" 5 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!! 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` 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 xscreensaver-5.42+dfsg1/configure.in000066400000000000000000004527241342162430400175020ustar00rootroot00000000000000# 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_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_RECORD_ANIM], [Define this to enable recording of videos.]) # After checking to see that --srcdir is correct (which AC_INIT does) # check for some random other files that come later in the tar file, # to make sure everything is here. # for d in utils jwxyz hacks hacks/glx driver ; do f=$srcdir/$d/Makefile.in if test \! -r $f ; then echo "" echo "ERROR: The package is incomplete: $f does not exist." echo " This probably means that your download was truncated." echo "" exit 1 fi done ############################################################################### # # Query AX_PTHREAD, and figure out which compiler gets used. # ############################################################################### AC_DEFUN([AC_PROG_CC_PTHREAD], [have_pthread=no with_pthread_req=unspecified # AX_PTHREAD is from the GNU Autoconf Archive. # https://savannah.gnu.org/projects/autoconf-archive/ m4_include(ax_pthread.m4) # This affects CC, LIBS, and CFLAGS, instead of defining new variables. AC_ARG_WITH([pthread], [ --with-pthread Enables POSIX threads, for SMP support.], [with_pthread="$withval"; with_pthread_req="$withval"], [with_pthread=yes]) if test "$with_pthread" = yes; then # AX_PTHREAD might want a different compiler. AX_PTHREAD( [if test "$CC" = "$PTHREAD_CC" -o -z "$ac_original_cc"; then have_pthread=yes else ac_prog_cc_no_pthread=yes fi ]) if test "$have_pthread" = yes; then AC_DEFINE([HAVE_PTHREAD]) CC=$PTHREAD_CC fi fi ]) ############################################################################### # # Function to figure out how to run the compiler. # ############################################################################### AC_DEFUN([AC_PROG_CC_ANSI], [AC_REQUIRE([AC_PROG_CC]) if test -z "$GCC"; then # not using GCC AC_MSG_CHECKING(how to request ANSI compilation) case "$host" in *-hpux* ) AC_MSG_RESULT(HPUX: adding -Ae) CC="$CC -Ae" ;; *-aix* ) AC_MSG_RESULT(AIX: adding -qlanglvl=ansi -qhalt=e) CC="$CC -qlanglvl=ansi -qhalt=e" ;; *-dec-* ) AC_MSG_RESULT(DEC: adding -std1 -ieee) CC="$CC -std1" ;; *) AC_MSG_RESULT(no idea) ;; esac else # using GCC case "$host" in *-solaris*) AC_MSG_RESULT(Solaris: adding -D__EXTENSIONS__) CC="$CC -D__EXTENSIONS__" ;; esac fi OBJCC="$CC" AC_MSG_CHECKING([whether the compiler works on ANSI C]) AC_TRY_RUN([ main(int ac, char **av) { return 0; } ], AC_MSG_RESULT(yes), AC_MSG_RESULT(no) AC_MSG_ERROR(Couldn't build even a trivial ANSI C program: check CC.), AC_MSG_ERROR(Couldn't build even a trivial ANSI C program: check CC.)) if test -n "$GCC"; then AC_MSG_RESULT(Turning on gcc compiler warnings.) CC="$CC -pedantic -Wall -Wstrict-prototypes -Wnested-externs -Wmissing-prototypes" OBJCC="$OBJCC -Wall" # As of gcc 3.4, we have "-Wdeclaration-after-statement" # and so perhaps now we can do without -pedantic? else case "$host" in *-irix5* |*-irix6.[0-3]* ) AC_MSG_RESULT(Turning on SGI compiler warnings.) CC="$CC -fullwarn -use_readonly_const -rdata_shared -g3" ;; # *-dec-osf* ) # if test -z "$GCC"; then # AC_MSG_RESULT(Turning on DEC C compiler warnings.) # CC="$CC -migrate -w0 -verbose -warnprotos" # fi # ;; esac fi ]) ############################################################################### # # Check for availability of various gcc command-line options. # ############################################################################### AC_DEFUN([AC_CHECK_GCC_ARG], [if test -n "$GCC"; then AC_CACHE_CHECK([whether gcc accepts [$2]], ac_cv_gcc_accepts_[$1], [rm -rf conftest.$ac_ext touch conftest.$ac_ext if ( ( gcc -c [$2] conftest.$ac_ext -o/dev/null >/dev/null ) 2>&1 | \ grep unrecognized >/dev/null ); then ac_cv_gcc_accepts_[$1]=no else ac_cv_gcc_accepts_[$1]=yes CC="$CC [$2]" fi]) ac_gcc_accepts_[$1]="$ac_cv_gcc_accepts_[$1]" fi ]) AC_DEFUN([AC_NO_LONG_STRING_WARNINGS], [AC_CHECK_GCC_ARG(no_overlength, -Wno-overlength-strings)]) AC_DEFUN([AC_NO_MISPLACED_DECLARATIONS], [AC_CHECK_GCC_ARG(no_decl_after, -Wdeclaration-after-statement)]) # Need to disable Objective C extensions in ANSI C on MacOS X to work # around an Apple-specific gcc bug. # AC_DEFUN([AC_NO_OBJECTIVE_C], [AC_CHECK_GCC_ARG(no_cpp_precomp, -no-cpp-precomp)]) ############################################################################### # # Function to figure out how to disable // comments in ANSI C code. # # (With recent gcc, this is done with "-std=c89". With older gcc, this # is done by passing "-lang-c89" to cpp, by passing "-Wp,-lang-c89" to # gcc. Old gcc doesn't support -std, and new gcc doesn't support -lang. # so much for compatibility!) # # UPDATE: apparently there is NO WAY to tell gcc 3.2.2 to require that # declarations preceed statements, without resorting to "-pedantic". # This means that there is no way to get gcc3 to issue warnings that # ensure that your code complies with the ANSI/ISO C89 standard, without # also drowning in totally useless warnings. Thank you master may I # have another. # # So, I give up, let's just use -pedantic. # ############################################################################### AC_DEFUN([AC_GCC_ACCEPTS_STD], [ case "$host" in *-darwin* ) # Fucking Apple let // comments sneak into OpenGL headers, so # we *must* allow // comments when compiling on Mac OS 10.6! FUCK! ;; *) AC_CHECK_GCC_ARG(std, -std=c89) ;; esac ]) AC_DEFUN([AC_NO_CPLUSPLUS_COMMENTS_IN_C_CODE], [if test -n "$GCC"; then AC_GCC_ACCEPTS_STD AC_MSG_RESULT(Disabling C++ comments in ANSI C code.) # # The reason that // comments are banned from xscreensaver is that gcc is # basically the only compiler in the world that supports them in C code. # All other vendors support them only in their C++ compilers, not in their # ANSI C compilers. This means that it's a portability problem: every time # these comments have snuck into the xscreensaver source code, I've gotten # complaints about it the next day. So we turn off support for them in gcc # as well to prevent them from accidentially slipping in. # if test "$ac_gcc_accepts_std" = yes ; then # # -std=c89 defines __STRICT_ANSI__, which we don't want. # (That appears to be the only additional preprocessor symbol # it defines, in addition to the syntax changes it makes.) # # -std=gnu89 is no good, because // comments were a GNU extension # before they were in the ANSI C 99 spec... (gcc 2.96 permits // # with -std=gnu89 but not with -std=c89.) # # $CC already contains "-std=c89" via AC_GCC_ACCEPTS_STD CC="$CC -U__STRICT_ANSI__" # else # # The old way: # CC="$CC -Wp,-lang-c89" fi fi ]) ############################################################################### # # Function to figure out how to create directory trees. # ############################################################################### AC_DEFUN([AC_PROG_INSTALL_DIRS], [AC_CACHE_CHECK([whether "\${INSTALL} -d" creates intermediate directories], ac_cv_install_d_creates_dirs, [ac_cv_install_d_creates_dirs=no rm -rf conftestdir if mkdir conftestdir; then cd conftestdir 2>/dev/null ${INSTALL} -d `pwd`/dir1/dir2 >/dev/null 2>&1 if test -d dir1/dir2/. ; then ac_cv_install_d_creates_dirs=yes fi cd .. 2>/dev/null rm -rf conftestdir fi ]) if test "$ac_cv_install_d_creates_dirs" = no ; then AC_CACHE_CHECK([whether "mkdir -p" creates intermediate directories], ac_cv_mkdir_p_creates_dirs, [ac_cv_mkdir_p_creates_dirs=no rm -rf conftestdir if mkdir conftestdir; then cd conftestdir 2>/dev/null mkdir -p dir1/dir2 >/dev/null 2>&1 if test -d dir1/dir2/. ; then ac_cv_mkdir_p_creates_dirs=yes fi cd .. 2>/dev/null rm -rf conftestdir fi ]) fi if test "$ac_cv_install_d_creates_dirs" = yes ; then INSTALL_DIRS='${INSTALL} -d' elif test "$ac_cv_mkdir_p_creates_dirs" = yes ; then INSTALL_DIRS='mkdir -p' else # any other ideas? INSTALL_DIRS='${INSTALL} -d' fi ]) ############################################################################### # # Function to check whether gettimeofday() exists, and how to call it. # This may define HAVE_GETTIMEOFDAY and GETTIMEOFDAY_TWO_ARGS. # ############################################################################### AC_DEFUN([AC_GETTIMEOFDAY_ARGS], [AC_MSG_CHECKING(how to call gettimeofday) AC_CACHE_VAL(ac_cv_gettimeofday_args, [AC_TRY_COMPILE([#include #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 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 --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 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(INSTALL_SETUID) AC_SUBST(SETUID_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(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_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 "$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 xscreensaver-5.42+dfsg1/driver/000077500000000000000000000000001342162430400164465ustar00rootroot00000000000000xscreensaver-5.42+dfsg1/driver/.gdbinit000066400000000000000000000014541342162430400200730ustar00rootroot00000000000000# If you're debugging xscreensaver and you are running a virtual root window # manager, you'd better let the process handle these signals: it remaps the # virtual root window when they arrive. If you don't do this, your window # manager will be hosed. # # Also, gdb copes badly with breakpoints in functions that are called on the # other side of a fork(). The Trace/BPT traps cause the spawned process to # die. # #handle 1 pass nostop #handle 3 pass nostop #handle 4 pass nostop #handle 6 pass nostop #handle 7 pass nostop #handle 8 pass nostop #handle 9 pass nostop #handle 10 pass nostop #handle 11 pass nostop #handle 12 pass nostop #handle 13 pass nostop #handle 15 pass nostop #handle 19 pass nostop set env MallocGuardEdges 1 set env MallocPreScribble 1 set env MallocScribble 1 b exit set args -debug xscreensaver-5.42+dfsg1/driver/Makefile.in000066400000000000000000001103661342162430400205220ustar00rootroot00000000000000# driver/Makefile.in --- xscreensaver, Copyright (c) 1997-2010 Jamie Zawinski. # the `../configure' script generates `driver/Makefile' from this file. @SET_MAKE@ .SUFFIXES: .SUFFIXES: .c .m .o srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = .. install_prefix = prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ datarootdir = @datarootdir@ datadir = @datadir@ localedir = @PO_DATADIR@/locale mandir = @mandir@ libexecdir = @libexecdir@ mansuffix = 1 manNdir = $(mandir)/man$(mansuffix) INTLTOOL_MERGE = @INTLTOOL_MERGE@ GTK_DATADIR = @GTK_DATADIR@ GTK_APPDIR = $(GTK_DATADIR)/applications GTK_ICONDIR = $(GTK_DATADIR)/pixmaps GTK_GLADEDIR = $(GTK_DATADIR)/xscreensaver/glade 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_DATA = @INSTALL_DATA@ INSTALL_DIRS = @INSTALL_DIRS@ 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@ # Note: # # X_LIBS would more properly be called X_LDFLAGS (it contains the -L args.) # X_PRE_LIBS contains extra libraries you have to link against on some systems, # and that must come before -lX11. (e.g., -lSM and -lICE.) # X_EXTRA_LIBS contains extra libraries needed by X that aren't a part of X. # (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 UTILS_SRC = $(srcdir)/../utils 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 GTK_SRCS = demo-Gtk.c demo-Gtk-conf.c GTK_OBJS = demo-Gtk.o demo-Gtk-conf.o @GTK_EXTRA_OBJS@ PWENT_SRCS = passwd-pwent.c PWENT_OBJS = passwd-pwent.o KERBEROS_SRCS = passwd-kerberos.c KERBEROS_OBJS = passwd-kerberos.o PAM_SRCS = passwd-pam.c 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 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) 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@ EXES2 = @ALL_DEMO_PROGRAMS@ EXES_OSX = pdf2jpeg 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 MEN_OSX = xscreensaver-getimage-desktop.man pdf2jpeg.man MEN = $(MEN_1) @MEN_OSX@ EXTRAS = README Makefile.in \ XScreenSaver.ad.in XScreenSaver-Xm.ad xscreensaver.pam.in \ xscreensaver-demo.glade2.in xscreensaver-demo.glade2p \ 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) \ $(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) 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 install-strip: $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ install install-program: $(EXES) @if [ ! -d $(install_prefix)$(bindir) ]; then \ $(INSTALL_DIRS) $(install_prefix)$(bindir) ; \ 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@ ; do \ echo $(INSTALL_PROGRAM) $$exe $(install_prefix)$(bindir)/$$exe ; \ $(INSTALL_PROGRAM) $$exe $(install_prefix)$(bindir)/$$exe ; \ done install-ad: XScreenSaver.ad @if [ ! -d $(install_prefix)$(AD_DIR) ]; then \ $(INSTALL_DIRS) $(install_prefix)$(AD_DIR) ; \ fi @-echo $(INSTALL_DATA) XScreenSaver.ad \ $(install_prefix)$(AD_DIR)/XScreenSaver ; \ if $(INSTALL_DATA) XScreenSaver.ad \ $(install_prefix)$(AD_DIR)/XScreenSaver ; then \ true ; \ else \ e=echo ; \ if [ -f $(install_prefix)$(AD_DIR)/XScreenSaver ]; then \ $$e "" ;\ $$e " ####################################################################";\ $$e " Warning: unable to install $(install_prefix)$(AD_DIR)/XScreenSaver" ;\ $$e " That file exists, and is unwritable. It is probably from" ;\ $$e " an older version of xscreensaver, and could cause things" ;\ $$e " to malfunction. Please delete it!" ;\ $$e " ####################################################################";\ $$e "" ;\ exit 1 ; \ else \ $$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 " ####################################################################";\ $$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. # install-man: $(MEN) @men="$(MEN)" ; \ 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" ; \ \ if [ ! -d $(install_prefix)$(manNdir) ]; then \ $(INSTALL_DIRS) $(install_prefix)$(manNdir) ; \ 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' \ < $(srcdir)/$$man > $$T ; \ echo $(INSTALL_DATA) $(srcdir)/$$man \ $(install_prefix)$(manNdir)/$$instname ; \ $(INSTALL_DATA) $$T \ $(install_prefix)$(manNdir)/$$instname ; \ done ; \ rm -f $$T uninstall-program: @for program in $(EXES) $(SCRIPTS); do \ echo rm -f $(install_prefix)$(bindir)/$$program ; \ rm -f $(install_prefix)$(bindir)/$$program ; \ done uninstall-ad: rm -f $(install_prefix)$(AD_DIR)/XScreenSaver uninstall-man: @men="$(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* ; \ done install-pam: xscreensaver.pam @src="xscreensaver.pam" ; \ dest=`sed -n 's/.*PAM_SERVICE_NAME[ ]*"\([^"]*\)".*$$/\1/p' \ < ../config.h` ; \ dir="$(install_prefix)$(PAM_DIR)" ; \ conf="$(PAM_CONF)" ; \ \ if [ -d $$dir ] ; then \ \ if [ -f $$dir/xdm ]; then \ src2=$$dir/xdm ; \ elif [ -f $$dir/login ]; then \ src2=$$dir/login ; \ fi ; \ \ if [ -z "$$src2" ]; then \ echo $(INSTALL_DATA) $$src $$dir/$$dest ; \ $(INSTALL_DATA) $$src $$dir/$$dest ; \ 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 ; \ fi ; \ \ if [ ! -f $$dir/$$dest ]; 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 " ####################################################################";\ $$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" ; \ 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 ; \ if [ "x$$extras" = "x" ]; then \ echo "Error: no login rules in $$conf?" >&2 ; \ else \ echo "adding $$dest rules to $$src:" ; \ echo "$$extras" | sed 's/^/ /' ; \ fi ; \ echo $(INSTALL_DATA) $$src $$conf ; \ $(INSTALL_DATA) $$src $$conf ; \ echo rm -f $$src ; \ rm -f $$src ; \ fi ; \ if ( grep $$dest $$conf >/dev/null ); then \ echo ; \ else \ 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 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 " ####################################################################";\ $$e "" ;\ fi ; \ fi # screensaver-properties.desktop # into /usr/share/applications/ install-gnome:: screensaver-properties.desktop @if [ "$(GTK_DATADIR)" != "" ]; then \ if [ ! -d "$(install_prefix)$(GTK_APPDIR)" ]; then \ echo $(INSTALL_DIRS) "$(install_prefix)$(GTK_APPDIR)" ;\ $(INSTALL_DIRS) "$(install_prefix)$(GTK_APPDIR)" ;\ fi ;\ name2=xscreensaver-properties.desktop ;\ echo $(INSTALL_DATA) screensaver-properties.desktop \ $(install_prefix)$(GTK_APPDIR)/$$name2 ;\ $(INSTALL_DATA) screensaver-properties.desktop \ $(install_prefix)$(GTK_APPDIR)/$$name2 ;\ fi # xscreensaver.xpm # into /usr/share/pixmaps/ install-gnome:: $(LOGO) @if [ "$(GTK_DATADIR)" != "" ]; then \ if [ ! -d "$(install_prefix)$(GTK_ICONDIR)" ]; then \ echo $(INSTALL_DIRS) "$(install_prefix)$(GTK_ICONDIR)" ;\ $(INSTALL_DIRS) "$(install_prefix)$(GTK_ICONDIR)" ;\ fi ;\ target=xscreensaver.xpm ;\ echo $(INSTALL_DATA) $(LOGO) \ $(install_prefix)$(GTK_ICONDIR)/$$target ;\ $(INSTALL_DATA) $(LOGO) \ $(install_prefix)$(GTK_ICONDIR)/$$target ;\ fi # ../utils/images/screensaver-*.png # into /usr/share/xscreensaver/glade/ 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)" ;\ fi ;\ for target in $(GTK_ICONS) ; do \ dest=`echo $$target | sed 's@^.*/@@'` ;\ echo $(INSTALL_DATA) $$target \ $(install_prefix)$(GTK_GLADEDIR)/$$dest ;\ $(INSTALL_DATA) $$target \ $(install_prefix)$(GTK_GLADEDIR)/$$dest ;\ done ;\ fi # xscreensaver-demo.glade2 # into /usr/share/xscreensaver/glade/ install-gnome:: xscreensaver-demo.glade2 @if [ "$(GTK_DATADIR)" != "" ]; then \ if [ ! -d "$(install_prefix)$(GTK_GLADEDIR)" ]; then \ echo $(INSTALL_DIRS) "$(install_prefix)$(GTK_GLADEDIR)" ;\ $(INSTALL_DIRS) "$(install_prefix)$(GTK_GLADEDIR)" ;\ fi ;\ target=xscreensaver-demo.glade2 ;\ echo $(INSTALL_DATA) $$target \ $(install_prefix)$(GTK_GLADEDIR)/$$target ;\ if $(INSTALL_DATA) $$target \ $(install_prefix)$(GTK_GLADEDIR)/$$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 " be able to run properly." ;\ $$e " ####################################################################";\ $$e "" ;\ exit 1 ; \ fi ; \ fi # screensaver-properties.desktop # into /usr/share/applications/ uninstall-gnome:: @if [ "$(GTK_DATADIR)" != "" ]; then \ f=xscreensaver-properties.desktop ;\ echo rm -f $(install_prefix)$(GTK_APPDIR)/$$f ;\ rm -f $(install_prefix)$(GTK_APPDIR)/$$f ;\ fi # xscreensaver.xpm # into /usr/share/pixmaps/ uninstall-gnome:: @if [ "$(GTK_ICONDIR)" != "" ]; then \ target=xscreensaver.xpm ;\ echo rm -f $(install_prefix)$(GTK_ICONDIR)/$$target ;\ rm -f $(install_prefix)$(GTK_ICONDIR)/$$target ;\ fi # ../utils/images/screensaver-*.png # into /usr/share/xscreensaver/glade/ 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 ;\ done ;\ fi # xscreensaver-demo.glade2 # into /usr/share/xscreensaver/glade/ uninstall-gnome:: xscreensaver-demo.glade2 @if [ "$(GTK_DATADIR)" != "" ]; then \ target=xscreensaver-demo.glade2 ;\ echo rm -f $(install_prefix)$(GTK_GLADEDIR)/$$target ;\ rm -f $(install_prefix)$(GTK_GLADEDIR)/$$target ;\ fi # /usr/share/xscreensaver/config/README install-xml: @dest=$(install_prefix)$(HACK_CONF_DIR) ; \ if [ ! -d $$dest ]; then \ $(INSTALL_DIRS) $$dest ; \ fi ; \ src=$(srcdir)/../hacks/config ; \ echo $(INSTALL_DATA) $$src/README $$dest/README ; \ $(INSTALL_DATA) $$src/README $$dest/README # /usr/share/xscreensaver/config/README uninstall-xml: rm -f $(install_prefix)$(HACK_CONF_DIR)/README clean: -rm -f *.o a.out core $(EXES) $(EXES2) $(TEST_EXES) \ XScreenSaver_ad.h XScreenSaver_Xm_ad.h distclean: clean -rm -f Makefile XScreenSaver.ad \ TAGS *~ "#"* screensaver-properties.desktop # Adds all current dependencies to Makefile 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) # Adds some dependencies to Makefile.in -- not totally accurate, but pretty # close. This excludes dependencies on files in /usr/include, etc. It tries # to include only dependencies on files which are themselves a part of this # package. distdepend: check_men update_ad_version XScreenSaver_ad.h XScreenSaver_Xm_ad.h @echo updating dependencies in `pwd`/Makefile.in... ; \ $(DEPEND) -w 0 -f - \ -s '# DO NOT DELETE: updated by make distdepend' $(DEPEND_FLAGS) -- \ $(INCLUDES_1) $(DEFS) $(DEPEND_DEFINES) $(CFLAGS) $(X_CFLAGS) -- \ $(SAVER_SRCS_1) $(MOTIF_SRCS) $(GTK_SRCS) $(GETIMG_SRCS_1) \ $(PWENT_SRCS) $(LOCK_SRCS_1) $(DEMO_SRCS_1) $(CMD_SRCS) \ $(TEST_SRCS) 2>/dev/null | \ sort -d | \ ( \ awk '/^# .*Makefile.in ---/,/^# DO .*distdepend/' < Makefile.in ; \ sed -e '/^#.*/d' \ -e 's@ \./@ @g;s@ /[^ ]*@@g;/^.*:$$/d' \ -e 's@\.\./utils@$$(UTILS_SRC)@g' \ -e 's@ \([^$$]\)@ $$(srcdir)/\1@g' \ -e 's@$$.*\(XScreenSaver_ad\)@\1@g' \ -e 's@$$.*\(XScreenSaver_Xm_ad\)@\1@g' \ -e 's@ $$(srcdir)/\(.*config\.h\)@ \1@g' ; \ echo '' \ ) > /tmp/distdepend.$$$$ && \ mv /tmp/distdepend.$$$$ Makefile.in # Updates the version number in the app-defaults file to be in sync with # the version number in version.h. This is so people can tell when they # have a version skew between the app-defaults file and the executable. # Also update hacks/config/README in the same way. 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` ; \ 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/" \ -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 ; \ if cmp -s $$S $$T ; then \ true ; \ else \ cat $$T > $$S ; \ echo "updated $$S to $$V $$D" ; \ fi ; \ done ; \ rm $$T TAGS: tags tags: find $(srcdir) -name '*.[chly]' -print | xargs etags -a echo_tarfiles: @$(MAKE) XScreenSaver_ad.h XScreenSaver_Xm_ad.h 2>&1 >/dev/null @echo $(TARFILES) check_men: @badmen="" ; \ for exe in $(EXES); do \ if ! [ -f $(srcdir)/$$exe.man ]; then \ badmen="$$badmen $$exe" ; \ fi ; \ done ; \ if [ -n "$$badmen" ]; then \ echo "" ; \ echo "Warning: The following programs have no manuals:" ; \ echo "" ; \ for m in $$badmen ; do \ echo " $$m" ; \ done ; \ echo "" ; \ 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... # $(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 $(UTILS_BIN)/visual.o: $(UTILS_SRC)/visual.c $(UTILS_BIN)/xmu.o: $(UTILS_SRC)/xmu.c $(UTILS_BIN)/logo.o: $(UTILS_SRC)/logo.c $(UTILS_BIN)/minixpm.o: $(UTILS_SRC)/minixpm.c $(UTILS_BIN)/yarandom.o: $(UTILS_SRC)/yarandom.c $(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)/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 $(UTIL_OBJS): cd $(UTILS_BIN) ; \ $(MAKE) $(@F) CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" # How we build object files in this directory. .c.o: $(CC) -c $(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) $< .m.o: $(OBJCC) -c $(INCLUDES) $(DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) $< # subprocs takes an extra -D option. subprocs.o: subprocs.c $(CC) -c $(INCLUDES) $(SUBP_DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) \ $(srcdir)/subprocs.c # xscreensaver takes an extra -D option. xscreensaver.o: xscreensaver.c $(CC) -c $(INCLUDES) $(DEFS) $(INTL_DEFS) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) \ $(srcdir)/xscreensaver.c # 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 # 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 # 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 XScreenSaver_Xm_ad.h: XScreenSaver-Xm.ad $(SHELL) $(UTILS_SRC)/ad2c XScreenSaver-Xm.ad > XScreenSaver_Xm_ad.h @INTLTOOL_DESKTOP_RULE@ # The executables linked in this directory. # xscreensaver: $(SAVER_OBJS) $(CC) $(LDFLAGS) -o $@ $(SAVER_OBJS) $(SAVER_LIBS) $(INTL_LIBS) xscreensaver-command: $(CMD_OBJS) $(CC) $(LDFLAGS) -o $@ $(CMD_OBJS) $(CMD_LIBS) xscreensaver-demo: @PREFERRED_DEMO_PROGRAM@ @if [ "@PREFERRED_DEMO_PROGRAM@" = "" ]; then \ echo "WARNING: neither GTK nor Motif are available," \ "therefore no xscreensaver-demo!" ; \ 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) 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-getimage: $(GETIMG_OBJS) $(CC) $(LDFLAGS) -o $@ $(GETIMG_OBJS) $(GETIMG_LIBS) -lm pdf2jpeg: $(PDF2JPEG_OBJS) $(OBJCC) $(LDFLAGS) -o $@ $(PDF2JPEG_OBJS) $(PDF2JPEG_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 test-passwd: $(TEST_PASSWD_OBJS) XScreenSaver_ad.h $(CC) $(LDFLAGS) -o $@ $(TEST_PASSWD_OBJS) $(SAVER_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) 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) 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) 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) test-grab: test-grab.o $(CC) $(LDFLAGS) -o $@ test-grab.o $(SAVER_LIBS) test-apm: test-apm.o $(CC) $(LDFLAGS) -o $@ test-apm.o $(SAVER_LIBS) -lapm test-mlstring.o: mlstring.c test-mlstring: test-mlstring.o $(CC) -DTEST $(LDFLAGS) -o $@ test-mlstring.o $(SAVER_LIBS) TEST_FADE_OBJS = test-fade.o $(UTILS_SRC)/fade.o $(DEMO_UTIL_OBJS) test-fade: test-fade.o $(UTILS_BIN)/fade.o $(CC) $(LDFLAGS) -o $@ $(TEST_FADE_OBJS) $(SAVER_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-yarandom: test-yarandom.o $(CC) -DTEST $(LDFLAGS) -o $@ test-yarandom.o $(UTILS_BIN)/yarandom.o xdpyinfo.o: xdpyinfo.c $(CC) -c $(INCLUDES) -DHAVE_GLX $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) \ $(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 ############################################################################## # # DO NOT DELETE: updated by make distdepend 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: ../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)/xscreensaver-intl.h demo-Xm.o: ../config.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.o: $(srcdir)/auth.h passwd.o: ../config.h passwd.o: $(srcdir)/prefs.h passwd.o: $(srcdir)/types.h passwd.o: $(srcdir)/xscreensaver.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: ../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: ../config.h test-fade.o: $(srcdir)/prefs.h test-fade.o: $(srcdir)/types.h test-fade.o: $(UTILS_SRC)/fade.h test-fade.o: $(srcdir)/xscreensaver.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: ../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: ../config.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: $(UTILS_SRC)/visual.h test-screens.o: $(srcdir)/xscreensaver.h test-uid.o: ../config.h test-vp.o: ../config.h test-xdpms.o: ../config.h test-xinerama.o: ../config.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: ../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-5.42+dfsg1/driver/README000066400000000000000000000004351342162430400173300ustar00rootroot00000000000000 This directory contains the source for xscreensaver and xscreensaver-command, the screensaver driver, and the program for externally controlling it. Some stuff from the ../utils/ directory is used here as well. If you have compilation problems, check the parameters in ../config.h. xscreensaver-5.42+dfsg1/driver/XScreenSaver-Xm.ad000066400000000000000000000070011342162430400217040ustar00rootroot00000000000000! Resources for the Motif dialog boxes of the "xscreensaver-demo" program. ! *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 ! above must be fully qualified to get around *sgiMode. *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 xscreensaver-5.42+dfsg1/driver/XScreenSaver.ad.in000066400000000000000000000464001342162430400217350ustar00rootroot00000000000000! ! XScreenSaver ! ! a screen saver and locker for the X window system ! by Jamie Zawinski ! ! version 5.42 ! 28-Dec-2018 ! ! See "man xscreensaver" for more info. The latest version is always ! available at https://www.jwz.org/xscreensaver/ ! These resources, when placed in the system-wide app-defaults directory ! (e.g., /usr/lib/X11/app-defaults/XScreenSaver) will provide the default ! settings for new users. However, if you have a ".xscreensaver" file in ! your home directory, the settings in that file take precedence. ! Don't hand this file to "xrdb" -- that isn't how app-defaults files work. ! Though app-defaults files have (mostly) the same syntax as your ~/.Xdefaults ! file, they are used differently, and if you run this file through xrdb, ! you will probably mess things up. #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. ! /* (xrdb prevention kludge: whole file) *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: @DEFAULT_IMAGES_P@ ! This can be a local directory name, or the URL of an RSS or Atom feed. *imageDirectory: @DEFAULT_IMAGE_DIRECTORY@ *nice: 10 *memoryLimit: 0 *lock: False *verbose: False *timestamp: True *fade: True *unfade: False *fadeSeconds: 0:00:03 *fadeTicks: 20 *splash: True *splashDuration: 0:00:05 *visualID: default *captureStderr: True *ignoreUninstalledPrograms: False *authWarningSlack: 20 *textMode: file *textLiteral: XScreenSaver *textFile: @DEFAULT_TEXT_FILE@ *textProgram: fortune *textURL: https://en.wikipedia.org/w/index.php?title=Special:NewPages&feed=rss *overlayTextForeground: #FFFF00 *overlayTextBackground: #000000 *overlayStderr: True *font: *-medium-r-*-140-*-m-* ! The default is to use these 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 "Demo" button on the splash screen runs (/bin/sh syntax.) *demoCommand: xscreensaver-demo ! This is what the "Prefs" button on the splash screen runs (/bin/sh syntax.) *prefsCommand: xscreensaver-demo -prefs ! This is the URL loaded by the "Help" button on the splash screen, ! and by the "Documentation" menu item in xscreensaver-demo. *helpURL: https://www.jwz.org/xscreensaver/man.html ! loadURL -- how the "Help" buttons load the helpURL (/bin/sh syntax.) ! manualCommand -- how the "Documentation" buttons display man pages. ! ! 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) ! @GNOME24@*loadURL: @WITH_BROWSER@ '%s' @GNOME24@*manualCommand: gnome-terminal --title '%s manual' \ @GNOME24@ --command '/bin/sh -c "man %s; read foo"' ! ! Gnome 2.2: ! @GNOME22@*loadURL: gnome-url-show '%s' @GNOME22@*manualCommand: gnome-terminal --title '%s manual' \ @GNOME22@ --command '/bin/sh -c "man %s; read foo"' ! ! Gnome 1.4: ! ! *loadURL: gnome-moz-remote --newwin '%s' ! *manualCommand: gnome-help-browser 'man:%s' ! ! non-Gnome systems: ! @NOGNOME@*loadURL: firefox '%s' || mozilla '%s' || netscape '%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 ! To show the time only: ! *dateFormat: %I:%M %p ! For 24 hour time: ! *dateFormat: %H:%M ! 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.) ! For Gnome: probably "gdmflexiserver -ls". KDE, probably "kdmctl reserve". ! Or maybe yet another wheel-reinvention, "lxdm -c USER_SWITCH". ! Oh wait, this wheel just keeps getting better: "dm-tool switch-to-greeter". ! @NEW_LOGIN_COMMAND_P@*newLoginCommand: @NEW_LOGIN_COMMAND@ ! Turning on "installColormap" on 8-bit systems interacts erratically with ! certain jurassic window managers. If your screen turns some color other ! than black, the window manager is buggy, and you need to set this resource ! to false. Or switch WMs. Or join the 21st century and get a 24-bit ! graphics card. ! *installColormap: True ! This is the list of installed screen saver modes. See "man xscreensaver" ! for the syntax used here. ! ! 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 ! screen savers interactively. ! *programs: \ maze -root \n\ @GL_KLUDGE@ 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_KLUDGE@ GL: jigsaw -root \n\ julia -root \n\ - kaleidescope -root \n\ @GL_KLUDGE@ GL: moebius -root \n\ moire -root \n\ @GL_KLUDGE@ GL: morph3d -root \n\ mountain -root \n\ munch -root \n\ penrose -root \n\ @GL_KLUDGE@ GL: pipes -root \n\ rd-bomb -root \n\ @GL_KLUDGE@ GL: rubik -root \n\ - sierpinski -root \n\ slip -root \n\ @GL_KLUDGE@ GL: sproingies -root \n\ starfish -root \n\ strange -root \n\ swirl -root \n\ triangle -root \n\ xjack -root \n\ xlyap -root \n\ @GL_KLUDGE@ GL: atlantis -root \n\ bsod -root \n\ @GL_KLUDGE@ GL: bubble3d -root \n\ @GL_KLUDGE@ GL: cage -root \n\ - crystal -root \n\ cynosure -root \n\ discrete -root \n\ distort -root \n\ epicycle -root \n\ flow -root \n\ @GL_KLUDGE@ GL: glplanet -root \n\ interference -root \n\ kumppa -root \n\ @GL_KLUDGE@ GL: lament -root \n\ moire2 -root \n\ @GL_KLUDGE@ GL: sonar -root \n\ @GL_KLUDGE@ 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\ @GLE_KLUDGE@ GL: extrusion -root \n\ - loop -root \n\ penetrate -root \n\ petri -root \n\ phosphor -root \n\ @GL_KLUDGE@ GL: pulsar -root \n\ ripples -root \n\ shadebobs -root \n\ @GL_KLUDGE@ GL: sierpinski3d -root \n\ spotlight -root \n\ squiral -root \n\ wander -root \n\ - webcollage -root \n\ xflame -root \n\ xmatrix -root \n\ @GL_KLUDGE@ GL: gflux -root \n\ - nerverot -root \n\ xrayswarm -root \n\ xspirograph -root \n\ @GL_KLUDGE@ GL: circuit -root \n\ @GL_KLUDGE@ GL: dangerball -root \n\ - GL: dnalogo -root \n\ @GL_KLUDGE@ GL: engine -root \n\ @GL_KLUDGE@ GL: flipscreen3d -root \n\ @GL_KLUDGE@ GL: gltext -root \n\ @GL_KLUDGE@ GL: menger -root \n\ @GL_KLUDGE@ GL: molecule -root \n\ rotzoomer -root \n\ speedmine -root \n\ @GL_KLUDGE@ GL: starwars -root \n\ @GL_KLUDGE@ GL: stonerview -root \n\ vermiculate -root \n\ whirlwindwarp -root \n\ zoom -root \n\ anemone -root \n\ apollonian -root \n\ @GL_KLUDGE@ GL: boxed -root \n\ @GL_KLUDGE@ GL: cubenetic -root \n\ @GL_KLUDGE@ GL: endgame -root \n\ euler2d -root \n\ fluidballs -root \n\ @GL_KLUDGE@ GL: flurry -root \n\ - GL: glblur -root \n\ @GL_KLUDGE@ GL: glsnake -root \n\ halftone -root \n\ @GL_KLUDGE@ GL: juggler3d -root \n\ @GL_KLUDGE@ GL: lavalite -root \n\ - polyominoes -root \n\ @GL_KLUDGE@ GL: queens -root \n\ - GL: sballs -root \n\ @GL_KLUDGE@ GL: spheremonics -root \n\ - thornbird -root \n\ twang -root \n\ - GL: antspotlight -root \n\ apple2 -root \n\ @GL_KLUDGE@ GL: atunnel -root \n\ barcode -root \n\ @GL_KLUDGE@ GL: blinkbox -root \n\ @GL_KLUDGE@ GL: blocktube -root \n\ @GL_KLUDGE@ GL: bouncingcow -root \n\ cloudlife -root \n\ @GL_KLUDGE@ GL: cubestorm -root \n\ eruption -root \n\ @GL_KLUDGE@ GL: flipflop -root \n\ @GL_KLUDGE@ GL: flyingtoasters -root \n\ fontglide -root \n\ @GL_KLUDGE@ GL: gleidescope -root \n\ @GL_KLUDGE@ GL: glknots -root \n\ @GL_KLUDGE@ GL: glmatrix -root \n\ - GL: glslideshow -root \n\ @GL_KLUDGE@ GL: hypertorus -root \n\ - GL: jigglypuff -root \n\ metaballs -root \n\ @GL_KLUDGE@ GL: mirrorblob -root \n\ piecewise -root \n\ @GL_KLUDGE@ GL: polytopes -root \n\ pong -root \n\ popsquares -root \n\ @GL_KLUDGE@ 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_KLUDGE@ GL: noof -root \n\ pacman -root \n\ @GL_KLUDGE@ GL: pinion -root \n\ @GL_KLUDGE@ GL: polyhedra -root \n\ - GL: providence -root \n\ substrate -root \n\ wormhole -root \n\ - GL: antmaze -root \n\ @GL_KLUDGE@ GL: boing -root \n\ boxfit -root \n\ @GL_KLUDGE@ GL: carousel -root \n\ celtic -root \n\ @GL_KLUDGE@ GL: crackberg -root \n\ @GL_KLUDGE@ GL: cube21 -root \n\ fiberlamp -root \n\ @GL_KLUDGE@ GL: fliptext -root \n\ @GL_KLUDGE@ GL: glhanoi -root \n\ @GL_KLUDGE@ GL: tangram -root \n\ @GL_KLUDGE@ GL: timetunnel -root \n\ @GL_KLUDGE@ GL: glschool -root \n\ @GL_KLUDGE@ GL: topblock -root \n\ @GL_KLUDGE@ GL: cubicgrid -root \n\ cwaves -root \n\ @GL_KLUDGE@ GL: gears -root \n\ @GL_KLUDGE@ GL: glcells -root \n\ @GL_KLUDGE@ GL: lockward -root \n\ m6502 -root \n\ @GL_KLUDGE@ GL: moebiusgears -root \n\ @GL_KLUDGE@ GL: voronoi -root \n\ @GL_KLUDGE@ GL: hypnowheel -root \n\ @GL_KLUDGE@ GL: klein -root \n\ - lcdscrub -root \n\ @GL_KLUDGE@ GL: photopile -root \n\ @GL_KLUDGE@ GL: skytentacles -root \n\ @GL_KLUDGE@ GL: rubikblocks -root \n\ @GL_KLUDGE@ GL: companioncube -root \n\ @GL_KLUDGE@ GL: hilbert -root \n\ @GL_KLUDGE@ GL: tronbit -root \n\ @GL_KLUDGE@ GL: geodesic -root \n\ hexadrop -root \n\ @GL_KLUDGE@ GL: kaleidocycle -root \n\ @GL_KLUDGE@ GL: quasicrystal -root \n\ @GL_KLUDGE@ GL: unknownpleasures -root \n\ binaryring -root \n\ @GL_KLUDGE@ GL: cityflow -root \n\ @GL_KLUDGE@ GL: geodesicgears -root \n\ @GL_KLUDGE@ GL: projectiveplane -root \n\ @GL_KLUDGE@ GL: romanboy -root \n\ tessellimage -root \n\ @GL_KLUDGE@ GL: winduprobot -root \n\ @GL_KLUDGE@ GL: splitflap -root \n\ @GL_KLUDGE@ GL: cubestack -root \n\ @GL_KLUDGE@ GL: cubetwist -root \n\ @GL_KLUDGE@ GL: discoball -root \n\ @GL_KLUDGE@ GL: dymaxionmap -root \n\ @GL_KLUDGE@ GL: energystream -root \n\ @GL_KLUDGE@ GL: hexstrut -root \n\ @GL_KLUDGE@ GL: hydrostat -root \n\ @GL_KLUDGE@ GL: raverhoop -root \n\ @GL_KLUDGE@ GL: splodesic -root \n\ @GL_KLUDGE@ GL: unicrud -root \n\ @GL_KLUDGE@ GL: esper -root \n\ @GL_KLUDGE@ GL: vigilance -root \n\ @GL_KLUDGE@ GL: crumbler -root \n\ filmleader -root \n\ glitchpeg -root \n\ @GL_KLUDGE@ GL: handsy -root \n\ @GL_KLUDGE@ GL: maze3d -root \n\ @GL_KLUDGE@ GL: peepers -root \n\ @GL_KLUDGE@ GL: razzledazzle -root \n\ vfeedback -root \n !============================================================================= ! ! You probably don't want to change anything after this point. ! !============================================================================= XScreenSaver.pointerPollTime: 0:00:05 XScreenSaver.pointerHysteresis: 10 XScreenSaver.initialDelay: 0:00:00 XScreenSaver.windowCreationTimeout: 0:00:30 XScreenSaver.bourneShell: /bin/sh ! Resources for the password and splash-screen dialog boxes of ! the "xscreensaver" daemon. ! *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-medium-r-*-*-*-140-*-*-*-iso8859-1 *Dialog.foreground: #000000 *Dialog.background: #E6E6E6 *Dialog.Button.foreground: #000000 *Dialog.Button.background: #F5F5F5 !*Dialog.Button.pointBackground: #EAEAEA !*Dialog.Button.clickBackground: #C3C3C3 *Dialog.text.foreground: #000000 *Dialog.text.background: #FFFFFF *passwd.thermometer.foreground: #4464AC *passwd.thermometer.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.heading.label: XScreenSaver %s *passwd.body.label: This screen is locked. *passwd.unlock.label: OK *passwd.login.label: New Login *passwd.user.label: Username: *passwd.thermometer.width: 8 *passwd.asterisks: True *passwd.uname: True *splash.heading.label: XScreenSaver %s *splash.body.label: Copyright \251 1991-2018 by *splash.body2.label: Jamie Zawinski *splash.demo.label: Settings *splash.help.label: Help !============================================================================= ! ! Pretty names for the hacks that have unusual capitalization. ! !============================================================================= *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.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.dnalogo.name: DNA Logo *hacks.dymaxionmap.name: DymaxionMap *hacks.energystream.name: EnergyStream *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.gflux.name: GFlux *hacks.gleidescope.name: Gleidescope *hacks.glforestfire.name: GLForestFire *hacks.glitchpeg.name: GlitchPEG *hacks.hyperball.name: HyperBall *hacks.hypercube.name: HyperCube *hacks.ifs.name: IFS *hacks.imsmap.name: IMSMap *hacks.jigglypuff.name: JigglyPuff *hacks.juggler3d.name: Juggler3D *hacks.lcdscrub.name: LCDscrub *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.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.t3d.name: T3D *hacks.testx11.name: TestX11 *hacks.timetunnel.name: TimeTunnel *hacks.topblock.name: TopBlock *hacks.tronbit.name: TronBit *hacks.unknownpleasures.name:UnknownPleasures *hacks.vfeedback.name: VFeedback *hacks.vidwhacker.name: VidWhacker *hacks.webcollage.name: WebCollage *hacks.whirlwindwarp.name: WhirlWindWarp *hacks.winduprobot.name: WindupRobot *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) */ xscreensaver-5.42+dfsg1/driver/XScreenSaver_Xm_ad.h000066400000000000000000000072641342162430400223100ustar00rootroot00000000000000"*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", xscreensaver-5.42+dfsg1/driver/XScreenSaver_ad.h000066400000000000000000000351751342162430400216460ustar00rootroot00000000000000"#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", "*timestamp: True", "*fade: True", "*unfade: False", "*fadeSeconds: 0:00:03", "*fadeTicks: 20", "*splash: True", "*splashDuration: 0:00:05", "*visualID: default", "*captureStderr: 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", "*overlayTextForeground: #FFFF00", "*overlayTextBackground: #000000", "*overlayStderr: True", "*font: *-medium-r-*-140-*-m-*", "*sgiSaverExtension: True", "*xidleExtension: True", "*procInterrupts: True", "*xinputExtensionDev: False", "GetViewPortIsFullOfLies: False", "*demoCommand: xscreensaver-demo", "*prefsCommand: xscreensaver-demo -prefs", "*helpURL: https://www.jwz.org/xscreensaver/man.html", "*loadURL: firefox '%s' || mozilla '%s' || netscape '%s'", "*manualCommand: xterm -sb -fg black -bg gray75 -T '%s manual' \ -e /bin/sh -c 'man \"%s\" ; read foo'", "*dateFormat: %d-%b-%y (%a); %I:%M %p", "*installColormap: True", "*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\ 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", "XScreenSaver.pointerPollTime: 0:00:05", "XScreenSaver.pointerHysteresis: 10", "XScreenSaver.initialDelay: 0:00:00", "XScreenSaver.windowCreationTimeout: 0:00:30", "XScreenSaver.bourneShell: /bin/sh", "*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", "*passwd.passwdFont: -*-courier-medium-r-*-*-*-140-*-*-*-iso8859-1", "*Dialog.foreground: #000000", "*Dialog.background: #E6E6E6", "*Dialog.Button.foreground: #000000", "*Dialog.Button.background: #F5F5F5", "*Dialog.text.foreground: #000000", "*Dialog.text.background: #FFFFFF", "*passwd.thermometer.foreground: #4464AC", "*passwd.thermometer.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.heading.label: XScreenSaver %s", "*passwd.body.label: This screen is locked.", "*passwd.unlock.label: OK", "*passwd.login.label: New Login", "*passwd.user.label: Username:", "*passwd.thermometer.width: 8", "*passwd.asterisks: True", "*passwd.uname: True", "*splash.heading.label: XScreenSaver %s", "*splash.body.label: Copyright \\251 1991-2018 by", "*splash.body2.label: Jamie Zawinski ", "*splash.demo.label: Settings", "*splash.help.label: Help", "*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.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.dnalogo.name: DNA Logo", "*hacks.dymaxionmap.name: DymaxionMap", "*hacks.energystream.name: EnergyStream", "*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.gflux.name: GFlux", "*hacks.gleidescope.name: Gleidescope", "*hacks.glforestfire.name: GLForestFire", "*hacks.glitchpeg.name: GlitchPEG", "*hacks.hyperball.name: HyperBall", "*hacks.hypercube.name: HyperCube", "*hacks.ifs.name: IFS", "*hacks.imsmap.name: IMSMap", "*hacks.jigglypuff.name: JigglyPuff", "*hacks.juggler3d.name: Juggler3D", "*hacks.lcdscrub.name: LCDscrub", "*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.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.t3d.name: T3D", "*hacks.testx11.name: TestX11", "*hacks.timetunnel.name: TimeTunnel", "*hacks.topblock.name: TopBlock", "*hacks.tronbit.name: TronBit", "*hacks.unknownpleasures.name:UnknownPleasures", "*hacks.vfeedback.name: VFeedback", "*hacks.vidwhacker.name: VidWhacker", "*hacks.webcollage.name: WebCollage", "*hacks.whirlwindwarp.name: WhirlWindWarp", "*hacks.winduprobot.name: WindupRobot", "*hacks.xanalogtv.name: XAnalogTV", "*hacks.xrayswarm.name: XRaySwarm", "*hacks.documentation.isInstalled: True", xscreensaver-5.42+dfsg1/driver/auth.h000066400000000000000000000023671342162430400175700ustar00rootroot00000000000000/* auth.h --- Providing authentication mechanisms. * * (c) 2007, Quest Software, Inc. All rights reserved. * * This file is part of XScreenSaver, * Copyright (c) 1993-2004 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 XSS_AUTH_H #define XSS_AUTH_H #include "types.h" #undef Bool #undef True #undef False #define Bool int #define True 1 #define False 0 struct auth_message { enum { AUTH_MSGTYPE_INFO, AUTH_MSGTYPE_ERROR, AUTH_MSGTYPE_PROMPT_NOECHO, AUTH_MSGTYPE_PROMPT_ECHO } type; const char *msg; }; struct auth_response { char *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); void auth_finished_cb (saver_info *si); #endif xscreensaver-5.42+dfsg1/driver/compile_axp.com000066400000000000000000000023731342162430400214530ustar00rootroot00000000000000$ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) DEMO.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) DIALOGS-XM.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) LOCK.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) PASSWD.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) STDERR.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,NO_SETUID)/INCL=([],[-],[-.UTILS]) SUBPROCS.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) TIMERS.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) WINDOWS.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) XSCREENSAVER-COMMAND.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,NO_SETUID)/INCL=([],[-],[-.UTILS]) XSCREENSAVER.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) XSET.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) VMS-GETPWNAM.C $!!! CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) GETPWUID.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) VMS-HPWD.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) VMS-VALIDATE.C xscreensaver-5.42+dfsg1/driver/compile_decc.com000066400000000000000000000023731342162430400215610ustar00rootroot00000000000000$ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) DEMO.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) DIALOGS-XM.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) LOCK.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) PASSWD.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) STDERR.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,NO_SETUID)/INCL=([],[-],[-.UTILS]) SUBPROCS.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) TIMERS.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) WINDOWS.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) XSCREENSAVER-COMMAND.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H,NO_SETUID)/INCL=([],[-],[-.UTILS]) XSCREENSAVER.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) XSET.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) VMS-GETPWNAM.C $!!! CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) GETPWUID.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) VMS-HPWD.C $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-],[-.UTILS]) VMS-VALIDATE.C xscreensaver-5.42+dfsg1/driver/demo-Gtk-conf.c000066400000000000000000001550641342162430400212170ustar00rootroot00000000000000/* demo-Gtk-conf.c --- implements the dynamic configuration dialogs. * xscreensaver, Copyright (c) 2001-2014 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 #if defined(HAVE_GTK) && defined(HAVE_XML) /* whole file */ #include #include #ifdef HAVE_UNISTD_H # include #endif #include #include #include /* * Both of these workarounds can be removed when support for ancient * libxml versions is dropped. versions 1.8.11 and 2.3.4 provide the * correct fixes. */ /* * Older libxml polluted the global headerspace, while libxml2 fixed * this. To support both old and recent libxmls, we have this * workaround. */ #ifdef HAVE_OLD_XML_HEADERS # include #else /* ! HAVE_OLD_XML_HEADERS */ # include #endif /* HAVE_OLD_XML_HEADERS */ /* * handle non-native spelling mistakes in earlier versions and provide * the source-compat fix for this that may not be in older versions. */ #ifndef xmlChildrenNode # if LIBXML_VERSION >= 20000 # define xmlChildrenNode children # define xmlRootNode children # else # define xmlChildrenNode childs # define xmlRootNode root # endif /* LIBXML_VERSION */ #endif /* xmlChildrenNode */ #include #include "demo-Gtk-conf.h" /* Deal with deprecation of direct access to struct fields on the way to GTK3 See http://live.gnome.org/GnomeGoals/UseGseal */ #if GTK_CHECK_VERSION(2,14,0) # define GET_PARENT(w) gtk_widget_get_parent (w) # define GET_ADJ_VALUE(a) gtk_adjustment_get_value (a) # define GET_ADJ_UPPER(a) gtk_adjustment_get_upper (a) # define GET_ADJ_LOWER(a) gtk_adjustment_get_lower (a) #else # define GET_PARENT(w) ((w)->parent) # define GET_ADJ_VALUE(a) ((a)->value) # define GET_ADJ_UPPER(a) ((a)->upper) # define GET_ADJ_LOWER(a) ((a)->lower) #endif extern const char *blurb (void); const char *hack_configuration_path = HACK_CONFIGURATION_PATH; static gboolean debug_p = FALSE; #define MIN_SLIDER_WIDTH 150 #define MIN_SPINBUTTON_WIDTH 48 #define MIN_LABEL_WIDTH 70 typedef enum { COMMAND, FAKE, DESCRIPTION, FAKEPREVIEW, STRING, FILENAME, SLIDER, SPINBUTTON, BOOLEAN, SELECT, SELECT_OPTION } parameter_type; typedef struct { parameter_type type; xmlChar *id; /* widget name */ xmlChar *label; /* heading label, or null */ /* command, fake, description, fakepreview, string, file */ xmlChar *string; /* file name, description, whatever. */ /* slider, spinbutton */ xmlChar *low_label; /* label for the left side */ xmlChar *high_label; /* label for the right side */ float low; /* minimum value */ float high; /* maximum value */ float value; /* default value */ gboolean integer_p; /* whether the range is integral, or real */ xmlChar *arg; /* command-line option to set (substitute "%") */ gboolean invert_p; /* whether to flip the value and pretend the range goes from hi-low instead of low-hi. */ /* boolean, select-option */ xmlChar *arg_set; /* command-line option to set for "yes", or null */ xmlChar *arg_unset; /* command-line option to set for "no", or null */ /* select */ GList *options; /* select_option */ GtkWidget *widget; } parameter; static parameter *make_select_option (const char *file, xmlNodePtr); static void make_parameter_widget (const char *filename, parameter *, GtkWidget *); static void browse_button_cb (GtkButton *button, gpointer user_data); /* Frees the parameter object and all strings and sub-parameters. Does not destroy the widget, if any. */ static void free_parameter (parameter *p) { GList *rest; if (p->id) free (p->id); if (p->label) free (p->label); if (p->string) free (p->string); if (p->low_label) free (p->low_label); if (p->high_label) free (p->high_label); if (p->arg) free (p->arg); if (p->arg_set) free (p->arg_set); if (p->arg_unset) free (p->arg_unset); for (rest = p->options; rest; rest = rest->next) if (rest->data) free_parameter ((parameter *) rest->data); memset (p, ~0, sizeof(*p)); free (p); } /* Debugging: dumps out a `parameter' structure. */ #if 0 void describe_parameter (FILE *out, parameter *p) { fprintf (out, "<"); switch (p->type) { case COMMAND: fprintf (out, "command"); break; case FAKE: fprintf (out, "fake"); break; case DESCRIPTION: fprintf (out, "_description"); break; case FAKEPREVIEW: fprintf (out, "fakepreview"); break; case STRING: fprintf (out, "string"); break; case FILENAME: fprintf (out, "filename"); break; case SLIDER: fprintf (out, "number type=\"slider\""); break; case SPINBUTTON: fprintf (out, "number type=\"spinbutton\""); break; case BOOLEAN: fprintf (out, "boolean"); break; case SELECT: fprintf (out, "select"); break; default: abort(); break; } if (p->id) fprintf (out, " id=\"%s\"", p->id); if (p->label) fprintf (out, " _label=\"%s\"", p->label); if (p->string && p->type != DESCRIPTION) fprintf (out, " string=\"%s\"", p->string); if (p->low_label) fprintf (out, " _low-label=\"%s\"", p->low_label); if (p->high_label) fprintf (out, " _high-label=\"%s\"", p->high_label); if (p->low) fprintf (out, " low=\"%.2f\"", p->low); if (p->high) fprintf (out, " high=\"%.2f\"", p->high); if (p->value) fprintf (out, " default=\"%.2f\"", p->value); if (p->arg) fprintf (out, " arg=\"%s\"", p->arg); if (p->invert_p) fprintf (out, " convert=\"invert\""); if (p->arg_set) fprintf (out, " arg-set=\"%s\"", p->arg_set); if (p->arg_unset) fprintf (out, " arg-unset=\"%s\"", p->arg_unset); fprintf (out, ">\n"); if (p->type == SELECT) { GList *opt; for (opt = p->options; opt; opt = opt->next) { parameter *o = (parameter *) opt->data; if (o->type != SELECT_OPTION) abort(); fprintf (out, " id) fprintf (out, " id=\"%s\"", o->id); if (o->label) fprintf (out, " _label=\"%s\"", o->label); if (o->arg_set) fprintf (out, " arg-set=\"%s\"", o->arg_set); if (o->arg_unset) fprintf (out, " arg-unset=\"%s\"", o->arg_unset); fprintf (out, ">\n"); } fprintf (out, "\n"); } else if (p->type == DESCRIPTION) { if (p->string) fprintf (out, " %s\n", p->string); fprintf (out, "\n"); } } #endif /* 0 */ /* Like xmlGetProp() but parses a float out of the string. If the number was expressed as a float and not an integer (that is, the string contained a decimal point) then `floatp' is set to TRUE. Otherwise, it is unchanged. */ static float xml_get_float (xmlNodePtr node, const xmlChar *name, gboolean *floatpP) { const char *s = (char *) xmlGetProp (node, name); float f; char c; if (!s || 1 != sscanf (s, "%f %c", &f, &c)) return 0; else { if (strchr (s, '.')) *floatpP = TRUE; return f; } } static void sanity_check_parameter (const char *filename, const xmlChar *node_name, parameter *p); static void sanity_check_text_node (const char *filename, const xmlNodePtr node); static void sanity_check_menu_options (const char *filename, const xmlChar *node_name, parameter *p); /* Allocates and returns a new `parameter' object based on the properties in the given XML node. Returns 0 if there's nothing to create (comment, or unknown tag.) */ static parameter * make_parameter (const char *filename, xmlNodePtr node) { parameter *p; const char *name = (char *) node->name; const char *convert; gboolean floatp = FALSE; if (node->type == XML_COMMENT_NODE) return 0; p = calloc (1, sizeof(*p)); if (!name) abort(); else if (!strcmp (name, "command")) p->type = COMMAND; else if (!strcmp (name, "fullcommand")) p->type = COMMAND; else if (!strcmp (name, "_description")) p->type = DESCRIPTION; else if (!strcmp (name, "fakepreview")) p->type = FAKEPREVIEW; else if (!strcmp (name, "fake")) p->type = FAKE; else if (!strcmp (name, "boolean")) p->type = BOOLEAN; else if (!strcmp (name, "string")) p->type = STRING; else if (!strcmp (name, "file")) p->type = FILENAME; else if (!strcmp (name, "number")) p->type = SPINBUTTON; else if (!strcmp (name, "select")) p->type = SELECT; else if (!strcmp (name, "xscreensaver-text") || /* ignored in X11; */ !strcmp (name, "xscreensaver-image") || /* used in Cocoa. */ !strcmp (name, "xscreensaver-updater") || !strcmp (name, "video")) { free (p); return 0; } else if (node->type == XML_TEXT_NODE) { sanity_check_text_node (filename, node); free (p); return 0; } else { if (debug_p) fprintf (stderr, "%s: WARNING: %s: unknown tag: \"%s\"\n", blurb(), filename, name); free (p); return 0; } if (p->type == SPINBUTTON) { const char *type = (char *) xmlGetProp (node, (xmlChar *) "type"); if (!type || !strcmp (type, "spinbutton")) p->type = SPINBUTTON; else if (!strcmp (type, "slider")) p->type = SLIDER; else { if (debug_p) fprintf (stderr, "%s: WARNING: %s: unknown %s type: \"%s\"\n", blurb(), filename, name, type); free (p); return 0; } } else if (p->type == DESCRIPTION) { if (node->xmlChildrenNode && node->xmlChildrenNode->type == XML_TEXT_NODE && !node->xmlChildrenNode->next) p->string = (xmlChar *) strdup ((char *) node->xmlChildrenNode->content); } p->id = xmlGetProp (node, (xmlChar *) "id"); p->label = xmlGetProp (node, (xmlChar *) "_label"); p->low_label = xmlGetProp (node, (xmlChar *) "_low-label"); p->high_label = xmlGetProp (node, (xmlChar *) "_high-label"); p->low = xml_get_float (node, (xmlChar *) "low", &floatp); p->high = xml_get_float (node, (xmlChar *) "high", &floatp); p->value = xml_get_float (node, (xmlChar *) "default", &floatp); p->integer_p = !floatp; convert = (char *) xmlGetProp (node, (xmlChar *) "convert"); p->invert_p = (convert && !strcmp (convert, "invert")); p->arg = xmlGetProp (node, (xmlChar *) "arg"); p->arg_set = xmlGetProp (node, (xmlChar *) "arg-set"); p->arg_unset = xmlGetProp (node, (xmlChar *) "arg-unset"); /* Check for missing decimal point */ if (debug_p && p->integer_p && (p->high != p->low) && (p->high - p->low) <= 1) fprintf (stderr, "%s: WARNING: %s: %s: range [%.1f, %.1f] shouldn't be integral!\n", blurb(), filename, p->id, p->low, p->high); if (p->type == SELECT) { xmlNodePtr kids; for (kids = node->xmlChildrenNode; kids; kids = kids->next) { parameter *s = make_select_option (filename, kids); if (s) p->options = g_list_append (p->options, s); } } sanity_check_parameter (filename, (const xmlChar *) name, p); return p; } /* Allocates and returns a new SELECT_OPTION `parameter' object based on the properties in the given XML node. Returns 0 if there's nothing to create (comment, or unknown tag.) */ static parameter * make_select_option (const char *filename, xmlNodePtr node) { if (node->type == XML_COMMENT_NODE) return 0; else if (node->type == XML_TEXT_NODE) { sanity_check_text_node (filename, node); return 0; } else if (node->type != XML_ELEMENT_NODE) { if (debug_p) fprintf (stderr, "%s: WARNING: %s: %s: unexpected child tag type %d\n", blurb(), filename, node->name, (int)node->type); return 0; } else if (strcmp ((char *) node->name, "option")) { if (debug_p) fprintf (stderr, "%s: WARNING: %s: %s: child not an option tag: \"%s\"\n", blurb(), filename, node->name, node->name); return 0; } else { parameter *s = calloc (1, sizeof(*s)); s->type = SELECT_OPTION; s->id = xmlGetProp (node, (xmlChar *) "id"); s->label = xmlGetProp (node, (xmlChar *) "_label"); s->arg_set = xmlGetProp (node, (xmlChar *) "arg-set"); s->arg_unset = xmlGetProp (node, (xmlChar *) "arg-unset"); sanity_check_parameter (filename, node->name, s); return s; } } /* Rudimentary check to make sure someone hasn't typed "arg-set=" when they should have typed "arg=", etc. */ static void sanity_check_parameter (const char *filename, const xmlChar *node_name, parameter *p) { struct { gboolean id; gboolean label; gboolean string; gboolean low_label; gboolean high_label; gboolean low; gboolean high; gboolean value; gboolean arg; gboolean invert_p; gboolean arg_set; gboolean arg_unset; } allowed, require; memset (&allowed, 0, sizeof (allowed)); memset (&require, 0, sizeof (require)); switch (p->type) { case COMMAND: allowed.arg = TRUE; require.arg = TRUE; break; case FAKE: break; case DESCRIPTION: allowed.string = TRUE; break; case FAKEPREVIEW: break; case STRING: allowed.id = TRUE; require.id = TRUE; allowed.label = TRUE; require.label = TRUE; allowed.arg = TRUE; require.arg = TRUE; break; case FILENAME: allowed.id = TRUE; require.id = TRUE; allowed.label = TRUE; allowed.arg = TRUE; require.arg = TRUE; break; case SLIDER: allowed.id = TRUE; require.id = TRUE; allowed.label = TRUE; allowed.low_label = TRUE; allowed.high_label = TRUE; allowed.arg = TRUE; require.arg = TRUE; allowed.low = TRUE; /* require.low = TRUE; -- may be 0 */ allowed.high = TRUE; /* require.high = TRUE; -- may be 0 */ allowed.value = TRUE; /* require.value = TRUE; -- may be 0 */ allowed.invert_p = TRUE; break; case SPINBUTTON: allowed.id = TRUE; require.id = TRUE; allowed.label = TRUE; allowed.arg = TRUE; require.arg = TRUE; allowed.low = TRUE; /* require.low = TRUE; -- may be 0 */ allowed.high = TRUE; /* require.high = TRUE; -- may be 0 */ allowed.value = TRUE; /* require.value = TRUE; -- may be 0 */ allowed.invert_p = TRUE; break; case BOOLEAN: allowed.id = TRUE; require.id = TRUE; allowed.label = TRUE; allowed.arg_set = TRUE; allowed.arg_unset = TRUE; break; case SELECT: allowed.id = TRUE; require.id = TRUE; break; case SELECT_OPTION: allowed.id = TRUE; allowed.label = TRUE; require.label = TRUE; allowed.arg_set = TRUE; break; default: abort(); break; } # define WARN(STR) \ fprintf (stderr, "%s: %s: " STR " in <%s%s id=\"%s\">\n", \ blurb(), filename, node_name, \ (!strcmp((char *) node_name, "number") \ ? (p->type == SPINBUTTON ? " type=spinbutton" : " type=slider")\ : ""), \ (p->id ? (char *) p->id : "")) # define CHECK(SLOT,NAME) \ if (p->SLOT && !allowed.SLOT) \ WARN ("\"" NAME "\" is not a valid option"); \ if (!p->SLOT && require.SLOT) \ WARN ("\"" NAME "\" is required") CHECK (id, "id"); CHECK (label, "_label"); CHECK (string, "(body text)"); CHECK (low_label, "_low-label"); CHECK (high_label, "_high-label"); CHECK (low, "low"); CHECK (high, "high"); CHECK (value, "default"); CHECK (arg, "arg"); CHECK (invert_p, "convert"); CHECK (arg_set, "arg-set"); CHECK (arg_unset, "arg-unset"); # undef CHECK # undef WARN if (p->type == SELECT) sanity_check_menu_options (filename, node_name, p); } static void sanity_check_menu_options (const char *filename, const xmlChar *node_name, parameter *p) { GList *opts; int noptions = 0; int nulls = 0; char *prefix = 0; /* fprintf (stderr, "\n## %s\n", p->id);*/ for (opts = p->options; opts; opts = opts->next) { parameter *s = (parameter *) opts->data; if (!s->arg_set) nulls++; noptions++; if (s->arg_set) { char *a = strdup ((char *) s->arg_set); char *spc = strchr (a, ' '); if (spc) *spc = 0; if (prefix) { if (strcmp (a, prefix)) fprintf (stderr, "%s: %s: both \"%s\" and \"%s\" used in \n", blurb(), filename, p->id); } /* "text" nodes show up for all the non-tag text in the file, including all the newlines between tags. Warn if there is text there that is not whitespace. */ static void sanity_check_text_node (const char *filename, const xmlNodePtr node) { const char *body = (const char *) node->content; if (node->type != XML_TEXT_NODE) abort(); while (isspace (*body)) body++; if (*body) fprintf (stderr, "%s: WARNING: %s: random text present: \"%s\"\n", blurb(), filename, body); } /* Returns a list of strings, every switch mentioned in the parameters. The strings must be freed. */ static GList * get_all_switches (const char *filename, GList *parms) { GList *switches = 0; GList *p; for (p = parms; p; p = p->next) { parameter *pp = (parameter *) p->data; if (pp->type == SELECT) { GList *list2 = get_all_switches (filename, pp->options); switches = g_list_concat (switches, list2); } if (pp->arg && *pp->arg) switches = g_list_append (switches, strdup ((char *) pp->arg)); if (pp->arg_set && *pp->arg_set) switches = g_list_append (switches, strdup ((char *) pp->arg_set)); if (pp->arg_unset && *pp->arg_unset) switches = g_list_append (switches, strdup ((char *) pp->arg_unset)); } return switches; } /* Ensures that no switch is mentioned more than once. */ static void sanity_check_parameters (const char *filename, GList *parms) { GList *list = get_all_switches (filename, parms); GList *p; for (p = list; p; p = p->next) { char *sw = (char *) p->data; GList *p2; if (*sw != '-' && *sw != '+') fprintf (stderr, "%s: %s: switch does not begin with hyphen \"%s\"\n", blurb(), filename, sw); for (p2 = p->next; p2; p2 = p2->next) { const char *sw2 = (const char *) p2->data; if (!strcmp (sw, sw2)) fprintf (stderr, "%s: %s: duplicate switch \"%s\"\n", blurb(), filename, sw); } free (sw); } g_list_free (list); } /* Helper for make_parameters() */ static GList * make_parameters_1 (const char *filename, xmlNodePtr node, GtkWidget *parent) { GList *list = 0; for (; node; node = node->next) { const char *name = (char *) node->name; if (!strcmp (name, "hgroup") || !strcmp (name, "vgroup")) { GtkWidget *box = (*name == 'h' ? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0)); GList *list2; gtk_widget_show (box); gtk_box_pack_start (GTK_BOX (parent), box, FALSE, FALSE, 0); list2 = make_parameters_1 (filename, node->xmlChildrenNode, box); if (list2) list = g_list_concat (list, list2); } else { parameter *p = make_parameter (filename, node); if (p) { list = g_list_append (list, p); make_parameter_widget (filename, p, parent); } } } return list; } /* Calls make_parameter() and make_parameter_widget() on each relevant tag in the XML tree. Also handles the "hgroup" and "vgroup" flags. Returns a GList of `parameter' objects. */ static GList * make_parameters (const char *filename, xmlNodePtr node, GtkWidget *parent) { for (; node; node = node->next) { if (node->type == XML_ELEMENT_NODE && !strcmp ((char *) node->name, "screensaver")) return make_parameters_1 (filename, node->xmlChildrenNode, parent); } return 0; } static gfloat invert_range (gfloat low, gfloat high, gfloat value) { gfloat range = high-low; gfloat off = value-low; return (low + (range - off)); } static GtkAdjustment * make_adjustment (const char *filename, parameter *p) { float range = (p->high - p->low); float value = (p->invert_p ? invert_range (p->low, p->high, p->value) : p->value); gfloat si = (p->high - p->low) / 100; gfloat pi = (p->high - p->low) / 10; gfloat page_size = ((p->type == SLIDER) ? 1 : 0); if (p->value < p->low || p->value > p->high) { if (debug_p && p->integer_p) fprintf (stderr, "%s: WARNING: %s: %d is not in range [%d, %d]\n", blurb(), filename, (int) p->value, (int) p->low, (int) p->high); else if (debug_p) fprintf (stderr, "%s: WARNING: %s: %.2f is not in range [%.2f, %.2f]\n", blurb(), filename, p->value, p->low, p->high); value = (value < p->low ? p->low : p->high); } #if 0 else if (debug_p && p->value < 1000 && p->high >= 10000) { if (p->integer_p) fprintf (stderr, "%s: WARNING: %s: %d is suspicious for range [%d, %d]\n", blurb(), filename, (int) p->value, (int) p->low, (int) p->high); else fprintf (stderr, "%s: WARNING: %s: %.2f is suspicious for range [%.2f, %.2f]\n", blurb(), filename, p->value, p->low, p->high); } #endif /* 0 */ si = (int) (si + 0.5); pi = (int) (pi + 0.5); if (si < 1) si = 1; if (pi < 1) pi = 1; if (range <= 500) si = 1; return GTK_ADJUSTMENT (gtk_adjustment_new (value, p->low, p->high + page_size, si, pi, page_size)); } static void set_widget_min_width (GtkWidget *w, int width) { GtkRequisition req; gtk_widget_size_request (GTK_WIDGET (w), &req); if (req.width < width) gtk_widget_set_size_request (GTK_WIDGET (w), width, -1); } /* If we're inside a vbox, we need to put an hbox in it, or labels appear on top instead of to the left, and things stretch to the full width of the window. */ static GtkWidget * insert_fake_hbox (GtkWidget *parent) { if (GTK_IS_VBOX (parent)) { GtkWidget *hbox = gtk_hbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (parent), hbox, FALSE, FALSE, 4); gtk_widget_show (hbox); return hbox; } return parent; } static void link_atk_label_to_widget(GtkWidget *label, GtkWidget *widget) { AtkObject *atk_label = gtk_widget_get_accessible (label); AtkObject *atk_widget = gtk_widget_get_accessible (widget); atk_object_add_relationship (atk_label, ATK_RELATION_LABEL_FOR, atk_widget); atk_object_add_relationship (atk_widget, ATK_RELATION_LABELLED_BY, atk_label); } /* Given a `parameter' struct, allocates an appropriate GtkWidget for it, and stores it in `p->widget'. `parent' must be a GtkBox. */ static void make_parameter_widget (const char *filename, parameter *p, GtkWidget *parent) { const char *label = (char *) p->label; if (p->widget) return; switch (p->type) { case STRING: { GtkWidget *entry = gtk_entry_new (); parent = insert_fake_hbox (parent); if (label) { GtkWidget *w = gtk_label_new (_(label)); link_atk_label_to_widget (w, entry); gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_RIGHT); gtk_misc_set_alignment (GTK_MISC (w), 1.0, 0.5); set_widget_min_width (GTK_WIDGET (w), MIN_LABEL_WIDTH); gtk_widget_show (w); gtk_box_pack_start (GTK_BOX (parent), w, FALSE, FALSE, 4); } p->widget = entry; if (p->string) gtk_entry_set_text (GTK_ENTRY (p->widget), (char *) p->string); gtk_box_pack_start (GTK_BOX (parent), p->widget, FALSE, FALSE, 4); break; } case FILENAME: { GtkWidget *L = gtk_label_new (label ? _(label) : ""); GtkWidget *entry = gtk_entry_new (); GtkWidget *button = gtk_button_new_with_label (_("Browse...")); link_atk_label_to_widget (L, entry); gtk_widget_show (entry); gtk_widget_show (button); p->widget = entry; gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (browse_button_cb), (gpointer) entry); gtk_label_set_justify (GTK_LABEL (L), GTK_JUSTIFY_RIGHT); gtk_misc_set_alignment (GTK_MISC (L), 1.0, 0.5); set_widget_min_width (GTK_WIDGET (L), MIN_LABEL_WIDTH); gtk_widget_show (L); if (p->string) gtk_entry_set_text (GTK_ENTRY (entry), (char *) p->string); parent = insert_fake_hbox (parent); gtk_box_pack_start (GTK_BOX (parent), L, FALSE, FALSE, 4); gtk_box_pack_start (GTK_BOX (parent), entry, TRUE, TRUE, 4); gtk_box_pack_start (GTK_BOX (parent), button, FALSE, FALSE, 4); break; } case SLIDER: { GtkAdjustment *adj = make_adjustment (filename, p); GtkWidget *scale = gtk_hscale_new (adj); GtkWidget *labelw = 0; if (label) { labelw = gtk_label_new (_(label)); link_atk_label_to_widget (labelw, scale); gtk_label_set_justify (GTK_LABEL (labelw), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (labelw), 0.0, 0.5); set_widget_min_width (GTK_WIDGET (labelw), MIN_LABEL_WIDTH); gtk_widget_show (labelw); gtk_box_pack_start (GTK_BOX (parent), labelw, FALSE, FALSE, 2); } /* Do this after 'labelw' so that it appears above, not to left. */ parent = insert_fake_hbox (parent); if (p->low_label) { GtkWidget *w = gtk_label_new (_((char *) p->low_label)); link_atk_label_to_widget (w, scale); gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_RIGHT); gtk_misc_set_alignment (GTK_MISC (w), 1.0, 0.5); set_widget_min_width (GTK_WIDGET (w), MIN_LABEL_WIDTH); gtk_widget_show (w); gtk_box_pack_start (GTK_BOX (parent), w, FALSE, FALSE, 4); } gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_BOTTOM); gtk_scale_set_draw_value (GTK_SCALE (scale), debug_p); gtk_scale_set_digits (GTK_SCALE (scale), (p->integer_p ? 0 : 2)); set_widget_min_width (GTK_WIDGET (scale), MIN_SLIDER_WIDTH); gtk_box_pack_start (GTK_BOX (parent), scale, FALSE, FALSE, 4); gtk_widget_show (scale); if (p->high_label) { GtkWidget *w = gtk_label_new (_((char *) p->high_label)); link_atk_label_to_widget (w, scale); gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5); set_widget_min_width (GTK_WIDGET (w), MIN_LABEL_WIDTH); gtk_widget_show (w); gtk_box_pack_start (GTK_BOX (parent), w, FALSE, FALSE, 4); } p->widget = scale; break; } case SPINBUTTON: { GtkAdjustment *adj = make_adjustment (filename, p); GtkWidget *spin = gtk_spin_button_new (adj, 15, 0); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (spin), TRUE); gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), GET_ADJ_VALUE(adj)); set_widget_min_width (GTK_WIDGET (spin), MIN_SPINBUTTON_WIDTH); if (label) { GtkWidget *w = gtk_label_new (_(label)); link_atk_label_to_widget (w, spin); gtk_label_set_justify (GTK_LABEL (w), GTK_JUSTIFY_RIGHT); gtk_misc_set_alignment (GTK_MISC (w), 1.0, 0.5); set_widget_min_width (GTK_WIDGET (w), MIN_LABEL_WIDTH); gtk_widget_show (w); parent = insert_fake_hbox (parent); gtk_box_pack_start (GTK_BOX (parent), w, FALSE, FALSE, 4); } gtk_widget_show (spin); gtk_box_pack_start (GTK_BOX (parent), spin, FALSE, FALSE, 4); p->widget = spin; break; } case BOOLEAN: { p->widget = gtk_check_button_new_with_label (_(label)); /* Let these stretch -- doesn't hurt. parent = insert_fake_hbox (parent); */ gtk_box_pack_start (GTK_BOX (parent), p->widget, FALSE, FALSE, 4); break; } case SELECT: { GtkWidget *opt = gtk_option_menu_new (); GtkWidget *menu = gtk_menu_new (); GList *opts; for (opts = p->options; opts; opts = opts->next) { parameter *s = (parameter *) opts->data; GtkWidget *i = gtk_menu_item_new_with_label (_((char *) s->label)); gtk_widget_show (i); gtk_menu_append (GTK_MENU (menu), i); } gtk_option_menu_set_menu (GTK_OPTION_MENU (opt), menu); p->widget = opt; parent = insert_fake_hbox (parent); gtk_box_pack_start (GTK_BOX (parent), p->widget, FALSE, FALSE, 4); break; } case COMMAND: case FAKE: case DESCRIPTION: case FAKEPREVIEW: break; default: abort(); } if (p->widget) { gtk_widget_set_name (p->widget, (char *) p->id); gtk_widget_show (p->widget); } } /* File selection. Absurdly, there is no GTK file entry widget, only a GNOME one, so in order to avoid depending on GNOME in this code, we have to do it ourselves. */ /* cancel button on GtkFileSelection: user_data unused */ static void file_sel_cancel (GtkWidget *button, gpointer user_data) { GtkWidget *dialog = button; while (GET_PARENT (dialog)) dialog = GET_PARENT (dialog); gtk_widget_destroy (dialog); } /* ok button on GtkFileSelection: user_data is the corresponding GtkEntry */ static void file_sel_ok (GtkWidget *button, gpointer user_data) { GtkWidget *entry = GTK_WIDGET (user_data); GtkWidget *dialog = button; const char *path; while (GET_PARENT (dialog)) dialog = GET_PARENT (dialog); gtk_widget_hide (dialog); path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (dialog)); /* apparently one doesn't free `path' */ gtk_entry_set_text (GTK_ENTRY (entry), path); gtk_entry_set_position (GTK_ENTRY (entry), strlen (path)); gtk_widget_destroy (dialog); } /* WM close on GtkFileSelection: user_data unused */ static void file_sel_close (GtkWidget *widget, GdkEvent *event, gpointer user_data) { file_sel_cancel (widget, user_data); } /* "Browse" button: user_data is the corresponding GtkEntry */ static void browse_button_cb (GtkButton *button, gpointer user_data) { GtkWidget *entry = GTK_WIDGET (user_data); const char *text = gtk_entry_get_text (GTK_ENTRY (entry)); GtkFileSelection *selector = GTK_FILE_SELECTION (gtk_file_selection_new (_("Select file."))); gtk_file_selection_set_filename (selector, text); gtk_signal_connect (GTK_OBJECT (selector->ok_button), "clicked", GTK_SIGNAL_FUNC (file_sel_ok), (gpointer) entry); gtk_signal_connect (GTK_OBJECT (selector->cancel_button), "clicked", GTK_SIGNAL_FUNC (file_sel_cancel), (gpointer) entry); gtk_signal_connect (GTK_OBJECT (selector), "delete_event", GTK_SIGNAL_FUNC (file_sel_close), (gpointer) entry); gtk_window_set_modal (GTK_WINDOW (selector), TRUE); gtk_widget_show (GTK_WIDGET (selector)); } /* Converting to and from command-lines */ /* Returns a copy of string that has been quoted according to shell rules: it may have been wrapped in "" and had some characters backslashed; or it may be unchanged. */ static char * shell_quotify (const char *string) { char *string2 = (char *) malloc ((strlen (string) * 2) + 10); const char *in; char *out; int need_quotes = 0; int in_length = 0; out = string2; *out++ = '"'; for (in = string; *in; in++) { in_length++; if (*in == '!' || *in == '"' || *in == '$') { need_quotes = 1; *out++ = '\\'; *out++ = *in; } else if (*in <= ' ' || *in >= 127 || *in == '\'' || *in == '#' || *in == '%' || *in == '&' || *in == '(' || *in == ')' || *in == '*') { need_quotes = 1; *out++ = *in; } else *out++ = *in; } *out++ = '"'; *out = 0; if (in_length == 0) need_quotes = 1; if (need_quotes) return (string2); free (string2); return strdup (string); } /* Modify the string in place to remove wrapping double-quotes and interior backslashes. */ static void de_stringify (char *s) { char q = s[0]; if (q != '\'' && q != '\"' && q != '`') abort(); memmove (s, s+1, strlen (s)); while (*s && *s != q) { if (*s == '\\') memmove (s, s+1, strlen (s)+1); s++; } if (*s != q) abort(); *s = 0; } /* Substitutes a shell-quotified version of `value' into `p->arg' at the place where the `%' character appeared. */ static char * format_switch (parameter *p, const char *value) { char *fmt = (char *) p->arg; char *v2; char *result, *s; if (!fmt || !value) return 0; v2 = shell_quotify (value); result = (char *) malloc (strlen (fmt) + strlen (v2) + 10); s = result; for (; *fmt; fmt++) if (*fmt != '%') *s++ = *fmt; else { strcpy (s, v2); s += strlen (s); } *s = 0; free (v2); return result; } /* Maps a `parameter' to a command-line switch. Returns 0 if it can't, or if the parameter has the default value. */ static char * parameter_to_switch (parameter *p) { switch (p->type) { case COMMAND: if (p->arg) return strdup ((char *) p->arg); else return 0; break; case STRING: case FILENAME: if (!p->widget) return 0; { const char *s = gtk_entry_get_text (GTK_ENTRY (p->widget)); char *v; if (!strcmp ((s ? s : ""), (p->string ? (char *) p->string : ""))) v = 0; /* same as default */ else v = format_switch (p, s); /* don't free `s' */ return v; } case SLIDER: case SPINBUTTON: if (!p->widget) return 0; { GtkAdjustment *adj = (p->type == SLIDER ? gtk_range_get_adjustment (GTK_RANGE (p->widget)) : gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (p->widget))); char buf[255]; char *s1; float value = (p->invert_p ? invert_range (GET_ADJ_LOWER(adj), GET_ADJ_UPPER(adj), GET_ADJ_VALUE(adj)) - 1 : GET_ADJ_VALUE(adj)); if (value == p->value) /* same as default */ return 0; if (p->integer_p) sprintf (buf, "%d", (int) (value + (value > 0 ? 0.5 : -0.5))); else sprintf (buf, "%.4f", value); s1 = strchr (buf, '.'); if (s1) { char *s2 = s1 + strlen(s1) - 1; while (s2 > s1 && *s2 == '0') /* lose trailing zeroes */ *s2-- = 0; if (s2 >= s1 && *s2 == '.') /* lose trailing decimal */ *s2-- = 0; } return format_switch (p, buf); } case BOOLEAN: if (!p->widget) return 0; { GtkToggleButton *b = GTK_TOGGLE_BUTTON (p->widget); const char *s = (gtk_toggle_button_get_active (b) ? (char *) p->arg_set : (char *) p->arg_unset); if (s) return strdup (s); else return 0; } case SELECT: if (!p->widget) return 0; { GtkOptionMenu *opt = GTK_OPTION_MENU (p->widget); 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); GList *ol = g_list_nth (p->options, menu_elt); parameter *o = (ol ? (parameter *) ol->data : 0); const char *s; if (!o) abort(); if (o->type != SELECT_OPTION) abort(); s = (char *) o->arg_set; if (s) return strdup (s); else return 0; } default: if (p->widget) abort(); else return 0; } } /* Maps a GList of `parameter' objects to a complete command-line string. All arguments will be properly quoted. */ static char * 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 *result; char *out; int i, j; for (i = 0, j = 0; parms; parms = parms->next, i++) { parameter *p = (parameter *) parms->data; if (!default_p || p->type == COMMAND) { char *s = parameter_to_switch (p); strs[j++] = s; LL += (s ? strlen(s) : 0) + 1; } } result = (char *) malloc (LL + 10); out = result; for (i = 0; i < j; i++) if (strs[i]) { strcpy (out, strs[i]); out += strlen (out); *out++ = ' '; free (strs[i]); } *out = 0; while (out > result && out[-1] == ' ') /* strip trailing spaces */ *(--out) = 0; free (strs); return result; } /* Returns a GList of the tokens the string, using shell syntax; Quoted strings are handled as a single token. */ static GList * tokenize_command_line (const char *cmd) { GList *result = 0; const char *s = cmd; while (*s) { const char *start; char *ss; for (; isspace(*s); s++); /* skip whitespace */ start = s; if (*s == '\'' || *s == '\"' || *s == '`') { char q = *s; s++; while (*s && *s != q) /* skip to matching quote */ { if (*s == '\\' && s[1]) /* allowing backslash quoting */ s++; s++; } s++; } else { while (*s && (! (isspace(*s) || *s == '\'' || *s == '\"' || *s == '`'))) s++; } if (s > start) { ss = (char *) malloc ((s - start) + 1); strncpy (ss, start, s-start); ss[s-start] = 0; if (*ss == '\'' || *ss == '\"' || *ss == '`') de_stringify (ss); result = g_list_append (result, ss); } } return result; } static void parameter_set_switch (parameter *, gpointer value); static gboolean parse_command_line_into_parameters_1 (const char *filename, GList *parms, const char *option, const char *value, parameter *parent); /* Parses the command line, and flushes those options down into the `parameter' structs in the list. */ static void parse_command_line_into_parameters (const char *filename, const char *cmd, GList *parms) { GList *tokens = tokenize_command_line (cmd); GList *rest; for (rest = tokens; rest; rest = rest->next) { char *option = rest->data; rest->data = 0; if (option[0] != '-' && option[0] != '+') { if (debug_p) fprintf (stderr, "%s: WARNING: %s: not a switch: \"%s\"\n", blurb(), filename, option); } else { char *value = 0; if (rest->next) /* pop off the arg to this option */ { char *s = (char *) rest->next->data; /* the next token is the next switch iff it matches "-[a-z]". (To avoid losing on "-x -3.1".) */ if (s && (s[0] != '-' || !isalpha(s[1]))) { value = s; rest->next->data = 0; rest = rest->next; } } parse_command_line_into_parameters_1 (filename, parms, option, value, 0); if (value) free (value); free (option); } } g_list_free (tokens); } static gboolean compare_opts (const char *option, const char *value, const char *template) { int ol = strlen (option); char *c; if (strncmp (option, template, ol)) return FALSE; if (template[ol] != (value ? ' ' : 0)) return FALSE; /* At this point, we have a match against "option". If template contains a %, we're done. Else, compare against "value" too. */ c = strchr (template, '%'); if (c) return TRUE; if (!value) return (template[ol] == 0); if (strcmp (template + ol + 1, value)) return FALSE; return TRUE; } static gboolean parse_command_line_into_parameters_1 (const char *filename, GList *parms, const char *option, const char *value, parameter *parent) { GList *p; parameter *match = 0; gint which = -1; gint index = 0; for (p = parms; p; p = p->next) { parameter *pp = (parameter *) p->data; which = -99; if (pp->type == SELECT) { if (parse_command_line_into_parameters_1 (filename, pp->options, option, value, pp)) { which = -2; match = pp; } } else if (pp->arg) { if (compare_opts (option, value, (char *) pp->arg)) { which = -1; match = pp; } } else if (pp->arg_set) { if (compare_opts (option, value, (char *) pp->arg_set)) { which = 1; match = pp; } } else if (pp->arg_unset) { if (compare_opts (option, value, (char *) pp->arg_unset)) { which = 0; match = pp; } } if (match) break; index++; } if (!match) { if (debug_p && !parent) fprintf (stderr, "%s: WARNING: %s: no match for %s %s\n", blurb(), filename, option, (value ? value : "")); return FALSE; } switch (match->type) { case STRING: case FILENAME: case SLIDER: case SPINBUTTON: if (which != -1) abort(); parameter_set_switch (match, (gpointer) value); break; case BOOLEAN: if (which != 0 && which != 1) abort(); parameter_set_switch (match, GINT_TO_POINTER(which)); break; case SELECT_OPTION: if (which != 1) abort(); parameter_set_switch (parent, GINT_TO_POINTER(index)); break; default: break; } return TRUE; } /* Set the parameter's value. For STRING, FILENAME, SLIDER, and SPINBUTTON, `value' is a char*. For BOOLEAN and SELECT, `value' is an int. */ static void parameter_set_switch (parameter *p, gpointer value) { if (p->type == SELECT_OPTION) abort(); if (!p->widget) return; switch (p->type) { case STRING: case FILENAME: { gtk_entry_set_text (GTK_ENTRY (p->widget), (char *) value); break; } case SLIDER: case SPINBUTTON: { GtkAdjustment *adj = (p->type == SLIDER ? gtk_range_get_adjustment (GTK_RANGE (p->widget)) : gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (p->widget))); float f; char c; if (1 == sscanf ((char *) value, "%f %c", &f, &c)) { if (p->invert_p) f = invert_range (GET_ADJ_LOWER(adj), GET_ADJ_UPPER(adj), f) - 1; gtk_adjustment_set_value (adj, f); } break; } case BOOLEAN: { GtkToggleButton *b = GTK_TOGGLE_BUTTON (p->widget); gtk_toggle_button_set_active (b, GPOINTER_TO_INT(value)); break; } case SELECT: { gtk_option_menu_set_history (GTK_OPTION_MENU (p->widget), GPOINTER_TO_INT(value)); break; } default: abort(); } } static void restore_defaults (const char *progname, GList *parms) { for (; parms; parms = parms->next) { parameter *p = (parameter *) parms->data; if (!p->widget) continue; switch (p->type) { case STRING: case FILENAME: { gtk_entry_set_text (GTK_ENTRY (p->widget), (p->string ? (char *) p->string : "")); break; } case SLIDER: case SPINBUTTON: { GtkAdjustment *adj = (p->type == SLIDER ? gtk_range_get_adjustment (GTK_RANGE (p->widget)) : gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (p->widget))); float value = (p->invert_p ? invert_range (p->low, p->high, p->value) : p->value); gtk_adjustment_set_value (adj, value); break; } case BOOLEAN: { /* A toggle button should be on by default if it inserts nothing into the command line when on. E.g., it should be on if `arg_set' is null. */ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (p->widget), (!p->arg_set || !*p->arg_set)); break; } case SELECT: { GtkOptionMenu *opt = GTK_OPTION_MENU (p->widget); GList *opts; int selected = 0; int index; for (opts = p->options, index = 0; opts; opts = opts->next, index++) { parameter *s = (parameter *) opts->data; /* The default menu item is the first one with no `arg_set' field. */ if (!s->arg_set) { selected = index; break; } } gtk_option_menu_set_history (GTK_OPTION_MENU (opt), selected); break; } default: abort(); } } } /* Documentation strings */ static char * get_description (GList *parms, gboolean verbose_p) { parameter *doc = 0; for (; parms; parms = parms->next) { parameter *p = (parameter *) parms->data; if (p->type == DESCRIPTION) { doc = p; break; } } if (!doc || !doc->string) return 0; else { char *d = strdup ((char *) doc->string); char *s; char *p; for (s = d; *s; s++) if (s[0] == '\n') { if (s[1] == '\n') /* blank line: leave it */ s++; else if (s[1] == ' ' || s[1] == '\t') s++; /* next line is indented: leave newline */ else if (!strncmp(s+1, "http:", 5)) s++; /* next line begins a URL: leave newline */ else s[0] = ' '; /* delete newline to un-fold this line */ } /* strip off leading whitespace on first line only */ for (s = d; *s && (*s == ' ' || *s == '\t'); s++) ; while (*s == '\n') /* strip leading newlines */ s++; if (s != d) memmove (d, s, strlen(s)+1); /* strip off trailing whitespace and newlines */ { int L = strlen(d); while (L && isspace(d[L-1])) d[--L] = 0; } /* strip off duplicated whitespaces */ for (s = d; *s; s++) if (s[0] == ' ') { p = s+1; while (*s == ' ') s++; if (*p && (s != p)) memmove (p, s, strlen(s)+1); } #if 0 if (verbose_p) { fprintf (stderr, "%s: text read is \"%s\"\n", blurb(),doc->string); fprintf (stderr, "%s: description is \"%s\"\n", blurb(), d); fprintf (stderr, "%s: translation is \"%s\"\n", blurb(), _(d)); } #endif /* 0 */ return (d); } } /* External interface. */ static conf_data * load_configurator_1 (const char *program, const char *arguments, gboolean verbose_p) { const char *dir = hack_configuration_path; char *base_program; int L = strlen (dir); char *file; char *s; FILE *f; conf_data *data; if (L == 0) return 0; base_program = strrchr(program, '/'); if (base_program) base_program++; if (!base_program) base_program = (char *) program; file = (char *) malloc (L + strlen (base_program) + 10); data = (conf_data *) calloc (1, sizeof(*data)); strcpy (file, dir); if (file[L-1] != '/') file[L++] = '/'; strcpy (file+L, base_program); for (s = file+L; *s; s++) if (*s == '/' || *s == ' ') *s = '_'; else if (isupper (*s)) *s = tolower (*s); strcat (file+L, ".xml"); f = fopen (file, "r"); if (f) { int res, size = 1024; char chars[1024]; xmlParserCtxtPtr ctxt; xmlDocPtr doc = 0; GtkWidget *vbox0; GList *parms; if (verbose_p) fprintf (stderr, "%s: reading %s...\n", blurb(), file); res = fread (chars, 1, 4, f); if (res <= 0) { free (data); data = 0; goto DONE; } ctxt = xmlCreatePushParserCtxt(NULL, NULL, chars, res, file); while ((res = fread(chars, 1, size, f)) > 0) xmlParseChunk (ctxt, chars, res, 0); xmlParseChunk (ctxt, chars, 0, 1); doc = ctxt->myDoc; xmlFreeParserCtxt (ctxt); fclose (f); /* Parsed the XML file. Now make some widgets. */ vbox0 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox0); parms = make_parameters (file, doc->xmlRootNode, vbox0); sanity_check_parameters (file, parms); xmlFreeDoc (doc); restore_defaults (program, parms); if (arguments && *arguments) parse_command_line_into_parameters (program, arguments, parms); data->widget = vbox0; data->parameters = parms; data->description = get_description (parms, verbose_p); } else { parameter *p; if (verbose_p) fprintf (stderr, "%s: %s does not exist.\n", blurb(), file); p = calloc (1, sizeof(*p)); p->type = COMMAND; p->arg = (xmlChar *) strdup (arguments); data->parameters = g_list_append (0, (gpointer) p); } data->progname = strdup (program); DONE: free (file); return data; } static void split_command_line (const char *full_command_line, char **prog_ret, char **args_ret) { char *line = strdup (full_command_line); char *prog; char *args; char *s; prog = line; s = line; while (*s) { if (isspace (*s)) { *s = 0; s++; while (isspace (*s)) s++; break; } else if (*s == '=') /* if the leading word contains an "=", skip it. */ { while (*s && !isspace (*s)) s++; while (isspace (*s)) s++; prog = s; } s++; } args = s; *prog_ret = strdup (prog); *args_ret = strdup (args); free (line); } conf_data * load_configurator (const char *full_command_line, gboolean verbose_p) { char *prog; char *args; conf_data *cd; debug_p = verbose_p; split_command_line (full_command_line, &prog, &args); cd = load_configurator_1 (prog, args, verbose_p); free (prog); free (args); return cd; } char * get_configurator_command_line (conf_data *data, gboolean default_p) { char *args = parameters_to_cmd_line (data->parameters, default_p); char *result = (char *) malloc (strlen (data->progname) + strlen (args) + 2); strcpy (result, data->progname); strcat (result, " "); strcat (result, args); free (args); return result; } void set_configurator_command_line (conf_data *data, const char *full_command_line) { char *prog; char *args; split_command_line (full_command_line, &prog, &args); if (data->progname) free (data->progname); data->progname = prog; restore_defaults (prog, data->parameters); parse_command_line_into_parameters (prog, args, data->parameters); free (args); } void free_conf_data (conf_data *data) { if (data->parameters) { GList *rest; for (rest = data->parameters; rest; rest = rest->next) { free_parameter ((parameter *) rest->data); rest->data = 0; } g_list_free (data->parameters); data->parameters = 0; } if (data->widget) gtk_widget_destroy (data->widget); if (data->progname) free (data->progname); if (data->description) free (data->description); memset (data, ~0, sizeof(*data)); free (data); } #endif /* HAVE_GTK && HAVE_XML -- whole file */ xscreensaver-5.42+dfsg1/driver/demo-Gtk-conf.h000066400000000000000000000023341342162430400212130ustar00rootroot00000000000000/* demo-Gtk-conf.c --- implements the dynamic configuration dialogs. * xscreensaver, Copyright (c) 2001-2008 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 _DEMO_GTK_CONF_H_ #define _DEMO_GTK_CONF_H_ typedef struct { GtkWidget *widget; /* the container widget with the sliders and stuff. */ GList *parameters; /* internal data -- hands off */ char *progname; char *progclass; char *description; } conf_data; extern conf_data *load_configurator (const char *cmd_line, gboolean verbose_p); extern char *get_configurator_command_line (conf_data *, gboolean default_p); extern void set_configurator_command_line (conf_data *, const char *cmd_line); extern void free_conf_data (conf_data *); extern const char *hack_configuration_path; #endif /* _DEMO_GTK_CONF_H_ */ xscreensaver-5.42+dfsg1/driver/demo-Gtk.c000066400000000000000000004600271342162430400202720ustar00rootroot00000000000000/* demo-Gtk.c --- implements the interactive demo-mode and options dialogs. * xscreensaver, Copyright (c) 1993-2018 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 #ifdef HAVE_GTK /* whole file */ #include #include #ifdef HAVE_UNISTD_H # include #endif # ifdef __GNUC__ # define STFU __extension__ /* ignore gcc -pendantic warnings in next sexp */ # else # define STFU /* */ # endif #ifdef ENABLE_NLS # 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 #include #include #include #ifdef HAVE_SYS_WAIT_H # include /* for waitpid() and associated macros */ #endif #include /* for CARD32 */ #include /* for XA_INTEGER */ #include #include /* We don't actually use any widget internals, but these are included so that gdb will have debug info for the widgets... */ #include #include #ifdef HAVE_XMU # ifndef VMS # include # else /* VMS */ # include # endif #else # include "xmu.h" #endif #ifdef HAVE_XINERAMA # include #endif /* HAVE_XINERAMA */ #include #ifdef HAVE_CRAPPLET # include # include #endif #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 #include "version.h" #include "prefs.h" #include "resources.h" /* for parse_time() */ #include "visual.h" /* for has_writable_cells() */ #include "remote.h" /* for xscreensaver_command() */ #include "usleep.h" #include "logo-50.xpm" #include "logo-180.xpm" #include "demo-Gtk-conf.h" #include #include #include #ifdef HAVE_GTK2 enum { COL_ENABLED, COL_NAME, COL_LAST }; #endif /* HAVE_GTK2 */ /* Deal with deprecation of direct access to struct fields on the way to GTK3 See http://live.gnome.org/GnomeGoals/UseGseal */ #if GTK_CHECK_VERSION(2,14,0) # define GET_PARENT(w) gtk_widget_get_parent (w) # define GET_WINDOW(w) gtk_widget_get_window (w) # define GET_ACTION_AREA(d) gtk_dialog_get_action_area (d) # define GET_CONTENT_AREA(d) gtk_dialog_get_content_area (d) # define GET_ADJ_VALUE(a) gtk_adjustment_get_value (a) # define SET_ADJ_VALUE(a,v) gtk_adjustment_set_value (a, v) # define SET_ADJ_UPPER(a,v) gtk_adjustment_set_upper (a, v) #else # define GET_PARENT(w) ((w)->parent) # define GET_WINDOW(w) ((w)->window) # define GET_ACTION_AREA(d) ((d)->action_area) # define GET_CONTENT_AREA(d) ((d)->vbox) # define GET_ADJ_VALUE(a) ((a)->value) # define SET_ADJ_VALUE(a,v) (a)->value = v # define SET_ADJ_UPPER(a,v) (a)->upper = v #endif #if GTK_CHECK_VERSION(2,18,0) # define SET_CAN_DEFAULT(w) gtk_widget_set_can_default ((w), TRUE) # define GET_SENSITIVE(w) gtk_widget_get_sensitive (w) #else # define SET_CAN_DEFAULT(w) GTK_WIDGET_SET_FLAGS ((w), GTK_CAN_DEFAULT) # define GET_SENSITIVE(w) GTK_WIDGET_IS_SENSITIVE (w) #endif #if GTK_CHECK_VERSION(2,20,0) # define GET_REALIZED(w) gtk_widget_get_realized (w) #else # define GET_REALIZED(w) GTK_WIDGET_REALIZED (w) #endif /* from exec.c */ extern void exec_command (const char *shell, const char *command, int nice); extern int on_path_p (const char *program); static void hack_subproc_environment (Window preview_window_id, Bool debug_p); #undef countof #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; /* The order of the items in the mode menu. */ static int mode_menu_order[] = { DONT_BLANK, BLANK_ONLY, ONE_HACK, RANDOM_HACKS, RANDOM_HACKS_SAME }; typedef struct { char *short_version; /* version number of this xscreensaver build */ GtkWidget *toplevel_widget; /* the main window */ GtkWidget *base_widget; /* root of our hierarchy (for name lookups) */ GtkWidget *popup_widget; /* the "Settings" dialog */ conf_data *cdata; /* private data for per-hack configuration */ #ifdef HAVE_GTK2 GladeXML *glade_ui; /* Glade UI file */ #endif /* HAVE_GTK2 */ Bool debug_p; /* whether to print diagnostics */ Bool initializing_p; /* flag for breaking recursion loops */ Bool saving_p; /* flag for breaking recursion loops */ char *desired_preview_cmd; /* subprocess we intend to run */ char *running_preview_cmd; /* subprocess we are currently running */ pid_t running_preview_pid; /* pid of forked subproc (might be dead) */ Bool running_preview_error_p; /* whether the pid died abnormally */ Bool preview_suppressed_p; /* flag meaning "don't launch subproc" */ int subproc_timer_id; /* timer to delay subproc launch */ int subproc_check_timer_id; /* timer to check whether it started up */ int subproc_check_countdown; /* how many more checks left */ int *list_elt_to_hack_number; /* table for sorting the hack list */ int *hack_number_to_list_elt; /* the inverse table */ Bool *hacks_available_p; /* whether hacks are on $PATH */ int total_available; /* how many are on $PATH */ int list_count; /* how many items are in the list: this may be less than p->screenhacks_count, if some are suppressed. */ int _selected_list_element; /* don't use this: call selected_list_element() instead */ int nscreens; /* How many X or Xinerama screens there are */ saver_preferences prefs; } state; /* Total fucking evilness due to the fact that it's rocket science to get 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_BLANK, XA_LOCK, XA_RESTART, XA_EXIT; static void populate_demo_window (state *, int list_elt); static void populate_prefs_page (state *); static void populate_popup_window (state *); static Bool flush_dialog_changes_and_save (state *); static Bool flush_popup_changes_and_save (state *); static int maybe_reload_init_file (state *); static void await_xscreensaver (state *); static Bool xscreensaver_running_p (state *); static void sensitize_menu_items (state *s, Bool force_p); static void force_dialog_repaint (state *s); static void schedule_preview (state *, const char *cmd); 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. */ 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 restart_menu_cb (GtkWidget *, gpointer user_data); void run_this_cb (GtkButton *, gpointer user_data); void manual_cb (GtkButton *, gpointer user_data); void run_next_cb (GtkButton *, gpointer user_data); void run_prev_cb (GtkButton *, gpointer user_data); void pref_changed_cb (GtkWidget *, gpointer user_data); gboolean pref_changed_event_cb (GtkWidget *, GdkEvent *, gpointer user_data); void mode_menu_item_cb (GtkWidget *, gpointer user_data); void switch_page_cb (GtkNotebook *, GtkNotebookPage *, gint page_num, gpointer user_data); void browse_image_dir_cb (GtkButton *, gpointer user_data); void browse_text_file_cb (GtkButton *, gpointer user_data); void browse_text_program_cb (GtkButton *, gpointer user_data); void settings_cb (GtkButton *, gpointer user_data); void settings_adv_cb (GtkButton *, gpointer user_data); void settings_std_cb (GtkButton *, gpointer user_data); void settings_reset_cb (GtkButton *, gpointer user_data); 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); 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) { GtkWidget *w; if (!s) abort(); if (!name) abort(); if (!*name) abort(); #ifdef HAVE_GTK2 if (!s->glade_ui) { /* First try to load the Glade 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 }; int i; 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; } } if (!s->glade_ui) { fprintf (stderr, "%s: could not load \"" GLADE_FILE_NAME "\"\n" "\tfrom " GLADE_DIR "/ or current directory.\n", blurb()); exit (-1); } # undef GLADE_FILE_NAME glade_xml_signal_autoconnect (s->glade_ui); } w = glade_xml_get_widget (s->glade_ui, name); #else /* !HAVE_GTK2 */ w = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (s->base_widget), name); if (w) return w; w = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (s->popup_widget), name); #endif /* HAVE_GTK2 */ if (w) return w; fprintf (stderr, "%s: no widget \"%s\" (wrong Glade file?)\n", blurb(), name); abort(); } /* Why this behavior isn't automatic in *either* toolkit, I'll never know. Takes a scroller, viewport, or list as an argument. */ static void ensure_selected_item_visible (GtkWidget *widget) { #ifdef HAVE_GTK2 GtkTreePath *path; GtkTreeSelection *selection; GtkTreeIter iter; GtkTreeModel *model; selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)); if (!gtk_tree_selection_get_selected (selection, &model, &iter)) path = gtk_tree_path_new_first (); else path = gtk_tree_model_get_path (model, &iter); gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget), path, NULL, FALSE); gtk_tree_path_free (path); #else /* !HAVE_GTK2 */ GtkScrolledWindow *scroller = 0; GtkViewport *vp = 0; GtkList *list_widget = 0; GList *slist; GList *kids; int nkids = 0; GtkWidget *selected = 0; int list_elt = -1; GtkAdjustment *adj; gint parent_h, child_y, child_h, children_h, ignore; double ratio_t, ratio_b; if (GTK_IS_SCROLLED_WINDOW (widget)) { scroller = GTK_SCROLLED_WINDOW (widget); vp = GTK_VIEWPORT (GTK_BIN (scroller)->child); list_widget = GTK_LIST (GTK_BIN(vp)->child); } else if (GTK_IS_VIEWPORT (widget)) { vp = GTK_VIEWPORT (widget); scroller = GTK_SCROLLED_WINDOW (GTK_WIDGET (vp)->parent); list_widget = GTK_LIST (GTK_BIN(vp)->child); } else if (GTK_IS_LIST (widget)) { list_widget = GTK_LIST (widget); vp = GTK_VIEWPORT (GTK_WIDGET (list_widget)->parent); scroller = GTK_SCROLLED_WINDOW (GTK_WIDGET (vp)->parent); } else abort(); slist = list_widget->selection; selected = (slist ? GTK_WIDGET (slist->data) : 0); if (!selected) return; list_elt = gtk_list_child_position (list_widget, GTK_WIDGET (selected)); for (kids = gtk_container_children (GTK_CONTAINER (list_widget)); kids; kids = kids->next) nkids++; adj = gtk_scrolled_window_get_vadjustment (scroller); gdk_window_get_geometry (GET_WINDOW (GTK_WIDGET (vp)), &ignore, &ignore, &ignore, &parent_h, &ignore); gdk_window_get_geometry (GET_WINDOW (GTK_WIDGET (selected)), &ignore, &child_y, &ignore, &child_h, &ignore); children_h = nkids * child_h; ratio_t = ((double) child_y) / ((double) children_h); ratio_b = ((double) child_y + child_h) / ((double) children_h); if (adj->upper == 0.0) /* no items in list */ return; if (ratio_t < (adj->value / adj->upper) || ratio_b > ((adj->value + adj->page_size) / adj->upper)) { double target; int slop = parent_h * 0.75; /* how much to overshoot by */ if (ratio_t < (adj->value / adj->upper)) { double ratio_w = ((double) parent_h) / ((double) children_h); double ratio_l = (ratio_b - ratio_t); target = ((ratio_t - ratio_w + ratio_l) * adj->upper); target += slop; } else /* if (ratio_b > ((adj->value + adj->page_size) / adj->upper))*/ { target = ratio_t * adj->upper; target -= slop; } if (target > adj->upper - adj->page_size) target = adj->upper - adj->page_size; if (target < 0) target = 0; gtk_adjustment_set_value (adj, target); } #endif /* !HAVE_GTK2 */ } static void warning_dialog_dismiss_cb (GtkWidget *widget, gpointer user_data) { GtkWidget *shell = GTK_WIDGET (user_data); while (GET_PARENT (shell)) shell = GET_PARENT (shell); gtk_widget_destroy (GTK_WIDGET (shell)); } void restart_menu_cb (GtkWidget *widget, gpointer user_data); static void warning_dialog_restart_cb (GtkWidget *widget, gpointer user_data) { restart_menu_cb (widget, user_data); warning_dialog_dismiss_cb (widget, user_data); } static void warning_dialog_killg_cb (GtkWidget *widget, gpointer user_data) { kill_gnome_screensaver (); warning_dialog_dismiss_cb (widget, user_data); } static void warning_dialog_killk_cb (GtkWidget *widget, gpointer user_data) { kill_kde_screensaver (); warning_dialog_dismiss_cb (widget, user_data); } typedef enum { D_NONE, D_LAUNCH, D_GNOME, D_KDE } dialog_button; static Bool warning_dialog (GtkWidget *parent, const char *message, dialog_button button_type, int center) { char *msg = strdup (message); char *head; GtkWidget *dialog = gtk_dialog_new (); GtkWidget *label = 0; GtkWidget *ok = 0; GtkWidget *cancel = 0; int i = 0; while (parent && !GET_WINDOW (parent)) parent = GET_PARENT (parent); if (!parent || !GET_WINDOW (parent)) /* too early to pop up transient dialogs */ { fprintf (stderr, "%s: too early for dialog?\n", progname); free(msg); return False; } head = msg; while (head) { char name[20]; char *s = strchr (head, '\n'); if (s) *s = 0; sprintf (name, "label%d", i++); { label = gtk_label_new (head); #ifdef HAVE_GTK2 gtk_label_set_selectable (GTK_LABEL (label), TRUE); #endif /* HAVE_GTK2 */ #ifndef HAVE_GTK2 if (i == 1) { GTK_WIDGET (label)->style = gtk_style_copy (GTK_WIDGET (label)->style); GTK_WIDGET (label)->style->font = gdk_font_load (get_string_resource("warning_dialog.headingFont", "Dialog.Font")); gtk_widget_set_style (GTK_WIDGET (label), GTK_WIDGET (label)->style); } #endif /* !HAVE_GTK2 */ if (center <= 0) gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_box_pack_start (GTK_BOX (GET_CONTENT_AREA (GTK_DIALOG (dialog))), label, TRUE, TRUE, 0); gtk_widget_show (label); } if (s) head = s+1; else head = 0; center--; } label = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (GET_CONTENT_AREA (GTK_DIALOG (dialog))), label, TRUE, TRUE, 0); gtk_widget_show (label); label = gtk_hbutton_box_new (); gtk_box_pack_start (GTK_BOX (GET_ACTION_AREA (GTK_DIALOG (dialog))), label, TRUE, TRUE, 0); #ifdef HAVE_GTK2 if (button_type != D_NONE) { cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL); gtk_container_add (GTK_CONTAINER (label), cancel); } ok = gtk_button_new_from_stock (GTK_STOCK_OK); gtk_container_add (GTK_CONTAINER (label), ok); #else /* !HAVE_GTK2 */ ok = gtk_button_new_with_label ("OK"); gtk_container_add (GTK_CONTAINER (label), ok); if (button_type != D_NONE) { cancel = gtk_button_new_with_label ("Cancel"); gtk_container_add (GTK_CONTAINER (label), cancel); } #endif /* !HAVE_GTK2 */ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); gtk_container_set_border_width (GTK_CONTAINER (dialog), 10); gtk_window_set_title (GTK_WINDOW (dialog), progclass); SET_CAN_DEFAULT (ok); gtk_widget_show (ok); gtk_widget_grab_focus (ok); if (cancel) { SET_CAN_DEFAULT (cancel); gtk_widget_show (cancel); } gtk_widget_show (label); gtk_widget_show (dialog); if (button_type != D_NONE) { GtkSignalFunc fn; switch (button_type) { case D_LAUNCH: fn = GTK_SIGNAL_FUNC (warning_dialog_restart_cb); break; case D_GNOME: fn = GTK_SIGNAL_FUNC (warning_dialog_killg_cb); break; case D_KDE: fn = GTK_SIGNAL_FUNC (warning_dialog_killk_cb); break; default: abort(); break; } gtk_signal_connect_object (GTK_OBJECT (ok), "clicked", fn, (gpointer) dialog); gtk_signal_connect_object (GTK_OBJECT (cancel), "clicked", GTK_SIGNAL_FUNC (warning_dialog_dismiss_cb), (gpointer) dialog); } else { gtk_signal_connect_object (GTK_OBJECT (ok), "clicked", GTK_SIGNAL_FUNC (warning_dialog_dismiss_cb), (gpointer) dialog); } gdk_window_set_transient_for (GET_WINDOW (GTK_WIDGET (dialog)), GET_WINDOW (GTK_WIDGET (parent))); #ifdef HAVE_GTK2 gtk_window_present (GTK_WINDOW (dialog)); #else /* !HAVE_GTK2 */ gdk_window_show (GTK_WIDGET (dialog)->window); gdk_window_raise (GTK_WIDGET (dialog)->window); #endif /* !HAVE_GTK2 */ free (msg); return True; } static void run_cmd (state *s, Atom command, int arg) { char *err = 0; int status; flush_dialog_changes_and_save (s); status = xscreensaver_command (GDK_DISPLAY(), command, arg, False, &err); /* Kludge: ignore the spurious "window unexpectedly deleted" errors... */ if (status < 0 && err && strstr (err, "unexpectedly deleted")) status = 0; if (status < 0) { char buf [255]; if (err) sprintf (buf, "Error:\n\n%s", err); else strcpy (buf, "Unknown error!"); warning_dialog (s->toplevel_widget, buf, D_NONE, 100); } if (err) free (err); sensitize_menu_items (s, True); force_dialog_repaint (s); } static void run_hack (state *s, int list_elt, Bool report_errors_p) { int hack_number; char *err = 0; int status; if (list_elt < 0) return; hack_number = s->list_elt_to_hack_number[list_elt]; flush_dialog_changes_and_save (s); schedule_preview (s, 0); status = xscreensaver_command (GDK_DISPLAY(), XA_DEMO, hack_number + 1, False, &err); if (status < 0 && report_errors_p) { if (xscreensaver_running_p (s)) { /* Kludge: ignore the spurious "window unexpectedly deleted" errors... */ if (err && strstr (err, "unexpectedly deleted")) status = 0; if (status < 0) { char buf [255]; if (err) sprintf (buf, "Error:\n\n%s", err); else strcpy (buf, "Unknown error!"); warning_dialog (s->toplevel_widget, buf, D_NONE, 100); } } else { /* The error is that the daemon isn't running; offer to restart it. */ const char *d = DisplayString (GDK_DISPLAY()); char msg [1024]; sprintf (msg, _("Warning:\n\n" "The XScreenSaver daemon doesn't seem to be running\n" "on display \"%s\". Launch it now?"), d); warning_dialog (s->toplevel_widget, msg, D_LAUNCH, 1); } } if (err) free (err); sensitize_menu_items (s, False); } /* 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. */ G_MODULE_EXPORT void exit_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ flush_dialog_changes_and_save (s); kill_preview_subproc (s, False); gtk_main_quit (); } static gboolean wm_toplevel_close_cb (GtkWidget *widget, GdkEvent *event, gpointer data) { state *s = (state *) data; flush_dialog_changes_and_save (s); gtk_main_quit (); return TRUE; } G_MODULE_EXPORT void about_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { 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, ','); *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 look as good in the plain-old default Latin1 "C" locale.) */ #ifdef HAVE_GTK2 sprintf(copy, ("Copyright \xC2\xA9 1991-%s %s"), year, s); #else /* !HAVE_GTK2 */ sprintf(copy, ("Copyright \251 1991-%s %s"), year, s); #endif /* !HAVE_GTK2 */ sprintf (msg, "%s\n\n%s", copy, desc); /* I can't make gnome_about_new() work here -- it starts dying in gdk_imlib_get_visual() under gnome_about_new(). If this worked, then this might be the thing to do: #ifdef HAVE_CRAPPLET { const gchar *auth[] = { 0 }; GtkWidget *about = gnome_about_new (progclass, vers, "", auth, desc, "xscreensaver.xpm"); gtk_widget_show (about); } #else / * GTK but not GNOME * / ... */ { GdkColormap *colormap; GdkPixmap *gdkpixmap; GdkBitmap *mask; GtkWidget *dialog = gtk_dialog_new (); GtkWidget *hbox, *icon, *vbox, *label1, *label2, *hb, *ok; GtkWidget *parent = GTK_WIDGET (menuitem); while (GET_PARENT (parent)) parent = GET_PARENT (parent); hbox = gtk_hbox_new (FALSE, 20); gtk_box_pack_start (GTK_BOX (GET_CONTENT_AREA (GTK_DIALOG (dialog))), hbox, TRUE, TRUE, 0); colormap = gtk_widget_get_colormap (parent); gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask, NULL, (gchar **) logo_180_xpm); icon = gtk_pixmap_new (gdkpixmap, mask); gtk_misc_set_padding (GTK_MISC (icon), 10, 10); gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0); vbox = gtk_vbox_new (FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); label1 = gtk_label_new (vers); 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); #ifndef HAVE_GTK2 GTK_WIDGET (label1)->style = gtk_style_copy (GTK_WIDGET (label1)->style); GTK_WIDGET (label1)->style->font = gdk_font_load (get_string_resource ("about.headingFont","Dialog.Font")); gtk_widget_set_style (GTK_WIDGET (label1), GTK_WIDGET (label1)->style); #endif /* HAVE_GTK2 */ label2 = gtk_label_new (msg); gtk_box_pack_start (GTK_BOX (vbox), label2, TRUE, TRUE, 0); gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label2), 0.0, 0.25); #ifndef HAVE_GTK2 GTK_WIDGET (label2)->style = gtk_style_copy (GTK_WIDGET (label2)->style); GTK_WIDGET (label2)->style->font = gdk_font_load (get_string_resource ("about.bodyFont","Dialog.Font")); gtk_widget_set_style (GTK_WIDGET (label2), GTK_WIDGET (label2)->style); #endif /* HAVE_GTK2 */ hb = gtk_hbutton_box_new (); gtk_box_pack_start (GTK_BOX (GET_ACTION_AREA (GTK_DIALOG (dialog))), hb, TRUE, TRUE, 0); #ifdef HAVE_GTK2 ok = gtk_button_new_from_stock (GTK_STOCK_OK); #else /* !HAVE_GTK2 */ ok = gtk_button_new_with_label (_("OK")); #endif /* !HAVE_GTK2 */ gtk_container_add (GTK_CONTAINER (hb), ok); gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); gtk_container_set_border_width (GTK_CONTAINER (dialog), 10); gtk_window_set_title (GTK_WINDOW (dialog), progclass); gtk_widget_show (hbox); gtk_widget_show (icon); gtk_widget_show (vbox); gtk_widget_show (label1); gtk_widget_show (label2); gtk_widget_show (hb); gtk_widget_show (ok); gtk_widget_show (dialog); gtk_signal_connect_object (GTK_OBJECT (ok), "clicked", GTK_SIGNAL_FUNC (warning_dialog_dismiss_cb), (gpointer) dialog); gdk_window_set_transient_for (GET_WINDOW (GTK_WIDGET (dialog)), GET_WINDOW (GTK_WIDGET (parent))); gdk_window_show (GET_WINDOW (GTK_WIDGET (dialog))); gdk_window_raise (GET_WINDOW (GTK_WIDGET (dialog))); } } G_MODULE_EXPORT void doc_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ saver_preferences *p = &s->prefs; char *help_command; if (!p->help_url || !*p->help_url) { warning_dialog (s->toplevel_widget, _("Error:\n\n" "No Help URL has been specified.\n"), D_NONE, 100); return; } help_command = (char *) malloc (strlen (p->load_url_command) + (strlen (p->help_url) * 4) + 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); strcat (help_command, " ) &"); if (system (help_command) < 0) fprintf (stderr, "%s: fork error\n", blurb()); free (help_command); } G_MODULE_EXPORT void file_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ sensitize_menu_items (s, False); } G_MODULE_EXPORT void activate_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ run_cmd (s, XA_ACTIVATE, 0); } G_MODULE_EXPORT void lock_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ run_cmd (s, XA_LOCK, 0); } G_MODULE_EXPORT void kill_menu_cb (GtkMenuItem *menuitem, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ run_cmd (s, XA_EXIT, 0); } G_MODULE_EXPORT void restart_menu_cb (GtkWidget *widget, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ flush_dialog_changes_and_save (s); xscreensaver_command (GDK_DISPLAY(), XA_EXIT, 0, False, NULL); sleep (1); if (system ("xscreensaver -nosplash &") < 0) fprintf (stderr, "%s: fork error\n", blurb()); await_xscreensaver (s); } static Bool xscreensaver_running_p (state *s) { Display *dpy = GDK_DISPLAY(); char *rversion = 0; server_xscreensaver_version (dpy, &rversion, 0, 0); if (!rversion) return False; free (rversion); return True; } static void await_xscreensaver (state *s) { int countdown = 5; Bool ok = False; while (!ok && (--countdown > 0)) if (xscreensaver_running_p (s)) ok = True; else sleep (1); /* If it's not there yet, wait a second... */ sensitize_menu_items (s, True); if (! ok) { /* Timed out, no screensaver running. */ char buf [1024]; Bool root_p = (geteuid () == 0); strcpy (buf, _("Error:\n\n" "The xscreensaver daemon did not start up properly.\n" "\n")); if (root_p) strcat (buf, STFU _("You are running as root. This usually means that xscreensaver\n" "was unable to contact your X server because access control is\n" "turned on. Try running this command:\n" "\n" " xhost +localhost\n" "\n" "and then selecting `File / Restart Daemon'.\n" "\n" "Note that turning off access control will allow anyone logged\n" "on to this machine to access your screen, which might be\n" "considered a security problem. Please read the xscreensaver\n" "manual and FAQ for more information.\n" "\n" "You shouldn't run X as root. Instead, you should log in as a\n" "normal user, and `su' as necessary.")); else strcat (buf, _("Please check your $PATH and permissions.")); warning_dialog (s->toplevel_widget, buf, D_NONE, 1); } force_dialog_repaint (s); } static int selected_list_element (state *s) { return s->_selected_list_element; } static int 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) fprintf (stderr, "%s: wrote %s\n", blurb(), init_file_name()); return 0; } else { const char *f = init_file_name(); if (!f || !*f) warning_dialog (s->toplevel_widget, _("Error:\n\nCouldn't determine init file name!\n"), D_NONE, 100); else { char *b = (char *) malloc (strlen(f) + 1024); sprintf (b, _("Error:\n\nCouldn't write %s\n"), f); warning_dialog (s->toplevel_widget, b, D_NONE, 100); free (b); } return -1; } } G_MODULE_EXPORT void run_this_cb (GtkButton *button, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ int list_elt = selected_list_element (s); if (list_elt < 0) return; if (!flush_dialog_changes_and_save (s)) run_hack (s, list_elt, True); } G_MODULE_EXPORT void manual_cb (GtkButton *button, gpointer user_data) { Display *dpy = GDK_DISPLAY(); state *s = global_state_kludge; /* I hate C so much... */ saver_preferences *p = &s->prefs; GtkWidget *list_widget = name_to_widget (s, "list"); int list_elt = selected_list_element (s); int hack_number; char *name, *name2, *cmd, *str; char *oname = 0; if (list_elt < 0) return; hack_number = s->list_elt_to_hack_number[list_elt]; flush_dialog_changes_and_save (s); ensure_selected_item_visible (list_widget); name = strdup (p->screenhacks[hack_number]->command); name2 = name; oname = name; while (isspace (*name2)) name2++; str = name2; while (*str && !isspace (*str)) str++; *str = 0; str = strrchr (name2, '/'); if (str) name2 = str+1; cmd = get_string_resource (dpy, "manualCommand", "ManualCommand"); if (cmd) { char *cmd2 = (char *) malloc (strlen (cmd) + (strlen (name2) * 4) + 100); strcpy (cmd2, "( "); sprintf (cmd2 + strlen (cmd2), cmd, name2, name2, name2, name2); strcat (cmd2, " ) &"); if (system (cmd2) < 0) fprintf (stderr, "%s: fork error\n", blurb()); free (cmd2); } else { warning_dialog (GTK_WIDGET (button), _("Error:\n\nno `manualCommand' resource set."), D_NONE, 100); } free (oname); } static void force_list_select_item (state *s, GtkWidget *list, int list_elt, Bool scroll_p) { GtkWidget *parent = name_to_widget (s, "scroller"); gboolean was = GET_SENSITIVE (parent); #ifdef HAVE_GTK2 GtkTreeIter iter; GtkTreeModel *model; GtkTreeSelection *selection; #endif /* HAVE_GTK2 */ 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 (gtk_tree_model_iter_nth_child (model, &iter, NULL, list_elt)) { selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list)); gtk_tree_selection_select_iter (selection, &iter); } #else /* !HAVE_GTK2 */ gtk_list_select_item (GTK_LIST (list), list_elt); #endif /* !HAVE_GTK2 */ if (scroll_p) ensure_selected_item_visible (GTK_WIDGET (list)); if (!was) gtk_widget_set_sensitive (parent, False); } G_MODULE_EXPORT void run_next_cb (GtkButton *button, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ /* saver_preferences *p = &s->prefs; */ Bool ops = s->preview_suppressed_p; GtkWidget *list_widget = name_to_widget (s, "list"); int list_elt = selected_list_element (s); if (list_elt < 0) list_elt = 0; else list_elt++; if (list_elt >= s->list_count) list_elt = 0; s->preview_suppressed_p = True; flush_dialog_changes_and_save (s); force_list_select_item (s, list_widget, list_elt, True); populate_demo_window (s, list_elt); run_hack (s, list_elt, False); s->preview_suppressed_p = ops; } G_MODULE_EXPORT void run_prev_cb (GtkButton *button, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ /* saver_preferences *p = &s->prefs; */ Bool ops = s->preview_suppressed_p; GtkWidget *list_widget = name_to_widget (s, "list"); int list_elt = selected_list_element (s); if (list_elt < 0) list_elt = s->list_count - 1; else list_elt--; if (list_elt < 0) list_elt = s->list_count - 1; s->preview_suppressed_p = True; flush_dialog_changes_and_save (s); force_list_select_item (s, list_widget, list_elt, True); populate_demo_window (s, list_elt); run_hack (s, list_elt, False); s->preview_suppressed_p = ops; } /* Writes the given settings into prefs. Returns true if there was a change, False otherwise. command and/or visual may be 0, or enabled_p may be -1, meaning "no change". */ static Bool flush_changes (state *s, int list_elt, int enabled_p, const char *command, const char *visual) { saver_preferences *p = &s->prefs; Bool changed = False; screenhack *hack; int hack_number; if (list_elt < 0 || list_elt >= s->list_count) abort(); hack_number = s->list_elt_to_hack_number[list_elt]; hack = p->screenhacks[hack_number]; if (enabled_p != -1 && enabled_p != hack->enabled_p) { hack->enabled_p = enabled_p; changed = True; if (s->debug_p) fprintf (stderr, "%s: \"%s\": enabled => %d\n", blurb(), hack->name, enabled_p); } if (command) { if (!hack->command || !!strcmp (command, hack->command)) { if (hack->command) free (hack->command); hack->command = strdup (command); changed = True; if (s->debug_p) fprintf (stderr, "%s: \"%s\": command => \"%s\"\n", blurb(), hack->name, command); } } if (visual) { const char *ov = hack->visual; if (!ov || !*ov) ov = "any"; if (!*visual) visual = "any"; if (!!strcasecmp (visual, ov)) { if (hack->visual) free (hack->visual); hack->visual = strdup (visual); changed = True; if (s->debug_p) fprintf (stderr, "%s: \"%s\": visual => \"%s\"\n", blurb(), hack->name, visual); } } return changed; } /* Helper for the text fields that contain time specifications: this parses the text, and does error checking. */ static void hack_time_text (state *s, const char *line, Time *store, Bool sec_p) { if (*line) { int value; if (!sec_p || strchr (line, ':')) value = parse_time ((char *) line, sec_p, True); else { char c; if (sscanf (line, "%d%c", &value, &c) != 1) value = -1; if (!sec_p) value *= 60; } value *= 1000; /* Time measures in microseconds */ if (value < 0) { char b[255]; sprintf (b, _("Error:\n\n" "Unparsable time format: \"%s\"\n"), line); warning_dialog (s->toplevel_widget, b, D_NONE, 100); } else *store = value; } } static Bool directory_p (const char *path) { struct stat st; if (!path || !*path) return False; else if (stat (path, &st)) return False; else if (!S_ISDIR (st.st_mode)) return False; else return True; } static Bool file_p (const char *path) { struct stat st; if (!path || !*path) return False; else if (stat (path, &st)) return False; else if (S_ISDIR (st.st_mode)) return False; else return True; } static char * normalize_directory (const char *path) { int L; char *p2, *s; if (!path || !*path) return 0; L = strlen (path); p2 = (char *) malloc (L + 2); strcpy (p2, path); if (p2[L-1] == '/') /* remove trailing slash */ p2[--L] = 0; for (s = p2; s && *s; s++) { if (*s == '/' && (!strncmp (s, "/../", 4) || /* delete "XYZ/../" */ !strncmp (s, "/..\000", 4))) /* delete "XYZ/..$" */ { char *s0 = s; while (s0 > p2 && s0[-1] != '/') s0--; if (s0 > p2) { s0--; s += 3; /* strcpy (s0, s); */ memmove(s0, s, strlen(s) + 1); s = s0-1; } } else if (*s == '/' && !strncmp (s, "/./", 3)) { /* delete "/./" */ /* strcpy (s, s+2), s--; */ memmove(s, s+2, strlen(s+2) + 1); s--; } else if (*s == '/' && !strncmp (s, "/.\000", 3)) /* delete "/.$" */ *s = 0, s--; } /* Normalize consecutive slashes. Ignore doubled slashes after ":" to avoid mangling URLs. */ for (s = p2; s && *s; s++){ if (*s == ':') continue; if (!s[1] || !s[2]) continue; while (s[1] == '/' && s[2] == '/') /* strcpy (s+1, s+2); */ memmove (s+1, s+2, strlen(s+2) + 1); } /* and strip trailing whitespace for good measure. */ L = strlen(p2); while (isspace(p2[L-1])) p2[--L] = 0; return p2; } #ifdef HAVE_GTK2 typedef struct { state *s; int i; Bool *changed; } FlushForeachClosure; static gboolean flush_checkbox (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) { FlushForeachClosure *closure = data; gboolean checked; gtk_tree_model_get (model, iter, COL_ENABLED, &checked, -1); if (flush_changes (closure->s, closure->i, checked, 0, 0)) *closure->changed = True; closure->i++; /* don't remove row */ return FALSE; } #endif /* HAVE_GTK2 */ /* 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.) */ static Bool flush_dialog_changes_and_save (state *s) { saver_preferences *p = &s->prefs; saver_preferences P2, *p2 = &P2; #ifdef HAVE_GTK2 GtkTreeView *list_widget = GTK_TREE_VIEW (name_to_widget (s, "list")); GtkTreeModel *model = gtk_tree_view_get_model (list_widget); FlushForeachClosure closure; #else /* !HAVE_GTK2 */ GtkList *list_widget = GTK_LIST (name_to_widget (s, "list")); GList *kids = gtk_container_children (GTK_CONTAINER (list_widget)); int i; #endif /* !HAVE_GTK2 */ static Bool already_warned_about_missing_image_directory = False; /* very long name... */ Bool changed = False; GtkWidget *w; if (s->saving_p) return False; s->saving_p = True; *p2 = *p; /* Flush any checkbox changes in the list down into the prefs struct. */ #ifdef HAVE_GTK2 closure.s = s; closure.changed = &changed; closure.i = 0; gtk_tree_model_foreach (model, flush_checkbox, &closure); #else /* !HAVE_GTK2 */ for (i = 0; kids; kids = kids->next, i++) { GtkWidget *line = GTK_WIDGET (kids->data); GtkWidget *line_hbox = GTK_WIDGET (GTK_BIN (line)->child); GtkWidget *line_check = GTK_WIDGET (gtk_container_children (GTK_CONTAINER (line_hbox))->data); Bool checked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (line_check)); if (flush_changes (s, i, (checked ? 1 : 0), 0, 0)) changed = True; } #endif /* ~HAVE_GTK2 */ /* Flush the non-hack-specific settings down into the prefs struct. */ # define SECONDS(FIELD,NAME) \ w = name_to_widget (s, (NAME)); \ hack_time_text (s, gtk_entry_get_text (GTK_ENTRY (w)), (FIELD), True) # define MINUTES(FIELD,NAME) \ w = name_to_widget (s, (NAME)); \ hack_time_text (s, gtk_entry_get_text (GTK_ENTRY (w)), (FIELD), False) # define CHECKBOX(FIELD,NAME) \ w = name_to_widget (s, (NAME)); \ (FIELD) = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)) # define PATHNAME(FIELD,NAME) \ w = name_to_widget (s, (NAME)); \ (FIELD) = normalize_directory (gtk_entry_get_text (GTK_ENTRY (w))) # define TEXT(FIELD,NAME) \ w = name_to_widget (s, (NAME)); \ (FIELD) = (char *) g_strdup(gtk_entry_get_text (GTK_ENTRY (w))) MINUTES (&p2->timeout, "timeout_spinbutton"); MINUTES (&p2->cycle, "cycle_spinbutton"); CHECKBOX (p2->lock_p, "lock_button"); MINUTES (&p2->lock_timeout, "lock_spinbutton"); CHECKBOX (p2->dpms_enabled_p, "dpms_button"); CHECKBOX (p2->dpms_quickoff_p, "dpms_quickoff_button"); MINUTES (&p2->dpms_standby, "dpms_standby_spinbutton"); MINUTES (&p2->dpms_suspend, "dpms_suspend_spinbutton"); MINUTES (&p2->dpms_off, "dpms_off_spinbutton"); CHECKBOX (p2->grab_desktop_p, "grab_desk_button"); CHECKBOX (p2->grab_video_p, "grab_video_button"); CHECKBOX (p2->random_image_p, "grab_image_button"); PATHNAME (p2->image_directory, "image_text"); #if 0 CHECKBOX (p2->verbose_p, "verbose_button"); CHECKBOX (p2->capture_stderr_p, "capture_button"); CHECKBOX (p2->splash_p, "splash_button"); #endif { Bool v = False; CHECKBOX (v, "text_host_radio"); if (v) p2->tmode = TEXT_DATE; CHECKBOX (v, "text_radio"); if (v) p2->tmode = TEXT_LITERAL; CHECKBOX (v, "text_file_radio"); if (v) p2->tmode = TEXT_FILE; CHECKBOX (v, "text_program_radio"); if (v) p2->tmode = TEXT_PROGRAM; CHECKBOX (v, "text_url_radio"); if (v) p2->tmode = TEXT_URL; TEXT (p2->text_literal, "text_entry"); PATHNAME (p2->text_file, "text_file_entry"); PATHNAME (p2->text_program, "text_program_entry"); PATHNAME (p2->text_program, "text_program_entry"); 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"); # undef SECONDS # undef MINUTES # undef CHECKBOX # undef PATHNAME # undef TEXT /* 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:// */ if (p2->image_directory && *p2->image_directory && !directory_p (p2->image_directory) && strncmp(p2->image_directory, "http://", 6) && ( !already_warned_about_missing_image_directory || ( p->image_directory && *p->image_directory && strcmp(p->image_directory, p2->image_directory) ) ) ) { char b[255]; sprintf (b, "Warning:\n\n" "Directory does not exist: \"%s\"\n", p2->image_directory); if (warning_dialog (s->toplevel_widget, b, D_NONE, 100)) already_warned_about_missing_image_directory = True; } /* 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); if (menu_elt < 0 || menu_elt >= countof(mode_menu_order)) abort(); p2->mode = mode_menu_order[menu_elt]; } if (p2->mode == ONE_HACK) { int list_elt = selected_list_element (s); p2->selected_hack = (list_elt >= 0 ? s->list_elt_to_hack_number[list_elt] : -1); } # 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); \ } \ p->field = p2->field COPY(mode, "mode"); COPY(selected_hack, "selected_hack"); COPY(timeout, "timeout"); COPY(cycle, "cycle"); COPY(lock_p, "lock_p"); COPY(lock_timeout, "lock_timeout"); COPY(dpms_enabled_p, "dpms_enabled_p"); COPY(dpms_quickoff_p, "dpms_quickoff_enabled_p"); COPY(dpms_standby, "dpms_standby"); COPY(dpms_suspend, "dpms_suspend"); COPY(dpms_off, "dpms_off"); #if 0 COPY(verbose_p, "verbose_p"); COPY(capture_stderr_p, "capture_stderr_p"); COPY(splash_p, "splash_p"); #endif COPY(tmode, "tmode"); COPY(install_cmap_p, "install_cmap_p"); COPY(fade_p, "fade_p"); COPY(unfade_p, "unfade_p"); COPY(fade_seconds, "fade_seconds"); COPY(grab_desktop_p, "grab_desktop_p"); COPY(grab_video_p, "grab_video_p"); COPY(random_image_p, "random_image_p"); # undef COPY # define COPYSTR(FIELD,NAME) \ if (!p->FIELD || \ !p2->FIELD || \ strcmp(p->FIELD, p2->FIELD)) \ { \ changed = True; \ if (s->debug_p) \ fprintf (stderr, "%s: %s => \"%s\"\n", blurb(), NAME, p2->FIELD); \ } \ if (p->FIELD && p->FIELD != p2->FIELD) \ free (p->FIELD); \ p->FIELD = p2->FIELD; \ p2->FIELD = 0 COPYSTR(image_directory, "image_directory"); COPYSTR(text_literal, "text_literal"); COPYSTR(text_file, "text_file"); COPYSTR(text_program, "text_program"); COPYSTR(text_url, "text_url"); # undef COPYSTR populate_prefs_page (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); changed = demo_write_init_file (s, p); } s->saving_p = False; return changed; } /* Flush out any changes made in the popup dialog box (where changes take place only when the OK button is clicked.) */ static Bool flush_popup_changes_and_save (state *s) { Bool changed = False; saver_preferences *p = &s->prefs; 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")); const char *visual = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (vis)->entry)); const char *command = gtk_entry_get_text (cmd); char c; unsigned long id; if (s->saving_p) return False; s->saving_p = True; if (list_elt < 0) goto DONE; if (maybe_reload_init_file (s) != 0) { changed = True; goto DONE; } /* Sanity-check and canonicalize whatever the user typed into the combo box. */ if (!strcasecmp (visual, "")) visual = ""; else if (!strcasecmp (visual, "any")) visual = ""; else if (!strcasecmp (visual, "default")) visual = "Default"; else if (!strcasecmp (visual, "default-n")) visual = "Default-N"; else if (!strcasecmp (visual, "default-i")) visual = "Default-I"; else if (!strcasecmp (visual, "best")) visual = "Best"; else if (!strcasecmp (visual, "mono")) visual = "Mono"; else if (!strcasecmp (visual, "monochrome")) visual = "Mono"; else if (!strcasecmp (visual, "gray")) visual = "Gray"; else if (!strcasecmp (visual, "grey")) visual = "Gray"; else if (!strcasecmp (visual, "color")) visual = "Color"; else if (!strcasecmp (visual, "gl")) visual = "GL"; else if (!strcasecmp (visual, "staticgray")) visual = "StaticGray"; else if (!strcasecmp (visual, "staticcolor")) visual = "StaticColor"; else if (!strcasecmp (visual, "truecolor")) visual = "TrueColor"; else if (!strcasecmp (visual, "grayscale")) visual = "GrayScale"; else if (!strcasecmp (visual, "greyscale")) visual = "GrayScale"; else if (!strcasecmp (visual, "pseudocolor")) visual = "PseudoColor"; else if (!strcasecmp (visual, "directcolor")) visual = "DirectColor"; else if (1 == sscanf (visual, " %lu %c", &id, &c)) ; else if (1 == sscanf (visual, " 0x%lx %c", &id, &c)) ; else { gdk_beep (); /* unparsable */ visual = ""; gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (vis)->entry), _("Any")); } changed = flush_changes (s, list_elt, -1, command, visual); if (changed) { changed = demo_write_init_file (s, p); /* Do this to re-launch the hack if (and only if) the command line has changed. */ populate_demo_window (s, selected_list_element (s)); } DONE: s->saving_p = False; return changed; } G_MODULE_EXPORT void pref_changed_cb (GtkWidget *widget, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ if (! s->initializing_p) { s->initializing_p = True; flush_dialog_changes_and_save (s); s->initializing_p = False; } } G_MODULE_EXPORT gboolean pref_changed_event_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data) { pref_changed_cb (widget, user_data); return FALSE; } /* Callback on menu items in the "mode" options menu. */ G_MODULE_EXPORT void mode_menu_item_cb (GtkWidget *widget, gpointer user_data) { state *s = (state *) user_data; saver_preferences *p = &s->prefs; 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]; /* Keep the same list element displayed as before; except if we're switching *to* "one screensaver" mode from any other mode, set "the one" to be that which is currently selected. */ list_elt = selected_list_element (s); if (new_mode == ONE_HACK) p->selected_hack = s->list_elt_to_hack_number[list_elt]; { saver_mode old_mode = p->mode; p->mode = new_mode; populate_demo_window (s, list_elt); force_list_select_item (s, list, list_elt, True); p->mode = old_mode; /* put it back, so the init file gets written */ } pref_changed_cb (widget, user_data); } G_MODULE_EXPORT void switch_page_cb (GtkNotebook *notebook, GtkNotebookPage *page, gint page_num, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ pref_changed_cb (GTK_WIDGET (notebook), user_data); /* If we're switching to page 0, schedule the current hack to be run. Otherwise, schedule it to stop. */ if (page_num == 0) populate_demo_window (s, selected_list_element (s)); else schedule_preview (s, 0); } #ifdef HAVE_GTK2 static void list_activated_cb (GtkTreeView *list, GtkTreePath *path, GtkTreeViewColumn *column, gpointer data) { state *s = data; char *str; int list_elt; g_return_if_fail (!gdk_pointer_is_grabbed ()); str = gtk_tree_path_to_string (path); list_elt = strtol (str, NULL, 10); g_free (str); if (list_elt >= 0) run_hack (s, list_elt, True); } static void list_select_changed_cb (GtkTreeSelection *selection, gpointer data) { state *s = (state *)data; GtkTreeModel *model; GtkTreeIter iter; GtkTreePath *path; char *str; int list_elt; if (!gtk_tree_selection_get_selected (selection, &model, &iter)) return; path = gtk_tree_model_get_path (model, &iter); str = gtk_tree_path_to_string (path); list_elt = strtol (str, NULL, 10); gtk_tree_path_free (path); g_free (str); populate_demo_window (s, list_elt); flush_dialog_changes_and_save (s); /* Re-populate the Settings window any time a new item is selected in the list, in case both windows are currently visible. */ populate_popup_window (s); } #else /* !HAVE_GTK2 */ static time_t last_doubleclick_time = 0; /* FMH! This is to suppress the list_select_cb that comes in *after* we've double-clicked. */ static gint list_doubleclick_cb (GtkWidget *button, GdkEventButton *event, gpointer data) { state *s = (state *) data; if (event->type == GDK_2BUTTON_PRESS) { GtkList *list = GTK_LIST (name_to_widget (s, "list")); int list_elt = gtk_list_child_position (list, GTK_WIDGET (button)); last_doubleclick_time = time ((time_t *) 0); if (list_elt >= 0) run_hack (s, list_elt, True); } return FALSE; } static void list_select_cb (GtkList *list, GtkWidget *child, gpointer data) { state *s = (state *) data; time_t now = time ((time_t *) 0); if (now >= last_doubleclick_time + 2) { int list_elt = gtk_list_child_position (list, GTK_WIDGET (child)); populate_demo_window (s, list_elt); flush_dialog_changes_and_save (s); } } static void list_unselect_cb (GtkList *list, GtkWidget *child, gpointer data) { state *s = (state *) data; populate_demo_window (s, -1); flush_dialog_changes_and_save (s); } #endif /* !HAVE_GTK2 */ /* Called when the checkboxes that are in the left column of the scrolling list are clicked. This both populates the right pane (just as clicking on the label (really, listitem) does) and also syncs this checkbox with the right pane Enabled checkbox. */ static void list_checkbox_cb ( #ifdef HAVE_GTK2 GtkCellRendererToggle *toggle, gchar *path_string, #else /* !HAVE_GTK2 */ GtkWidget *cb, #endif /* !HAVE_GTK2 */ gpointer data) { state *s = (state *) data; #ifdef HAVE_GTK2 GtkScrolledWindow *scroller = GTK_SCROLLED_WINDOW (name_to_widget (s, "scroller")); GtkTreeView *list = GTK_TREE_VIEW (name_to_widget (s, "list")); GtkTreeModel *model = gtk_tree_view_get_model (list); GtkTreePath *path = gtk_tree_path_new_from_string (path_string); GtkTreeIter iter; gboolean active; #else /* !HAVE_GTK2 */ GtkWidget *line_hbox = GTK_WIDGET (cb)->parent; GtkWidget *line = GTK_WIDGET (line_hbox)->parent; GtkList *list = GTK_LIST (GTK_WIDGET (line)->parent); GtkViewport *vp = GTK_VIEWPORT (GTK_WIDGET (list)->parent); GtkScrolledWindow *scroller = GTK_SCROLLED_WINDOW (GTK_WIDGET (vp)->parent); #endif /* !HAVE_GTK2 */ GtkAdjustment *adj; double scroll_top; int list_elt; #ifdef HAVE_GTK2 if (!gtk_tree_model_get_iter (model, &iter, path)) { g_warning ("bad path: %s", path_string); return; } gtk_tree_path_free (path); gtk_tree_model_get (model, &iter, COL_ENABLED, &active, -1); gtk_list_store_set (GTK_LIST_STORE (model), &iter, COL_ENABLED, !active, -1); list_elt = strtol (path_string, NULL, 10); #else /* !HAVE_GTK2 */ list_elt = gtk_list_child_position (list, line); #endif /* !HAVE_GTK2 */ /* remember previous scroll position of the top of the list */ adj = gtk_scrolled_window_get_vadjustment (scroller); scroll_top = GET_ADJ_VALUE (adj); flush_dialog_changes_and_save (s); force_list_select_item (s, GTK_WIDGET (list), list_elt, False); populate_demo_window (s, list_elt); /* restore the previous scroll position of the top of the list. this is weak, but I don't really know why it's moving... */ gtk_adjustment_set_value (adj, scroll_top); } typedef struct { state *state; GtkFileSelection *widget; } file_selection_data; static void store_image_directory (GtkWidget *button, gpointer user_data) { file_selection_data *fsd = (file_selection_data *) user_data; state *s = fsd->state; GtkFileSelection *selector = fsd->widget; GtkWidget *top = s->toplevel_widget; saver_preferences *p = &s->prefs; const char *path = gtk_file_selection_get_filename (selector); if (p->image_directory && !strcmp(p->image_directory, path)) return; /* no change */ /* No warning for URLs. */ if ((!directory_p (path)) && strncmp(path, "http://", 6)) { char b[255]; sprintf (b, _("Error:\n\n" "Directory does not exist: \"%s\"\n"), path); warning_dialog (GTK_WIDGET (top), b, D_NONE, 100); return; } if (p->image_directory) free (p->image_directory); p->image_directory = normalize_directory (path); gtk_entry_set_text (GTK_ENTRY (name_to_widget (s, "image_text")), (p->image_directory ? p->image_directory : "")); demo_write_init_file (s, p); } static void store_text_file (GtkWidget *button, gpointer user_data) { file_selection_data *fsd = (file_selection_data *) user_data; state *s = fsd->state; GtkFileSelection *selector = fsd->widget; GtkWidget *top = s->toplevel_widget; saver_preferences *p = &s->prefs; const char *path = gtk_file_selection_get_filename (selector); if (p->text_file && !strcmp(p->text_file, path)) return; /* no change */ if (!file_p (path)) { char b[255]; sprintf (b, _("Error:\n\n" "File does not exist: \"%s\"\n"), path); warning_dialog (GTK_WIDGET (top), b, D_NONE, 100); return; } if (p->text_file) free (p->text_file); p->text_file = normalize_directory (path); gtk_entry_set_text (GTK_ENTRY (name_to_widget (s, "text_file_entry")), (p->text_file ? p->text_file : "")); demo_write_init_file (s, p); } static void store_text_program (GtkWidget *button, gpointer user_data) { file_selection_data *fsd = (file_selection_data *) user_data; state *s = fsd->state; GtkFileSelection *selector = fsd->widget; /*GtkWidget *top = s->toplevel_widget;*/ saver_preferences *p = &s->prefs; const char *path = gtk_file_selection_get_filename (selector); if (p->text_program && !strcmp(p->text_program, path)) return; /* no change */ # if 0 if (!file_p (path)) { char b[255]; sprintf (b, _("Error:\n\n" "File does not exist: \"%s\"\n"), path); warning_dialog (GTK_WIDGET (top), b, D_NONE, 100); return; } # endif if (p->text_program) free (p->text_program); p->text_program = normalize_directory (path); gtk_entry_set_text (GTK_ENTRY (name_to_widget (s, "text_program_entry")), (p->text_program ? p->text_program : "")); demo_write_init_file (s, p); } static void browse_image_dir_cancel (GtkWidget *button, gpointer user_data) { file_selection_data *fsd = (file_selection_data *) user_data; gtk_widget_hide (GTK_WIDGET (fsd->widget)); } static void browse_image_dir_ok (GtkWidget *button, gpointer user_data) { browse_image_dir_cancel (button, user_data); store_image_directory (button, user_data); } static void browse_text_file_ok (GtkWidget *button, gpointer user_data) { browse_image_dir_cancel (button, user_data); store_text_file (button, user_data); } static void browse_text_program_ok (GtkWidget *button, gpointer user_data) { browse_image_dir_cancel (button, user_data); store_text_program (button, user_data); } static void browse_image_dir_close (GtkWidget *widget, GdkEvent *event, gpointer user_data) { browse_image_dir_cancel (widget, user_data); } G_MODULE_EXPORT void browse_image_dir_cb (GtkButton *button, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ saver_preferences *p = &s->prefs; static file_selection_data *fsd = 0; GtkFileSelection *selector = GTK_FILE_SELECTION( gtk_file_selection_new ("Please select the image directory.")); if (!fsd) fsd = (file_selection_data *) malloc (sizeof (*fsd)); fsd->widget = selector; fsd->state = s; if (p->image_directory && *p->image_directory) gtk_file_selection_set_filename (selector, p->image_directory); gtk_signal_connect (GTK_OBJECT (selector->ok_button), "clicked", GTK_SIGNAL_FUNC (browse_image_dir_ok), (gpointer *) fsd); gtk_signal_connect (GTK_OBJECT (selector->cancel_button), "clicked", GTK_SIGNAL_FUNC (browse_image_dir_cancel), (gpointer *) fsd); gtk_signal_connect (GTK_OBJECT (selector), "delete_event", GTK_SIGNAL_FUNC (browse_image_dir_close), (gpointer *) fsd); gtk_widget_set_sensitive (GTK_WIDGET (selector->file_list), False); gtk_window_set_modal (GTK_WINDOW (selector), True); gtk_widget_show (GTK_WIDGET (selector)); } G_MODULE_EXPORT void browse_text_file_cb (GtkButton *button, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ saver_preferences *p = &s->prefs; static file_selection_data *fsd = 0; GtkFileSelection *selector = GTK_FILE_SELECTION( gtk_file_selection_new ("Please select a text file.")); if (!fsd) fsd = (file_selection_data *) malloc (sizeof (*fsd)); fsd->widget = selector; fsd->state = s; if (p->text_file && *p->text_file) gtk_file_selection_set_filename (selector, p->text_file); gtk_signal_connect (GTK_OBJECT (selector->ok_button), "clicked", GTK_SIGNAL_FUNC (browse_text_file_ok), (gpointer *) fsd); gtk_signal_connect (GTK_OBJECT (selector->cancel_button), "clicked", GTK_SIGNAL_FUNC (browse_image_dir_cancel), (gpointer *) fsd); gtk_signal_connect (GTK_OBJECT (selector), "delete_event", GTK_SIGNAL_FUNC (browse_image_dir_close), (gpointer *) fsd); gtk_window_set_modal (GTK_WINDOW (selector), True); gtk_widget_show (GTK_WIDGET (selector)); } G_MODULE_EXPORT void browse_text_program_cb (GtkButton *button, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ saver_preferences *p = &s->prefs; static file_selection_data *fsd = 0; GtkFileSelection *selector = GTK_FILE_SELECTION( gtk_file_selection_new ("Please select a text-generating program.")); if (!fsd) fsd = (file_selection_data *) malloc (sizeof (*fsd)); fsd->widget = selector; fsd->state = s; if (p->text_program && *p->text_program) gtk_file_selection_set_filename (selector, p->text_program); gtk_signal_connect (GTK_OBJECT (selector->ok_button), "clicked", GTK_SIGNAL_FUNC (browse_text_program_ok), (gpointer *) fsd); gtk_signal_connect (GTK_OBJECT (selector->cancel_button), "clicked", GTK_SIGNAL_FUNC (browse_image_dir_cancel), (gpointer *) fsd); gtk_signal_connect (GTK_OBJECT (selector), "delete_event", GTK_SIGNAL_FUNC (browse_image_dir_close), (gpointer *) fsd); gtk_window_set_modal (GTK_WINDOW (selector), True); gtk_widget_show (GTK_WIDGET (selector)); } G_MODULE_EXPORT void settings_cb (GtkButton *button, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ int list_elt = selected_list_element (s); populate_demo_window (s, list_elt); /* reset the widget */ populate_popup_window (s); /* create UI on popup window */ gtk_widget_show (s->popup_widget); } static void settings_sync_cmd_text (state *s) { # ifdef HAVE_XML GtkWidget *cmd = GTK_WIDGET (name_to_widget (s, "cmd_text")); char *cmd_line = get_configurator_command_line (s->cdata, False); gtk_entry_set_text (GTK_ENTRY (cmd), cmd_line); gtk_entry_set_position (GTK_ENTRY (cmd), strlen (cmd_line)); free (cmd_line); # endif /* HAVE_XML */ } G_MODULE_EXPORT void settings_adv_cb (GtkButton *button, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ GtkNotebook *notebook = GTK_NOTEBOOK (name_to_widget (s, "opt_notebook")); settings_sync_cmd_text (s); gtk_notebook_set_page (notebook, 1); } G_MODULE_EXPORT void settings_std_cb (GtkButton *button, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ GtkNotebook *notebook = GTK_NOTEBOOK (name_to_widget (s, "opt_notebook")); /* Re-create UI to reflect the in-progress command-line settings. */ populate_popup_window (s); gtk_notebook_set_page (notebook, 0); } G_MODULE_EXPORT void settings_reset_cb (GtkButton *button, gpointer user_data) { # ifdef HAVE_XML state *s = global_state_kludge; /* I hate C so much... */ GtkWidget *cmd = GTK_WIDGET (name_to_widget (s, "cmd_text")); char *cmd_line = get_configurator_command_line (s->cdata, True); gtk_entry_set_text (GTK_ENTRY (cmd), cmd_line); gtk_entry_set_position (GTK_ENTRY (cmd), strlen (cmd_line)); free (cmd_line); populate_popup_window (s); # endif /* HAVE_XML */ } G_MODULE_EXPORT void settings_switch_page_cb (GtkNotebook *notebook, GtkNotebookPage *page, gint page_num, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ GtkWidget *adv = name_to_widget (s, "adv_button"); GtkWidget *std = name_to_widget (s, "std_button"); if (page_num == 0) { gtk_widget_show (adv); gtk_widget_hide (std); } else if (page_num == 1) { gtk_widget_hide (adv); gtk_widget_show (std); } else abort(); } G_MODULE_EXPORT void settings_cancel_cb (GtkButton *button, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ gtk_widget_hide (s->popup_widget); } G_MODULE_EXPORT void settings_ok_cb (GtkButton *button, gpointer user_data) { state *s = global_state_kludge; /* I hate C so much... */ GtkNotebook *notebook = GTK_NOTEBOOK (name_to_widget (s, "opt_notebook")); int page = gtk_notebook_get_current_page (notebook); if (page == 0) /* Regenerate the command-line from the widget contents before saving. But don't do this if we're looking at the command-line page already, or we will blow away what they typed... */ settings_sync_cmd_text (s); flush_popup_changes_and_save (s); gtk_widget_hide (s->popup_widget); } static gboolean wm_popup_close_cb (GtkWidget *widget, GdkEvent *event, gpointer data) { state *s = (state *) data; settings_cancel_cb (0, (gpointer) s); return TRUE; } /* Populating the various widgets */ /* Returns the number of the last hack run by the server. */ static int server_current_hack (void) { Atom type; int format; unsigned long nitems, bytesafter; unsigned char *dataP = 0; Display *dpy = GDK_DISPLAY(); int hack_number = -1; if (XGetWindowProperty (dpy, RootWindow (dpy, 0), /* always screen #0 */ XA_SCREENSAVER_STATUS, 0, 3, False, XA_INTEGER, &type, &format, &nitems, &bytesafter, &dataP) == Success && type == XA_INTEGER && nitems >= 3 && dataP) { PROP32 *data = (PROP32 *) dataP; hack_number = (int) data[2] - 1; } if (dataP) XFree (dataP); return hack_number; } /* Finds the number of the last hack that was run, and makes that item be selected by default. */ static void scroll_to_current_hack (state *s) { saver_preferences *p = &s->prefs; int hack_number = -1; if (p->mode == ONE_HACK) /* in "one" mode, use the one */ hack_number = p->selected_hack; if (hack_number < 0) /* otherwise, use the last-run */ hack_number = server_current_hack (); if (hack_number < 0) /* failing that, last "one mode" */ hack_number = p->selected_hack; if (hack_number < 0) /* failing that, newest hack. */ { /* We should only get here if the user does not have a .xscreensaver file, and the screen has not been blanked with a hack since X started up: in other words, this is probably a fresh install. Instead of just defaulting to hack #0 (in either "programs" or "alphabetical" order) let's try to default to the last runnable hack in the "programs" list: this is probably the hack that was most recently added to the xscreensaver distribution (and so it's probably the currently-coolest one!) */ hack_number = p->screenhacks_count-1; while (hack_number > 0 && ! (s->hacks_available_p[hack_number] && p->screenhacks[hack_number]->enabled_p)) hack_number--; } if (hack_number >= 0 && hack_number < p->screenhacks_count) { int list_elt = s->hack_number_to_list_elt[hack_number]; GtkWidget *list = name_to_widget (s, "list"); force_list_select_item (s, list, list_elt, True); populate_demo_window (s, list_elt); } } static void populate_hack_list (state *s) { Display *dpy = GDK_DISPLAY(); #ifdef HAVE_GTK2 saver_preferences *p = &s->prefs; GtkTreeView *list = GTK_TREE_VIEW (name_to_widget (s, "list")); GtkListStore *model; GtkTreeSelection *selection; GtkCellRenderer *ren; GtkTreeIter iter; int i; g_object_get (G_OBJECT (list), "model", &model, NULL); if (!model) { model = gtk_list_store_new (COL_LAST, G_TYPE_BOOLEAN, G_TYPE_STRING); g_object_set (G_OBJECT (list), "model", model, NULL); g_object_unref (model); ren = gtk_cell_renderer_toggle_new (); gtk_tree_view_insert_column_with_attributes (list, COL_ENABLED, _("Use"), ren, "active", COL_ENABLED, NULL); g_signal_connect (ren, "toggled", G_CALLBACK (list_checkbox_cb), s); ren = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (list, COL_NAME, _("Screen Saver"), ren, "markup", COL_NAME, NULL); g_signal_connect_after (list, "row_activated", G_CALLBACK (list_activated_cb), s); selection = gtk_tree_view_get_selection (list); g_signal_connect (selection, "changed", G_CALLBACK (list_select_changed_cb), s); } for (i = 0; i < s->list_count; i++) { int hack_number = s->list_elt_to_hack_number[i]; screenhack *hack = (hack_number < 0 ? 0 : p->screenhacks[hack_number]); char *pretty_name; Bool available_p = (hack && s->hacks_available_p [hack_number]); if (!hack) continue; /* If we're to suppress uninstalled hacks, check $PATH now. */ if (p->ignore_uninstalled_p && !available_p) continue; pretty_name = (hack->name ? strdup (hack->name) : make_hack_name (dpy, hack->command)); if (!available_p) { /* Make the text foreground be the color of insensitive widgets (but don't actually make it be insensitive, since we still want to be able to click on it.) */ GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (list)); GdkColor *fg = &style->fg[GTK_STATE_INSENSITIVE]; /* GdkColor *bg = &style->bg[GTK_STATE_INSENSITIVE]; */ char *buf = (char *) malloc (strlen (pretty_name) + 100); sprintf (buf, "%s", fg->red >> 8, fg->green >> 8, fg->blue >> 8, /* bg->red >> 8, bg->green >> 8, bg->blue >> 8, */ pretty_name); free (pretty_name); pretty_name = buf; } gtk_list_store_append (model, &iter); gtk_list_store_set (model, &iter, COL_ENABLED, hack->enabled_p, COL_NAME, pretty_name, -1); free (pretty_name); } #else /* !HAVE_GTK2 */ saver_preferences *p = &s->prefs; GtkList *list = GTK_LIST (name_to_widget (s, "list")); int i; for (i = 0; i < s->list_count; i++) { int hack_number = s->list_elt_to_hack_number[i]; screenhack *hack = (hack_number < 0 ? 0 : p->screenhacks[hack_number]); /* A GtkList must contain only GtkListItems, but those can contain an arbitrary widget. We add an Hbox, and inside that, a Checkbox and a Label. We handle single and double click events on the line itself, for clicking on the text, but the interior checkbox also handles its own events. */ GtkWidget *line; GtkWidget *line_hbox; GtkWidget *line_check; GtkWidget *line_label; char *pretty_name; Bool available_p = (hack && s->hacks_available_p [hack_number]); if (!hack) continue; /* If we're to suppress uninstalled hacks, check $PATH now. */ if (p->ignore_uninstalled_p && !available_p) continue; pretty_name = (hack->name ? strdup (hack->name) : make_hack_name (hack->command)); line = gtk_list_item_new (); line_hbox = gtk_hbox_new (FALSE, 0); line_check = gtk_check_button_new (); line_label = gtk_label_new (pretty_name); gtk_container_add (GTK_CONTAINER (line), line_hbox); gtk_box_pack_start (GTK_BOX (line_hbox), line_check, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (line_hbox), line_label, FALSE, FALSE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (line_check), hack->enabled_p); gtk_label_set_justify (GTK_LABEL (line_label), GTK_JUSTIFY_LEFT); gtk_widget_show (line_check); gtk_widget_show (line_label); gtk_widget_show (line_hbox); gtk_widget_show (line); free (pretty_name); gtk_container_add (GTK_CONTAINER (list), line); gtk_signal_connect (GTK_OBJECT (line), "button_press_event", GTK_SIGNAL_FUNC (list_doubleclick_cb), (gpointer) s); gtk_signal_connect (GTK_OBJECT (line_check), "toggled", GTK_SIGNAL_FUNC (list_checkbox_cb), (gpointer) s); gtk_widget_show (line); if (!available_p) { /* Make the widget be colored like insensitive widgets (but don't actually make it be insensitive, since we still want to be able to click on it.) */ GtkRcStyle *rc_style; GdkColor fg, bg; gtk_widget_realize (GTK_WIDGET (line_label)); fg = GTK_WIDGET (line_label)->style->fg[GTK_STATE_INSENSITIVE]; bg = GTK_WIDGET (line_label)->style->bg[GTK_STATE_INSENSITIVE]; rc_style = gtk_rc_style_new (); rc_style->fg[GTK_STATE_NORMAL] = fg; rc_style->bg[GTK_STATE_NORMAL] = bg; rc_style->color_flags[GTK_STATE_NORMAL] |= GTK_RC_FG|GTK_RC_BG; gtk_widget_modify_style (GTK_WIDGET (line_label), rc_style); gtk_rc_style_unref (rc_style); } } gtk_signal_connect (GTK_OBJECT (list), "select_child", GTK_SIGNAL_FUNC (list_select_cb), (gpointer) s); gtk_signal_connect (GTK_OBJECT (list), "unselect_child", GTK_SIGNAL_FUNC (list_unselect_cb), (gpointer) s); #endif /* !HAVE_GTK2 */ } static void update_list_sensitivity (state *s) { saver_preferences *p = &s->prefs; Bool sensitive = (p->mode == RANDOM_HACKS || p->mode == RANDOM_HACKS_SAME || p->mode == ONE_HACK); Bool checkable = (p->mode == RANDOM_HACKS || p->mode == RANDOM_HACKS_SAME); Bool blankable = (p->mode != DONT_BLANK); #ifndef HAVE_GTK2 GtkWidget *head = name_to_widget (s, "col_head_hbox"); GtkWidget *use = name_to_widget (s, "use_col_frame"); #endif /* HAVE_GTK2 */ GtkWidget *scroller = name_to_widget (s, "scroller"); GtkWidget *buttons = name_to_widget (s, "next_prev_hbox"); GtkWidget *blanker = name_to_widget (s, "blanking_table"); #ifdef HAVE_GTK2 GtkTreeView *list = GTK_TREE_VIEW (name_to_widget (s, "list")); GtkTreeViewColumn *use = gtk_tree_view_get_column (list, COL_ENABLED); #else /* !HAVE_GTK2 */ GtkList *list = GTK_LIST (name_to_widget (s, "list")); GList *kids = gtk_container_children (GTK_CONTAINER (list)); gtk_widget_set_sensitive (GTK_WIDGET (head), sensitive); #endif /* !HAVE_GTK2 */ gtk_widget_set_sensitive (GTK_WIDGET (scroller), sensitive); gtk_widget_set_sensitive (GTK_WIDGET (buttons), sensitive); gtk_widget_set_sensitive (GTK_WIDGET (blanker), blankable); #ifdef HAVE_GTK2 gtk_tree_view_column_set_visible (use, checkable); #else /* !HAVE_GTK2 */ if (checkable) gtk_widget_show (use); /* the "Use" column header */ else gtk_widget_hide (use); while (kids) { GtkBin *line = GTK_BIN (kids->data); GtkContainer *line_hbox = GTK_CONTAINER (line->child); GtkWidget *line_check = GTK_WIDGET (gtk_container_children (line_hbox)->data); if (checkable) gtk_widget_show (line_check); else gtk_widget_hide (line_check); kids = kids->next; } #endif /* !HAVE_GTK2 */ } static void populate_prefs_page (state *s) { saver_preferences *p = &s->prefs; Bool can_lock_p = True; /* Disable all the "lock" controls if locking support was not provided at compile-time, or if running on MacOS. */ # if defined(NO_LOCKING) || defined(__APPLE__) can_lock_p = False; # endif /* If there is only one screen, the mode menu contains "random" but not "random-same". */ if (s->nscreens <= 1 && p->mode == RANDOM_HACKS_SAME) p->mode = RANDOM_HACKS; /* The file supports timeouts of less than a minute, but the GUI does not, so throttle the values to be at least one minute (since "0" is a bad rounding choice...) */ # define THROTTLE(NAME) if (p->NAME != 0 && p->NAME < 60000) p->NAME = 60000 THROTTLE (timeout); THROTTLE (cycle); /* THROTTLE (passwd_timeout); */ /* GUI doesn't set this; leave it alone */ # undef THROTTLE # define FMT_MINUTES(NAME,N) \ gtk_spin_button_set_value (GTK_SPIN_BUTTON (name_to_widget (s, (NAME))), (double)((N) + 59) / (60 * 1000)) # define FMT_SECONDS(NAME,N) \ gtk_spin_button_set_value (GTK_SPIN_BUTTON (name_to_widget (s, (NAME))), (double)((N) / 1000)) FMT_MINUTES ("timeout_spinbutton", p->timeout); FMT_MINUTES ("cycle_spinbutton", p->cycle); FMT_MINUTES ("lock_spinbutton", p->lock_timeout); FMT_MINUTES ("dpms_standby_spinbutton", p->dpms_standby); FMT_MINUTES ("dpms_suspend_spinbutton", p->dpms_suspend); FMT_MINUTES ("dpms_off_spinbutton", p->dpms_off); FMT_SECONDS ("fade_spinbutton", p->fade_seconds); # undef FMT_MINUTES # undef FMT_SECONDS # define TOGGLE_ACTIVE(NAME,ACTIVEP) \ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (name_to_widget (s,(NAME))),\ (ACTIVEP)) 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); TOGGLE_ACTIVE ("dpms_quickoff_button", p->dpms_quickoff_p); 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); switch (p->tmode) { case TEXT_LITERAL: TOGGLE_ACTIVE ("text_radio", True); break; case TEXT_FILE: TOGGLE_ACTIVE ("text_file_radio", True); break; case TEXT_PROGRAM: TOGGLE_ACTIVE ("text_program_radio", True); break; case TEXT_URL: TOGGLE_ACTIVE ("text_url_radio", True); break; default: TOGGLE_ACTIVE ("text_host_radio", True); break; } # undef TOGGLE_ACTIVE gtk_entry_set_text (GTK_ENTRY (name_to_widget (s, "image_text")), (p->image_directory ? p->image_directory : "")); gtk_widget_set_sensitive (name_to_widget (s, "image_text"), p->random_image_p); gtk_widget_set_sensitive (name_to_widget (s, "image_browse_button"), p->random_image_p); gtk_entry_set_text (GTK_ENTRY (name_to_widget (s, "text_entry")), (p->text_literal ? p->text_literal : "")); gtk_entry_set_text (GTK_ENTRY (name_to_widget (s, "text_file_entry")), (p->text_file ? p->text_file : "")); gtk_entry_set_text (GTK_ENTRY (name_to_widget (s, "text_program_entry")), (p->text_program ? p->text_program : "")); gtk_entry_set_text (GTK_ENTRY (name_to_widget (s, "text_url_entry")), (p->text_url ? p->text_url : "")); gtk_widget_set_sensitive (name_to_widget (s, "text_entry"), p->tmode == TEXT_LITERAL); gtk_widget_set_sensitive (name_to_widget (s, "text_file_entry"), p->tmode == TEXT_FILE); gtk_widget_set_sensitive (name_to_widget (s, "text_file_browse"), p->tmode == TEXT_FILE); gtk_widget_set_sensitive (name_to_widget (s, "text_program_entry"), p->tmode == TEXT_PROGRAM); gtk_widget_set_sensitive (name_to_widget (s, "text_program_browse"), p->tmode == TEXT_PROGRAM); gtk_widget_set_sensitive (name_to_widget (s, "text_url_entry"), p->tmode == TEXT_URL); /* Map the `saver_mode' enum to mode menu to values. */ { GtkOptionMenu *opt = GTK_OPTION_MENU (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); 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 { int op = 0, event = 0, error = 0; if (XQueryExtension (dpy, "DPMS", &op, &event, &error)) dpms_supported = True; } #endif /* HAVE_DPMS_EXTENSION */ # define SENSITIZE(NAME,SENSITIVEP) \ gtk_widget_set_sensitive (name_to_widget (s, (NAME)), (SENSITIVEP)) /* Blanking and Locking */ SENSITIZE ("lock_button", can_lock_p); SENSITIZE ("lock_spinbutton", can_lock_p && p->lock_p); SENSITIZE ("lock_mlabel", can_lock_p && p->lock_p); /* DPMS */ 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); SENSITIZE ("dpms_standby_spinbutton", dpms_supported && p->dpms_enabled_p); SENSITIZE ("dpms_suspend_label", dpms_supported && p->dpms_enabled_p); SENSITIZE ("dpms_suspend_mlabel", dpms_supported && p->dpms_enabled_p); SENSITIZE ("dpms_suspend_spinbutton", dpms_supported && p->dpms_enabled_p); 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); /* 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))); # undef SENSITIZE } } static void populate_popup_window (state *s) { GtkLabel *doc = GTK_LABEL (name_to_widget (s, "doc")); char *doc_string = 0; /* #### not in Gtk 1.2 gtk_label_set_selectable (doc); */ # ifdef HAVE_XML if (s->cdata) { free_conf_data (s->cdata); s->cdata = 0; } { saver_preferences *p = &s->prefs; int list_elt = selected_list_element (s); int hack_number = (list_elt >= 0 && list_elt < s->list_count ? s->list_elt_to_hack_number[list_elt] : -1); screenhack *hack = (hack_number >= 0 ? p->screenhacks[hack_number] : 0); if (hack) { GtkWidget *parent = name_to_widget (s, "settings_vbox"); GtkWidget *cmd = GTK_WIDGET (name_to_widget (s, "cmd_text")); const char *cmd_line = gtk_entry_get_text (GTK_ENTRY (cmd)); s->cdata = load_configurator (cmd_line, s->debug_p); if (s->cdata && s->cdata->widget) gtk_box_pack_start (GTK_BOX (parent), s->cdata->widget, TRUE, TRUE, 0); } } doc_string = (s->cdata ? s->cdata->description : 0); # else /* !HAVE_XML */ doc_string = _("Descriptions not available: no XML support compiled in."); # endif /* !HAVE_XML */ gtk_label_set_text (doc, (doc_string ? _(doc_string) : _("No description available."))); } static void sensitize_demo_widgets (state *s, Bool sensitive_p) { const char *names[] = { "demo", "settings", "cmd_label", "cmd_text", "manual", "visual", "visual_combo" }; int i; for (i = 0; i < countof(names); i++) { GtkWidget *w = name_to_widget (s, names[i]); gtk_widget_set_sensitive (GTK_WIDGET(w), sensitive_p); } } static void 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", /* "demo" */ }; int i; if (force_p || now > last_checked + 10) /* check every 10 seconds */ { running_p = xscreensaver_running_p (s); last_checked = time ((time_t *) 0); } for (i = 0; i < countof(names); i++) { GtkWidget *w = name_to_widget (s, names[i]); gtk_widget_set_sensitive (GTK_WIDGET(w), running_p); } } /* When the File menu is de-posted after a "Restart Daemon" command, the window underneath doesn't repaint for some reason. I guess this is a bug in exposure handling in GTK or GDK. This works around it. */ static void force_dialog_repaint (state *s) { #if 1 /* Tell GDK to invalidate and repaint the whole window. */ GdkWindow *w = GET_WINDOW (s->toplevel_widget); GdkRegion *region = gdk_region_new (); GdkRectangle rect; rect.x = rect.y = 0; rect.width = rect.height = 32767; gdk_region_union_with_rect (region, &rect); gdk_window_invalidate_region (w, region, True); gdk_region_destroy (region); gdk_window_process_updates (w, True); #else /* Force the server to send an exposure event by creating and then destroying a window as a child of the top level shell. */ Display *dpy = GDK_DISPLAY(); Window parent = GDK_WINDOW_XWINDOW (s->toplevel_widget->window); Window w; XWindowAttributes xgwa; XGetWindowAttributes (dpy, parent, &xgwa); w = XCreateSimpleWindow (dpy, parent, 0, 0, xgwa.width, xgwa.height, 0,0,0); XMapRaised (dpy, w); XDestroyWindow (dpy, w); XSync (dpy, False); #endif } /* Even though we've given these text fields a maximum number of characters, their default size is still about 30 characters wide -- so measure out a string in their font, and resize them to just fit that. */ static void fix_text_entry_sizes (state *s) { GtkWidget *w; # if 0 /* appears no longer necessary with Gtk 1.2.10 */ const char * const spinbuttons[] = { "timeout_spinbutton", "cycle_spinbutton", "lock_spinbutton", "dpms_standby_spinbutton", "dpms_suspend_spinbutton", "dpms_off_spinbutton", "-fade_spinbutton" }; int i; int width = 0; for (i = 0; i < countof(spinbuttons); i++) { const char *n = spinbuttons[i]; int cols = 4; while (*n == '-') n++, cols--; w = GTK_WIDGET (name_to_widget (s, n)); width = gdk_text_width (w->style->font, "MMMMMMMM", cols); gtk_widget_set_usize (w, width, -2); } /* Now fix the width of the combo box. */ w = GTK_WIDGET (name_to_widget (s, "visual_combo")); w = GTK_COMBO (w)->entry; width = gdk_string_width (w->style->font, "PseudoColor___"); gtk_widget_set_usize (w, width, -2); /* Now fix the width of the file entry text. */ w = GTK_WIDGET (name_to_widget (s, "image_text")); width = gdk_string_width (w->style->font, "mmmmmmmmmmmmmm"); gtk_widget_set_usize (w, width, -2); /* Now fix the width of the command line text. */ w = GTK_WIDGET (name_to_widget (s, "cmd_text")); width = gdk_string_width (w->style->font, "mmmmmmmmmmmmmmmmmmmm"); gtk_widget_set_usize (w, width, -2); # endif /* 0 */ /* Now fix the height of the list widget: make it default to being around 10 text-lines high instead of 4. */ w = GTK_WIDGET (name_to_widget (s, "list")); { int lines = 10; int height; int leading = 3; /* approximate is ok... */ int border = 2; #ifdef HAVE_GTK2 PangoFontMetrics *pain = pango_context_get_metrics (gtk_widget_get_pango_context (w), gtk_widget_get_style (w)->font_desc, gtk_get_default_language ()); height = PANGO_PIXELS (pango_font_metrics_get_ascent (pain) + pango_font_metrics_get_descent (pain)); #else /* !HAVE_GTK2 */ height = w->style->font->ascent + w->style->font->descent; #endif /* !HAVE_GTK2 */ height += leading; height *= lines; height += border * 2; w = GTK_WIDGET (name_to_widget (s, "scroller")); gtk_widget_set_usize (w, -2, height); } } #ifndef HAVE_GTK2 /* Pixmaps for the up and down arrow buttons (yeah, this is sleazy...) */ static char *up_arrow_xpm[] = { "15 15 4 1", " c None", "- c #FFFFFF", "+ c #D6D6D6", "@ c #000000", " @ ", " @ ", " -+@ ", " -+@ ", " -+++@ ", " -+++@ ", " -+++++@ ", " -+++++@ ", " -+++++++@ ", " -+++++++@ ", " -+++++++++@ ", " -+++++++++@ ", " -+++++++++++@ ", " @@@@@@@@@@@@@ ", " ", /* Need these here because gdk_pixmap_create_from_xpm_d() walks off the end of the array (Gtk 1.2.5.) */ "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" }; static char *down_arrow_xpm[] = { "15 15 4 1", " c None", "- c #FFFFFF", "+ c #D6D6D6", "@ c #000000", " ", " ------------- ", " -+++++++++++@ ", " -+++++++++@ ", " -+++++++++@ ", " -+++++++@ ", " -+++++++@ ", " -+++++@ ", " -+++++@ ", " -+++@ ", " -+++@ ", " -+@ ", " -+@ ", " @ ", " @ ", /* Need these here because gdk_pixmap_create_from_xpm_d() walks off the end of the array (Gtk 1.2.5.) */ "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" }; static void pixmapify_button (state *s, int down_p) { GdkPixmap *pixmap; GdkBitmap *mask; GtkWidget *pixmapwid; GtkStyle *style; GtkWidget *w; w = GTK_WIDGET (name_to_widget (s, (down_p ? "next" : "prev"))); style = gtk_widget_get_style (w); mask = 0; pixmap = gdk_pixmap_create_from_xpm_d (w->window, &mask, &style->bg[GTK_STATE_NORMAL], (down_p ? (gchar **) down_arrow_xpm : (gchar **) up_arrow_xpm)); pixmapwid = gtk_pixmap_new (pixmap, mask); gtk_widget_show (pixmapwid); gtk_container_remove (GTK_CONTAINER (w), GTK_BIN (w)->child); gtk_container_add (GTK_CONTAINER (w), pixmapwid); } static void map_next_button_cb (GtkWidget *w, gpointer user_data) { state *s = (state *) user_data; pixmapify_button (s, 1); } static void map_prev_button_cb (GtkWidget *w, gpointer user_data) { state *s = (state *) user_data; pixmapify_button (s, 0); } #endif /* !HAVE_GTK2 */ #ifndef HAVE_GTK2 /* Work around a Gtk bug that causes label widgets to wrap text too early. */ static void you_are_not_a_unique_or_beautiful_snowflake (GtkWidget *label, GtkAllocation *allocation, void *foo) { GtkRequisition req; GtkWidgetAuxInfo *aux_info; aux_info = gtk_object_get_data (GTK_OBJECT (label), "gtk-aux-info"); aux_info->width = allocation->width; aux_info->height = -2; aux_info->x = -1; aux_info->y = -1; gtk_widget_size_request (label, &req); } /* Feel the love. Thanks to Nat Friedman for finding this workaround. */ static void eschew_gtk_lossage (GtkLabel *label) { GtkWidgetAuxInfo *aux_info = g_new0 (GtkWidgetAuxInfo, 1); aux_info->width = GTK_WIDGET (label)->allocation.width; aux_info->height = -2; aux_info->x = -1; aux_info->y = -1; gtk_object_set_data (GTK_OBJECT (label), "gtk-aux-info", aux_info); gtk_signal_connect (GTK_OBJECT (label), "size_allocate", GTK_SIGNAL_FUNC (you_are_not_a_unique_or_beautiful_snowflake), 0); gtk_widget_set_usize (GTK_WIDGET (label), -2, -2); gtk_widget_queue_resize (GTK_WIDGET (label)); } #endif /* !HAVE_GTK2 */ static void populate_demo_window (state *s, int list_elt) { Display *dpy = GDK_DISPLAY(); saver_preferences *p = &s->prefs; screenhack *hack; char *pretty_name; 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")); GtkWidget *list = GTK_WIDGET (name_to_widget (s, "list")); if (p->mode == BLANK_ONLY) { hack = 0; pretty_name = strdup (_("Blank Screen")); schedule_preview (s, 0); } else if (p->mode == DONT_BLANK) { hack = 0; pretty_name = strdup (_("Screen Saver Disabled")); schedule_preview (s, 0); } else { int hack_number = (list_elt >= 0 && list_elt < s->list_count ? s->list_elt_to_hack_number[list_elt] : -1); hack = (hack_number >= 0 ? p->screenhacks[hack_number] : 0); pretty_name = (hack ? (hack->name ? strdup (hack->name) : make_hack_name (dpy, hack->command)) : 0); if (hack) schedule_preview (s, hack->command); else schedule_preview (s, 0); } if (!pretty_name) pretty_name = strdup (_("Preview")); gtk_frame_set_label (frame1, _(pretty_name)); gtk_frame_set_label (frame2, _(pretty_name)); gtk_entry_set_text (cmd, (hack ? hack->command : "")); gtk_entry_set_position (cmd, 0); { char title[255]; sprintf (title, _("%s: %.100s Settings"), progclass, (pretty_name ? pretty_name : "???")); gtk_window_set_title (GTK_WINDOW (s->popup_widget), title); } gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (vis)->entry), (hack ? (hack->visual && *hack->visual ? hack->visual : _("Any")) : "")); sensitize_demo_widgets (s, (hack ? True : False)); if (pretty_name) free (pretty_name); ensure_selected_item_visible (list); s->_selected_list_element = list_elt; } static void widget_deleter (GtkWidget *widget, gpointer data) { /* #### Well, I want to destroy these widgets, but if I do that, they get referenced again, and eventually I get a SEGV. So instead of destroying them, I'll just hide them, and leak a bunch of memory every time the disk file changes. Go go go Gtk! #### Ok, that's a lie, I get a crash even if I just hide the widget and don't ever delete it. Fuck! */ #if 0 gtk_widget_destroy (widget); #else gtk_widget_hide (widget); #endif } static char **sort_hack_cmp_names_kludge; static int sort_hack_cmp (const void *a, const void *b) { if (a == b) return 0; else { int aa = *(int *) a; int bb = *(int *) b; const char last[] = "\377\377\377\377\377\377\377\377\377\377\377"; return strcmp ((aa < 0 ? last : sort_hack_cmp_names_kludge[aa]), (bb < 0 ? last : sort_hack_cmp_names_kludge[bb])); } } static void initialize_sort_map (state *s) { Display *dpy = GDK_DISPLAY(); saver_preferences *p = &s->prefs; int i, j; if (s->list_elt_to_hack_number) free (s->list_elt_to_hack_number); if (s->hack_number_to_list_elt) free (s->hack_number_to_list_elt); if (s->hacks_available_p) free (s->hacks_available_p); s->list_elt_to_hack_number = (int *) calloc (sizeof(int), p->screenhacks_count + 1); s->hack_number_to_list_elt = (int *) calloc (sizeof(int), p->screenhacks_count + 1); s->hacks_available_p = (Bool *) calloc (sizeof(Bool), p->screenhacks_count + 1); s->total_available = 0; /* Check which hacks actually exist on $PATH */ for (i = 0; i < p->screenhacks_count; i++) { screenhack *hack = p->screenhacks[i]; int on = on_path_p (hack->command) ? 1 : 0; s->hacks_available_p[i] = on; s->total_available += on; } /* Initialize list->hack table to unsorted mapping, omitting nonexistent hacks, if desired. */ j = 0; for (i = 0; i < p->screenhacks_count; i++) { if (!p->ignore_uninstalled_p || s->hacks_available_p[i]) s->list_elt_to_hack_number[j++] = i; } s->list_count = j; for (; j < p->screenhacks_count; j++) s->list_elt_to_hack_number[j] = -1; /* Generate list of sortable names (once) */ sort_hack_cmp_names_kludge = (char **) calloc (sizeof(char *), p->screenhacks_count); for (i = 0; i < p->screenhacks_count; i++) { screenhack *hack = p->screenhacks[i]; 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; } /* Sort list->hack map alphabetically */ qsort (s->list_elt_to_hack_number, p->screenhacks_count, sizeof(*s->list_elt_to_hack_number), sort_hack_cmp); /* Free names */ for (i = 0; i < p->screenhacks_count; i++) free (sort_hack_cmp_names_kludge[i]); free (sort_hack_cmp_names_kludge); sort_hack_cmp_names_kludge = 0; /* Build inverse table */ for (i = 0; i < p->screenhacks_count; i++) { int n = s->list_elt_to_hack_number[i]; if (n != -1) s->hack_number_to_list_elt[n] = i; } } static int maybe_reload_init_file (state *s) { Display *dpy = GDK_DISPLAY(); saver_preferences *p = &s->prefs; int status = 0; static Bool reentrant_lock = False; if (reentrant_lock) return 0; reentrant_lock = True; if (init_file_changed_p (p)) { const char *f = init_file_name(); char *b; int list_elt; GtkWidget *list; if (!f || !*f) return 0; b = (char *) malloc (strlen(f) + 1024); sprintf (b, _("Warning:\n\n" "file \"%s\" has changed, reloading.\n"), f); warning_dialog (s->toplevel_widget, b, D_NONE, 100); free (b); load_init_file (dpy, p); initialize_sort_map (s); list_elt = selected_list_element (s); list = name_to_widget (s, "list"); gtk_container_foreach (GTK_CONTAINER (list), widget_deleter, NULL); populate_hack_list (s); force_list_select_item (s, list, list_elt, True); populate_prefs_page (s); populate_demo_window (s, list_elt); ensure_selected_item_visible (list); status = 1; } reentrant_lock = False; return status; } /* Making the preview window have the right X visual (so that GL works.) */ static Visual *get_best_gl_visual (state *); static GdkVisual * x_visual_to_gdk_visual (Visual *xv) { GList *gvs = gdk_list_visuals(); if (!xv) return gdk_visual_get_system(); for (; gvs; gvs = gvs->next) { GdkVisual *gv = (GdkVisual *) gvs->data; if (xv == GDK_VISUAL_XVISUAL (gv)) return gv; } fprintf (stderr, "%s: couldn't convert X Visual 0x%lx to a GdkVisual\n", blurb(), (unsigned long) xv->visualid); abort(); } static void clear_preview_window (state *s) { GtkWidget *p; GdkWindow *window; GtkStyle *style; if (!s->toplevel_widget) return; /* very early */ p = name_to_widget (s, "preview"); window = GET_WINDOW (p); if (!window) return; /* Flush the widget background down into the window, in case a subproc has changed it. */ style = gtk_widget_get_style (p); gdk_window_set_background (window, &style->bg[GTK_STATE_NORMAL]); gdk_window_clear (window); { int list_elt = selected_list_element (s); int hack_number = (list_elt >= 0 ? s->list_elt_to_hack_number[list_elt] : -1); Bool available_p = (hack_number >= 0 ? s->hacks_available_p [hack_number] : True); Bool nothing_p = (s->total_available < 5); #ifdef HAVE_GTK2 GtkWidget *notebook = name_to_widget (s, "preview_notebook"); gtk_notebook_set_page (GTK_NOTEBOOK (notebook), (s->running_preview_error_p ? (available_p ? 1 : nothing_p ? 3 : 2) : 0)); #else /* !HAVE_GTK2 */ if (s->running_preview_error_p) { const char * const lines1[] = { N_("No Preview"), N_("Available") }; const char * const lines2[] = { N_("Not"), N_("Installed") }; int nlines = countof(lines1); int lh = p->style->font->ascent + p->style->font->descent; int y, i; gint w, h; const char * const *lines = (available_p ? lines1 : lines2); gdk_window_get_size (window, &w, &h); y = (h - (lh * nlines)) / 2; y += p->style->font->ascent; for (i = 0; i < nlines; i++) { int sw = gdk_string_width (p->style->font, _(lines[i])); int x = (w - sw) / 2; gdk_draw_string (window, p->style->font, p->style->fg_gc[GTK_STATE_NORMAL], x, y, _(lines[i])); y += lh; } } #endif /* !HAVE_GTK2 */ } gdk_flush (); } static void reset_preview_window (state *s) { /* On some systems (most recently, MacOS X) OpenGL programs get confused when you kill one and re-start another on the same window. So maybe it's best to just always destroy and recreate the preview window when changing hacks, instead of always trying to reuse the same one? */ GtkWidget *pr = name_to_widget (s, "preview"); if (GET_REALIZED (pr)) { GdkWindow *window = GET_WINDOW (pr); Window oid = (window ? GDK_WINDOW_XWINDOW (window) : 0); Window id; gtk_widget_hide (pr); gtk_widget_unrealize (pr); gtk_widget_realize (pr); gtk_widget_show (pr); id = (window ? GDK_WINDOW_XWINDOW (window) : 0); if (s->debug_p) fprintf (stderr, "%s: window id 0x%X -> 0x%X\n", blurb(), (unsigned int) oid, (unsigned int) id); } } static void fix_preview_visual (state *s) { GtkWidget *widget = name_to_widget (s, "preview"); Visual *xvisual = get_best_gl_visual (s); GdkVisual *visual = x_visual_to_gdk_visual (xvisual); GdkVisual *dvisual = gdk_visual_get_system(); GdkColormap *cmap = (visual == dvisual ? gdk_colormap_get_system () : gdk_colormap_new (visual, False)); if (s->debug_p) fprintf (stderr, "%s: using %s visual 0x%lx\n", blurb(), (visual == dvisual ? "default" : "non-default"), (xvisual ? (unsigned long) xvisual->visualid : 0L)); if (!GET_REALIZED (widget) || gtk_widget_get_visual (widget) != visual) { gtk_widget_unrealize (widget); gtk_widget_set_visual (widget, visual); gtk_widget_set_colormap (widget, cmap); gtk_widget_realize (widget); } /* Set the Widget colors to be white-on-black. */ { GdkWindow *window = GET_WINDOW (widget); GtkStyle *style = gtk_style_copy (gtk_widget_get_style (widget)); GdkColormap *cmap = gtk_widget_get_colormap (widget); GdkColor *fg = &style->fg[GTK_STATE_NORMAL]; GdkColor *bg = &style->bg[GTK_STATE_NORMAL]; GdkGC *fgc = gdk_gc_new(window); GdkGC *bgc = gdk_gc_new(window); if (!gdk_color_white (cmap, fg)) abort(); if (!gdk_color_black (cmap, bg)) abort(); gdk_gc_set_foreground (fgc, fg); gdk_gc_set_background (fgc, bg); gdk_gc_set_foreground (bgc, bg); gdk_gc_set_background (bgc, fg); style->fg_gc[GTK_STATE_NORMAL] = fgc; style->bg_gc[GTK_STATE_NORMAL] = fgc; gtk_widget_set_style (widget, style); /* For debugging purposes, put a title on the window (so that it can be easily found in the output of "xwininfo -tree".) */ gdk_window_set_title (window, "Preview"); } gtk_widget_show (widget); } /* Subprocesses */ static char * subproc_pretty_name (state *s) { if (s->running_preview_cmd) { char *ps = strdup (s->running_preview_cmd); char *ss = strchr (ps, ' '); if (ss) *ss = 0; ss = strrchr (ps, '/'); if (!ss) ss = ps; else { ss = strdup (ss+1); free (ps); } return ss; } else return strdup ("???"); } static void reap_zombies (state *s) { int wait_status = 0; pid_t pid; while ((pid = waitpid (-1, &wait_status, WNOHANG|WUNTRACED)) > 0) { if (s->debug_p) { if (pid == s->running_preview_pid) { char *ss = subproc_pretty_name (s); fprintf (stderr, "%s: pid %lu (%s) died\n", blurb(), (unsigned long) pid, ss); free (ss); } else fprintf (stderr, "%s: pid %lu died\n", blurb(), (unsigned long) pid); } } } /* Mostly lifted from driver/subprocs.c */ static Visual * get_best_gl_visual (state *s) { Display *dpy = GDK_DISPLAY(); pid_t forked; int fds [2]; int in, out; char buf[1024]; char *av[10]; int ac = 0; av[ac++] = "xscreensaver-gl-helper"; av[ac] = 0; if (pipe (fds)) { perror ("error creating pipe:"); return 0; } in = fds [0]; out = fds [1]; switch ((int) (forked = fork ())) { case -1: { sprintf (buf, "%s: couldn't fork", blurb()); perror (buf); exit (1); } case 0: { int stdout_fd = 1; close (in); /* don't need this one */ close (ConnectionNumber (dpy)); /* close display fd */ if (dup2 (out, stdout_fd) < 0) /* pipe stdout */ { perror ("could not dup() a new stdout:"); return 0; } execvp (av[0], av); /* shouldn't return. */ if (errno != ENOENT) { /* Ignore "no such file or directory" errors, unless verbose. Issue all other exec errors, though. */ sprintf (buf, "%s: running %s", blurb(), av[0]); perror (buf); } /* Note that one must use _exit() instead of exit() in procs forked off of Gtk programs -- Gtk installs an atexit handler that has a copy of the X connection (which we've already closed, for safety.) If one uses exit() instead of _exit(), then one sometimes gets a spurious "Gdk-ERROR: Fatal IO error on X server" error message. */ _exit (1); /* exits fork */ break; } default: { int result = 0; int wait_status = 0; FILE *f = fdopen (in, "r"); unsigned int v = 0; char c; close (out); /* don't need this one */ *buf = 0; if (!fgets (buf, sizeof(buf)-1, f)) *buf = 0; fclose (f); /* Wait for the child to die. */ waitpid (-1, &wait_status, 0); if (1 == sscanf (buf, "0x%x %c", &v, &c)) result = (int) v; if (result == 0) { if (s->debug_p) fprintf (stderr, "%s: %s did not report a GL visual!\n", blurb(), av[0]); return 0; } else { Visual *v = id_to_visual (DefaultScreenOfDisplay (dpy), result); if (s->debug_p) fprintf (stderr, "%s: %s says the GL visual is 0x%X.\n", blurb(), av[0], result); if (!v) abort(); return v; } } } abort(); } static void kill_preview_subproc (state *s, Bool reset_p) { s->running_preview_error_p = False; reap_zombies (s); clear_preview_window (s); if (s->subproc_check_timer_id) { gtk_timeout_remove (s->subproc_check_timer_id); s->subproc_check_timer_id = 0; s->subproc_check_countdown = 0; } if (s->running_preview_pid) { int status = kill (s->running_preview_pid, SIGTERM); char *ss = subproc_pretty_name (s); if (status < 0) { if (errno == ESRCH) { if (s->debug_p) fprintf (stderr, "%s: pid %lu (%s) was already dead.\n", blurb(), (unsigned long) s->running_preview_pid, ss); } else { char buf [1024]; sprintf (buf, "%s: couldn't kill pid %lu (%s)", blurb(), (unsigned long) s->running_preview_pid, ss); perror (buf); } } else { int endstatus; waitpid(s->running_preview_pid, &endstatus, 0); if (s->debug_p) fprintf (stderr, "%s: killed pid %lu (%s)\n", blurb(), (unsigned long) s->running_preview_pid, ss); } free (ss); s->running_preview_pid = 0; if (s->running_preview_cmd) free (s->running_preview_cmd); s->running_preview_cmd = 0; } reap_zombies (s); if (reset_p) { reset_preview_window (s); clear_preview_window (s); } } /* Immediately and unconditionally launches the given process, after appending the -window-id option; sets running_preview_pid. */ static void launch_preview_subproc (state *s) { saver_preferences *p = &s->prefs; Window id; char *new_cmd = 0; pid_t forked; const char *cmd = s->desired_preview_cmd; GtkWidget *pr = name_to_widget (s, "preview"); GdkWindow *window; reset_preview_window (s); window = GET_WINDOW (pr); s->running_preview_error_p = False; if (s->preview_suppressed_p) { kill_preview_subproc (s, False); goto DONE; } new_cmd = malloc (strlen (cmd) + 40); id = (window ? GDK_WINDOW_XWINDOW (window) : 0); if (id == 0) { /* No window id? No command to run. */ free (new_cmd); new_cmd = 0; } else { /* We do this instead of relying on $XSCREENSAVER_WINDOW specifically so that third-party savers that don't implement -window-id will fail: otherwise we might have full-screen windows popping up when we were just trying to get a preview thumbnail. */ strcpy (new_cmd, cmd); sprintf (new_cmd + strlen (new_cmd), " -window-id 0x%X", (unsigned int) id); } kill_preview_subproc (s, False); if (! new_cmd) { s->running_preview_error_p = True; clear_preview_window (s); goto DONE; } switch ((int) (forked = fork ())) { case -1: { char buf[255]; sprintf (buf, "%s: couldn't fork", blurb()); perror (buf); s->running_preview_error_p = True; goto DONE; break; } case 0: { close (ConnectionNumber (GDK_DISPLAY())); hack_subproc_environment (id, s->debug_p); usleep (250000); /* pause for 1/4th second before launching, to give the previous program time to die and flush its X buffer, so we don't get leftover turds on the window. */ exec_command (p->shell, new_cmd, p->nice_inferior); /* Don't bother printing an error message when we are unable to exec subprocesses; we handle that by polling the pid later. Note that one must use _exit() instead of exit() in procs forked off of Gtk programs -- Gtk installs an atexit handler that has a copy of the X connection (which we've already closed, for safety.) If one uses exit() instead of _exit(), then one sometimes gets a spurious "Gdk-ERROR: Fatal IO error on X server" error message. */ _exit (1); /* exits child fork */ break; default: if (s->running_preview_cmd) free (s->running_preview_cmd); s->running_preview_cmd = strdup (s->desired_preview_cmd); s->running_preview_pid = forked; if (s->debug_p) { char *ss = subproc_pretty_name (s); fprintf (stderr, "%s: forked %lu (%s)\n", blurb(), (unsigned long) forked, ss); free (ss); } break; } } schedule_preview_check (s); DONE: if (new_cmd) free (new_cmd); new_cmd = 0; } /* Modify $DISPLAY and $PATH for the benefit of subprocesses. */ static void hack_environment (state *s) { static const char *def_path = # ifdef DEFAULT_PATH_PREFIX DEFAULT_PATH_PREFIX; # else ""; # endif Display *dpy = GDK_DISPLAY(); const char *odpy = DisplayString (dpy); char *ndpy = (char *) malloc(strlen(odpy) + 20); strcpy (ndpy, "DISPLAY="); strcat (ndpy, odpy); if (putenv (ndpy)) abort (); if (s->debug_p) fprintf (stderr, "%s: %s\n", blurb(), ndpy); /* don't free(ndpy) -- 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. */ if (def_path && *def_path) { const char *opath = getenv("PATH"); char *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 (); /* do not free(npath) -- see above */ if (s->debug_p) fprintf (stderr, "%s: added \"%s\" to $PATH\n", blurb(), def_path); } } static void hack_subproc_environment (Window preview_window_id, Bool debug_p) { /* Store a window ID in $XSCREENSAVER_WINDOW -- this isn't strictly necessary yet, but it will make programs work if we had invoked them with "-root" and not with "-window-id" -- which, of course, doesn't happen. */ char *nssw = (char *) malloc (40); sprintf (nssw, "XSCREENSAVER_WINDOW=0x%X", (unsigned int) preview_window_id); /* 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. */ if (putenv (nssw)) abort (); if (debug_p) fprintf (stderr, "%s: %s\n", blurb(), nssw); /* do not free(nssw) -- see above */ } /* Called from a timer: Launches the currently-chosen subprocess, if it's not already running. If there's a different process running, kills it. */ static int update_subproc_timer (gpointer data) { state *s = (state *) data; if (! s->desired_preview_cmd) kill_preview_subproc (s, True); else if (!s->running_preview_cmd || !!strcmp (s->desired_preview_cmd, s->running_preview_cmd)) launch_preview_subproc (s); s->subproc_timer_id = 0; return FALSE; /* do not re-execute timer */ } static int settings_timer (gpointer data) { settings_cb (0, 0); return FALSE; } /* Call this when you think you might want a preview process running. It will set a timer that will actually launch that program a second from now, if you haven't changed your mind (to avoid double-click spazzing, etc.) `cmd' may be null meaning "no process". */ static void schedule_preview (state *s, const char *cmd) { int delay = 1000 * 0.5; /* 1/2 second hysteresis */ if (s->debug_p) { if (cmd) fprintf (stderr, "%s: scheduling preview \"%s\"\n", blurb(), cmd); else fprintf (stderr, "%s: scheduling preview death\n", blurb()); } if (s->desired_preview_cmd) free (s->desired_preview_cmd); s->desired_preview_cmd = (cmd ? strdup (cmd) : 0); if (s->subproc_timer_id) gtk_timeout_remove (s->subproc_timer_id); s->subproc_timer_id = gtk_timeout_add (delay, update_subproc_timer, s); } /* Called from a timer: Checks to see if the subproc that should be running, actually is. */ static int check_subproc_timer (gpointer data) { state *s = (state *) data; Bool again_p = True; if (s->running_preview_error_p || /* already dead */ s->running_preview_pid <= 0) { again_p = False; } else { int status; reap_zombies (s); status = kill (s->running_preview_pid, 0); if (status < 0 && errno == ESRCH) s->running_preview_error_p = True; if (s->debug_p) { char *ss = subproc_pretty_name (s); fprintf (stderr, "%s: timer: pid %lu (%s) is %s\n", blurb(), (unsigned long) s->running_preview_pid, ss, (s->running_preview_error_p ? "dead" : "alive")); free (ss); } if (s->running_preview_error_p) { clear_preview_window (s); again_p = False; } } /* Otherwise, it's currently alive. We might be checking again, or we might be satisfied. */ if (--s->subproc_check_countdown <= 0) again_p = False; if (again_p) return TRUE; /* re-execute timer */ else { s->subproc_check_timer_id = 0; s->subproc_check_countdown = 0; return FALSE; /* do not re-execute timer */ } } /* Call this just after launching a subprocess. This sets a timer that will, five times a second for two seconds, check whether the program is still running. The assumption here is that if the process didn't stay up for more than a couple of seconds, then either the program doesn't exist, or it doesn't take a -window-id argument. */ static void schedule_preview_check (state *s) { int seconds = 2; int ticks = 5; if (s->debug_p) fprintf (stderr, "%s: scheduling check\n", blurb()); if (s->subproc_check_timer_id) gtk_timeout_remove (s->subproc_check_timer_id); s->subproc_check_timer_id = gtk_timeout_add (1000 / ticks, check_subproc_timer, (gpointer) s); s->subproc_check_countdown = ticks * seconds; } static Bool screen_blanked_p (void) { Atom type; int format; unsigned long nitems, bytesafter; unsigned char *dataP = 0; Display *dpy = GDK_DISPLAY(); Bool blanked_p = False; if (XGetWindowProperty (dpy, RootWindow (dpy, 0), /* always screen #0 */ XA_SCREENSAVER_STATUS, 0, 3, False, XA_INTEGER, &type, &format, &nitems, &bytesafter, &dataP) == Success && type == XA_INTEGER && nitems >= 3 && dataP) { Atom *data = (Atom *) dataP; blanked_p = (data[0] == XA_BLANK || data[0] == XA_LOCK); } if (dataP) XFree (dataP); return blanked_p; } /* Wake up every now and then and see if the screen is blanked. If it is, kill off the small-window demo -- no point in wasting cycles by running two screensavers at once... */ static int check_blanked_timer (gpointer data) { state *s = (state *) data; Bool blanked_p = screen_blanked_p (); if (blanked_p && s->running_preview_pid) { if (s->debug_p) fprintf (stderr, "%s: screen is blanked: killing preview\n", blurb()); kill_preview_subproc (s, True); } return True; /* re-execute timer */ } /* How many screens are there (including Xinerama.) */ static int screen_count (Display *dpy) { int nscreens = ScreenCount(dpy); # ifdef HAVE_XINERAMA if (nscreens <= 1) { int event_number, error_number; if (XineramaQueryExtension (dpy, &event_number, &error_number) && XineramaIsActive (dpy)) { XineramaScreenInfo *xsi = XineramaQueryScreens (dpy, &nscreens); if (xsi) XFree (xsi); } } # endif /* HAVE_XINERAMA */ return nscreens; } /* Setting window manager icon */ static void init_icon (GdkWindow *window) { GdkBitmap *mask = 0; GdkPixmap *pixmap = gdk_pixmap_create_from_xpm_d (window, &mask, 0, (gchar **) logo_50_xpm); if (pixmap) gdk_window_set_icon (window, 0, pixmap, mask); } /* The main demo-mode command loop. */ #if 0 static Bool mapper (XrmDatabase *db, XrmBindingList bindings, XrmQuarkList quarks, XrmRepresentation *type, XrmValue *value, XPointer closure) { int i; for (i = 0; quarks[i]; i++) { if (bindings[i] == XrmBindTightly) fprintf (stderr, (i == 0 ? "" : ".")); else if (bindings[i] == XrmBindLoosely) fprintf (stderr, "*"); else fprintf (stderr, " ??? "); fprintf(stderr, "%s", XrmQuarkToString (quarks[i])); } fprintf (stderr, ": %s\n", (char *) value->addr); return False; } #endif static Window gnome_screensaver_window (Screen *screen) { Display *dpy = DisplayOfScreen (screen); Window root = RootWindowOfScreen (screen); Window parent, *kids; unsigned int nkids; Window gnome_window = 0; int i; if (! XQueryTree (dpy, root, &root, &parent, &kids, &nkids)) abort (); for (i = 0; i < nkids; i++) { Atom type; int format; unsigned long nitems, bytesafter; unsigned char *name; if (XGetWindowProperty (dpy, kids[i], XA_WM_COMMAND, 0, 128, False, XA_STRING, &type, &format, &nitems, &bytesafter, &name) == Success && type != None && !strcmp ((char *) name, "gnome-screensaver")) { gnome_window = kids[i]; break; } } if (kids) XFree ((char *) kids); return gnome_window; } static Bool gnome_screensaver_active_p (void) { Display *dpy = GDK_DISPLAY(); Window w = gnome_screensaver_window (DefaultScreenOfDisplay (dpy)); return (w ? True : False); } static void kill_gnome_screensaver (void) { Display *dpy = GDK_DISPLAY(); Window w = gnome_screensaver_window (DefaultScreenOfDisplay (dpy)); if (w) XKillClient (dpy, (XID) w); } static Bool kde_screensaver_active_p (void) { FILE *p = popen ("dcop kdesktop KScreensaverIface isEnabled 2>/dev/null", "r"); char buf[255]; fgets (buf, sizeof(buf)-1, p); pclose (p); if (!strcmp (buf, "true\n")) return True; else return False; } static void kill_kde_screensaver (void) { system ("dcop kdesktop KScreensaverIface enable false"); } static void the_network_is_not_the_computer (state *s) { Display *dpy = GDK_DISPLAY(); char *rversion = 0, *ruser = 0, *rhost = 0; char *luser, *lhost; char *msg = 0; struct passwd *p = getpwuid (getuid ()); const char *d = DisplayString (dpy); # if defined(HAVE_UNAME) struct utsname uts; if (uname (&uts) < 0) lhost = ""; else lhost = uts.nodename; # elif defined(VMS) strcpy (lhost, getenv("SYS$NODE")); # else /* !HAVE_UNAME && !VMS */ strcat (lhost, ""); # endif /* !HAVE_UNAME && !VMS */ if (p && p->pw_name) luser = p->pw_name; else luser = "???"; server_xscreensaver_version (dpy, &rversion, &ruser, &rhost); /* Make a buffer that's big enough for a number of copies of all the strings, plus some. */ msg = (char *) malloc (10 * ((rversion ? strlen(rversion) : 0) + (ruser ? strlen(ruser) : 0) + (rhost ? strlen(rhost) : 0) + strlen(lhost) + strlen(luser) + strlen(d) + 1024)); *msg = 0; if (!rversion || !*rversion) { sprintf (msg, _("Warning:\n\n" "The XScreenSaver daemon doesn't seem to be running\n" "on display \"%s\". Launch it now?"), d); } else if (p && ruser && *ruser && !!strcmp (ruser, p->pw_name)) { /* Warn that the two processes are running as different users. */ sprintf(msg, _("Warning:\n\n" "%s is running as user \"%s\" on host \"%s\".\n" "But the xscreensaver managing display \"%s\"\n" "is running as user \"%s\" on host \"%s\".\n" "\n" "Since they are different users, they won't be reading/writing\n" "the same ~/.xscreensaver file, so %s isn't\n" "going to work right.\n" "\n" "You should either re-run %s as \"%s\", or re-run\n" "xscreensaver as \"%s\".\n" "\n" "Restart the xscreensaver daemon now?\n"), progname, luser, lhost, d, (ruser ? ruser : "???"), (rhost ? rhost : "???"), progname, progname, (ruser ? ruser : "???"), luser); } else if (rhost && *rhost && !!strcmp (rhost, lhost)) { /* Warn that the two processes are running on different hosts. */ sprintf (msg, _("Warning:\n\n" "%s is running as user \"%s\" on host \"%s\".\n" "But the xscreensaver managing display \"%s\"\n" "is running as user \"%s\" on host \"%s\".\n" "\n" "If those two machines don't share a file system (that is,\n" "if they don't see the same ~%s/.xscreensaver file) then\n" "%s won't work right.\n" "\n" "Restart the daemon on \"%s\" as \"%s\" now?\n"), progname, luser, lhost, d, (ruser ? ruser : "???"), (rhost ? rhost : "???"), luser, progname, lhost, luser); } else if (!!strcmp (rversion, s->short_version)) { /* Warn that the version numbers don't match. */ sprintf (msg, _("Warning:\n\n" "This is %s version %s.\n" "But the xscreensaver managing display \"%s\"\n" "is version %s. This could cause problems.\n" "\n" "Restart the xscreensaver daemon now?\n"), progname, s->short_version, d, rversion); } if (*msg) warning_dialog (s->toplevel_widget, msg, D_LAUNCH, 1); if (rversion) free (rversion); if (ruser) free (ruser); if (rhost) free (rhost); free (msg); msg = 0; /* Note: since these dialogs are not modal, they will stack up. So we do this check *after* popping up the "xscreensaver is not running" dialog so that these are on top. Good enough. */ if (gnome_screensaver_active_p ()) warning_dialog (s->toplevel_widget, _("Warning:\n\n" "The GNOME screensaver daemon appears to be running.\n" "It must be stopped for XScreenSaver to work properly.\n" "\n" "Stop the GNOME screen saver daemon now?\n"), D_GNOME, 1); if (kde_screensaver_active_p ()) warning_dialog (s->toplevel_widget, _("Warning:\n\n" "The KDE screen saver daemon appears to be running.\n" "It must be stopped for XScreenSaver to work properly.\n" "\n" "Stop the KDE screen saver daemon now?\n"), D_KDE, 1); } /* We use this error handler so that X errors are preceeded by the name of the program that generated them. */ static int demo_ehandler (Display *dpy, XErrorEvent *error) { state *s = global_state_kludge; /* I hate C so much... */ fprintf (stderr, "\nX error in %s:\n", blurb()); XmuPrintDefaultErrorMessage (dpy, error, stderr); kill_preview_subproc (s, False); exit (-1); return 0; } /* We use this error handler so that Gtk/Gdk errors are preceeded by the name of the program that generated them; and also that we can ignore one particular bogus error message that Gdk madly spews. */ static void g_log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) { /* Ignore the message "Got event for unknown window: 0x...". Apparently some events are coming in for the xscreensaver window (presumably reply events related to the ClientMessage) and Gdk feels the need to complain about them. So, just suppress any messages that look like that one. */ if (strstr (message, "unknown window")) return; fprintf (stderr, "%s: %s-%s: %s%s", blurb(), (log_domain ? log_domain : progclass), (log_level == G_LOG_LEVEL_ERROR ? "error" : log_level == G_LOG_LEVEL_CRITICAL ? "critical" : log_level == G_LOG_LEVEL_WARNING ? "warning" : log_level == G_LOG_LEVEL_MESSAGE ? "message" : log_level == G_LOG_LEVEL_INFO ? "info" : log_level == G_LOG_LEVEL_DEBUG ? "debug" : "???"), message, ((!*message || message[strlen(message)-1] != '\n') ? "\n" : "")); } STFU static char *defaults[] = { #include "XScreenSaver_ad.h" 0 }; #if 0 #ifdef HAVE_CRAPPLET static struct poptOption crapplet_options[] = { {NULL, '\0', 0, NULL, 0} }; #endif /* HAVE_CRAPPLET */ #endif /* 0 */ const char *usage = "[--display dpy] [--prefs | --settings]" # ifdef HAVE_CRAPPLET " [--crapplet]" # endif "\n\t\t [--debug] [--sync] [--no-xshm] [--configdir dir]"; static void map_popup_window_cb (GtkWidget *w, gpointer user_data) { state *s = (state *) user_data; Boolean oi = s->initializing_p; #ifndef HAVE_GTK2 GtkLabel *label = GTK_LABEL (name_to_widget (s, "doc")); #endif s->initializing_p = True; #ifndef HAVE_GTK2 eschew_gtk_lossage (label); #endif s->initializing_p = oi; } #if 0 static void print_widget_tree (GtkWidget *w, int depth) { int i; for (i = 0; i < depth; i++) fprintf (stderr, " "); fprintf (stderr, "%s\n", gtk_widget_get_name (w)); if (GTK_IS_LIST (w)) { for (i = 0; i < depth+1; i++) fprintf (stderr, " "); fprintf (stderr, "...list kids...\n"); } else if (GTK_IS_CONTAINER (w)) { GList *kids = gtk_container_children (GTK_CONTAINER (w)); while (kids) { print_widget_tree (GTK_WIDGET (kids->data), depth+1); kids = kids->next; } } } #endif /* 0 */ static int delayed_scroll_kludge (gpointer data) { state *s = (state *) data; GtkWidget *w = GTK_WIDGET (name_to_widget (s, "list")); ensure_selected_item_visible (w); /* Oh, this is just fucking lovely, too. */ w = GTK_WIDGET (name_to_widget (s, "preview")); gtk_widget_hide (w); gtk_widget_show (w); return FALSE; /* do not re-execute timer */ } #ifdef HAVE_GTK2 static GtkWidget * create_xscreensaver_demo (void) { GtkWidget *nb; nb = name_to_widget (global_state_kludge, "preview_notebook"); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (nb), FALSE); return name_to_widget (global_state_kludge, "xscreensaver_demo"); } static GtkWidget * create_xscreensaver_settings_dialog (void) { GtkWidget *w, *box; box = name_to_widget (global_state_kludge, "dialog_action_area"); w = name_to_widget (global_state_kludge, "adv_button"); gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (box), w, TRUE); w = name_to_widget (global_state_kludge, "std_button"); gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (box), w, TRUE); return name_to_widget (global_state_kludge, "xscreensaver_settings_dialog"); } #endif /* HAVE_GTK2 */ int main (int argc, char **argv) { XtAppContext app; state S, *s; saver_preferences *p; Bool prefs_p = False; Bool settings_p = False; int i; Display *dpy; Widget toplevel_shell; char *real_progname = argv[0]; char *window_title; char *geom = 0; Bool crapplet_p = False; char *str; #ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); textdomain (GETTEXT_PACKAGE); # ifdef HAVE_GTK2 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); # else /* !HAVE_GTK2 */ if (!setlocale (LC_ALL, "")) fprintf (stderr, "%s: locale not supported by C library\n", real_progname); # endif /* !HAVE_GTK2 */ #endif /* ENABLE_NLS */ str = strrchr (real_progname, '/'); if (str) real_progname = str+1; s = &S; memset (s, 0, sizeof(*s)); s->initializing_p = True; p = &s->prefs; global_state_kludge = s; /* I hate C so much... */ progname = real_progname; s->short_version = (char *) malloc (5); memcpy (s->short_version, screensaver_id + 17, 4); s->short_version [4] = 0; /* 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 for all of the domains that seem to be in use. */ { const char * const domains[] = { 0, "Gtk", "Gdk", "GLib", "GModule", "GThread", "Gnome", "GnomeUI" }; for (i = 0; i < countof(domains); i++) g_log_set_handler (domains[i], G_LOG_LEVEL_MASK, g_log_handler, 0); } #ifdef DEFAULT_ICONDIR /* from -D on compile line */ # ifndef HAVE_GTK2 { const char *dir = DEFAULT_ICONDIR; if (*dir) add_pixmap_directory (dir); } # endif /* !HAVE_GTK2 */ #endif /* DEFAULT_ICONDIR */ /* This is gross, but Gtk understands --display and not -display... */ for (i = 1; i < argc; i++) if (argv[i][0] && argv[i][1] && !strncmp(argv[i], "-display", strlen(argv[i]))) argv[i] = "--display"; /* We need to parse this arg really early... Sigh. */ for (i = 1; i < argc; i++) { if (argv[i] && (!strcmp(argv[i], "--crapplet") || !strcmp(argv[i], "--capplet"))) { # if defined(HAVE_CRAPPLET) || defined(HAVE_GTK2) int j; crapplet_p = True; for (j = i; j < argc; j++) /* remove it from the list */ argv[j] = argv[j+1]; argc--; # else /* !HAVE_CRAPPLET && !HAVE_GTK2 */ fprintf (stderr, "%s: not compiled with --crapplet support\n", real_progname); fprintf (stderr, "%s: %s\n", real_progname, usage); exit (1); # endif /* !HAVE_CRAPPLET && !HAVE_GTK2 */ } else if (argv[i] && (!strcmp(argv[i], "--debug") || !strcmp(argv[i], "-debug") || !strcmp(argv[i], "-d"))) { int j; s->debug_p = True; for (j = i; j < argc; j++) /* remove it from the list */ argv[j] = argv[j+1]; argc--; i--; } else if (argv[i] && argc > i+1 && *argv[i+1] && (!strcmp(argv[i], "-geometry") || !strcmp(argv[i], "-geom") || !strcmp(argv[i], "-geo") || !strcmp(argv[i], "-g"))) { int j; geom = argv[i+1]; for (j = i; j < argc; j++) /* remove them from the list */ argv[j] = argv[j+2]; argc -= 2; i -= 2; } else if (argv[i] && argc > i+1 && *argv[i+1] && (!strcmp(argv[i], "--configdir"))) { int j; struct stat st; hack_configuration_path = argv[i+1]; for (j = i; j < argc; j++) /* remove them from the list */ argv[j] = argv[j+2]; argc -= 2; i -= 2; if (0 != stat (hack_configuration_path, &st)) { char buf[255]; sprintf (buf, "%s: %.200s", blurb(), hack_configuration_path); perror (buf); exit (1); } else if (!S_ISDIR (st.st_mode)) { fprintf (stderr, "%s: not a directory: %s\n", blurb(), hack_configuration_path); exit (1); } } } if (s->debug_p) fprintf (stderr, "%s: using config directory \"%s\"\n", progname, hack_configuration_path); /* Let Gtk open the X connection, then initialize Xt to use that same connection. Doctor Frankenstein would be proud. */ # ifdef HAVE_CRAPPLET if (crapplet_p) { GnomeClient *client; GnomeClientFlags flags = 0; int init_results = gnome_capplet_init ("screensaver-properties", s->short_version, argc, argv, NULL, 0, NULL); /* init_results is: 0 upon successful initialization; 1 if --init-session-settings was passed on the cmdline; 2 if --ignore was passed on the cmdline; -1 on error. So the 1 signifies just to init the settings, and quit, basically. (Meaning launch the xscreensaver daemon.) */ if (init_results < 0) { # if 0 g_error ("An initialization error occurred while " "starting xscreensaver-capplet.\n"); # else /* !0 */ fprintf (stderr, "%s: gnome_capplet_init failed: %d\n", real_progname, init_results); exit (1); # endif /* !0 */ } client = gnome_master_client (); if (client) flags = gnome_client_get_flags (client); if (flags & GNOME_CLIENT_IS_CONNECTED) { int token = gnome_startup_acquire_token ("GNOME_SCREENSAVER_PROPERTIES", gnome_client_get_id (client)); if (token) { char *session_args[20]; int i = 0; session_args[i++] = real_progname; session_args[i++] = "--capplet"; session_args[i++] = "--init-session-settings"; session_args[i] = 0; gnome_client_set_priority (client, 20); gnome_client_set_restart_style (client, GNOME_RESTART_ANYWAY); gnome_client_set_restart_command (client, i, session_args); } else { gnome_client_set_restart_style (client, GNOME_RESTART_NEVER); } gnome_client_flush (client); } if (init_results == 1) { system ("xscreensaver -nosplash &"); return 0; } } else # endif /* HAVE_CRAPPLET */ { gtk_init (&argc, &argv); } /* We must read exactly the same resources as xscreensaver. That means we must have both the same progclass *and* progname, at least as far as the resource database is concerned. So, put "xscreensaver" in argv[0] while initializing Xt. */ argv[0] = "xscreensaver"; progname = argv[0]; /* Teach Xt to use the Display that Gtk/Gdk have already opened. */ XtToolkitInitialize (); app = XtCreateApplicationContext (); dpy = GDK_DISPLAY(); XtAppSetFallbackResources (app, defaults); XtDisplayInitialize (app, dpy, progname, progclass, 0, 0, &argc, argv); toplevel_shell = XtAppCreateShell (progname, progclass, applicationShellWidgetClass, dpy, 0, 0); dpy = XtDisplay (toplevel_shell); db = XtDatabase (dpy); XtGetApplicationNameAndClass (dpy, &progname, &progclass); XSetErrorHandler (demo_ehandler); /* Let's just ignore these. They seem to confuse Irix Gtk... */ signal (SIGPIPE, SIG_IGN); /* After doing Xt-style command-line processing, complain about any unrecognized command-line arguments. */ for (i = 1; i < argc; i++) { char *str = argv[i]; if (str[0] == '-' && str[1] == '-') str++; if (!strcmp (str, "-prefs")) prefs_p = True; else if (!strcmp (str, "-settings")) settings_p = True; else if (crapplet_p) /* There are lots of random args that we don't care about when we're started as a crapplet, so just ignore unknown args in that case. */ ; else { fprintf (stderr, _("%s: unknown option: %s\n"), real_progname, argv[i]); fprintf (stderr, "%s: %s\n", real_progname, usage); exit (1); } } /* 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 important that `progname' be "xscreensaver", rather than whatever was in argv[0]. */ p->db = db; s->nscreens = screen_count (dpy); hack_environment (s); /* must be before initialize_sort_map() */ load_init_file (dpy, p); initialize_sort_map (s); /* Now that Xt has been initialized, and the resources have been read, we can set our `progname' variable to something more in line with reality. */ progname = real_progname; #if 0 /* Print out all the resources we read. */ { XrmName name = { 0 }; XrmClass class = { 0 }; int count = 0; XrmEnumerateDatabase (db, &name, &class, XrmEnumAllLevels, mapper, (POINTER) &count); } #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_BLANK = XInternAtom (dpy, "BLANK", False); XA_LOCK = XInternAtom (dpy, "LOCK", False); XA_EXIT = XInternAtom (dpy, "EXIT", False); XA_RESTART = XInternAtom (dpy, "RESTART", False); /* Create the window and all its widgets. */ s->base_widget = create_xscreensaver_demo (); s->popup_widget = create_xscreensaver_settings_dialog (); s->toplevel_widget = s->base_widget; /* Set the main window's title. */ { char *base_title = _("Screensaver Preferences"); char *v = (char *) strdup(strchr(screensaver_id, ' ')); char *s1, *s2, *s3, *s4; s1 = (char *) strchr(v, ' '); s1++; s2 = (char *) strchr(s1, ' '); s3 = (char *) strchr(v, '('); s3++; s4 = (char *) strchr(s3, ')'); *s2 = 0; *s4 = 0; window_title = (char *) malloc (strlen (base_title) + strlen (progclass) + strlen (s1) + strlen (s3) + 100); sprintf (window_title, "%s (%s %s, %s)", base_title, progclass, s1, s3); gtk_window_set_title (GTK_WINDOW (s->toplevel_widget), window_title); gtk_window_set_title (GTK_WINDOW (s->popup_widget), window_title); free (v); } /* Adjust the (invisible) notebooks on the popup dialog... */ { GtkNotebook *notebook = GTK_NOTEBOOK (name_to_widget (s, "opt_notebook")); GtkWidget *std = GTK_WIDGET (name_to_widget (s, "std_button")); int page = 0; # ifdef HAVE_XML gtk_widget_hide (std); # else /* !HAVE_XML */ /* Make the advanced page be the only one available. */ gtk_widget_set_sensitive (std, False); std = GTK_WIDGET (name_to_widget (s, "adv_button")); gtk_widget_hide (std); std = GTK_WIDGET (name_to_widget (s, "reset_button")); gtk_widget_hide (std); page = 1; # endif /* !HAVE_XML */ gtk_notebook_set_page (notebook, page); gtk_notebook_set_show_tabs (notebook, False); } /* Various other widget initializations... */ gtk_signal_connect (GTK_OBJECT (s->toplevel_widget), "delete_event", GTK_SIGNAL_FUNC (wm_toplevel_close_cb), (gpointer) s); gtk_signal_connect (GTK_OBJECT (s->popup_widget), "delete_event", GTK_SIGNAL_FUNC (wm_popup_close_cb), (gpointer) s); populate_hack_list (s); populate_prefs_page (s); sensitize_demo_widgets (s, False); fix_text_entry_sizes (s); scroll_to_current_hack (s); gtk_signal_connect (GTK_OBJECT (name_to_widget (s, "cancel_button")), "map", GTK_SIGNAL_FUNC(map_popup_window_cb), (gpointer) s); #ifndef HAVE_GTK2 gtk_signal_connect (GTK_OBJECT (name_to_widget (s, "prev")), "map", GTK_SIGNAL_FUNC(map_prev_button_cb), (gpointer) s); gtk_signal_connect (GTK_OBJECT (name_to_widget (s, "next")), "map", GTK_SIGNAL_FUNC(map_next_button_cb), (gpointer) s); #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)); } if (s->nscreens <= 1) /* recompute option-menu size */ { gtk_widget_unrealize (GTK_WIDGET (menu)); gtk_widget_realize (GTK_WIDGET (menu)); } } /* Handle the -prefs command-line argument. */ if (prefs_p) { GtkNotebook *notebook = GTK_NOTEBOOK (name_to_widget (s, "notebook")); gtk_notebook_set_page (notebook, 1); } # ifdef HAVE_CRAPPLET if (crapplet_p) { GtkWidget *capplet; GtkWidget *outer_vbox; gtk_widget_hide (s->toplevel_widget); capplet = capplet_widget_new (); /* Make there be a "Close" button instead of "OK" and "Cancel" */ # ifdef HAVE_CRAPPLET_IMMEDIATE capplet_widget_changes_are_immediate (CAPPLET_WIDGET (capplet)); # endif /* HAVE_CRAPPLET_IMMEDIATE */ /* In crapplet-mode, take off the menubar. */ gtk_widget_hide (name_to_widget (s, "menubar")); /* Reparent our top-level container to be a child of the capplet window. */ outer_vbox = GTK_BIN (s->toplevel_widget)->child; gtk_widget_ref (outer_vbox); gtk_container_remove (GTK_CONTAINER (s->toplevel_widget), outer_vbox); STFU GTK_OBJECT_SET_FLAGS (outer_vbox, GTK_FLOATING); gtk_container_add (GTK_CONTAINER (capplet), outer_vbox); /* Find the window above us, and set the title and close handler. */ { GtkWidget *window = capplet; while (window && !GTK_IS_WINDOW (window)) window = GET_PARENT (window); if (window) { gtk_window_set_title (GTK_WINDOW (window), window_title); gtk_signal_connect (GTK_OBJECT (window), "delete_event", GTK_SIGNAL_FUNC (wm_toplevel_close_cb), (gpointer) s); } } s->toplevel_widget = capplet; } # endif /* HAVE_CRAPPLET */ /* The Gnome folks hate the menubar. I think it's important to have access to the commands on the File menu (Restart Daemon, etc.) and to the About and Documentation commands on the Help menu. */ #if 0 #ifdef HAVE_GTK2 gtk_widget_hide (name_to_widget (s, "menubar")); #endif #endif free (window_title); window_title = 0; #ifdef HAVE_GTK2 /* After picking the default size, allow -geometry to override it. */ if (geom) gtk_window_parse_geometry (GTK_WINDOW (s->toplevel_widget), geom); #endif gtk_widget_show (s->toplevel_widget); init_icon (GET_WINDOW (GTK_WIDGET (s->toplevel_widget))); /* after `show' */ fix_preview_visual (s); /* Realize page zero, so that we can diddle the scrollbar when the user tabs back to it -- otherwise, the current hack isn't scrolled to the first time they tab back there, when started with "-prefs". (Though it is if they then tab away, and back again.) #### Bah! This doesn't work. Gtk eats my ass! Someone who #### understands this crap, explain to me how to make this work. */ gtk_widget_realize (name_to_widget (s, "demos_table")); gtk_timeout_add (60 * 1000, check_blanked_timer, s); /* Handle the --settings command-line argument. */ if (settings_p) gtk_timeout_add (500, settings_timer, 0); /* Issue any warnings about the running xscreensaver daemon. */ if (! s->debug_p) the_network_is_not_the_computer (s); if (senesculent_p()) warning_dialog (s->toplevel_widget, _("Warning:\n\n" "This version of xscreensaver is VERY OLD!\n" "Please upgrade!\n" "\n" "https://www.jwz.org/xscreensaver/\n" "\n" "(If this is the latest version that your distro ships, then\n" "your distro is doing you a disservice. Build from source.)\n" ), 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. Fortunately, we're using Gtk for all of the UI, and only initialized Xt so that we could process the command line and use the X resource manager. */ s->initializing_p = False; /* This totally sucks -- set a timer that whacks the scrollbar 0.5 seconds after we start up. Otherwise, it always appears scrolled to the top when in crapplet-mode. */ gtk_timeout_add (500, delayed_scroll_kludge, s); #if 1 /* Load every configurator in turn, to scan them for errors all at once. */ if (s->debug_p) { int i; for (i = 0; i < p->screenhacks_count; i++) { screenhack *hack = p->screenhacks[i]; conf_data *d = load_configurator (hack->command, s->debug_p); if (d) free_conf_data (d); } } #endif # ifdef HAVE_CRAPPLET if (crapplet_p) capplet_gtk_main (); else # endif /* HAVE_CRAPPLET */ gtk_main (); kill_preview_subproc (s, False); exit (0); } #endif /* HAVE_GTK -- whole file */ xscreensaver-5.42+dfsg1/driver/demo-Xm-widgets.c000066400000000000000000000737421342162430400216010ustar00rootroot00000000000000/* demo-Xm.c --- implements the interactive demo-mode and options dialogs. * xscreensaver, Copyright (c) 1999, 2003 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 /* just for debug info */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_XMCOMBOBOX /* a Motif 2.0 widget */ # include # ifndef XmNtextField /* Lesstif 0.89.4 bug */ # undef HAVE_XMCOMBOBOX # endif #endif /* HAVE_XMCOMBOBOX */ #include #include const char *visual_menu[] = { "Any", "Best", "Default", "Default-N", "GL", "TrueColor", "PseudoColor", "StaticGray", "GrayScale", "DirectColor", "Color", "Gray", "Mono", 0 }; static Widget create_demos_page (Widget parent); static Widget create_options_page (Widget parent); static void tab_cb (Widget button, XtPointer client_data, XtPointer ignored) { Widget parent = XtParent(button); Widget tabber = XtNameToWidget (parent, "*folder"); Widget this_tab = (Widget) client_data; Widget *kids = 0; Cardinal nkids = 0; if (!tabber) abort(); XtVaGetValues (tabber, XmNnumChildren, &nkids, XmNchildren, &kids, NULL); if (!kids) abort(); if (nkids > 0) XtUnmanageChildren (kids, nkids); XtManageChild (this_tab); } Widget create_xscreensaver_demo (Widget parent) { /* MainWindow Form Menubar DemoTab OptionsTab HR Tabber (demo page) (options page) */ Widget mainw, form, menubar; Widget demo_tab, options_tab, hr, tabber, demos, options; Arg av[100]; int ac = 0; mainw = XmCreateMainWindow (parent, "demoForm", av, ac); form = XmCreateForm (mainw, "form", av, ac); menubar = XmCreateSimpleMenuBar (form, "menubar", av, ac); XtVaSetValues (menubar, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL); { Widget menu = 0, item = 0; char *menus[] = { "*file", "blank", "lock", "kill", "restart", "-", "exit", "*edit", "cut", "copy", "paste", "*help", "about", "docMenu" }; int i; for (i = 0; i < sizeof(menus)/sizeof(*menus); i++) { ac = 0; if (menus[i][0] == '-') item = XmCreateSeparatorGadget (menu, "separator", av, ac); else if (menus[i][0] != '*') item = XmCreatePushButtonGadget (menu, menus[i], av, ac); else { menu = XmCreatePulldownMenu (parent, menus[i]+1, av, ac); XtSetArg (av [ac], XmNsubMenuId, menu); ac++; item = XmCreateCascadeButtonGadget (menubar, menus[i]+1, av, ac); if (!strcmp (menus[i]+1, "help")) XtVaSetValues(menubar, XmNmenuHelpWidget, item, NULL); } XtManageChild (item); } ac = 0; } demo_tab = XmCreatePushButtonGadget (form, "demoTab", av, ac); XtVaSetValues (demo_tab, XmNleftAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, menubar, NULL); options_tab = XmCreatePushButtonGadget (form, "optionsTab", av, ac); XtVaSetValues (options_tab, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, demo_tab, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopWidget, demo_tab, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, demo_tab, NULL); hr = XmCreateSeparatorGadget (form, "hr", av, ac); XtVaSetValues (hr, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, demo_tab, NULL); tabber = XmCreateForm (form, "folder", av, ac); XtVaSetValues (tabber, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, hr, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); demos = create_demos_page (tabber); options = create_options_page (tabber); XtAddCallback (demo_tab, XmNactivateCallback, tab_cb, demos); XtAddCallback (options_tab, XmNactivateCallback, tab_cb, options); XtManageChild (demos); XtManageChild (options); XtManageChild (demo_tab); XtManageChild (options_tab); XtManageChild (hr); XtManageChild (menubar); XtManageChild (tabber); XtManageChild (form); #if 1 XtUnmanageChild (options); XtManageChild (demos); #endif return mainw; } static Widget create_demos_page (Widget parent) { /* Form1 (horizontal) Form2 (vertical) Scroller List ButtonBox1 (vertical) Button ("Down") Button ("Up") Form3 (vertical) Frame Label TextArea (doc) Label Text ("Command Line") Form4 (horizontal) Checkbox ("Enabled") Label ("Visual") ComboBox HR ButtonBox2 (vertical) Button ("Demo") Button ("Documentation") */ Widget form1, form2, form3, form4; Widget scroller, list, buttonbox1, down, up; Widget frame, frame_label, doc, cmd_label, cmd_text, enabled, vis_label; Widget combo; Widget hr, buttonbox2, demo, man; Arg av[100]; int ac = 0; int i; form1 = XmCreateForm (parent, "form1", av, ac); form2 = XmCreateForm (form1, "form2", av, ac); XtVaSetValues (form2, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); scroller = XmCreateScrolledWindow (form2, "scroller", av, ac); XtVaSetValues (scroller, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, NULL); list = XmCreateList (scroller, "list", av, ac); buttonbox1 = XmCreateForm (form2, "buttonbox1", av, ac); XtVaSetValues (buttonbox1, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); XtVaSetValues (scroller, XmNbottomWidget, buttonbox1, NULL); down = XmCreatePushButton (buttonbox1, "down", av, ac); XtVaSetValues (down, XmNleftAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); up = XmCreatePushButton (buttonbox1, "up", av, ac); XtVaSetValues (up, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, down, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); form3 = XmCreateForm (form1, "form3", av, ac); XtVaSetValues (form3, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, form2, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); frame = XmCreateFrame (form3, "frame", av, ac); ac = 0; XtSetArg (av [ac], XmNchildType, XmFRAME_TITLE_CHILD); ac++; frame_label = XmCreateLabelGadget (frame, "frameLabel", av, ac); ac = 0; XtVaSetValues (frame, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, NULL); ac = 0; XtSetArg (av [ac], XmNchildType, XmFRAME_WORKAREA_CHILD); ac++; doc = XmCreateText (frame, "doc", av, ac); ac = 0; XtVaSetValues (doc, XmNeditable, FALSE, XmNcursorPositionVisible, FALSE, XmNwordWrap, TRUE, XmNeditMode, XmMULTI_LINE_EDIT, XmNshadowThickness, 0, NULL); cmd_label = XmCreateLabelGadget (form3, "cmdLabel", av, ac); XtVaSetValues (cmd_label, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, NULL); XtVaSetValues (frame, XmNbottomWidget, cmd_label, NULL); cmd_text = XmCreateTextField (form3, "cmdText", av, ac); XtVaSetValues (cmd_text, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, NULL); XtVaSetValues (cmd_label, XmNbottomWidget, cmd_text, NULL); form4 = XmCreateForm (form3, "form4", av, ac); XtVaSetValues (form4, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, NULL); XtVaSetValues (cmd_text, XmNbottomWidget, form4, NULL); enabled = XmCreateToggleButtonGadget (form4, "enabled", av, ac); XtVaSetValues (enabled, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); vis_label = XmCreateLabelGadget (form4, "visLabel", av, ac); XtVaSetValues (vis_label, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, enabled, XmNbottomAttachment, XmATTACH_FORM, NULL); #ifdef HAVE_XMCOMBOBOX { Widget list; ac = 0; XtSetArg (av [ac], XmNcomboBoxType, XmDROP_DOWN_COMBO_BOX); ac++; combo = XmCreateComboBox (form4, "combo", av, ac); for (i = 0; visual_menu[i]; i++) { XmString xs = XmStringCreate ((char *) visual_menu[i], XmSTRING_DEFAULT_CHARSET); XmComboBoxAddItem (combo, xs, 0, False); XmStringFree (xs); } XtVaGetValues (combo, XmNlist, &list, NULL); XtVaSetValues (list, XmNvisibleItemCount, i, NULL); } #else /* !HAVE_XMCOMBOBOX */ { Widget popup_menu = XmCreatePulldownMenu (parent, "menu", av, ac); Widget kids[100]; for (i = 0; visual_menu[i]; i++) { XmString xs = XmStringCreate ((char *) visual_menu[i], XmSTRING_DEFAULT_CHARSET); ac = 0; XtSetArg (av [ac], XmNlabelString, xs); ac++; kids[i] = XmCreatePushButtonGadget (popup_menu, "button", av, ac); /* XtAddCallback (combo, XmNactivateCallback, visual_popup_cb, combo); */ XmStringFree (xs); } XtManageChildren (kids, i); ac = 0; XtSetArg (av [ac], XmNsubMenuId, popup_menu); ac++; combo = XmCreateOptionMenu (form4, "combo", av, ac); ac = 0; } #endif /* !HAVE_XMCOMBOBOX */ XtVaSetValues (combo, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, vis_label, XmNbottomAttachment, XmATTACH_FORM, NULL); hr = XmCreateSeparatorGadget (form3, "hr", av, ac); XtVaSetValues (hr, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_WIDGET, NULL); XtVaSetValues (form4, XmNbottomWidget, hr, NULL); buttonbox2 = XmCreateForm (form3, "buttonbox2", av, ac); XtVaSetValues (buttonbox2, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); XtVaSetValues (hr, XmNbottomWidget, buttonbox2, NULL); demo = XmCreatePushButtonGadget (buttonbox2, "demo", av, ac); XtVaSetValues (demo, XmNleftAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); man = XmCreatePushButtonGadget (buttonbox2, "man", av, ac); XtVaSetValues (man, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); XtManageChild (demo); XtManageChild (man); XtManageChild (buttonbox2); XtManageChild (hr); XtManageChild (combo); XtManageChild (vis_label); XtManageChild (enabled); XtManageChild (form4); XtManageChild (cmd_text); XtManageChild (cmd_label); XtManageChild (doc); XtManageChild (frame_label); XtManageChild (frame); XtManageChild (form3); XtManageChild (up); XtManageChild (down); XtManageChild (buttonbox1); XtManageChild (list); XtManageChild (scroller); XtManageChild (form2); XtManageChild (form1); XtVaSetValues (form1, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); return form1; } static Widget create_options_page (Widget parent) { /* This is what the layout is today: Form (horizontal) Label ("Saver Timeout") Label ("Cycle Timeout") Label ("Fade Duration") Label ("Fade Ticks") Label ("Lock Timeout") Label ("Password Timeout") Text (timeout) Text (cycle) Text (fade seconds) Text (fade ticks) Text (lock) Text (passwd) Toggle ("Verbose") Toggle ("Install Colormap") Toggle ("Fade Colormap") Toggle ("Unfade Colormap") Toggle ("Require Password") HR Button ("OK") Button ("Cancel") */ /* This is what it should be: Form (horizontal) Form (vertical) ("column1") Frame Label ("Blanking and Locking") Form Label ("Blank After") Label ("Cycle After") Text ("Blank After") Text ("Cycle After") HR Checkbox ("Require Password") Label ("Lock After") Text ("Lock After") Frame Label ("Image Manipulation") Form Checkbox ("Grab Desktop Images") Checkbox ("Grab Video Frames") Checkbox ("Choose Random Image") Text (pathname) Button ("Browse") Frame Label ("Diagnostics") Form Checkbox ("Verbose Diagnostics") Checkbox ("Display Subprocess Errors") Checkbox ("Display Splash Screen at Startup") Form (vertical) ("column2") Frame Label ("Display Power Management") Form Checkbox ("Power Management Enabled") Label ("Standby After") Label ("Suspend After") Label ("Off After") Text ("Standby After") Text ("Suspend After") Text ("Off After") Frame Label ("Colormaps") Form Checkbox ("Install Colormap") HR Checkbox ("Fade To Black When Blanking") Checkbox ("Fade From Black When Unblanking") Label ("Fade Duration") Text ("Fade Duration") timeoutLabel cycleLabel fadeSecondsLabel fadeTicksLabel lockLabel passwdLabel timeoutText cycleText fadeSecondsText fadeTicksText lockText passwdText verboseToggle cmapToggle fadeToggle unfadeToggle lockToggle separator OK Cancel */ Arg av[64]; int ac = 0; Widget children[100]; Widget timeout_label, cycle_label, fade_seconds_label, fade_ticks_label; Widget lock_label, passwd_label, hr; Widget preferences_form; Widget timeout_text, cycle_text, fade_text, fade_ticks_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; ac = 0; XtSetArg (av [ac], XmNdialogType, XmDIALOG_PROMPT); ac++; ac = 0; XtSetArg (av [ac], XmNtopAttachment, XmATTACH_FORM); ac++; XtSetArg (av [ac], XmNbottomAttachment, XmATTACH_FORM); ac++; XtSetArg (av [ac], XmNleftAttachment, XmATTACH_FORM); ac++; XtSetArg (av [ac], XmNrightAttachment, XmATTACH_FORM); ac++; preferences_form = XmCreateForm (parent, "preferencesForm", av, ac); XtManageChild (preferences_form); ac = 0; XtSetArg(av[ac], XmNalignment, XmALIGNMENT_END); ac++; timeout_label = XmCreateLabelGadget (preferences_form, "timeoutLabel", av, ac); ac = 0; XtSetArg(av[ac], XmNalignment, XmALIGNMENT_END); ac++; cycle_label = XmCreateLabelGadget (preferences_form, "cycleLabel", av, ac); ac = 0; XtSetArg(av[ac], XmNalignment, XmALIGNMENT_END); ac++; fade_seconds_label = XmCreateLabelGadget (preferences_form, "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++; passwd_label = XmCreateLabelGadget (preferences_form, "passwdLabel", av, ac); ac = 0; 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", av, ac); XtSetArg(av[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; verbose_toggle = XmCreateToggleButtonGadget (preferences_form, "verboseToggle", av, ac); ac = 0; XtSetArg(av[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; install_cmap_toggle = XmCreateToggleButtonGadget (preferences_form, "cmapToggle", av, ac); ac = 0; XtSetArg(av[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; fade_toggle = XmCreateToggleButtonGadget (preferences_form, "fadeToggle", av, ac); ac = 0; XtSetArg(av[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; unfade_toggle = XmCreateToggleButtonGadget (preferences_form, "unfadeToggle", av,ac); ac = 0; XtSetArg(av[ac], XmNalignment, XmALIGNMENT_BEGINNING); ac++; lock_toggle = XmCreateToggleButtonGadget (preferences_form, "lockToggle", av, ac); ac = 0; hr = XmCreateSeparatorGadget (preferences_form, "separator", av, ac); prefs_done = XmCreatePushButtonGadget (preferences_form, "OK", av, ac); prefs_cancel = XmCreatePushButtonGadget (preferences_form, "Cancel", av, ac); XtVaSetValues (timeout_label, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 4, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomWidget, timeout_text, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 20, XmNrightAttachment, XmATTACH_WIDGET, XmNrightOffset, 4, XmNrightWidget, timeout_text, NULL); XtVaSetValues (cycle_label, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopOffset, 0, XmNtopWidget, cycle_text, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomOffset, 0, XmNbottomWidget, cycle_text, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 20, XmNrightAttachment, XmATTACH_WIDGET, XmNrightOffset, 4, XmNrightWidget, cycle_text, NULL); XtVaSetValues (fade_seconds_label, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopOffset, 0, XmNtopWidget, fade_text, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomOffset, 0, XmNbottomWidget, fade_text, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 20, XmNrightAttachment, XmATTACH_WIDGET, XmNrightOffset, 4, 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, XmNtopWidget, lock_timeout_text, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomOffset, 0, XmNbottomWidget, lock_timeout_text, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 19, XmNrightAttachment, XmATTACH_WIDGET, XmNrightOffset, 4, XmNrightWidget, lock_timeout_text, NULL); XtVaSetValues (passwd_label, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopOffset, 0, XmNtopWidget, passwd_timeout_text, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomOffset, 0, XmNbottomWidget, passwd_timeout_text, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 14, XmNrightAttachment, XmATTACH_WIDGET, XmNrightOffset, 4, XmNrightWidget, passwd_timeout_text, NULL); XtVaSetValues (timeout_text, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 4, XmNleftAttachment, XmATTACH_FORM, XmNleftOffset, 141, NULL); XtVaSetValues (cycle_text, XmNtopAttachment, XmATTACH_WIDGET, XmNtopOffset, 2, XmNtopWidget, timeout_text, XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, XmNleftOffset, 0, XmNleftWidget, timeout_text, NULL); XtVaSetValues (fade_text, XmNtopAttachment, XmATTACH_WIDGET, XmNtopOffset, 2, XmNtopWidget, cycle_text, XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, XmNleftOffset, 0, XmNleftWidget, cycle_text, NULL); XtVaSetValues (fade_ticks_text, XmNtopAttachment, XmATTACH_WIDGET, XmNtopOffset, 2, XmNtopWidget, fade_text, XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, XmNleftOffset, 0, 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, XmNtopWidget, lock_timeout_text, XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, XmNleftOffset, 0, XmNleftWidget, lock_timeout_text, NULL); XtVaSetValues (verbose_toggle, XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 4, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomOffset, 0, XmNbottomWidget, timeout_text, XmNleftAttachment, XmATTACH_WIDGET, XmNleftOffset, 20, XmNleftWidget, timeout_text, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 20, NULL); XtVaSetValues (install_cmap_toggle, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopOffset, 0, XmNtopWidget, cycle_text, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomOffset, 0, XmNbottomWidget, cycle_text, XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, XmNleftOffset, 0, XmNleftWidget, verbose_toggle, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 20, NULL); XtVaSetValues (fade_toggle, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopOffset, 0, XmNtopWidget, fade_text, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomOffset, 0, XmNbottomWidget, fade_text, XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, XmNleftOffset, 0, XmNleftWidget, install_cmap_toggle, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 20, NULL); XtVaSetValues (unfade_toggle, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopOffset, 0, XmNtopWidget, fade_ticks_text, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomOffset, 0, XmNbottomWidget, fade_ticks_text, XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, XmNleftOffset, 0, XmNleftWidget, fade_toggle, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 20, NULL); XtVaSetValues (lock_toggle, XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET, XmNtopOffset, 0, XmNtopWidget, lock_timeout_text, XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET, XmNbottomOffset, 0, XmNbottomWidget, lock_timeout_text, XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET, XmNleftOffset, 0, XmNleftWidget, unfade_toggle, XmNrightAttachment, XmATTACH_FORM, XmNrightOffset, 20, NULL); XtVaSetValues (hr, XmNtopWidget, passwd_timeout_text, XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 4, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL); XtVaSetValues (prefs_done, XmNleftAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); XtVaSetValues (prefs_cancel, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); XtVaSetValues (hr, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, prefs_done, NULL); ac = 0; 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; children[ac++] = install_cmap_toggle; children[ac++] = fade_toggle; children[ac++] = unfade_toggle; children[ac++] = lock_toggle; children[ac++] = hr; XtManageChildren(children, ac); ac = 0; XtManageChild (prefs_done); XtManageChild (prefs_cancel); XtManageChild (preferences_form); XtVaSetValues (preferences_form, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, NULL); return preferences_form; } xscreensaver-5.42+dfsg1/driver/demo-Xm.c000066400000000000000000001426571342162430400201370ustar00rootroot00000000000000/* demo-Xm.c --- implements the interactive demo-mode and options dialogs. * xscreensaver, Copyright (c) 1993-2003, 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 * 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 #ifdef HAVE_MOTIF /* whole file */ #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 CARD32 */ #include /* for XA_INTEGER */ #include #include /* We don't actually use any widget internals, but these are included so that gdb will have debug info for the widgets... */ #include #include #ifdef HAVE_XPM # include #endif /* HAVE_XPM */ #ifdef HAVE_XMU # ifndef VMS # include # else /* VMS */ # include # endif #else # include "xmu.h" #endif #include #include #include #include #include #include #ifdef HAVE_XMCOMBOBOX /* a Motif 2.0 widget */ # include # ifndef XmNtextField /* Lesstif 0.89.4 bug */ # undef HAVE_XMCOMBOBOX # endif # if (XmVersion < 2001) /* Lesstif has two personalities these days */ # undef HAVE_XMCOMBOBOX # endif #endif /* HAVE_XMCOMBOBOX */ #include "version.h" #include "prefs.h" #include "resources.h" /* for parse_time() */ #include "visual.h" /* for has_writable_cells() */ #include "remote.h" /* for xscreensaver_command() */ #include "usleep.h" #include #include #include #undef countof #define countof(x) (sizeof((x))/sizeof((*x))) char *progname = 0; char *progclass = "XScreenSaver"; XrmDatabase db; typedef struct { saver_preferences *a, *b; } prefs_pair; 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_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); static int apply_changes_and_save (Widget widget); static int maybe_reload_init_file (Widget widget, prefs_pair *pair); static void await_xscreensaver (Widget widget); /* Some random utility functions */ static Widget name_to_widget (Widget widget, const char *name) { Widget parent; char name2[255]; name2[0] = '*'; strcpy (name2+1, name); while ((parent = XtParent (widget))) widget = parent; return XtNameToWidget (widget, name2); } /* Why this behavior isn't automatic in *either* toolkit, I'll never know. Takes a scroller, viewport, or list as an argument. */ static void ensure_selected_item_visible (Widget list) { int *pos_list = 0; int pos_count = 0; if (XmListGetSelectedPos (list, &pos_list, &pos_count) && pos_count > 0) { int top = -2; int visible = 0; XtVaGetValues (list, XmNtopItemPosition, &top, XmNvisibleItemCount, &visible, NULL); if (pos_list[0] >= top + visible) { int pos = pos_list[0] - visible + 1; if (pos < 0) pos = 0; XmListSetPos (list, pos); } else if (pos_list[0] < top) { XmListSetPos (list, pos_list[0]); } } if (pos_list) XtFree ((char *) pos_list); } static void warning_dialog_dismiss_cb (Widget button, XtPointer client_data, XtPointer user_data) { Widget shell = (Widget) client_data; XtDestroyWidget (shell); } static void warning_dialog (Widget parent, const char *message, int center) { char *msg = strdup (message); char *head; Widget dialog = 0; Widget label = 0; Widget ok = 0; int i = 0; Widget w; Widget container; XmString xmstr; Arg av[10]; int ac = 0; ac = 0; dialog = XmCreateWarningDialog (parent, "warning", av, ac); w = XmMessageBoxGetChild (dialog, XmDIALOG_MESSAGE_LABEL); if (w) XtUnmanageChild (w); w = XmMessageBoxGetChild (dialog, XmDIALOG_CANCEL_BUTTON); if (w) XtUnmanageChild (w); w = XmMessageBoxGetChild (dialog, XmDIALOG_HELP_BUTTON); if (w) XtUnmanageChild (w); ok = XmMessageBoxGetChild (dialog, XmDIALOG_OK_BUTTON); ac = 0; XtSetArg (av[ac], XmNnumColumns, 1); ac++; XtSetArg (av[ac], XmNorientation, XmVERTICAL); ac++; XtSetArg (av[ac], XmNpacking, XmPACK_COLUMN); ac++; XtSetArg (av[ac], XmNrowColumnType, XmWORK_AREA); ac++; XtSetArg (av[ac], XmNspacing, 0); ac++; container = XmCreateRowColumn (dialog, "container", av, ac); head = msg; while (head) { char name[20]; char *s = strchr (head, '\n'); if (s) *s = 0; sprintf (name, "label%d", i++); xmstr = XmStringCreate (head, XmSTRING_DEFAULT_CHARSET); ac = 0; XtSetArg (av[ac], XmNlabelString, xmstr); ac++; XtSetArg (av[ac], XmNmarginHeight, 0); ac++; label = XmCreateLabelGadget (container, name, av, ac); XtManageChild (label); XmStringFree (xmstr); if (s) head = s+1; else head = 0; center--; } XtManageChild (container); XtRealizeWidget (dialog); XtManageChild (dialog); XtAddCallback (ok, XmNactivateCallback, warning_dialog_dismiss_cb, dialog); free (msg); } static void run_cmd (Widget widget, Atom command, int arg) { char *err = 0; int status; apply_changes_and_save (widget); status = xscreensaver_command (XtDisplay (widget), command, arg, False, &err); if (status < 0) { char buf [255]; if (err) sprintf (buf, "Error:\n\n%s", err); else strcpy (buf, "Unknown error!"); warning_dialog (widget, buf, 100); } if (err) free (err); } static void run_hack (Widget widget, int which, Bool report_errors_p) { if (which < 0) return; apply_changes_and_save (widget); if (report_errors_p) run_cmd (widget, XA_DEMO, which + 1); else { char *s = 0; xscreensaver_command (XtDisplay (widget), XA_DEMO, which + 1, False, &s); if (s) free (s); } } /* Button callbacks */ void exit_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { apply_changes_and_save (XtParent (button)); exit (0); } #if 0 static void wm_close_cb (Widget widget, GdkEvent *event, XtPointer data) { apply_changes_and_save (XtParent (button)); exit (0); } #endif void cut_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { /* #### */ warning_dialog (XtParent (button), "Error:\n\n" "cut unimplemented\n", 1); } void copy_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { /* #### */ warning_dialog (XtParent (button), "Error:\n\n" "copy unimplemented\n", 1); } void paste_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { /* #### */ warning_dialog (XtParent (button), "Error:\n\n" "paste unimplemented\n", 1); } void about_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { char buf [2048]; char *s = strdup (screensaver_id + 4); char *s2; s2 = strchr (s, ','); *s2 = 0; s2 += 2; 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" "instead, which has many more features.\n" "\n" "For xscreensaver updates, check https://www.jwz.org/xscreensaver/", s, s2); free (s); warning_dialog (XtParent (button), buf, 100); } void doc_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { prefs_pair *pair = (prefs_pair *) client_data; saver_preferences *p = pair->a; char *help_command; if (!p->help_url || !*p->help_url) { warning_dialog (XtParent (button), "Error:\n\n" "No Help URL has been specified.\n", 100); return; } help_command = (char *) malloc (strlen (p->load_url_command) + (strlen (p->help_url) * 4) + 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); strcat (help_command, " ) &"); system (help_command); free (help_command); } void activate_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { run_cmd (XtParent (button), XA_ACTIVATE, 0); } void lock_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { run_cmd (XtParent (button), XA_LOCK, 0); } void kill_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { run_cmd (XtParent (button), XA_EXIT, 0); } void restart_menu_cb (Widget button, XtPointer client_data, XtPointer ignored) { #if 0 run_cmd (XtParent (button), XA_RESTART, 0); #else button = XtParent (button); apply_changes_and_save (button); xscreensaver_command (XtDisplay (button), XA_EXIT, 0, False, NULL); sleep (1); system ("xscreensaver -nosplash &"); #endif await_xscreensaver (button); } static void await_xscreensaver (Widget widget) { int countdown = 5; Display *dpy = XtDisplay (widget); char *rversion = 0; while (!rversion && (--countdown > 0)) { /* Check for the version of the running xscreensaver... */ server_xscreensaver_version (dpy, &rversion, 0, 0); /* If it's not there yet, wait a second... */ sleep (1); } if (rversion) { /* Got it. */ free (rversion); } else { /* Timed out, no screensaver running. */ char buf [1024]; Bool root_p = (geteuid () == 0); strcpy (buf, "Error:\n\n" "The xscreensaver daemon did not start up properly.\n" "\n"); if (root_p) # ifdef __GNUC__ __extension__ /* don't warn about "string length is greater than the length ISO C89 compilers are required to support" in the following expression... */ # endif strcat (buf, "You are running as root. This usually means that xscreensaver\n" "was unable to contact your X server because access control is\n" "turned on. Try running this command:\n" "\n" " xhost +localhost\n" "\n" "and then selecting `File / Restart Daemon'.\n" "\n" "Note that turning off access control will allow anyone logged\n" "on to this machine to access your screen, which might be\n" "considered a security problem. Please read the xscreensaver\n" "manual and FAQ for more information.\n" "\n" "You shouldn't run X as root. Instead, you should log in as a\n" "normal user, and `su' as necessary."); else strcat (buf, "Please check your $PATH and permissions."); warning_dialog (XtParent (widget), buf, 1); } } static int _selected_hack_number = -1; static int selected_hack_number (Widget toplevel) { return _selected_hack_number; } static int demo_write_init_file (Widget widget, saver_preferences *p) { if (!write_init_file (XtDisplay (widget), p, short_version, False)) return 0; else { const char *f = init_file_name(); if (!f || !*f) warning_dialog (widget, "Error:\n\nCouldn't determine init file name!\n", 100); else { char *b = (char *) malloc (strlen(f) + 1024); sprintf (b, "Error:\n\nCouldn't write %s\n", f); warning_dialog (widget, b, 100); free (b); } return -1; } } static int apply_changes_and_save (Widget widget) { prefs_pair *pair = global_prefs_pair; saver_preferences *p = pair->a; Widget list_widget = name_to_widget (widget, "list"); int which = selected_hack_number (widget); Widget cmd = name_to_widget (widget, "cmdText"); Widget enabled = name_to_widget (widget, "enabled"); Widget vis = name_to_widget (widget, "combo"); # ifdef HAVE_XMCOMBOBOX Widget text = 0; # else /* !HAVE_XMCOMBOBOX */ Widget menu = 0, *kids = 0, selected_item = 0; Cardinal nkids = 0; int i = 0; # endif /* !HAVE_XMCOMBOBOX */ Bool enabled_p = False; const char *visual = 0; const char *command = 0; char c; unsigned long id; if (which < 0) return -1; # ifdef HAVE_XMCOMBOBOX XtVaGetValues (vis, XmNtextField, &text, NULL); if (!text) /* If we can't get at the text field of this combo box, we're screwed. */ abort(); XtVaGetValues (text, XmNvalue, &visual, NULL); # else /* !HAVE_XMCOMBOBOX */ XtVaGetValues (vis, XmNsubMenuId, &menu, NULL); XtVaGetValues (menu, XmNnumChildren, &nkids, XmNchildren, &kids, NULL); XtVaGetValues (menu, XmNmenuHistory, &selected_item, NULL); if (selected_item) for (i = 0; i < nkids; i++) if (kids[i] == selected_item) break; visual = visual_menu[i]; # endif /* !HAVE_XMCOMBOBOX */ XtVaGetValues (enabled, XmNset, &enabled_p, NULL); XtVaGetValues (cmd, XtNvalue, &command, NULL); if (maybe_reload_init_file (widget, pair) != 0) return 1; /* Sanity-check and canonicalize whatever the user typed into the combo box. */ if (!strcasecmp (visual, "")) visual = ""; else if (!strcasecmp (visual, "any")) visual = ""; else if (!strcasecmp (visual, "default")) visual = "Default"; else if (!strcasecmp (visual, "default-n")) visual = "Default-N"; else if (!strcasecmp (visual, "default-i")) visual = "Default-I"; else if (!strcasecmp (visual, "best")) visual = "Best"; else if (!strcasecmp (visual, "mono")) visual = "Mono"; else if (!strcasecmp (visual, "monochrome")) visual = "Mono"; else if (!strcasecmp (visual, "gray")) visual = "Gray"; else if (!strcasecmp (visual, "grey")) visual = "Gray"; else if (!strcasecmp (visual, "color")) visual = "Color"; else if (!strcasecmp (visual, "gl")) visual = "GL"; else if (!strcasecmp (visual, "staticgray")) visual = "StaticGray"; else if (!strcasecmp (visual, "staticcolor")) visual = "StaticColor"; else if (!strcasecmp (visual, "truecolor")) visual = "TrueColor"; else if (!strcasecmp (visual, "grayscale")) visual = "GrayScale"; else if (!strcasecmp (visual, "greyscale")) visual = "GrayScale"; else if (!strcasecmp (visual, "pseudocolor")) visual = "PseudoColor"; else if (!strcasecmp (visual, "directcolor")) visual = "DirectColor"; else if (1 == sscanf (visual, " %lu %c", &id, &c)) ; else if (1 == sscanf (visual, " 0x%lx %c", &id, &c)) ; else { XBell (XtDisplay (widget), 0); /* unparsable */ visual = ""; /* #### gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (vis)->entry), "Any");*/ } ensure_selected_item_visible (list_widget); if (!p->screenhacks[which]->visual) p->screenhacks[which]->visual = strdup (""); if (!p->screenhacks[which]->command) p->screenhacks[which]->command = strdup (""); if (p->screenhacks[which]->enabled_p != enabled_p || !!strcasecmp (p->screenhacks[which]->visual, visual) || !!strcasecmp (p->screenhacks[which]->command, command)) { /* Something was changed -- store results into the struct, and write the file. */ free (p->screenhacks[which]->visual); free (p->screenhacks[which]->command); p->screenhacks[which]->visual = strdup (visual); p->screenhacks[which]->command = strdup (command); p->screenhacks[which]->enabled_p = enabled_p; return demo_write_init_file (widget, p); } /* No changes made */ return 0; } void run_this_cb (Widget button, XtPointer client_data, XtPointer ignored) { int which = selected_hack_number (XtParent (button)); if (which < 0) return; if (0 == apply_changes_and_save (XtParent (button))) run_hack (XtParent (button), which, True); } void manual_cb (Widget button, XtPointer client_data, XtPointer ignored) { prefs_pair *pair = (prefs_pair *) client_data; saver_preferences *p = pair->a; Widget list_widget = name_to_widget (button, "list"); int which = selected_hack_number (button); char *name, *name2, *cmd, *s; if (which < 0) return; apply_changes_and_save (button); ensure_selected_item_visible (list_widget); name = strdup (p->screenhacks[which]->command); name2 = name; while (isspace (*name2)) name2++; s = name2; while (*s && !isspace (*s)) s++; *s = 0; s = strrchr (name2, '/'); if (s) name = s+1; cmd = get_string_resource (XtDisplay (button), "manualCommand", "ManualCommand"); if (cmd) { char *cmd2 = (char *) malloc (strlen (cmd) + (strlen (name2) * 4) + 100); strcpy (cmd2, "( "); sprintf (cmd2 + strlen (cmd2), cmd, name2, name2, name2, name2); strcat (cmd2, " ) &"); system (cmd2); free (cmd2); } else { warning_dialog (XtParent (button), "Error:\n\nno `manualCommand' resource set.", 100); } free (name); } void run_next_cb (Widget button, XtPointer client_data, XtPointer ignored) { prefs_pair *pair = (prefs_pair *) client_data; saver_preferences *p = pair->a; Widget list_widget = name_to_widget (button, "list"); int which = selected_hack_number (button); button = XtParent (button); if (which < 0) which = 0; else which++; if (which >= p->screenhacks_count) which = 0; apply_changes_and_save (button); XmListDeselectAllItems (list_widget); /* LessTif lossage */ XmListSelectPos (list_widget, which+1, True); ensure_selected_item_visible (list_widget); populate_demo_window (button, which, pair); run_hack (button, which, False); } void run_prev_cb (Widget button, XtPointer client_data, XtPointer ignored) { prefs_pair *pair = (prefs_pair *) client_data; saver_preferences *p = pair->a; Widget list_widget = name_to_widget (button, "list"); int which = selected_hack_number (button); button = XtParent (button); if (which < 0) which = p->screenhacks_count - 1; else which--; if (which < 0) which = p->screenhacks_count - 1; apply_changes_and_save (button); XmListDeselectAllItems (list_widget); /* LessTif lossage */ XmListSelectPos (list_widget, which+1, True); ensure_selected_item_visible (list_widget); populate_demo_window (button, which, pair); run_hack (button, which, False); } /* Helper for the text fields that contain time specifications: this parses the text, and does error checking. */ static void hack_time_text (Widget button, const char *line, Time *store, Bool sec_p) { if (*line) { int value; value = parse_time ((char *) line, sec_p, True); value *= 1000; /* Time measures in microseconds */ if (value < 0) { char b[255]; sprintf (b, "Error:\n\n" "Unparsable time format: \"%s\"\n", line); warning_dialog (XtParent (button), b, 100); } else *store = value; } } void prefs_ok_cb (Widget button, XtPointer client_data, XtPointer ignored) { prefs_pair *pair = (prefs_pair *) client_data; saver_preferences *p = pair->a; saver_preferences *p2 = pair->b; Bool changed = False; char *v = 0; button = XtParent (button); # define SECONDS(field, name) \ v = 0; \ XtVaGetValues (name_to_widget (button, (name)), XtNvalue, &v, NULL); \ hack_time_text (button, v, (field), True) # define MINUTES(field, name) \ v = 0; \ XtVaGetValues (name_to_widget (button, (name)), XtNvalue, &v, NULL); \ hack_time_text (button, v, (field), False) # define INTEGER(field, name) do { \ unsigned int value; \ char c; \ XtVaGetValues (name_to_widget (button, (name)), XtNvalue, &v, NULL); \ if (! *v) \ ; \ else if (sscanf (v, "%u%c", &value, &c) != 1) \ { \ char b[255]; \ sprintf (b, "Error:\n\n" "Not an integer: \"%s\"\n", v); \ warning_dialog (XtParent (button), b, 100); \ } \ else \ *(field) = value; \ } while(0) # define CHECKBOX(field, name) \ XtVaGetValues (name_to_widget (button, (name)), XmNset, &field, NULL) 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"); CHECKBOX (p2->install_cmap_p, "cmapToggle"); CHECKBOX (p2->fade_p, "fadeToggle"); CHECKBOX (p2->unfade_p, "unfadeToggle"); CHECKBOX (p2->lock_p, "lockToggle"); # undef SECONDS # undef MINUTES # undef INTEGER # undef CHECKBOX # define COPY(field) \ if (p->field != p2->field) changed = True; \ p->field = p2->field COPY(timeout); COPY(cycle); COPY(lock_timeout); COPY(passwd_timeout); COPY(fade_seconds); COPY(fade_ticks); COPY(verbose_p); COPY(install_cmap_p); COPY(fade_p); COPY(unfade_p); COPY(lock_p); # undef COPY populate_prefs_page (button, pair); if (changed) demo_write_init_file (button, p); } void prefs_cancel_cb (Widget button, XtPointer client_data, XtPointer ignored) { prefs_pair *pair = (prefs_pair *) client_data; *pair->b = *pair->a; populate_prefs_page (XtParent (button), pair); } static void list_select_cb (Widget list, XtPointer client_data, XtPointer call_data) { prefs_pair *pair = (prefs_pair *) client_data; XmListCallbackStruct *lcb = (XmListCallbackStruct *) call_data; int which = lcb->item_position - 1; apply_changes_and_save (list); populate_demo_window (list, which, pair); if (lcb->reason == XmCR_DEFAULT_ACTION && which >= 0) run_hack (list, which, True); } /* Populating the various widgets */ /* Formats a `Time' into "H:MM:SS". (Time is microseconds.) */ static void format_time (char *buf, Time time) { int s = time / 1000; unsigned int h = 0, m = 0; if (s >= 60) { m += (s / 60); s %= 60; } if (m >= 60) { h += (m / 60); m %= 60; } sprintf (buf, "%u:%02u:%02u", h, m, s); } /* Finds the number of the last hack to run, and makes that item be selected by default. */ static void scroll_to_current_hack (Widget toplevel, prefs_pair *pair) { Atom type; int format; unsigned long nitems, bytesafter; unsigned char *data = 0; Display *dpy = XtDisplay (toplevel); int which = 0; Widget list; if (XGetWindowProperty (dpy, RootWindow (dpy, 0), /* always screen #0 */ XA_SCREENSAVER_STATUS, 0, 3, False, XA_INTEGER, &type, &format, &nitems, &bytesafter, &data) == Success && type == XA_INTEGER && nitems >= 3 && data) which = (int) data[2] - 1; if (data) free (data); if (which < 0) return; list = name_to_widget (toplevel, "list"); apply_changes_and_save (toplevel); XmListDeselectAllItems (list); /* LessTif lossage */ XmListSelectPos (list, which+1, True); ensure_selected_item_visible (list); populate_demo_window (toplevel, which, pair); } static void populate_hack_list (Widget toplevel, prefs_pair *pair) { saver_preferences *p = pair->a; Widget list = name_to_widget (toplevel, "list"); screenhack **hacks = p->screenhacks; screenhack **h; for (h = hacks; *h; h++) { char *pretty_name = (h[0]->name ? strdup (h[0]->name) : make_hack_name (XtDisplay (toplevel), h[0]->command)); XmString xmstr = XmStringCreate (pretty_name, XmSTRING_DEFAULT_CHARSET); XmListAddItem (list, xmstr, 0); XmStringFree (xmstr); } XtAddCallback (list, XmNbrowseSelectionCallback, list_select_cb, pair); XtAddCallback (list, XmNdefaultActionCallback, list_select_cb, pair); } static void populate_prefs_page (Widget top, prefs_pair *pair) { saver_preferences *p = pair->a; char s[100]; format_time (s, p->timeout); XtVaSetValues (name_to_widget (top, "timeoutText"), XmNvalue, s, NULL); format_time (s, p->cycle); XtVaSetValues (name_to_widget (top, "cycleText"), XmNvalue, s, NULL); format_time (s, p->lock_timeout); XtVaSetValues (name_to_widget (top, "lockText"), XmNvalue, s, NULL); format_time (s, p->passwd_timeout); 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); XtVaSetValues (name_to_widget (top, "cmapToggle"), XmNset, p->install_cmap_p, NULL); XtVaSetValues (name_to_widget (top, "fadeToggle"), XmNset, p->fade_p, NULL); XtVaSetValues (name_to_widget (top, "unfadeToggle"), 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); } } static void 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++) { Widget w = name_to_widget (toplevel, names[i]); XtVaSetValues (w, XtNsensitive, sensitive_p, NULL); } /* I don't know how to handle these yet... */ { const char *names2[] = { "cut", "copy", "paste" }; for (i = 0; i < sizeof(names2)/countof(*names2); i++) { Widget w = name_to_widget (toplevel, names2[i]); XtVaSetValues (w, XtNsensitive, FALSE, NULL); } } } /* Pixmaps for the up and down arrow buttons (yeah, this is sleazy...) */ #ifdef HAVE_XPM static char *up_arrow_xpm[] = { "15 15 4 1", " c None s background", "- c #FFFFFF", "+ c #D6D6D6", "@ c #000000", " @ ", " @ ", " -+@ ", " -+@ ", " -+++@ ", " -+++@ ", " -+++++@ ", " -+++++@ ", " -+++++++@ ", " -+++++++@ ", " -+++++++++@ ", " -+++++++++@ ", " -+++++++++++@ ", " @@@@@@@@@@@@@ ", " " }; static char *down_arrow_xpm[] = { "15 15 4 1", " c None s background", "- c #FFFFFF", "+ c #D6D6D6", "@ c #000000", " ", " ------------- ", " -+++++++++++@ ", " -+++++++++@ ", " -+++++++++@ ", " -+++++++@ ", " -+++++++@ ", " -+++++@ ", " -+++++@ ", " -+++@ ", " -+++@ ", " -+@ ", " -+@ ", " @ ", " @ " }; #endif /* HAVE_XPM */ static void pixmapify_buttons (Widget toplevel) { #ifdef HAVE_XPM Display *dpy = XtDisplay (toplevel); Window window = XtWindow (toplevel); XWindowAttributes xgwa; XpmAttributes xpmattrs; Pixmap up_pixmap = 0, down_pixmap = 0; int result; Widget up = name_to_widget (toplevel, "up"); Widget dn = name_to_widget (toplevel, "down"); # ifdef XpmColorSymbols XColor xc; XpmColorSymbol symbols[2]; char color[20]; # endif XGetWindowAttributes (dpy, window, &xgwa); xpmattrs.valuemask = 0; # ifdef XpmColorSymbols symbols[0].name = "background"; symbols[0].pixel = 0; symbols[1].name = 0; XtVaGetValues (up, XmNbackground, &xc, NULL); XQueryColor (dpy, xgwa.colormap, &xc); sprintf (color, "#%04X%04X%04X", xc.red, xc.green, xc.blue); symbols[0].value = color; symbols[0].pixel = xc.pixel; xpmattrs.valuemask |= XpmColorSymbols; xpmattrs.colorsymbols = symbols; xpmattrs.numsymbols = 1; # endif # ifdef XpmCloseness xpmattrs.valuemask |= XpmCloseness; xpmattrs.closeness = 40000; # endif # ifdef XpmVisual xpmattrs.valuemask |= XpmVisual; xpmattrs.visual = xgwa.visual; # endif # ifdef XpmDepth xpmattrs.valuemask |= XpmDepth; xpmattrs.depth = xgwa.depth; # endif # ifdef XpmColormap xpmattrs.valuemask |= XpmColormap; xpmattrs.colormap = xgwa.colormap; # endif result = XpmCreatePixmapFromData(dpy, window, up_arrow_xpm, &up_pixmap, 0 /* mask */, &xpmattrs); if (!up_pixmap || (result != XpmSuccess && result != XpmColorError)) { fprintf (stderr, "%s: Can't load pixmaps\n", progname); return; } result = XpmCreatePixmapFromData(dpy, window, down_arrow_xpm, &down_pixmap, 0 /* mask */, &xpmattrs); if (!down_pixmap || (result != XpmSuccess && result != XpmColorError)) { fprintf (stderr, "%s: Can't load pixmaps\n", progname); return; } XtVaSetValues (up, XmNlabelType, XmPIXMAP, XmNlabelPixmap, up_pixmap, NULL); XtVaSetValues (dn, XmNlabelType, XmPIXMAP, XmNlabelPixmap, down_pixmap,NULL); #endif /* HAVE_XPM */ } char * get_hack_blurb (Display *dpy, screenhack *hack) { char *doc_string; char *prog_name = strdup (hack->command); char *pretty_name = (hack->name ? strdup (hack->name) : make_hack_name (dpy, hack->command)); char doc_name[255], doc_class[255]; char *s, *s2; for (s = prog_name; *s && !isspace(*s); s++) ; *s = 0; s = strrchr (prog_name, '/'); if (s) strcpy (prog_name, s+1); sprintf (doc_name, "hacks.%s.documentation", pretty_name); sprintf (doc_class, "hacks.%s.documentation", prog_name); free (prog_name); free (pretty_name); doc_string = get_string_resource (dpy, doc_name, doc_class); if (doc_string) { for (s = doc_string; *s; s++) { if (*s == '\n') { /* skip over whitespace at beginning of line */ s++; while (*s && (*s == ' ' || *s == '\t')) s++; } else if (*s == ' ' || *s == '\t') { /* compress all other horizontal whitespace. */ *s = ' '; s++; for (s2 = s; *s2 && (*s2 == ' ' || *s2 == '\t'); s2++) ; if (s2 > s) strcpy (s, s2); s--; } } while (*s && isspace (*s)) /* Strip trailing whitespace */ *(--s) = 0; /* Delete whitespace at end of each line. */ for (; s > doc_string; s--) if (*s == '\n' && (s[-1] == ' ' || s[-1] == '\t')) { for (s2 = s-1; s2 > doc_string && (*s2 == ' ' || *s2 == '\t'); s2--) ; s2++; if (s2 < s) strcpy (s2, s); s = s2; } /* Delete leading blank lines. */ for (s = doc_string; *s == '\n'; s++) ; if (s > doc_string) strcpy (doc_string, s); } else { # if 0 static int doc_installed = 0; if (doc_installed == 0) { if (get_boolean_resource ("hacks.documentation.isInstalled", "hacks.documentation.isInstalled")) doc_installed = 1; else doc_installed = -1; } if (doc_installed < 0) doc_string = strdup ("Error:\n\n" "The documentation strings do not appear to be " "installed. This is probably because there is " "an \"XScreenSaver\" app-defaults file installed " "that is from an older version of the program. " "To fix this problem, delete that file, or " "install a current version (either will work.)"); else # 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 " "instead, which has many more features." "\n\n" "If you were running the GTK version, there would be a preview " "of this screen saver mode displayed here, along with graphical " "configuration options."); } return doc_string; } static void populate_demo_window (Widget toplevel, int which, prefs_pair *pair) { saver_preferences *p = pair->a; screenhack *hack = (which >= 0 ? p->screenhacks[which] : 0); Widget frameL = name_to_widget (toplevel, "frameLabel"); Widget doc = name_to_widget (toplevel, "doc"); Widget cmd = name_to_widget (toplevel, "cmdText"); Widget enabled = name_to_widget (toplevel, "enabled"); Widget vis = name_to_widget (toplevel, "combo"); int i = 0; char *pretty_name = (hack ? (hack->name ? strdup (hack->name) : make_hack_name (XtDisplay (toplevel), hack->command)) : 0); char *doc_string = hack ? get_hack_blurb (XtDisplay (toplevel), hack) : 0; XmString xmstr; xmstr = XmStringCreate (pretty_name, XmSTRING_DEFAULT_CHARSET); XtVaSetValues (frameL, XmNlabelString, xmstr, NULL); XmStringFree (xmstr); XtVaSetValues (doc, XmNvalue, doc_string, NULL); XtVaSetValues (cmd, XmNvalue, (hack ? hack->command : ""), NULL); XtVaSetValues (enabled, XmNset, (hack ? hack->enabled_p : False), NULL); i = 0; if (hack && hack->visual && *hack->visual) for (i = 0; visual_menu[i]; i++) if (!strcasecmp (hack->visual, visual_menu[i])) break; if (!visual_menu[i]) i = -1; { # ifdef HAVE_XMCOMBOBOX Widget text = 0; XtVaGetValues (vis, XmNtextField, &text, NULL); XtVaSetValues (vis, XmNselectedPosition, i, NULL); if (i < 0) XtVaSetValues (text, XmNvalue, hack->visual, NULL); # else /* !HAVE_XMCOMBOBOX */ Cardinal nkids; Widget *kids; Widget menu; XtVaGetValues (vis, XmNsubMenuId, &menu, NULL); if (!menu) abort (); XtVaGetValues (menu, XmNnumChildren, &nkids, XmNchildren, &kids, NULL); if (!kids) abort(); if (i < nkids) XtVaSetValues (vis, XmNmenuHistory, kids[i], NULL); # endif /* !HAVE_XMCOMBOBOX */ } sensitize_demo_widgets (toplevel, (hack ? True : False)); if (pretty_name) free (pretty_name); if (doc_string) free (doc_string); _selected_hack_number = which; } static int maybe_reload_init_file (Widget widget, prefs_pair *pair) { int status = 0; saver_preferences *p = pair->a; static Bool reentrant_lock = False; if (reentrant_lock) return 0; reentrant_lock = True; if (init_file_changed_p (p)) { const char *f = init_file_name(); char *b; int which; Widget list; if (!f || !*f) return 0; b = (char *) malloc (strlen(f) + 1024); sprintf (b, "Warning:\n\n" "file \"%s\" has changed, reloading.\n", f); warning_dialog (widget, b, 100); free (b); load_init_file (XtDisplay (widget), p); which = selected_hack_number (widget); list = name_to_widget (widget, "list"); XtVaSetValues (list, XmNitemCount, 0, NULL); populate_hack_list (widget, pair); XmListDeselectAllItems (list); /* LessTif lossage */ XmListSelectPos (list, which+1, True); populate_prefs_page (widget, pair); populate_demo_window (widget, which, pair); ensure_selected_item_visible (list); status = 1; } reentrant_lock = False; return status; } /* Attach all callback functions to widgets */ static void add_callbacks (Widget toplevel, prefs_pair *pair) { Widget w; # define CB(NAME,FN) \ w = name_to_widget (toplevel, (NAME)); \ XtAddCallback (w, XmNactivateCallback, (FN), pair) CB ("blank", activate_menu_cb); CB ("lock", lock_menu_cb); CB ("kill", kill_menu_cb); CB ("restart", restart_menu_cb); CB ("exit", exit_menu_cb); CB ("cut", cut_menu_cb); CB ("copy", copy_menu_cb); CB ("paste", paste_menu_cb); CB ("about", about_menu_cb); CB ("docMenu", doc_menu_cb); CB ("down", run_next_cb); CB ("up", run_prev_cb); CB ("demo", run_this_cb); CB ("man", manual_cb); CB ("preferencesForm.Cancel", prefs_cancel_cb); CB ("preferencesForm.OK", prefs_ok_cb); # undef CB } static void sanity_check_resources (Widget toplevel) { const char *names[] = { "demoTab", "optionsTab", "cmdLabel", "visLabel", "enabled", "demo", "man", "timeoutLabel", "cycleLabel", "fadeSecondsLabel", "fadeTicksLabel", "lockLabel", "passwdLabel" }; int i; for (i = 0; i < sizeof(names)/countof(*names); i++) { Widget w = name_to_widget (toplevel, names[i]); const char *name = XtName(w); XmString xm = 0; char *label = 0; XtVaGetValues (w, XmNlabelString, &xm, NULL); if (xm) XmStringGetLtoR (xm, XmSTRING_DEFAULT_CHARSET, &label); if (w && (!label || !strcmp (name, label))) { xm = XmStringCreate ("ERROR", XmSTRING_DEFAULT_CHARSET); XtVaSetValues (w, XmNlabelString, xm, NULL); } } } /* Set certain buttons to be the same size (the max of the set.) */ static void hack_button_sizes (Widget toplevel) { Widget demo = name_to_widget (toplevel, "demo"); Widget man = name_to_widget (toplevel, "man"); Widget ok = name_to_widget (toplevel, "OK"); Widget can = name_to_widget (toplevel, "Cancel"); Widget up = name_to_widget (toplevel, "up"); Widget down = name_to_widget (toplevel, "down"); Dimension w1, w2; XtVaGetValues (demo, XmNwidth, &w1, NULL); XtVaGetValues (man, XmNwidth, &w2, NULL); XtVaSetValues ((w1 > w2 ? man : demo), XmNwidth, (w1 > w2 ? w1 : w2), NULL); XtVaGetValues (ok, XmNwidth, &w1, NULL); XtVaGetValues (can, XmNwidth, &w2, NULL); XtVaSetValues ((w1 > w2 ? can : ok), XmNwidth, (w1 > w2 ? w1 : w2), NULL); XtVaGetValues (up, XmNwidth, &w1, NULL); XtVaGetValues (down, XmNwidth, &w2, NULL); XtVaSetValues ((w1 > w2 ? down : up), XmNwidth, (w1 > w2 ? w1 : w2), NULL); } /* The main demo-mode command loop. */ #if 0 static Bool mapper (XrmDatabase *db, XrmBindingList bindings, XrmQuarkList quarks, XrmRepresentation *type, XrmValue *value, XPointer closure) { int i; for (i = 0; quarks[i]; i++) { if (bindings[i] == XrmBindTightly) fprintf (stderr, (i == 0 ? "" : ".")); else if (bindings[i] == XrmBindLoosely) fprintf (stderr, "*"); else fprintf (stderr, " ??? "); fprintf(stderr, "%s", XrmQuarkToString (quarks[i])); } fprintf (stderr, ": %s\n", (char *) value->addr); return False; } #endif static void the_network_is_not_the_computer (Widget parent) { Display *dpy = XtDisplay (parent); char *rversion, *ruser, *rhost; char *luser, *lhost; char *msg = 0; struct passwd *p = getpwuid (getuid ()); const char *d = DisplayString (dpy); # if defined(HAVE_UNAME) struct utsname uts; if (uname (&uts) < 0) lhost = ""; else lhost = uts.nodename; # elif defined(VMS) strcpy (lhost, getenv("SYS$NODE")); # else /* !HAVE_UNAME && !VMS */ strcat (lhost, ""); # endif /* !HAVE_UNAME && !VMS */ if (p && p->pw_name) luser = p->pw_name; else luser = "???"; server_xscreensaver_version (dpy, &rversion, &ruser, &rhost); /* Make a buffer that's big enough for a number of copies of all the strings, plus some. */ msg = (char *) malloc (10 * ((rversion ? strlen(rversion) : 0) + (ruser ? strlen(ruser) : 0) + (rhost ? strlen(rhost) : 0) + strlen(lhost) + strlen(luser) + strlen(d) + 1024)); *msg = 0; if (!rversion || !*rversion) { sprintf (msg, "Warning:\n\n" "The XScreenSaver daemon doesn't seem to be running\n" "on display \"%s\". You can launch it by selecting\n" "`Restart Daemon' from the File menu, or by typing\n" "\"xscreensaver &\" in a shell.", d); } else if (p && ruser && *ruser && !!strcmp (ruser, p->pw_name)) { /* Warn that the two processes are running as different users. */ sprintf(msg, "Warning:\n\n" "%s is running as user \"%s\" on host \"%s\".\n" "But the xscreensaver managing display \"%s\"\n" "is running as user \"%s\" on host \"%s\".\n" "\n" "Since they are different users, they won't be reading/writing\n" "the same ~/.xscreensaver file, so %s isn't\n" "going to work right.\n" "\n" "Either re-run %s as \"%s\", or re-run\n" "xscreensaver as \"%s\" (which you can do by\n" "selecting `Restart Daemon' from the File menu.)\n", progname, luser, lhost, d, (ruser ? ruser : "???"), (rhost ? rhost : "???"), progname, progname, (ruser ? ruser : "???"), luser); } else if (rhost && *rhost && !!strcmp (rhost, lhost)) { /* Warn that the two processes are running on different hosts. */ sprintf (msg, "Warning:\n\n" "%s is running as user \"%s\" on host \"%s\".\n" "But the xscreensaver managing display \"%s\"\n" "is running as user \"%s\" on host \"%s\".\n" "\n" "If those two machines don't share a file system (that is,\n" "if they don't see the same ~%s/.xscreensaver file) then\n" "%s won't work right.\n" "\n" "You can restart the daemon on \"%s\" as \"%s\" by\n" "selecting `Restart Daemon' from the File menu.)", progname, luser, lhost, d, (ruser ? ruser : "???"), (rhost ? rhost : "???"), luser, progname, lhost, luser); } else if (!!strcmp (rversion, short_version)) { /* Warn that the version numbers don't match. */ sprintf (msg, "Warning:\n\n" "This is %s version %s.\n" "But the xscreensaver managing display \"%s\"\n" "is version %s. This could cause problems.", progname, short_version, d, rversion); } if (*msg) warning_dialog (parent, msg, 1); free (msg); } /* We use this error handler so that X errors are preceeded by the name of the program that generated them. */ static int demo_ehandler (Display *dpy, XErrorEvent *error) { fprintf (stderr, "\nX error in %s:\n", progname); XmuPrintDefaultErrorMessage (dpy, error, stderr); exit (-1); 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 *defaults[] = { #include "XScreenSaver_ad.h" #include "XScreenSaver_Xm_ad.h" 0 }; int main (int argc, char **argv) { XtAppContext app; prefs_pair Pair, *pair; saver_preferences P, P2, *p, *p2; Bool prefs = False; int i; Display *dpy; Widget toplevel_shell, dialog; char *real_progname = argv[0]; char *s; s = strrchr (real_progname, '/'); if (s) real_progname = s+1; p = &P; p2 = &P2; pair = &Pair; pair->a = p; pair->b = p2; memset (p, 0, sizeof (*p)); memset (p2, 0, sizeof (*p2)); global_prefs_pair = pair; progname = real_progname; /* We must read exactly the same resources as xscreensaver. That means we must have both the same progclass *and* progname, at least as far as the resource database is concerned. So, put "xscreensaver" in argv[0] while initializing Xt. */ argv[0] = "xscreensaver"; progname = argv[0]; toplevel_shell = XtAppInitialize (&app, progclass, 0, 0, &argc, argv, defaults, 0, 0); dpy = XtDisplay (toplevel_shell); db = XtDatabase (dpy); XtGetApplicationNameAndClass (dpy, &progname, &progclass); XSetErrorHandler (demo_ehandler); /* Complain about unrecognized command-line arguments. */ for (i = 1; i < argc; i++) { char *s = argv[i]; if (s[0] == '-' && s[1] == '-') s++; if (!strcmp (s, "-prefs")) prefs = True; else { fprintf (stderr, "usage: %s [ -display dpy-string ] [ -prefs ]\n", real_progname); exit (1); } } short_version = (char *) malloc (5); memcpy (short_version, screensaver_id + 17, 4); short_version [4] = 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 important that `progname' be "xscreensaver", rather than whatever was in argv[0]. */ p->db = db; load_init_file (dpy, p); *p2 = *p; /* Now that Xt has been initialized, and the resources have been read, we can set our `progname' variable to something more in line with reality. */ progname = real_progname; #if 0 { XrmName name = { 0 }; XrmClass class = { 0 }; int count = 0; XrmEnumerateDatabase (db, &name, &class, XrmEnumAllLevels, mapper, (POINTER) &count); } #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_BLANK = XInternAtom (dpy, "BLANK", False); XA_LOCK = XInternAtom (dpy, "LOCK", False); XA_EXIT = XInternAtom (dpy, "EXIT", False); XA_RESTART = XInternAtom (dpy, "RESTART", False); /* Create the window and all its widgets. */ dialog = create_xscreensaver_demo (toplevel_shell); /* Set the window's title. */ { char title[255]; char *v = (char *) strdup(strchr(screensaver_id, ' ')); char *s1, *s2, *s3, *s4; s1 = (char *) strchr(v, ' '); s1++; s2 = (char *) strchr(s1, ' '); s3 = (char *) strchr(v, '('); s3++; s4 = (char *) strchr(s3, ')'); *s2 = 0; *s4 = 0; sprintf (title, "%.50s %.50s, %.50s", progclass, s1, s3); XtVaSetValues (toplevel_shell, XtNtitle, title, NULL); free (v); } sanity_check_resources (toplevel_shell); add_callbacks (toplevel_shell, pair); populate_hack_list (toplevel_shell, pair); populate_prefs_page (toplevel_shell, pair); sensitize_demo_widgets (toplevel_shell, False); scroll_to_current_hack (toplevel_shell, pair); XtManageChild (dialog); XtRealizeWidget(toplevel_shell); /* The next few calls must come after XtRealizeWidget(). */ pixmapify_buttons (toplevel_shell); hack_button_sizes (toplevel_shell); ensure_selected_item_visible (name_to_widget (toplevel_shell, "list")); XSync (dpy, False); XtVaSetValues (toplevel_shell, XmNallowShellResize, False, NULL); /* Handle the -prefs command-line argument. */ if (prefs) { Widget tabber = name_to_widget (toplevel_shell, "folder"); Widget this_tab = name_to_widget (toplevel_shell, "optionsTab"); Widget this_page = name_to_widget (toplevel_shell, "preferencesForm"); Widget *kids = 0; Cardinal nkids = 0; if (!tabber) abort(); XtVaGetValues (tabber, XmNnumChildren, &nkids, XmNchildren, &kids, NULL); if (!kids) abort(); if (nkids > 0) XtUnmanageChildren (kids, nkids); XtManageChild (this_page); XmProcessTraversal (this_tab, XmTRAVERSE_CURRENT); } /* Issue any warnings about the running xscreensaver daemon. */ the_network_is_not_the_computer (toplevel_shell); XtAppMainLoop (app); exit (0); } #endif /* HAVE_MOTIF -- whole file */ xscreensaver-5.42+dfsg1/driver/dpms.c000066400000000000000000000230341342162430400175570ustar00rootroot00000000000000/* dpms.c --- syncing the X Display Power Management values * xscreensaver, Copyright (c) 2001-2017 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. */ /* 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 #ifdef HAVE_DPMS_EXTENSION /* almost the whole file */ # include # include /*# include */ /* 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* #include "xscreensaver.h" #ifdef HAVE_DPMS_EXTENSION static Bool error_handler_hit_p = False; static int ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error) { error_handler_hit_p = True; return 0; } 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) { int event = 0, error = 0; BOOL o_enabled = False; CARD16 o_power = 0; CARD16 o_standby = 0, o_suspend = 0, o_off = 0; Bool bogus_p = False; if (dpms_quickoff_p && !off_secs) { /* 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" */ enabled_p = False; else if ((standby_secs != 0 && standby_secs < 10) || (suspend_secs != 0 && suspend_secs < 10) || (off_secs != 0 && off_secs < 10)) /* any negative, or any positive-and-less-than-10-seconds, is crazy. */ bogus_p = True; if (bogus_p) enabled_p = False; /* X protocol sends these values in a CARD16, so truncate them to 16 bits. This means that the maximum timeout is 18:12:15. */ if (standby_secs > 0xFFFF) standby_secs = 0xFFFF; if (suspend_secs > 0xFFFF) suspend_secs = 0xFFFF; if (off_secs > 0xFFFF) off_secs = 0xFFFF; if (! DPMSQueryExtension (dpy, &event, &error)) { if (verbose_p) fprintf (stderr, "%s: XDPMS extension not supported.\n", blurb()); return; } if (! DPMSCapable (dpy)) { if (verbose_p) fprintf (stderr, "%s: DPMS not supported.\n", blurb()); return; } if (! DPMSInfo (dpy, &o_power, &o_enabled)) { if (verbose_p) fprintf (stderr, "%s: unable to get DPMS state.\n", blurb()); return; } if (o_enabled != enabled_p) { if (! (enabled_p ? DPMSEnable (dpy) : DPMSDisable (dpy))) { if (verbose_p) fprintf (stderr, "%s: unable to set DPMS state.\n", blurb()); return; } else if (verbose_p) 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", blurb(), standby_secs, suspend_secs, off_secs); return; } if (!DPMSGetTimeouts (dpy, &o_standby, &o_suspend, &o_off)) { if (verbose_p) fprintf (stderr, "%s: unable to get DPMS timeouts.\n", blurb()); return; } if (o_standby != standby_secs || o_suspend != suspend_secs || o_off != off_secs) { if (!DPMSSetTimeouts (dpy, standby_secs, suspend_secs, off_secs)) { if (verbose_p) 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(), standby_secs, suspend_secs, off_secs); } } Bool monitor_powered_on_p (saver_info *si) { Bool result; int event_number, error_number; BOOL onoff = False; CARD16 state; if (!DPMSQueryExtension(si->dpy, &event_number, &error_number)) /* Server doesn't know -- assume the monitor is on. */ result = True; else if (!DPMSCapable(si->dpy)) /* Server says the monitor doesn't do power management -- so it's on. */ result = True; else { DPMSInfo(si->dpy, &state, &onoff); if (!onoff) /* Server says DPMS is disabled -- so the monitor is on. */ result = True; else switch (state) { case DPMSModeOn: result = True; break; /* really on */ case DPMSModeStandby: result = False; break; /* kinda off */ case DPMSModeSuspend: result = False; break; /* pretty off */ case DPMSModeOff: result = False; break; /* really off */ default: result = True; break; /* protocol error? */ } } return result; } void monitor_power_on (saver_info *si, Bool on_p) { if ((!!on_p) != monitor_powered_on_p (si)) { XErrorHandler old_handler; int event_number, error_number; if (!DPMSQueryExtension(si->dpy, &event_number, &error_number) || !DPMSCapable(si->dpy)) { if (si->prefs.verbose_p) fprintf (stderr, "%s: unable to power %s monitor: no DPMS extension.\n", blurb(), (on_p ? "on" : "off")); return; } /* The manual for DPMSForceLevel() says that it throws BadMatch if "DPMS is disabled on the specified display." The manual for DPMSCapable() says that it "returns True if the X server is capable of DPMS." Apparently they consider "capable of DPMS" and "DPMS is enabled" to be different things, and so even if DPMSCapable() returns True, DPMSForceLevel() *might* throw an X Error. Isn't that just fucking special. */ XSync (si->dpy, False); error_handler_hit_p = False; old_handler = XSetErrorHandler (ignore_all_errors_ehandler); XSync (si->dpy, False); DPMSForceLevel(si->dpy, (on_p ? DPMSModeOn : DPMSModeOff)); XSync (si->dpy, False); XSetErrorHandler (old_handler); /* Ignore error_handler_hit_p, just probe monitor instead */ if ((!!on_p) != monitor_powered_on_p (si)) /* double-check */ fprintf (stderr, "%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 */ xscreensaver-5.42+dfsg1/driver/exec.c000066400000000000000000000170131342162430400175400ustar00rootroot00000000000000/* exec.c --- executes a program in *this* pid, without an intervening process. * xscreensaver, Copyright (c) 1991-2013 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. */ /* I don't believe what a sorry excuse for an operating system UNIX is! - I want to spawn a process. - I want to know it's pid so that I can kill it. - I would like to receive a message when it dies of natural causes. - I want the spawned process to have user-specified arguments. If shell metacharacters are present (wildcards, backquotes, etc), the only way to parse those arguments is to run a shell to do the parsing for you. And the only way to know the pid of the process is to fork() and exec() it in the spawned side of the fork. But if you're running a shell to parse your arguments, this gives you the pid of the *shell*, not the pid of the *process* that you're actually interested in, which is an *inferior* of the shell. This also means that the SIGCHLD you get applies to the shell, not its inferior. (Why isn't that sufficient? I don't remember any more, but it turns out that it isn't.) So, the only solution, when metacharacters are present, is to force the shell to exec() its inferior. What a fucking hack! We prepend "exec " to the command string, and hope it doesn't contain unquoted semicolons or ampersands (we don't search for them, because we don't want to prohibit their use in quoted strings (messages, for example) and parsing out the various quote characters is too much of a pain.) (Actually, Clint Wong points out that process groups might be used to take care of this problem; this may be worth considering some day, except that, 1: this code works now, so why fix it, and 2: from what I've seen in Emacs, dealing with process groups isn't especially portable.) */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #ifdef HAVE_UNISTD_H # include #endif #include #include #include #include #ifndef ESRCH # include #endif #if defined(HAVE_SETPRIORITY) && defined(PRIO_PROCESS) # include /* for setpriority() and PRIO_PROCESS */ /* 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); static void nice_process (int nice_level); #ifndef VMS static void exec_simple_command (const char *command) { char *av[1024]; int ac = 0; char *token = strtok (strdup(command), " \t"); while (token) { av[ac++] = token; token = strtok(0, " \t"); } av[ac] = 0; execvp (av[0], av); /* shouldn't return. */ } static void exec_complex_command (const char *shell, const char *command) { char *av[5]; int ac = 0; char *command2 = (char *) malloc (strlen (command) + 10); const char *s; int got_eq = 0; const char *after_vars; /* Skip leading whitespace. */ while (*command == ' ' || *command == '\t') command++; /* If the string has a series of tokens with "=" in them at them, set `after_vars' to point into the string after those tokens and any trailing whitespace. Otherwise, after_vars == command. */ after_vars = command; for (s = command; *s; s++) { if (*s == '=') got_eq = 1; else if (*s == ' ') { if (got_eq) { while (*s == ' ' || *s == '\t') s++; after_vars = s; got_eq = 0; } else break; } } *command2 = 0; strncat (command2, command, after_vars - command); strcat (command2, "exec "); strcat (command2, after_vars); /* We have now done these transformations: "foo -x -y" ==> "exec foo -x -y" "BLAT=foop foo -x" ==> "BLAT=foop exec foo -x" "BLAT=foop A=b foo -x" ==> "BLAT=foop A=b exec foo -x" */ /* Invoke the shell as "/bin/sh -c 'exec prog -arg -arg ...'" */ av [ac++] = (char *) shell; av [ac++] = "-c"; av [ac++] = command2; av [ac] = 0; 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, "*?$&!<>[];`'\\\"="); /* note: = is in the above because of the sh syntax "FOO=bar cmd". */ if (getuid() == (uid_t) 0 || geteuid() == (uid_t) 0) { /* If you're thinking of commenting this out, think again. If you do so, you will open a security hole. Mail jwz so that he may enlighten you as to the error of your ways. */ fprintf (stderr, "%s: we're still running as root! Disaster!\n", blurb()); exit (-1); } if (hairy_p) /* If it contains any shell metacharacters, do it the hard way, and fork a shell to parse the arguments for us. */ exec_complex_command (shell, command); else /* Otherwise, we can just exec the program directly. */ exec_simple_command (command); #else /* VMS */ exec_vms_command (command); #endif /* VMS */ } /* Setting process priority */ static void nice_process (int nice_level) { if (nice_level == 0) return; #if defined(HAVE_NICE) { int old_nice = nice (0); int n = nice_level - old_nice; errno = 0; if (nice (n) == -1 && errno != 0) { char buf [512]; sprintf (buf, "%s: nice(%d) failed", blurb(), n); perror (buf); } } #elif defined(HAVE_SETPRIORITY) && defined(PRIO_PROCESS) if (setpriority (PRIO_PROCESS, getpid(), nice_level) != 0) { char buf [512]; sprintf (buf, "%s: setpriority(PRIO_PROCESS, %lu, %d) failed", blurb(), (unsigned long) getpid(), nice_level); perror (buf); } #else fprintf (stderr, "%s: don't know how to change process priority on this system.\n", blurb()); #endif } /* Whether the given command exists on $PATH. (Anything before the first space is considered to be the program name.) */ int on_path_p (const char *program) { int result = 0; struct stat st; char *cmd = strdup (program); char *token = strchr (cmd, ' '); char *path = 0; int L; if (token) *token = 0; token = 0; if (strchr (cmd, '/')) { result = (0 == stat (cmd, &st)); goto DONE; } path = getenv("PATH"); if (!path || !*path) goto DONE; L = strlen (cmd); path = strdup (path); token = strtok (path, ":"); while (token) { char *p2 = (char *) malloc (strlen (token) + L + 3); strcpy (p2, token); strcat (p2, "/"); strcat (p2, cmd); result = (0 == stat (p2, &st)); free (p2); if (result) goto DONE; token = strtok (0, ":"); } DONE: free (cmd); if (path) free (path); return result; } xscreensaver-5.42+dfsg1/driver/exec.h000066400000000000000000000015611342162430400175460ustar00rootroot00000000000000/* exec.c --- executes a program in *this* pid, without an intervening process. * xscreensaver, Copyright (c) 1991-2006 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_EXEC_H__ #define __XSCREENSAVER_EXEC_H__ extern void exec_command (const char *shell, const char *command, int nice_level); extern int on_path_p (const char *program); #endif /* __XSCREENSAVER_EXEC_H__ */ xscreensaver-5.42+dfsg1/driver/link_axp.com000066400000000000000000000012641342162430400207560ustar00rootroot00000000000000$! We fisrt test the version of DECW/Motif ; if 1.2 we need to link with new $! X11R5 libraries $@sys$update:decw$get_image_version sys$share:decw$xlibshr.exe decw$version $ if f$extract(4,3,decw$version).eqs."1.2" $ then $! DECW/Motif 1.2 : link with X11R5 libraries $ link xscreensaver-command,vms_axp_12.opt/opt $ link xscreensaver,demo,dialogs-xm,lock,passwd,stderr,subprocs,timers, - windows,xset,vms-getpwnam,vms-hpwd,vms-validate,vms_axp_12.opt/opt $ else $! Else, link with X11R4 libraries $ link xscreensaver-command,vms_axp.opt/opt $ link xscreensaver,demo,dialogs-xm,lock,passwd,stderr,subprocs,timers, - windows,xset,vms-getpwnam,vms-hpwd,vms-validate,vms_axp.opt/opt $ endif xscreensaver-5.42+dfsg1/driver/link_decc.com000066400000000000000000000012701342162430400210610ustar00rootroot00000000000000$! We fisrt test the version of DECW/Motif ; if 1.2 we need to link with new $! X11R5 libraries $@sys$update:decw$get_image_version sys$share:decw$xlibshr.exe decw$version $ if f$extract(4,3,decw$version).eqs."1.2" $ then $! DECW/Motif 1.2 : link with X11R5 libraries $ link xscreensaver-command,vms_decc_12.opt/opt $ link xscreensaver,demo,dialogs-xm,lock,passwd,stderr,subprocs,timers, - windows,xset,vms-getpwnam,vms-hpwd,vms-validate,vms_decc_12.opt/opt $ else $! Else, link with X11R4 libraries $ link xscreensaver-command,vms_decc.opt/opt $ link xscreensaver,demo,dialogs-xm,lock,passwd,stderr,subprocs,timers, - windows,xset,vms-getpwnam,vms-hpwd,vms-validate,vms_decc.opt/opt $ endif xscreensaver-5.42+dfsg1/driver/lock.c000066400000000000000000002036621342162430400175530ustar00rootroot00000000000000/* lock.c --- handling the password dialog for locking-mode. * xscreensaver, Copyright (c) 1993-2018 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. */ /* Athena locking code contributed by Jon A. Christopher */ /* Copyright 1997, with the same permissions as above. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include /* for time() */ #include #include #include "xscreensaver.h" #include "resources.h" #include "mlstring.h" #include "auth.h" #ifndef NO_LOCKING /* (mostly) whole file */ #ifdef HAVE_XHPDISABLERESET # include static void hp_lock_reset (saver_info *si, Bool lock_p); #endif /* HAVE_XHPDISABLERESET */ #ifdef HAVE_XF86VMODE # include static void xfree_lock_mode_switch (saver_info *si, Bool lock_p); #endif /* HAVE_XF86VMODE */ #ifdef HAVE_XF86MISCSETGRABKEYSSTATE # include static void xfree_lock_grab_smasher (saver_info *si, Bool lock_p); #endif /* HAVE_XF86MISCSETGRABKEYSSTATE */ #ifdef HAVE_RANDR # include #endif /* HAVE_RANDR */ #ifdef _VROOT_H_ ERROR! You must not include vroot.h in this file. #endif #ifdef HAVE_UNAME # include /* for hostname info */ #endif /* HAVE_UNAME */ #include #ifndef VMS # include #else /* VMS */ extern char *getenv(const char *name); extern int validate_user(char *name, char *password); static Bool vms_passwd_valid_p(char *pw, Bool verbose_p) { return (validate_user (getenv("USER"), typed_passwd) == 1); } # undef passwd_valid_p # define passwd_valid_p vms_passwd_valid_p #endif /* VMS */ #define SAMPLE_INPUT "MMMMMMMMMMMM" #undef MAX #define MAX(a,b) ((a)>(b)?(a):(b)) typedef struct info_dialog_data info_dialog_data; #define MAX_BYTES_PER_CHAR 8 /* UTF-8 uses no more than 3, I think */ #define MAX_PASSWD_CHARS 128 /* Longest possible passphrase */ struct passwd_dialog_data { saver_screen_info *prompt_screen; int previous_mouse_x, previous_mouse_y; /* "Characters" in the password may be a variable number of bytes long. typed_passwd contains the raw bytes. typed_passwd_char_size indicates the size in bytes of each character, so that we can make backspace work. */ char typed_passwd [MAX_PASSWD_CHARS * MAX_BYTES_PER_CHAR]; char typed_passwd_char_size [MAX_PASSWD_CHARS]; XtIntervalId timer; int i_beam; float ratio; Position x, y; Dimension width; Dimension height; Dimension border_width; Bool echo_input; Bool show_stars_p; /* "I regret that I have but one asterisk for my country." -- Nathan Hale, 1776. */ char *heading_label; char *body_label; char *user_label; mlstring *info_label; /* The entry field shall only be displayed if prompt_label is not NULL */ mlstring *prompt_label; char *date_label; char *passwd_string; Bool passwd_changed_p; /* Whether the user entry field needs redrawing */ Bool caps_p; /* Whether we saw a keypress with caps-lock on */ char *unlock_label; char *login_label; char *uname_label; Bool show_uname_p; XFontStruct *heading_font; XFontStruct *body_font; XFontStruct *label_font; XFontStruct *passwd_font; XFontStruct *date_font; XFontStruct *button_font; XFontStruct *uname_font; Pixel foreground; Pixel background; Pixel border; Pixel passwd_foreground; Pixel passwd_background; Pixel thermo_foreground; Pixel thermo_background; Pixel shadow_top; Pixel shadow_bottom; Pixel button_foreground; Pixel button_background; Dimension preferred_logo_width, logo_width; Dimension preferred_logo_height, logo_height; Dimension thermo_width; Dimension internal_border; Dimension shadow_width; Dimension passwd_field_x, passwd_field_y; Dimension passwd_field_width, passwd_field_height; Dimension unlock_button_x, unlock_button_y; Dimension unlock_button_width, unlock_button_height; Dimension login_button_x, login_button_y; Dimension login_button_width, login_button_height; Dimension thermo_field_x, thermo_field_y; Dimension thermo_field_height; Pixmap logo_pixmap; Pixmap logo_clipmask; int logo_npixels; unsigned long *logo_pixels; Cursor passwd_cursor; Bool unlock_button_down_p; Bool login_button_down_p; Bool login_button_p; Bool login_button_enabled_p; Bool button_state_changed_p; /* Refers to both buttons */ Pixmap save_under; Pixmap user_entry_pixmap; }; static void draw_passwd_window (saver_info *si); static void update_passwd_window (saver_info *si, const char *printed_passwd, float ratio); static void destroy_passwd_window (saver_info *si); static void undo_vp_motion (saver_info *si); static void finished_typing_passwd (saver_info *si, passwd_dialog_data *pw); static void cleanup_passwd_window (saver_info *si); static void restore_background (saver_info *si); extern void xss_authenticate(saver_info *si, Bool verbose_p); static int new_passwd_window (saver_info *si) { passwd_dialog_data *pw; Screen *screen; Colormap cmap; saver_screen_info *ssi = &si->screens [mouse_screen (si)]; pw = (passwd_dialog_data *) calloc (1, sizeof(*pw)); if (!pw) return -1; /* Display the button only if the "newLoginCommand" pref is non-null. */ pw->login_button_p = (si->prefs.new_login_command && *si->prefs.new_login_command); pw->passwd_cursor = XCreateFontCursor (si->dpy, XC_top_left_arrow); pw->prompt_screen = ssi; screen = pw->prompt_screen->screen; cmap = DefaultColormapOfScreen (screen); pw->show_stars_p = get_boolean_resource(si->dpy, "passwd.asterisks", "Boolean"); pw->heading_label = get_string_resource (si->dpy, "passwd.heading.label", "Dialog.Label.Label"); pw->body_label = get_string_resource (si->dpy, "passwd.body.label", "Dialog.Label.Label"); pw->user_label = get_string_resource (si->dpy, "passwd.user.label", "Dialog.Label.Label"); pw->unlock_label = get_string_resource (si->dpy, "passwd.unlock.label", "Dialog.Button.Label"); pw->login_label = get_string_resource (si->dpy, "passwd.login.label", "Dialog.Button.Label"); pw->date_label = get_string_resource (si->dpy, "dateFormat", "DateFormat"); if (!pw->heading_label) pw->heading_label = strdup("ERROR: RESOURCES NOT INSTALLED CORRECTLY"); if (!pw->body_label) pw->body_label = strdup("ERROR: RESOURCES NOT INSTALLED CORRECTLY"); if (!pw->user_label) pw->user_label = strdup("ERROR"); if (!pw->date_label) pw->date_label = strdup("ERROR"); if (!pw->unlock_label) pw->unlock_label = strdup("ERROR (UNLOCK)"); if (!pw->login_label) pw->login_label = strdup ("ERROR (LOGIN)") ; /* Put the version number in the label. */ { char *s = (char *) malloc (strlen(pw->heading_label) + 20); sprintf(s, pw->heading_label, si->version); free (pw->heading_label); pw->heading_label = s; } /* Get hostname info */ pw->uname_label = strdup(""); /* Initialy, write nothing */ # ifdef HAVE_UNAME { struct utsname uts; if (uname (&uts) == 0) { #if 0 /* Get the full hostname */ { char *s; if ((s = strchr(uts.nodename, '.'))) *s = 0; } #endif char *s = strdup (uts.nodename); free (pw->uname_label); pw->uname_label = s; } } # endif pw->passwd_string = strdup(""); pw->heading_font = splash_load_font (si->dpy, "passwd.headingFont", "Dialog.Font"); pw->button_font = splash_load_font (si->dpy, "passwd.buttonFont", "Dialog.Font"); pw->body_font = splash_load_font (si->dpy, "passwd.bodyFont", "Dialog.Font"); pw->label_font = splash_load_font (si->dpy, "passwd.labelFont", "Dialog.Font"); pw->passwd_font = splash_load_font (si->dpy, "passwd.passwdFont", "Dialog.Font"); pw->date_font = splash_load_font (si->dpy, "passwd.dateFont", "Dialog.Font"); pw->uname_font = splash_load_font (si->dpy, "passwd.unameFont", "Dialog.Font"); pw->show_uname_p = get_boolean_resource(si->dpy, "passwd.uname", "Boolean"); pw->foreground = get_pixel_resource (si->dpy, cmap, "passwd.foreground", "Dialog.Foreground" ); pw->background = get_pixel_resource (si->dpy, cmap, "passwd.background", "Dialog.Background" ); pw->border = get_pixel_resource (si->dpy, cmap, "passwd.borderColor", "Dialog.borderColor"); if (pw->foreground == pw->background) { /* Make sure the error messages show up. */ pw->foreground = BlackPixelOfScreen (screen); pw->background = WhitePixelOfScreen (screen); } pw->passwd_foreground = get_pixel_resource (si->dpy, cmap, "passwd.text.foreground", "Dialog.Text.Foreground" ); pw->passwd_background = get_pixel_resource (si->dpy, cmap, "passwd.text.background", "Dialog.Text.Background" ); pw->button_foreground = get_pixel_resource (si->dpy, cmap, "splash.Button.foreground", "Dialog.Button.Foreground" ); pw->button_background = get_pixel_resource (si->dpy, cmap, "splash.Button.background", "Dialog.Button.Background" ); pw->thermo_foreground = get_pixel_resource (si->dpy, cmap, "passwd.thermometer.foreground", "Dialog.Thermometer.Foreground"); pw->thermo_background = get_pixel_resource ( si->dpy, cmap, "passwd.thermometer.background", "Dialog.Thermometer.Background"); pw->shadow_top = get_pixel_resource ( si->dpy, cmap, "passwd.topShadowColor", "Dialog.Foreground" ); pw->shadow_bottom = get_pixel_resource (si->dpy, cmap, "passwd.bottomShadowColor", "Dialog.Background" ); pw->preferred_logo_width = get_integer_resource (si->dpy, "passwd.logo.width", "Dialog.Logo.Width"); pw->preferred_logo_height = get_integer_resource (si->dpy, "passwd.logo.height", "Dialog.Logo.Height"); pw->thermo_width = get_integer_resource (si->dpy, "passwd.thermometer.width", "Dialog.Thermometer.Width"); pw->internal_border = get_integer_resource (si->dpy, "passwd.internalBorderWidth", "Dialog.InternalBorderWidth"); pw->shadow_width = get_integer_resource (si->dpy, "passwd.shadowThickness", "Dialog.ShadowThickness"); if (pw->preferred_logo_width == 0) pw->preferred_logo_width = 150; if (pw->preferred_logo_height == 0) pw->preferred_logo_height = 150; if (pw->internal_border == 0) pw->internal_border = 15; if (pw->shadow_width == 0) pw->shadow_width = 4; if (pw->thermo_width == 0) pw->thermo_width = pw->shadow_width; /* We need to remember the mouse position and restore it afterward, or sometimes (perhaps only with Xinerama?) the mouse gets warped to inside the bounds of the lock dialog window. */ { Window pointer_root, pointer_child; int root_x, root_y, win_x, win_y; unsigned int mask; pw->previous_mouse_x = 0; pw->previous_mouse_y = 0; if (XQueryPointer (si->dpy, RootWindowOfScreen (pw->prompt_screen->screen), &pointer_root, &pointer_child, &root_x, &root_y, &win_x, &win_y, &mask)) { pw->previous_mouse_x = root_x; pw->previous_mouse_y = root_y; if (si->prefs.verbose_p) fprintf (stderr, "%s: %d: mouse is at %d,%d.\n", blurb(), pw->prompt_screen->number, pw->previous_mouse_x, pw->previous_mouse_y); } else if (si->prefs.verbose_p) fprintf (stderr, "%s: %d: unable to determine mouse position?\n", blurb(), pw->prompt_screen->number); } /* Before mapping the window, save a pixmap of the current screen. When we lower the window, we restore these bits. This works, because the running screenhack has already been sent SIGSTOP, so we know nothing else is drawing right now! */ { XGCValues gcv; GC gc; pw->save_under = XCreatePixmap (si->dpy, pw->prompt_screen->screensaver_window, pw->prompt_screen->width, pw->prompt_screen->height, pw->prompt_screen->current_depth); gcv.function = GXcopy; gc = XCreateGC (si->dpy, pw->save_under, GCFunction, &gcv); XCopyArea (si->dpy, pw->prompt_screen->screensaver_window, pw->save_under, gc, 0, 0, pw->prompt_screen->width, pw->prompt_screen->height, 0, 0); XFreeGC (si->dpy, gc); } si->pw_data = pw; return 0; } Bool debug_passwd_window_p = False; /* used only by test-passwd.c */ /** * info_msg and prompt may be NULL. */ static int make_passwd_window (saver_info *si, const char *info_msg, const char *prompt, Bool echo) { XSetWindowAttributes attrs; unsigned long attrmask = 0; passwd_dialog_data *pw; Screen *screen; Colormap cmap; Dimension max_string_width_px; saver_screen_info *ssi = &si->screens [mouse_screen (si)]; cleanup_passwd_window (si); if (! ssi) /* WTF? Trying to prompt while no screens connected? */ return -1; if (!si->pw_data) if (new_passwd_window (si) < 0) return -1; if (!(pw = si->pw_data)) return -1; pw->ratio = 1.0; pw->prompt_screen = ssi; if (si->prefs.verbose_p) fprintf (stderr, "%s: %d: creating password dialog (\"%s\")\n", blurb(), pw->prompt_screen->number, info_msg ? info_msg : ""); screen = pw->prompt_screen->screen; cmap = DefaultColormapOfScreen (screen); pw->echo_input = echo; max_string_width_px = ssi->width - pw->shadow_width * 4 - pw->border_width * 2 - pw->thermo_width - pw->preferred_logo_width - pw->internal_border * 2; /* As the string wraps it makes the window taller which makes the logo wider * which leaves less room for the text which makes the string wrap. Uh-oh, a * loop. By wrapping at a bit less than the available width, there's some * room for the dialog to grow without going off the edge of the screen. */ max_string_width_px *= 0.75; if (!info_msg && senesculent_p()) info_msg = ("\n" "This version of XScreenSaver\n" "is very old! Please upgrade!\n"); pw->info_label = mlstring_new(info_msg ? info_msg : pw->body_label, pw->label_font, max_string_width_px); { int direction, ascent, descent; XCharStruct overall; pw->width = 0; pw->height = 0; /* Measure the heading_label. */ XTextExtents (pw->heading_font, pw->heading_label, strlen(pw->heading_label), &direction, &ascent, &descent, &overall); if (overall.width > pw->width) pw->width = overall.width; pw->height += ascent + descent; /* Measure the uname_label. */ if ((strlen(pw->uname_label)) && pw->show_uname_p) { XTextExtents (pw->uname_font, pw->uname_label, strlen(pw->uname_label), &direction, &ascent, &descent, &overall); if (overall.width > pw->width) pw->width = overall.width; pw->height += ascent + descent; } { Dimension w2 = 0, w3 = 0, button_w = 0; Dimension h2 = 0, h3 = 0, button_h = 0; const char *passwd_string = SAMPLE_INPUT; /* Measure the user_label. */ XTextExtents (pw->label_font, pw->user_label, strlen(pw->user_label), &direction, &ascent, &descent, &overall); if (overall.width > w2) w2 = overall.width; h2 += ascent + descent; /* Measure the info_label. */ if (pw->info_label->overall_width > pw->width) pw->width = pw->info_label->overall_width; h2 += pw->info_label->overall_height; /* Measure the user string. */ XTextExtents (pw->passwd_font, si->user, strlen(si->user), &direction, &ascent, &descent, &overall); overall.width += (pw->shadow_width * 4); ascent += (pw->shadow_width * 4); if (overall.width > w3) w3 = overall.width; h3 += ascent + descent; /* Measure the (dummy) passwd_string. */ if (prompt) { XTextExtents (pw->passwd_font, passwd_string, strlen(passwd_string), &direction, &ascent, &descent, &overall); overall.width += (pw->shadow_width * 4); ascent += (pw->shadow_width * 4); if (overall.width > w3) w3 = overall.width; h3 += ascent + descent; /* Measure the prompt_label. */ max_string_width_px -= w3; pw->prompt_label = mlstring_new (prompt, pw->label_font, max_string_width_px); if (pw->prompt_label->overall_width > w2) w2 = pw->prompt_label->overall_width; h2 += pw->prompt_label->overall_height; w2 = w2 + w3 + (pw->shadow_width * 2); h2 = MAX (h2, h3); } /* The "Unlock" button. */ XTextExtents (pw->label_font, pw->unlock_label, strlen(pw->unlock_label), &direction, &ascent, &descent, &overall); button_w = overall.width; button_h = ascent + descent; /* Add some horizontal padding inside the button. */ button_w += ascent; button_w += ((ascent + descent) / 2) + (pw->shadow_width * 2); button_h += ((ascent + descent) / 2) + (pw->shadow_width * 2); pw->unlock_button_width = button_w; pw->unlock_button_height = button_h; w2 = MAX (w2, button_w); h2 += button_h * 1.5; /* The "New Login" button */ pw->login_button_width = 0; pw->login_button_height = 0; if (pw->login_button_p) { pw->login_button_enabled_p = True; /* Measure the "New Login" button */ XTextExtents (pw->button_font, pw->login_label, strlen (pw->login_label), &direction, &ascent, &descent, &overall); button_w = overall.width; button_h = ascent + descent; /* Add some horizontal padding inside the buttons. */ button_w += ascent; button_w += ((ascent + descent) / 2) + (pw->shadow_width * 2); button_h += ((ascent + descent) / 2) + (pw->shadow_width * 2); pw->login_button_width = button_w; pw->login_button_height = button_h; if (button_h > pw->unlock_button_height) h2 += (button_h * 1.5 - pw->unlock_button_height * 1.5); /* Use (2 * shadow_width) spacing between the buttons. Another (2 * shadow_width) is required to account for button shadows. */ w2 = MAX (w2, button_w + pw->unlock_button_width + (pw->shadow_width * 4)); } if (w2 > pw->width) pw->width = w2; pw->height += h2; } pw->width += (pw->internal_border * 2); pw->height += (pw->internal_border * 4); pw->width += pw->thermo_width + (pw->shadow_width * 3); if (pw->preferred_logo_height > pw->height) pw->height = pw->logo_height = pw->preferred_logo_height; else if (pw->height > pw->preferred_logo_height) pw->logo_height = pw->height; pw->logo_width = pw->logo_height; pw->width += pw->logo_width; } attrmask |= CWOverrideRedirect; attrs.override_redirect = True; if (debug_passwd_window_p) attrs.override_redirect = False; /* kludge for test-passwd.c */ attrmask |= CWEventMask; attrs.event_mask = (ExposureMask | KeyPressMask | ButtonPressMask | ButtonReleaseMask); /* Figure out where on the desktop to place the window so that it will actually be visible; this takes into account virtual viewports as well as Xinerama. */ { saver_screen_info *ssi = &si->screens [mouse_screen (si)]; int x = ssi->x; int y = ssi->y; int w = ssi->width; int h = ssi->height; if (si->prefs.debug_p) w /= 2; pw->x = x + ((w + pw->width) / 2) - pw->width; pw->y = y + ((h + pw->height) / 2) - pw->height; if (pw->x < x) pw->x = x; if (pw->y < y) pw->y = y; } pw->border_width = get_integer_resource (si->dpy, "passwd.borderWidth", "Dialog.BorderWidth"); /* Only create the window the first time around */ if (!si->passwd_dialog) { si->passwd_dialog = XCreateWindow (si->dpy, RootWindowOfScreen(screen), pw->x, pw->y, pw->width, pw->height, pw->border_width, DefaultDepthOfScreen (screen), InputOutput, DefaultVisualOfScreen(screen), attrmask, &attrs); XSetWindowBackground (si->dpy, si->passwd_dialog, pw->background); XSetWindowBorder (si->dpy, si->passwd_dialog, pw->border); /* We use the default visual, not ssi->visual, so that the logo pixmap's visual matches that of the si->passwd_dialog window. */ pw->logo_pixmap = xscreensaver_logo (ssi->screen, /* ssi->current_visual, */ DefaultVisualOfScreen(screen), si->passwd_dialog, cmap, pw->background, &pw->logo_pixels, &pw->logo_npixels, &pw->logo_clipmask, True); } else /* On successive prompts, just resize the window */ { XWindowChanges wc; unsigned int mask = CWX | CWY | CWWidth | CWHeight; wc.x = pw->x; wc.y = pw->y; wc.width = pw->width; wc.height = pw->height; XConfigureWindow (si->dpy, si->passwd_dialog, mask, &wc); } restore_background(si); XMapRaised (si->dpy, si->passwd_dialog); XSync (si->dpy, False); move_mouse_grab (si, si->passwd_dialog, pw->passwd_cursor, pw->prompt_screen->number); undo_vp_motion (si); si->pw_data = pw; if (cmap) XInstallColormap (si->dpy, cmap); draw_passwd_window (si); return 0; } static void draw_passwd_window (saver_info *si) { passwd_dialog_data *pw = si->pw_data; XGCValues gcv; GC gc1, gc2; int spacing, height; int x1, x2, x3, y1, y2; int sw; int tb_height; /* Force redraw */ pw->passwd_changed_p = True; pw->button_state_changed_p = True; /* This height is the height of all the elements, not to be confused with * the overall window height which is pw->height. It is used to compute * the amount of spacing (padding) between elements. */ height = (pw->heading_font->ascent + pw->heading_font->descent + pw->info_label->overall_height + MAX (((pw->label_font->ascent + pw->label_font->descent) + (pw->prompt_label ? pw->prompt_label->overall_height : 0)), ((pw->passwd_font->ascent + pw->passwd_font->descent) + (pw->shadow_width * 2)) * (pw->prompt_label ? 2 : 1)) + pw->date_font->ascent + pw->date_font->descent); if ((strlen(pw->uname_label)) && pw->show_uname_p) height += (pw->uname_font->ascent + pw->uname_font->descent); height += ((pw->button_font->ascent + pw->button_font->descent) * 2 + 2 * pw->shadow_width); spacing = ((pw->height - 2 * pw->shadow_width - pw->internal_border - height) / 10); if (spacing < 0) spacing = 0; gcv.foreground = pw->foreground; gc1 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground, &gcv); gc2 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground, &gcv); x1 = pw->logo_width + pw->thermo_width + (pw->shadow_width * 3); x3 = pw->width - (pw->shadow_width * 2); y1 = (pw->shadow_width * 2) + spacing + spacing; /* top heading */ XSetFont (si->dpy, gc1, pw->heading_font->fid); sw = string_width (pw->heading_font, pw->heading_label); x2 = (x1 + ((x3 - x1 - sw) / 2)); y1 += spacing + pw->heading_font->ascent + pw->heading_font->descent; XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1, pw->heading_label, strlen(pw->heading_label)); /* uname below top heading */ if ((strlen(pw->uname_label)) && pw->show_uname_p) { XSetFont (si->dpy, gc1, pw->uname_font->fid); y1 += spacing + pw->uname_font->ascent + pw->uname_font->descent; sw = string_width (pw->uname_font, pw->uname_label); x2 = (x1 + ((x3 - x1 - sw) / 2)); XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1, pw->uname_label, strlen(pw->uname_label)); } /* the info_label (below uname) */ x2 = (x1 + ((x3 - x1 - pw->info_label->overall_width) / 2)); y1 += spacing + pw->info_label->font_height / 2; mlstring_draw(si->dpy, si->passwd_dialog, gc1, pw->info_label, x2, y1); y1 += pw->info_label->overall_height; tb_height = (pw->passwd_font->ascent + pw->passwd_font->descent + (pw->shadow_width * 4)); /* the "User:" prompt */ y2 = y1; XSetForeground (si->dpy, gc1, pw->foreground); XSetFont (si->dpy, gc1, pw->label_font->fid); y1 += (spacing + tb_height + pw->shadow_width); x2 = (x1 + pw->internal_border + MAX(string_width (pw->label_font, pw->user_label), pw->prompt_label ? pw->prompt_label->overall_width : 0)); XDrawString (si->dpy, si->passwd_dialog, gc1, x2 - string_width (pw->label_font, pw->user_label), y1 - pw->passwd_font->descent, pw->user_label, strlen(pw->user_label)); /* the prompt_label prompt */ if (pw->prompt_label) { y1 += tb_height - pw->label_font->ascent + pw->shadow_width; mlstring_draw(si->dpy, si->passwd_dialog, gc1, pw->prompt_label, x2 - pw->prompt_label->overall_width, y1); } /* the "user name" text field */ y1 = y2; XSetForeground (si->dpy, gc1, pw->passwd_foreground); XSetForeground (si->dpy, gc2, pw->passwd_background); XSetFont (si->dpy, gc1, pw->passwd_font->fid); y1 += (spacing + tb_height); x2 += (pw->shadow_width * 4); pw->passwd_field_width = x3 - x2 - pw->internal_border; pw->passwd_field_height = (pw->passwd_font->ascent + pw->passwd_font->descent + pw->shadow_width); XFillRectangle (si->dpy, si->passwd_dialog, gc2, x2 - pw->shadow_width, y1 - (pw->passwd_font->ascent + pw->passwd_font->descent), pw->passwd_field_width, pw->passwd_field_height); XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1 - pw->passwd_font->descent, si->user, strlen(si->user)); /* the password/prompt text field */ if (pw->prompt_label) { y1 += (spacing + pw->prompt_label->overall_height + pw->shadow_width*2); pw->passwd_field_x = x2 - pw->shadow_width; pw->passwd_field_y = y1 - (pw->passwd_font->ascent + pw->passwd_font->descent); } /* The shadow around the text fields */ y1 = y2; y1 += (spacing + (pw->shadow_width * 3)); x1 = x2 - (pw->shadow_width * 2); x2 = pw->passwd_field_width + (pw->shadow_width * 2); y2 = pw->passwd_field_height + (pw->shadow_width * 2); draw_shaded_rectangle (si->dpy, si->passwd_dialog, x1, y1, x2, y2, pw->shadow_width, pw->shadow_bottom, pw->shadow_top); if (pw->prompt_label) { y1 += (spacing + pw->prompt_label->overall_height + pw->shadow_width*2); draw_shaded_rectangle (si->dpy, si->passwd_dialog, x1, y1, x2, y2, pw->shadow_width, pw->shadow_bottom, pw->shadow_top); } /* The date, below the text fields */ { char buf[100]; time_t now = time ((time_t *) 0); struct tm *tm = localtime (&now); memset (buf, 0, sizeof(buf)); strftime (buf, sizeof(buf)-1, pw->date_label, tm); XSetFont (si->dpy, gc1, pw->date_font->fid); y1 += pw->shadow_width; y1 += (spacing + tb_height); y1 += spacing/2; sw = string_width (pw->date_font, buf); x2 = x1 + x2 - sw; XDrawString (si->dpy, si->passwd_dialog, gc1, x2, y1, buf, strlen(buf)); } /* Set up the GCs for the "New Login" and "Unlock" buttons. */ XSetForeground(si->dpy, gc1, pw->button_foreground); XSetForeground(si->dpy, gc2, pw->button_background); XSetFont(si->dpy, gc1, pw->button_font->fid); /* The "Unlock" button */ x2 = pw->width - pw->internal_border - (pw->shadow_width * 2); /* right aligned button */ x1 = x2 - pw->unlock_button_width; /* Add half the difference between y1 and the internal edge. * It actually looks better if the internal border is ignored. */ y1 += ((pw->height - MAX (pw->unlock_button_height, pw->login_button_height) - spacing - y1) / 2); pw->unlock_button_x = x1; pw->unlock_button_y = y1; /* The "New Login" button */ if (pw->login_button_p) { /* Using the same GC as for the Unlock button */ sw = string_width (pw->button_font, pw->login_label); /* left aligned button */ x1 = (pw->logo_width + pw->thermo_width + (pw->shadow_width * 3) + pw->internal_border); pw->login_button_x = x1; pw->login_button_y = y1; } /* The logo */ x1 = pw->shadow_width * 6; y1 = pw->shadow_width * 6; x2 = pw->logo_width - (pw->shadow_width * 12); y2 = pw->logo_height - (pw->shadow_width * 12); if (pw->logo_pixmap) { Window root; int x, y; unsigned int w, h, bw, d; XGetGeometry (si->dpy, pw->logo_pixmap, &root, &x, &y, &w, &h, &bw, &d); XSetForeground (si->dpy, gc1, pw->foreground); XSetBackground (si->dpy, gc1, pw->background); XSetClipMask (si->dpy, gc1, pw->logo_clipmask); XSetClipOrigin (si->dpy, gc1, x1 + ((x2 - (int)w) / 2), y1 + ((y2 - (int)h) / 2)); if (d == 1) XCopyPlane (si->dpy, pw->logo_pixmap, si->passwd_dialog, gc1, 0, 0, w, h, x1 + ((x2 - (int)w) / 2), y1 + ((y2 - (int)h) / 2), 1); else XCopyArea (si->dpy, pw->logo_pixmap, si->passwd_dialog, gc1, 0, 0, w, h, x1 + ((x2 - (int)w) / 2), y1 + ((y2 - (int)h) / 2)); } /* The thermometer */ XSetForeground (si->dpy, gc1, pw->thermo_foreground); XSetForeground (si->dpy, gc2, pw->thermo_background); pw->thermo_field_x = pw->logo_width + pw->shadow_width; pw->thermo_field_y = pw->shadow_width * 5; pw->thermo_field_height = pw->height - (pw->shadow_width * 10); #if 0 /* Solid border inside the logo box. */ XSetForeground (si->dpy, gc1, pw->foreground); XDrawRectangle (si->dpy, si->passwd_dialog, gc1, x1, y1, x2-1, y2-1); #endif /* The shadow around the logo */ draw_shaded_rectangle (si->dpy, si->passwd_dialog, pw->shadow_width * 4, pw->shadow_width * 4, pw->logo_width - (pw->shadow_width * 8), pw->logo_height - (pw->shadow_width * 8), pw->shadow_width, pw->shadow_bottom, pw->shadow_top); /* The shadow around the thermometer */ draw_shaded_rectangle (si->dpy, si->passwd_dialog, pw->logo_width, pw->shadow_width * 4, pw->thermo_width + (pw->shadow_width * 2), pw->height - (pw->shadow_width * 8), pw->shadow_width, pw->shadow_bottom, pw->shadow_top); #if 1 /* Solid border inside the thermometer. */ XSetForeground (si->dpy, gc1, pw->foreground); XDrawRectangle (si->dpy, si->passwd_dialog, gc1, pw->thermo_field_x, pw->thermo_field_y, pw->thermo_width - 1, pw->thermo_field_height - 1); #endif /* The shadow around the whole window */ draw_shaded_rectangle (si->dpy, si->passwd_dialog, 0, 0, pw->width, pw->height, pw->shadow_width, pw->shadow_top, pw->shadow_bottom); XFreeGC (si->dpy, gc1); XFreeGC (si->dpy, gc2); update_passwd_window (si, pw->passwd_string, pw->ratio); } static void draw_button(Display *dpy, Drawable dialog, XFontStruct *font, unsigned long foreground, unsigned long background, char *label, int x, int y, int width, int height, int shadow_width, Pixel shadow_light, Pixel shadow_dark, Bool button_down) { XGCValues gcv; GC gc1, gc2; int sw; int label_x, label_y; gcv.foreground = foreground; gcv.font = font->fid; gc1 = XCreateGC(dpy, dialog, GCForeground|GCFont, &gcv); gcv.foreground = background; gc2 = XCreateGC(dpy, dialog, GCForeground, &gcv); XFillRectangle(dpy, dialog, gc2, x, y, width, height); sw = string_width(font, label); label_x = x + ((width - sw) / 2); label_y = (y + (height - (font->ascent + font->descent)) / 2 + font->ascent); if (button_down) { label_x += 2; label_y += 2; } XDrawString(dpy, dialog, gc1, label_x, label_y, label, strlen(label)); XFreeGC(dpy, gc1); XFreeGC(dpy, gc2); draw_shaded_rectangle(dpy, dialog, x, y, width, height, shadow_width, shadow_light, shadow_dark); } static void update_passwd_window (saver_info *si, const char *printed_passwd, float ratio) { passwd_dialog_data *pw = si->pw_data; XGCValues gcv; GC gc1, gc2; int x, y; XRectangle rects[1]; pw->ratio = ratio; gcv.foreground = pw->passwd_foreground; gcv.font = pw->passwd_font->fid; gc1 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground|GCFont, &gcv); gcv.foreground = pw->passwd_background; gc2 = XCreateGC (si->dpy, si->passwd_dialog, GCForeground, &gcv); if (printed_passwd) { char *s = strdup (printed_passwd); if (pw->passwd_string) free (pw->passwd_string); pw->passwd_string = s; } if (pw->prompt_label) { /* the "password" text field */ rects[0].x = pw->passwd_field_x; rects[0].y = pw->passwd_field_y; rects[0].width = pw->passwd_field_width; rects[0].height = pw->passwd_field_height; /* The user entry (password) field is double buffered. * This avoids flickering, particularly in synchronous mode. */ if (pw->passwd_changed_p) { pw->passwd_changed_p = False; if (pw->user_entry_pixmap) { XFreePixmap(si->dpy, pw->user_entry_pixmap); pw->user_entry_pixmap = 0; } pw->user_entry_pixmap = XCreatePixmap (si->dpy, si->passwd_dialog, rects[0].width, rects[0].height, DefaultDepthOfScreen (pw->prompt_screen->screen)); XFillRectangle (si->dpy, pw->user_entry_pixmap, gc2, 0, 0, rects[0].width, rects[0].height); XDrawString (si->dpy, pw->user_entry_pixmap, gc1, pw->shadow_width, pw->passwd_font->ascent, pw->passwd_string, strlen(pw->passwd_string)); /* Ensure the new pixmap gets copied to the window */ pw->i_beam = 0; } /* The I-beam */ if (pw->i_beam == 0) { /* Make the I-beam disappear */ XCopyArea(si->dpy, pw->user_entry_pixmap, si->passwd_dialog, gc2, 0, 0, rects[0].width, rects[0].height, rects[0].x, rects[0].y); } else if (pw->i_beam == 1) { /* Make the I-beam appear */ x = (rects[0].x + pw->shadow_width + string_width (pw->passwd_font, pw->passwd_string)); y = rects[0].y + pw->shadow_width; if (x > rects[0].x + rects[0].width - 1) x = rects[0].x + rects[0].width - 1; XDrawLine (si->dpy, si->passwd_dialog, gc1, x, y, x, y + pw->passwd_font->ascent + pw->passwd_font->descent-1); } pw->i_beam = (pw->i_beam + 1) % 4; } /* the thermometer */ y = (pw->thermo_field_height - 2) * (1.0 - pw->ratio); if (y > 0) { XFillRectangle (si->dpy, si->passwd_dialog, gc2, pw->thermo_field_x + 1, pw->thermo_field_y + 1, pw->thermo_width-2, y); XSetForeground (si->dpy, gc1, pw->thermo_foreground); XFillRectangle (si->dpy, si->passwd_dialog, gc1, pw->thermo_field_x + 1, pw->thermo_field_y + 1 + y, pw->thermo_width-2, MAX (0, pw->thermo_field_height - y - 2)); } if (pw->button_state_changed_p) { pw->button_state_changed_p = False; /* The "Unlock" button */ draw_button(si->dpy, si->passwd_dialog, pw->button_font, pw->button_foreground, pw->button_background, pw->unlock_label, pw->unlock_button_x, pw->unlock_button_y, pw->unlock_button_width, pw->unlock_button_height, pw->shadow_width, (pw->unlock_button_down_p ? pw->shadow_bottom : pw->shadow_top), (pw->unlock_button_down_p ? pw->shadow_top : pw->shadow_bottom), pw->unlock_button_down_p); /* The "New Login" button */ if (pw->login_button_p) { draw_button(si->dpy, si->passwd_dialog, pw->button_font, (pw->login_button_enabled_p ? pw->passwd_foreground : pw->shadow_bottom), pw->button_background, pw->login_label, pw->login_button_x, pw->login_button_y, pw->login_button_width, pw->login_button_height, pw->shadow_width, (pw->login_button_down_p ? pw->shadow_bottom : pw->shadow_top), (pw->login_button_down_p ? pw->shadow_top : pw->shadow_bottom), pw->login_button_down_p); } } XFreeGC (si->dpy, gc1); XFreeGC (si->dpy, gc2); XSync (si->dpy, False); } void restore_background (saver_info *si) { passwd_dialog_data *pw = si->pw_data; saver_screen_info *ssi = pw->prompt_screen; XGCValues gcv; GC gc; gcv.function = GXcopy; gc = XCreateGC (si->dpy, ssi->screensaver_window, GCFunction, &gcv); XCopyArea (si->dpy, pw->save_under, ssi->screensaver_window, gc, 0, 0, ssi->width, ssi->height, 0, 0); XFreeGC (si->dpy, gc); } /* Frees anything created by make_passwd_window */ static void cleanup_passwd_window (saver_info *si) { passwd_dialog_data *pw; if (!(pw = si->pw_data)) return; if (pw->info_label) { mlstring_free(pw->info_label); pw->info_label = 0; } if (pw->prompt_label) { mlstring_free(pw->prompt_label); pw->prompt_label = 0; } memset (pw->typed_passwd, 0, sizeof(pw->typed_passwd)); memset (pw->typed_passwd_char_size, 0, sizeof(pw->typed_passwd_char_size)); memset (pw->passwd_string, 0, strlen(pw->passwd_string)); if (pw->timer) { XtRemoveTimeOut (pw->timer); pw->timer = 0; } if (pw->user_entry_pixmap) { XFreePixmap(si->dpy, pw->user_entry_pixmap); pw->user_entry_pixmap = 0; } } static void destroy_passwd_window (saver_info *si) { saver_preferences *p = &si->prefs; passwd_dialog_data *pw = si->pw_data; saver_screen_info *ssi = pw->prompt_screen; Colormap cmap = DefaultColormapOfScreen (ssi->screen); Pixel black = BlackPixelOfScreen (ssi->screen); Pixel white = WhitePixelOfScreen (ssi->screen); XEvent event; cleanup_passwd_window (si); if (si->cached_passwd) { char *wipe = si->cached_passwd; while (*wipe) *wipe++ = '\0'; free(si->cached_passwd); si->cached_passwd = NULL; } move_mouse_grab (si, RootWindowOfScreen (ssi->screen), ssi->cursor, ssi->number); if (pw->passwd_cursor) XFreeCursor (si->dpy, pw->passwd_cursor); if (p->verbose_p) fprintf (stderr, "%s: %d: moving mouse back to %d,%d.\n", blurb(), ssi->number, pw->previous_mouse_x, pw->previous_mouse_y); XWarpPointer (si->dpy, None, RootWindowOfScreen (ssi->screen), 0, 0, 0, 0, pw->previous_mouse_x, pw->previous_mouse_y); XSync (si->dpy, False); while (XCheckMaskEvent (si->dpy, PointerMotionMask, &event)) if (p->verbose_p) fprintf (stderr, "%s: discarding MotionNotify event.\n", blurb()); #ifdef HAVE_XINPUT if (si->using_xinput_extension && si->xinput_DeviceMotionNotify) while (XCheckTypedEvent (si->dpy, si->xinput_DeviceMotionNotify, &event)) if (p->verbose_p) fprintf (stderr, "%s: discarding DeviceMotionNotify event.\n", blurb()); #endif if (si->passwd_dialog) { if (si->prefs.verbose_p) fprintf (stderr, "%s: %d: destroying password dialog.\n", blurb(), pw->prompt_screen->number); XDestroyWindow (si->dpy, si->passwd_dialog); si->passwd_dialog = 0; } if (pw->save_under) { restore_background(si); XFreePixmap (si->dpy, pw->save_under); pw->save_under = 0; } if (pw->heading_label) free (pw->heading_label); if (pw->body_label) free (pw->body_label); if (pw->user_label) free (pw->user_label); if (pw->date_label) free (pw->date_label); if (pw->login_label) free (pw->login_label); if (pw->unlock_label) free (pw->unlock_label); if (pw->passwd_string) free (pw->passwd_string); if (pw->uname_label) free (pw->uname_label); if (pw->heading_font) XFreeFont (si->dpy, pw->heading_font); if (pw->body_font) XFreeFont (si->dpy, pw->body_font); if (pw->label_font) XFreeFont (si->dpy, pw->label_font); if (pw->passwd_font) XFreeFont (si->dpy, pw->passwd_font); if (pw->date_font) XFreeFont (si->dpy, pw->date_font); if (pw->button_font) XFreeFont (si->dpy, pw->button_font); if (pw->uname_font) XFreeFont (si->dpy, pw->uname_font); if (pw->foreground != black && pw->foreground != white) XFreeColors (si->dpy, cmap, &pw->foreground, 1, 0L); if (pw->background != black && pw->background != white) XFreeColors (si->dpy, cmap, &pw->background, 1, 0L); if (!(pw->button_foreground == black || pw->button_foreground == white)) XFreeColors (si->dpy, cmap, &pw->button_foreground, 1, 0L); if (!(pw->button_background == black || pw->button_background == white)) XFreeColors (si->dpy, cmap, &pw->button_background, 1, 0L); if (pw->passwd_foreground != black && pw->passwd_foreground != white) XFreeColors (si->dpy, cmap, &pw->passwd_foreground, 1, 0L); if (pw->passwd_background != black && pw->passwd_background != white) XFreeColors (si->dpy, cmap, &pw->passwd_background, 1, 0L); if (pw->thermo_foreground != black && pw->thermo_foreground != white) XFreeColors (si->dpy, cmap, &pw->thermo_foreground, 1, 0L); if (pw->thermo_background != black && pw->thermo_background != white) XFreeColors (si->dpy, cmap, &pw->thermo_background, 1, 0L); if (pw->shadow_top != black && pw->shadow_top != white) XFreeColors (si->dpy, cmap, &pw->shadow_top, 1, 0L); if (pw->shadow_bottom != black && pw->shadow_bottom != white) XFreeColors (si->dpy, cmap, &pw->shadow_bottom, 1, 0L); if (pw->logo_pixmap) XFreePixmap (si->dpy, pw->logo_pixmap); if (pw-> logo_clipmask) XFreePixmap (si->dpy, pw->logo_clipmask); if (pw->logo_pixels) { if (pw->logo_npixels) XFreeColors (si->dpy, cmap, pw->logo_pixels, pw->logo_npixels, 0L); free (pw->logo_pixels); pw->logo_pixels = 0; pw->logo_npixels = 0; } if (pw->save_under) XFreePixmap (si->dpy, pw->save_under); if (cmap) XInstallColormap (si->dpy, cmap); memset (pw, 0, sizeof(*pw)); free (pw); si->pw_data = 0; } #if defined(HAVE_XF86MISCSETGRABKEYSSTATE) || defined(HAVE_XF86VMODE) static Bool error_handler_hit_p = False; static int ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error) { error_handler_hit_p = True; return 0; } #endif /* HAVE_XF86MISCSETGRABKEYSSTATE || HAVE_XF86VMODE */ #ifdef HAVE_XHPDISABLERESET /* This function enables and disables the C-Sh-Reset hot-key, which normally resets the X server (logging out the logged-in user.) We don't want random people to be able to do that while the screen is locked. */ static void hp_lock_reset (saver_info *si, Bool lock_p) { static Bool hp_locked_p = False; /* Calls to XHPDisableReset and XHPEnableReset must be balanced, or BadAccess errors occur. (It's ok for this to be global, since it affects the whole machine, not just the current screen.) */ if (hp_locked_p == lock_p) return; if (lock_p) XHPDisableReset (si->dpy); else XHPEnableReset (si->dpy); hp_locked_p = lock_p; } #endif /* HAVE_XHPDISABLERESET */ #ifdef HAVE_XF86MISCSETGRABKEYSSTATE /* This function enables and disables the Ctrl-Alt-KP_star and Ctrl-Alt-KP_slash hot-keys, which (in XFree86 4.2) break any grabs and/or kill the grabbing client. That would effectively unlock the screen, so we don't like that. The Ctrl-Alt-KP_star and Ctrl-Alt-KP_slash hot-keys only exist if AllowDeactivateGrabs and/or AllowClosedownGrabs are turned on in XF86Config. I believe they are disabled by default. This does not affect any other keys (specifically Ctrl-Alt-BS or Ctrl-Alt-F1) but I wish it did. Maybe it will someday. */ static void xfree_lock_grab_smasher (saver_info *si, Bool lock_p) { saver_preferences *p = &si->prefs; int status; int event, error; XErrorHandler old_handler; if (!XF86MiscQueryExtension(si->dpy, &event, &error)) return; XSync (si->dpy, False); error_handler_hit_p = False; old_handler = XSetErrorHandler (ignore_all_errors_ehandler); XSync (si->dpy, False); status = XF86MiscSetGrabKeysState (si->dpy, !lock_p); XSync (si->dpy, False); if (error_handler_hit_p) status = 666; if (!lock_p && status == MiscExtGrabStateAlready) status = MiscExtGrabStateSuccess; /* shut up, consider this success */ if (p->verbose_p && status != MiscExtGrabStateSuccess) fprintf (stderr, "%s: error: XF86MiscSetGrabKeysState(%d) returned %s\n", blurb(), !lock_p, (status == MiscExtGrabStateSuccess ? "MiscExtGrabStateSuccess" : status == MiscExtGrabStateLocked ? "MiscExtGrabStateLocked" : status == MiscExtGrabStateAlready ? "MiscExtGrabStateAlready" : status == 666 ? "an X error" : "unknown value")); XSync (si->dpy, False); XSetErrorHandler (old_handler); XSync (si->dpy, False); } #endif /* HAVE_XF86MISCSETGRABKEYSSTATE */ /* This function enables and disables the C-Alt-Plus and C-Alt-Minus hot-keys, which normally change the resolution of the X server. We don't want people to be able to switch the server resolution while the screen is locked, because if they switch to a higher resolution, it could cause part of the underlying desktop to become exposed. */ #ifdef HAVE_XF86VMODE static void xfree_lock_mode_switch (saver_info *si, Bool lock_p) { static Bool any_mode_locked_p = False; saver_preferences *p = &si->prefs; int screen; int real_nscreens = ScreenCount (si->dpy); int event, error; Bool status; XErrorHandler old_handler; if (any_mode_locked_p == lock_p) return; if (!XF86VidModeQueryExtension (si->dpy, &event, &error)) return; for (screen = 0; screen < real_nscreens; screen++) { XSync (si->dpy, False); old_handler = XSetErrorHandler (ignore_all_errors_ehandler); error_handler_hit_p = False; status = XF86VidModeLockModeSwitch (si->dpy, screen, lock_p); XSync (si->dpy, False); XSetErrorHandler (old_handler); if (error_handler_hit_p) status = False; if (status) any_mode_locked_p = lock_p; if (!status && (p->verbose_p || !lock_p)) /* Only print this when verbose, or when we locked but can't unlock. I tried printing this message whenever it comes up, but mode-locking always fails if DontZoom is set in XF86Config. */ fprintf (stderr, "%s: %d: unable to %s mode switching!\n", blurb(), screen, (lock_p ? "lock" : "unlock")); else if (p->verbose_p) fprintf (stderr, "%s: %d: %s mode switching.\n", blurb(), screen, (lock_p ? "locked" : "unlocked")); } } #endif /* HAVE_XF86VMODE */ /* If the viewport has been scrolled since the screen was blanked, then scroll it back to where it belongs. This function only exists to patch over a very brief race condition. */ static void undo_vp_motion (saver_info *si) { #ifdef HAVE_XF86VMODE saver_preferences *p = &si->prefs; int screen; int real_nscreens = ScreenCount (si->dpy); int event, error; if (!XF86VidModeQueryExtension (si->dpy, &event, &error)) return; for (screen = 0; screen < real_nscreens; screen++) { saver_screen_info *ssi = &si->screens[screen]; int x, y; Bool status; if (ssi->blank_vp_x == -1 && ssi->blank_vp_y == -1) break; if (!XF86VidModeGetViewPort (si->dpy, screen, &x, &y)) return; if (ssi->blank_vp_x == x && ssi->blank_vp_y == y) return; /* We're going to move the viewport. The mouse has just been grabbed on (and constrained to, thus warped to) the password window, so it is no longer near the edge of the screen. However, wait a bit anyway, just to make sure the server drains its last motion event, so that the screen doesn't continue to scroll after we've reset the viewport. */ XSync (si->dpy, False); usleep (250000); /* 1/4 second */ XSync (si->dpy, False); status = XF86VidModeSetViewPort (si->dpy, screen, ssi->blank_vp_x, ssi->blank_vp_y); if (!status) fprintf (stderr, "%s: %d: unable to move vp from (%d,%d) back to (%d,%d)!\n", blurb(), screen, x, y, ssi->blank_vp_x, ssi->blank_vp_y); else if (p->verbose_p) fprintf (stderr, "%s: %d: vp moved to (%d,%d); moved it back to (%d,%d).\n", blurb(), screen, x, y, ssi->blank_vp_x, ssi->blank_vp_y); } #endif /* HAVE_XF86VMODE */ } /* Interactions */ static void passwd_animate_timer (XtPointer closure, XtIntervalId *id) { saver_info *si = (saver_info *) closure; int tick = 166; passwd_dialog_data *pw = si->pw_data; if (!pw) return; pw->ratio -= (1.0 / ((double) si->prefs.passwd_timeout / (double) tick)); if (pw->ratio < 0) { pw->ratio = 0; if (si->unlock_state == ul_read) si->unlock_state = ul_time; } update_passwd_window (si, 0, pw->ratio); if (si->unlock_state == ul_read) pw->timer = XtAppAddTimeOut (si->app, tick, passwd_animate_timer, (XtPointer) si); else pw->timer = 0; idle_timer ((XtPointer) si, 0); } static XComposeStatus *compose_status; static void handle_login_button (saver_info *si, XEvent *event) { saver_preferences *p = &si->prefs; Bool mouse_in_box = False; Bool hit_p = False; passwd_dialog_data *pw = si->pw_data; saver_screen_info *ssi = pw->prompt_screen; if (! pw->login_button_enabled_p) return; mouse_in_box = (event->xbutton.x >= pw->login_button_x && event->xbutton.x <= pw->login_button_x + pw->login_button_width && event->xbutton.y >= pw->login_button_y && event->xbutton.y <= pw->login_button_y + pw->login_button_height); if (ButtonRelease == event->xany.type && pw->login_button_down_p && mouse_in_box) { /* Only allow them to press the button once: don't want to accidentally launch a dozen gdm choosers if the machine is being slow. */ hit_p = True; pw->login_button_enabled_p = False; } pw->login_button_down_p = (mouse_in_box && ButtonRelease != event->xany.type); update_passwd_window (si, 0, pw->ratio); if (hit_p) fork_and_exec (ssi, p->new_login_command); } static void handle_unlock_button (saver_info *si, XEvent *event) { Bool mouse_in_box = False; passwd_dialog_data *pw = si->pw_data; mouse_in_box = (event->xbutton.x >= pw->unlock_button_x && event->xbutton.x <= pw->unlock_button_x + pw->unlock_button_width && event->xbutton.y >= pw->unlock_button_y && event->xbutton.y <= pw->unlock_button_y + pw->unlock_button_height); if (ButtonRelease == event->xany.type && pw->unlock_button_down_p && mouse_in_box) finished_typing_passwd (si, pw); pw->unlock_button_down_p = (mouse_in_box && ButtonRelease != event->xany.type); } static void finished_typing_passwd (saver_info *si, passwd_dialog_data *pw) { if (si->unlock_state == ul_read) { update_passwd_window (si, "Checking...", pw->ratio); XSync (si->dpy, False); si->unlock_state = ul_finished; update_passwd_window (si, "", pw->ratio); } } static void handle_passwd_key (saver_info *si, XKeyEvent *event) { passwd_dialog_data *pw = si->pw_data; 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.c. */ int decoded_size = XLookupString (event, (char *)decoded, sizeof(decoded), &keysym, compose_status); #if 0 { const char *ks = XKeysymToString (keysym); int i; fprintf(stderr, "## %-12s\t=> %d\t", (ks ? ks : "(null)"), decoded_size); for (i = 0; i < decoded_size; i++) fprintf(stderr, "%c", decoded[i]); fprintf(stderr, "\t"); for (i = 0; i < decoded_size; i++) fprintf(stderr, "\\%03o", ((unsigned char *)decoded)[i]); fprintf(stderr, "\n"); } #endif if (decoded_size > MAX_BYTES_PER_CHAR) { /* The multi-byte character returned is too large. */ XBell (si->dpy, 0); return; } decoded[decoded_size] = 0; pw->passwd_changed_p = True; /* Add 10% to the time remaining every time a key is pressed. */ pw->ratio += 0.1; if (pw->ratio > 1) pw->ratio = 1; 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 (pw->typed_passwd_char_size); int nbytes = strlen (pw->typed_passwd); if (nbytes <= 0) XBell (si->dpy, 0); else { int i; for (i = pw->typed_passwd_char_size[nchars-1]; i >= 0; i--) { if (nbytes < 0) abort(); pw->typed_passwd[nbytes--] = 0; } pw->typed_passwd_char_size[nchars-1] = 0; } } break; case '\012': case '\015': /* Enter */ finished_typing_passwd (si, pw); break; case '\033': /* Escape */ si->unlock_state = ul_cancel; break; case '\025': case '\030': /* Erase line */ memset (pw->typed_passwd, 0, sizeof (pw->typed_passwd)); memset (pw->typed_passwd_char_size, 0, sizeof (pw->typed_passwd_char_size)); break; default: if (*decoded < ' ' && *decoded != '\t') /* Other ctrl char */ XBell (si->dpy, 0); else goto SELF_INSERT; break; } } else { int nbytes, nchars; SELF_INSERT: nbytes = strlen (pw->typed_passwd); nchars = strlen (pw->typed_passwd_char_size); if (nchars + 1 >= sizeof (pw->typed_passwd_char_size)-1 || nbytes + decoded_size >= sizeof (pw->typed_passwd)-1) /* overflow */ XBell (si->dpy, 0); else { pw->typed_passwd_char_size[nchars] = decoded_size; pw->typed_passwd_char_size[nchars+1] = 0; memcpy (pw->typed_passwd + nbytes, decoded, decoded_size); pw->typed_passwd[nbytes + decoded_size] = 0; } } if (pw->echo_input) { /* If the input is wider than the text box, only show the last portion, to simulate a horizontally-scrolling text field. */ int chars_in_pwfield = (pw->passwd_field_width / pw->passwd_font->max_bounds.width); const char *output = pw->typed_passwd; if (strlen(output) > chars_in_pwfield) output += (strlen(output) - chars_in_pwfield); update_passwd_window (si, output, pw->ratio); } else if (pw->show_stars_p) { int nchars = strlen (pw->typed_passwd_char_size); char *stars = 0; stars = (char *) malloc(nchars + 1); memset (stars, '*', nchars); stars[nchars] = 0; update_passwd_window (si, stars, pw->ratio); free (stars); } else { update_passwd_window (si, "", pw->ratio); } } static void passwd_event_loop (saver_info *si) { saver_preferences *p = &si->prefs; char *msg = 0; /* We have to go through this union bullshit because gcc-4.4.0 has stricter struct-aliasing rules. Without this, the optimizer can fuck things up. */ union { XEvent x_event; # ifdef HAVE_RANDR XRRScreenChangeNotifyEvent xrr_event; # endif /* HAVE_RANDR */ } event; passwd_animate_timer ((XtPointer) si, 0); reset_watchdog_timer (si, False); /* Disable watchdog while dialog up */ while (si->unlock_state == ul_read) { XtAppNextEvent (si->app, &event.x_event); #ifdef HAVE_RANDR if (si->using_randr_extension && (event.x_event.type == (si->randr_event_number + RRScreenChangeNotify))) { /* The Resize and Rotate extension sends an event when the size, rotation, or refresh rate of any screen has changed. */ if (p->verbose_p) { /* XRRRootToScreen is in Xrandr.h 1.4, 2001/06/07 */ int screen = XRRRootToScreen(si->dpy, event.xrr_event.window); fprintf (stderr, "%s: %d: screen change event received\n", blurb(), screen); } #ifdef RRScreenChangeNotifyMask /* Inform Xlib that it's ok to update its data structures. */ XRRUpdateConfiguration(&event.x_event); /* Xrandr.h 1.9, 2002/09/29*/ #endif /* RRScreenChangeNotifyMask */ /* Resize the existing xscreensaver windows and cached ssi data. */ if (update_screen_layout (si)) { if (p->verbose_p) { fprintf (stderr, "%s: new layout:\n", blurb()); describe_monitor_layout (si); } resize_screensaver_window (si); } } else #endif /* HAVE_RANDR */ if (event.x_event.xany.window == si->passwd_dialog && event.x_event.xany.type == Expose) draw_passwd_window (si); else if (event.x_event.xany.type == KeyPress) { handle_passwd_key (si, &event.x_event.xkey); si->pw_data->caps_p = (event.x_event.xkey.state & LockMask); } else if (event.x_event.xany.type == ButtonPress || event.x_event.xany.type == ButtonRelease) { si->pw_data->button_state_changed_p = True; handle_unlock_button (si, &event.x_event); if (si->pw_data->login_button_p) handle_login_button (si, &event.x_event); } else XtDispatchEvent (&event.x_event); } switch (si->unlock_state) { case ul_cancel: msg = ""; break; case ul_time: msg = "Timed out!"; break; case ul_finished: msg = "Checking..."; break; default: msg = 0; break; } if (p->verbose_p) switch (si->unlock_state) { case ul_cancel: fprintf (stderr, "%s: input cancelled.\n", blurb()); break; case ul_time: fprintf (stderr, "%s: input timed out.\n", blurb()); break; case ul_finished: fprintf (stderr, "%s: input finished.\n", blurb()); break; default: break; } if (msg) { si->pw_data->i_beam = 0; update_passwd_window (si, msg, 0.0); XSync (si->dpy, False); /* Swallow all pending KeyPress/KeyRelease events. */ { XEvent e; while (XCheckMaskEvent (si->dpy, KeyPressMask|KeyReleaseMask, &e)) ; } } reset_watchdog_timer (si, True); /* Re-enable watchdog */ } static void handle_typeahead (saver_info *si) { passwd_dialog_data *pw = si->pw_data; int i; if (!si->unlock_typeahead) return; pw->passwd_changed_p = True; i = strlen (si->unlock_typeahead); if (i >= sizeof(pw->typed_passwd) - 1) i = sizeof(pw->typed_passwd) - 1; memcpy (pw->typed_passwd, si->unlock_typeahead, i); pw->typed_passwd [i] = 0; { int j; char *c = pw->typed_passwd_char_size; for (j = 0; j < i; j++) *c++ = 1; *c = 0; } memset (si->unlock_typeahead, '*', strlen(si->unlock_typeahead)); si->unlock_typeahead[i] = 0; update_passwd_window (si, si->unlock_typeahead, pw->ratio); free (si->unlock_typeahead); si->unlock_typeahead = 0; } /** * Returns a copy of the input string with trailing whitespace removed. * Whitespace is anything considered so by isspace(). * It is safe to call this with NULL, in which case NULL will be returned. * The returned string (if not NULL) should be freed by the caller with free(). */ static char * remove_trailing_whitespace(const char *str) { size_t len; char *newstr, *chr; if (!str) return NULL; len = strlen(str); newstr = malloc(len + 1); if (!newstr) return NULL; (void) strcpy(newstr, str); chr = newstr + len; while (isspace(*--chr) && chr >= newstr) *chr = '\0'; return newstr; } /* * The authentication conversation function. * Like a PAM conversation function, this accepts multiple messages in a single * round. It then splits them into individual messages for display on the * passwd dialog. A message sequence of info or error followed by a prompt will * be reduced into a single dialog window. * * Returns 0 on success or -1 if some problem occurred (cancelled, OOM, etc.) */ int gui_auth_conv(int num_msg, const struct auth_message auth_msgs[], struct auth_response **resp, saver_info *si) { int i; const char *info_msg, *prompt; struct auth_response *responses; if (si->unlock_state == ul_cancel || si->unlock_state == ul_time) /* If we've already cancelled or timed out in this PAM conversation, don't prompt again even if PAM asks us to! */ return -1; if (!(responses = calloc(num_msg, sizeof(struct auth_response)))) goto fail; for (i = 0; i < num_msg; ++i) { info_msg = prompt = NULL; /* See if there is a following message that can be shown at the same * time */ if (auth_msgs[i].type == AUTH_MSGTYPE_INFO && i+1 < num_msg && ( auth_msgs[i+1].type == AUTH_MSGTYPE_PROMPT_NOECHO || auth_msgs[i+1].type == AUTH_MSGTYPE_PROMPT_ECHO) ) { info_msg = auth_msgs[i].msg; prompt = auth_msgs[++i].msg; } else { if ( auth_msgs[i].type == AUTH_MSGTYPE_INFO || auth_msgs[i].type == AUTH_MSGTYPE_ERROR) info_msg = auth_msgs[i].msg; else prompt = auth_msgs[i].msg; } { char *info_msg_trimmed, *prompt_trimmed; /* Trailing whitespace looks bad in a GUI */ info_msg_trimmed = remove_trailing_whitespace(info_msg); prompt_trimmed = remove_trailing_whitespace(prompt); if (make_passwd_window(si, info_msg_trimmed, prompt_trimmed, auth_msgs[i].type == AUTH_MSGTYPE_PROMPT_ECHO ? True : False) < 0) goto fail; if (info_msg_trimmed) free(info_msg_trimmed); if (prompt_trimmed) free(prompt_trimmed); } compose_status = calloc (1, sizeof (*compose_status)); if (!compose_status) goto fail; si->unlock_state = ul_read; handle_typeahead (si); passwd_event_loop (si); if (si->unlock_state == ul_cancel) goto fail; responses[i].response = strdup(si->pw_data->typed_passwd); /* Cache the first response to a PROMPT_NOECHO to save prompting for * each auth mechanism. */ if (si->cached_passwd == NULL && auth_msgs[i].type == AUTH_MSGTYPE_PROMPT_NOECHO) si->cached_passwd = strdup(responses[i].response); free (compose_status); compose_status = 0; } *resp = responses; return (si->unlock_state == ul_finished) ? 0 : -1; fail: if (compose_status) free (compose_status); compose_status = 0; if (responses) { for (i = 0; i < num_msg; ++i) if (responses[i].response) free (responses[i].response); free (responses); } return -1; } void auth_finished_cb (saver_info *si) { char buf[1024]; const char *s; /* If we have something to say, put the dialog back up for a few seconds to display it. Otherwise, don't bother. */ if (si->unlock_state == ul_fail && /* failed with caps lock on */ si->pw_data && si->pw_data->caps_p) s = "Authentication failed (Caps Lock?)"; else if (si->unlock_state == ul_fail) /* failed without caps lock */ s = "Authentication failed!"; else if (si->unlock_state == ul_success && /* good, but report failures */ si->unlock_failures > 0) { if (si->unlock_failures == 1) s = "There has been\n1 failed login attempt."; else { sprintf (buf, "There have been\n%d failed login attempts.", si->unlock_failures); s = buf; } si->unlock_failures = 0; /* ignore failures if they all were too recent */ if (time((time_t *) 0) - si->unlock_failure_time < si->prefs.auth_warning_slack) goto END; } else /* good, with no failures, */ goto END; /* or timeout, or cancel. */ make_passwd_window (si, s, NULL, True); XSync (si->dpy, False); { int secs = 4; time_t start = time ((time_t *) 0); XEvent event; while (time ((time_t *) 0) < start + secs) if (XPending (si->dpy)) { XNextEvent (si->dpy, &event); if (event.xany.window == si->passwd_dialog && event.xany.type == Expose) draw_passwd_window (si); else if (event.xany.type == ButtonPress || event.xany.type == KeyPress) break; XSync (si->dpy, False); } else usleep (250000); /* 1/4 second */ } END: if (si->pw_data) destroy_passwd_window (si); } Bool unlock_p (saver_info *si) { saver_preferences *p = &si->prefs; if (!si->unlock_cb) { fprintf(stderr, "%s: Error: no unlock function specified!\n", blurb()); return False; } raise_window (si, True, True, True); xss_authenticate(si, p->verbose_p); return (si->unlock_state == ul_success); } void set_locked_p (saver_info *si, Bool locked_p) { si->locked_p = locked_p; #ifdef HAVE_XHPDISABLERESET hp_lock_reset (si, locked_p); /* turn off/on C-Sh-Reset */ #endif #ifdef HAVE_XF86VMODE xfree_lock_mode_switch (si, locked_p); /* turn off/on C-Alt-Plus */ #endif #ifdef HAVE_XF86MISCSETGRABKEYSSTATE xfree_lock_grab_smasher (si, locked_p); /* turn off/on C-Alt-KP-*,/ */ #endif store_saver_status (si); /* store locked-p */ } #else /* NO_LOCKING -- whole file */ void set_locked_p (saver_info *si, Bool locked_p) { if (locked_p) abort(); } #endif /* !NO_LOCKING */ xscreensaver-5.42+dfsg1/driver/mlstring.c000066400000000000000000000120601342162430400204500ustar00rootroot00000000000000/* * (c) 2007, Quest Software, Inc. All rights reserved. * * This file is part of XScreenSaver, * Copyright (c) 1993-2009 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. */ #include #include #include #include "mlstring.h" #define LINE_SPACING 1.2 static mlstring * mlstring_allocate(const char *msg); static void mlstring_calculate(mlstring *str, XFontStruct *font); mlstring* mlstring_new(const char *msg, XFontStruct *font, Dimension wrap_width) { mlstring *newstr; if (!(newstr = mlstring_allocate(msg))) return NULL; newstr->font_id = font->fid; mlstring_wrap(newstr, font, wrap_width); return newstr; } mlstring * mlstring_allocate(const char *msg) { const char *s; mlstring *ml; struct mlstr_line *cur, *prev = NULL; size_t linelength; int the_end = 0; if (!msg) return NULL; ml = calloc(1, sizeof(mlstring)); if (!ml) return NULL; for (s = msg; !the_end; msg = ++s) { /* New string struct */ cur = calloc(1, sizeof(struct mlstr_line)); if (!cur) goto fail; if (!ml->lines) ml->lines = cur; /* Find the \n or end of string */ while (*s != '\n') { if (*s == '\0') { the_end = 1; break; } ++s; } linelength = s - msg; /* Duplicate the string */ cur->line = malloc(linelength + 1); if (!cur->line) goto fail; strncpy(cur->line, msg, linelength); cur->line[linelength] = '\0'; if (prev) prev->next_line = cur; prev = cur; } return ml; fail: if (ml) mlstring_free(ml); return NULL; } /* * Frees an mlstring. * This function does not have any unit tests. */ void mlstring_free(mlstring *str) { struct mlstr_line *cur, *next; for (cur = str->lines; cur; cur = next) { next = cur->next_line; free(cur->line); free(cur); } free(str); } void mlstring_wrap(mlstring *mstring, XFontStruct *font, Dimension width) { short char_width = font->max_bounds.width; int line_length, wrap_at; struct mlstr_line *mstr, *newml; /* An alternative implementation of this function would be to keep trying * XTextWidth() on space-delimited substrings until the longest one less * than 'width' is found, however there shouldn't be much difference * between that, and this implementation. */ for (mstr = mstring->lines; mstr; mstr = mstr->next_line) { if (XTextWidth(font, mstr->line, strlen(mstr->line)) > width) { /* Wrap it */ line_length = width / char_width; if (line_length == 0) line_length = 1; /* First try to soft wrap by finding a space */ for (wrap_at = line_length; wrap_at >= 0 && !isspace(mstr->line[wrap_at]); --wrap_at); if (wrap_at == -1) /* No space found, hard wrap */ wrap_at = line_length; else wrap_at++; /* Leave the space at the end of the line. */ newml = calloc(1, sizeof(*newml)); if (!newml) /* OOM, don't bother trying to wrap */ break; if (NULL == (newml->line = strdup(mstr->line + wrap_at))) { /* OOM, jump ship */ free(newml); break; } /* Terminate the existing string at its end */ mstr->line[wrap_at] = '\0'; newml->next_line = mstr->next_line; mstr->next_line = newml; } } mlstring_calculate(mstring, font); } #undef MAX #define MAX(x, y) ((x) > (y) ? (x) : (y)) /* * Calculates the overall extents (width + height of the multi-line string). * This function is called as part of mlstring_new(). * It does not have any unit testing. */ void mlstring_calculate(mlstring *str, XFontStruct *font) { struct mlstr_line *line; str->font_height = font->ascent + font->descent; str->overall_height = 0; str->overall_width = 0; /* XXX: Should there be some baseline calculations to help XDrawString later on? */ str->font_ascent = font->ascent; for (line = str->lines; line; line = line->next_line) { line->line_width = XTextWidth(font, line->line, strlen(line->line)); str->overall_width = MAX(str->overall_width, line->line_width); /* Don't add line spacing for the first line */ str->overall_height += (font->ascent + font->descent) * (line == str->lines ? 1 : LINE_SPACING); } } void mlstring_draw(Display *dpy, Drawable dialog, GC gc, mlstring *string, int x, int y) { struct mlstr_line *line; if (!string) return; y += string->font_ascent; XSetFont(dpy, gc, string->font_id); for (line = string->lines; line; line = line->next_line) { XDrawString(dpy, dialog, gc, x, y, line->line, strlen(line->line)); y += string->font_height * LINE_SPACING; } } /* vim:ts=8:sw=2:noet */ xscreensaver-5.42+dfsg1/driver/mlstring.h000066400000000000000000000030141342162430400204540ustar00rootroot00000000000000/* mlstring.h --- Multi-line strings for use with Xlib * * (c) 2007, Quest Software, Inc. All rights reserved. * * This file is part of XScreenSaver, * Copyright (c) 1993-2004 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 MLSTRING_H #define MLSTRING_H #include /* mlstring means multi-line string */ struct mlstr_line; typedef struct mlstring mlstring; struct mlstring { struct mlstr_line *lines; /* linked list */ Dimension overall_height; Dimension overall_width; /* XXX: Perhaps it is simpler to keep a reference to the XFontStruct */ int font_ascent; int font_height; Font font_id; }; struct mlstr_line { char *line; Dimension line_width; struct mlstr_line *next_line; }; mlstring * mlstring_new(const char *str, XFontStruct *font, Dimension wrap_width); /* Does not have to be called manually */ void mlstring_wrap(mlstring *mstr, XFontStruct *font, Dimension width); void mlstring_free(mlstring *str); void mlstring_draw(Display *dpy, Drawable dialog, GC gc, mlstring *string, int x, int y); #endif /* vim:ts=8:sw=2:noet */ xscreensaver-5.42+dfsg1/driver/passwd-helper.c000066400000000000000000000102741342162430400213740ustar00rootroot00000000000000/* passwd-helper.c --- verifying typed passwords with external helper program * 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 * 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. */ /* 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 * name argument. * * The external helper does whatever authentication is necessary. Currently, * SuSE uses "unix2_chkpwd", which is a variation of "unix_chkpwd" from the * PAM distribution. * * Normally, the password helper should just authenticate the calling user * (i.e. based on the caller's real uid). This is in order to prevent * brute-forcing passwords in a shadow environment. A less restrictive * approach would be to allow verifying other passwords as well, but always * with a 2 second delay or so. (Not sure what SuSE's "unix2_chkpwd" * currently does.) * -- Olaf Kirch , 16-Dec-2003 */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #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 #endif #include #include #include #include #include #include static int ext_run (const char *user, const char *typed_passwd, int verbose_p) { int pfd[2], status; pid_t pid; if (pipe(pfd) < 0) return 0; if (verbose_p) fprintf (stderr, "%s: ext_run (%s, %s)\n", blurb(), PASSWD_HELPER_PROGRAM, user); block_sigchld(); if ((pid = fork()) < 0) { close(pfd[0]); close(pfd[1]); return 0; } if (pid == 0) { close(pfd[1]); if (pfd[0] != 0) dup2(pfd[0], 0); /* 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, strerror(errno)); exit(1); } close(pfd[0]); /* Write out password to helper process */ if (!typed_passwd) typed_passwd = ""; write(pfd[1], typed_passwd, strlen(typed_passwd)); close(pfd[1]); while (waitpid(pid, &status, 0) < 0) { if (errno == EINTR) continue; if (verbose_p) fprintf(stderr, "%s: ext_run: waitpid failed: %s\n", blurb(), strerror(errno)); unblock_sigchld(); return 0; } unblock_sigchld(); if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) return 0; return 1; } /* This can be called at any time, and says whether the typed password belongs to either the logged in user (real uid, not effective); or to root. */ int ext_passwd_valid_p (const char *typed_passwd, int verbose_p) { struct passwd *pw; int res = 0; if ((pw = getpwuid(getuid())) != NULL) res = ext_run (pw->pw_name, typed_passwd, verbose_p); endpwent(); #ifdef ALLOW_ROOT_PASSWD if (!res) res = ext_run ("root", typed_passwd, verbose_p); #endif /* ALLOW_ROOT_PASSWD */ return res; } int ext_priv_init (int argc, char **argv, int verbose_p) { /* 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", blurb(), PASSWD_HELPER_PROGRAM, blurb()); return 0; } return 1; } #endif /* NO_LOCKING -- whole file */ xscreensaver-5.42+dfsg1/driver/passwd-kerberos.c000066400000000000000000000164411342162430400217330ustar00rootroot00000000000000/* kpasswd.c --- verify kerberos passwords. * written by Nat Lanza (magus@cs.cmu.edu) for * xscreensaver, Copyright (c) 1993-2004 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 #ifndef NO_LOCKING /* whole file */ #include #ifdef HAVE_UNISTD_H # include #endif #include #include #include #include /* I'm not sure if this is exactly the right test... Might __APPLE__ be defined if this is apple hardware, but not an Apple OS? Thanks to Alexei Kosut for the MacOS X code. */ #ifdef __APPLE__ # define HAVE_DARWIN #endif #if defined(HAVE_DARWIN) # include #elif defined(HAVE_KERBEROS5) # include # include #else /* !HAVE_KERBEROS5 (meaning Kerberos 4) */ # include # include #endif /* !HAVE_KERBEROS5 */ #if !defined(VMS) && !defined(HAVE_ADJUNCT_PASSWD) # include #endif #ifdef __bsdi__ # include # if _BSDI_VERSION >= 199608 # define BSD_AUTH # endif #endif /* __bsdi__ */ /* blargh */ #undef Bool #undef True #undef False #define Bool int #define True 1 #define False 0 /* The user information we need to store */ #ifdef HAVE_DARWIN static KLPrincipal princ; #else /* !HAVE_DARWIN */ static char realm[REALM_SZ]; static char name[ANAME_SZ]; static char inst[INST_SZ]; 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 using tf_get_pname(), this should work even if your kerberos username isn't the same as your local username. We grab the ticket at startup time so that even if your ticketfile dies while the screen's locked we'll still have the information to unlock it. Problems: the password dialog currently displays local username, so if you have some non-standard name/instance when you run xscreensaver, you'll need to remember what it was when unlocking, or else you lose. Also, we use des_string_to_key(), so if you have an AFS password (encrypted with ka_StringToKey()), you'll lose. Get a kerberos password; it isn't that hard. Like the original lock_init, we return false if something went wrong. We don't use the arguments we're given, though. */ Bool kerberos_lock_init (int argc, char **argv, Bool verbose_p) { # ifdef HAVE_DARWIN KLBoolean found; return ((klNoErr == (KLCacheHasValidTickets (NULL, kerberosVersion_Any, &found, &princ, NULL))) && found); # else /* !HAVE_DARWIN */ /* Perhaps we should be doing it the Mac way (above) all the time? The following code assumes Unix-style file-based Kerberos credentials cache, which Mac OS X doesn't use. But is there any real reason to do it this way at all, even on other Unixen? */ int k_errno; memset(name, 0, sizeof(name)); memset(inst, 0, sizeof(inst)); /* find out where the user's keeping his tickets. squirrel it away for later use. */ tk_file = tkt_string(); /* open ticket file or die trying. */ if ((k_errno = tf_init(tk_file, R_TKT_FIL))) { return False; } /* same with principal and instance names */ if ((k_errno = tf_get_pname(name)) || (k_errno = tf_get_pinst(inst))) { return False; } /* close the ticketfile to release the lock on it. */ tf_close(); /* figure out what realm we're authenticated to. this ought to be the local realm, but it pays to be sure. */ if ((k_errno = krb_get_tf_realm(tk_file, realm))) { return False; } /* last-minute sanity check on what we got. */ if ((strlen(name)+strlen(inst)+strlen(realm)+3) > (REALM_SZ + ANAME_SZ + INST_SZ + 3)) { return False; } /* success */ return True; # endif /* !HAVE_DARWIN */ } /* des_string_to_key() wants this. If C didn't suck, we could have an anonymous function do this. Even a local one. But it does, so here we are. Calling it ive_got_your_local_function_right_here_buddy() would have been rude. */ #ifndef HAVE_DARWIN static int key_to_key(char *user, char *instance, char *realm, char *passwd, C_Block key) { memcpy(key, passwd, sizeof(des_cblock)); return (0); } #endif /* !HAVE_DARWIN */ /* Called to see if the user's typed password is valid. We do this by asking the kerberos server for a ticket and checking to see if it gave us one. We need to move the ticketfile first, or otherwise we end up updating the user's tkfile with new tickets. This would break services like zephyr that like to stay authenticated, and it would screw with AFS authentication at some sites. So, we do a quick, painful hack with a tmpfile. */ Bool kerberos_passwd_valid_p (const char *typed_passwd, Bool verbose_p) { # ifdef HAVE_DARWIN return (klNoErr == KLAcquireNewInitialTicketsWithPassword (princ, NULL, typed_passwd, NULL)); # else /* !HAVE_DARWIN */ /* See comments in kerberos_lock_init -- should we do it the Mac Way on all systems? */ C_Block mitkey; Bool success; char *newtkfile; int fh = -1; /* 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()); if( (fh = mkstemp(newtkfile)) < 0) { free(newtkfile); return(False); } if( fchmod(fh, 0600) < 0) { free(newtkfile); return(False); } krb_set_tkt_string(newtkfile); /* encrypt the typed password. if you have an AFS password instead of a kerberos one, you lose *right here*. If you want to use AFS passwords, you can use ka_StringToKey() instead. As always, ymmv. */ des_string_to_key(typed_passwd, mitkey); if (krb_get_in_tkt(name, inst, realm, "krbtgt", realm, DEFAULT_TKT_LIFE, key_to_key, NULL, (char *) mitkey) != 0) { success = False; } else { success = True; } /* quickly block out the tempfile and password to prevent snooping, then restore the old ticketfile and cleean up a bit. */ dest_tkt(); krb_set_tkt_string(tk_file); free(newtkfile); memset(mitkey, 0, sizeof(mitkey)); close(fh); /* #### tom: should the file be removed? */ /* Did we verify successfully? */ return success; # endif /* !HAVE_DARWIN */ } #endif /* NO_LOCKING -- whole file */ xscreensaver-5.42+dfsg1/driver/passwd-pam.c000066400000000000000000000426111342162430400206720ustar00rootroot00000000000000/* 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 * * 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 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 */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #ifndef NO_LOCKING /* whole file */ #include #ifdef HAVE_UNISTD_H # include #endif extern char *blurb(void); #include #include #include #include #include #include #include #include #include #include #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! */ #if !defined(PAM_REFRESH_CRED) && defined(PAM_CRED_REFRESH) # define PAM_REFRESH_CRED PAM_CRED_REFRESH #endif #if !defined(PAM_REINITIALIZE_CRED) && defined(PAM_CRED_REINITIALIZE) # define PAM_REINITIALIZE_CRED PAM_CRED_REINITIALIZE #endif static int pam_conversation (int nmsgs, const struct pam_message **msg, 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)); Bool pam_priv_init (int argc, char **argv, Bool verbose_p); #ifdef HAVE_PAM_FAIL_DELAY /* We handle delays ourself.*/ /* Don't set this to 0 (Linux bug workaround.) */ # define PAM_NO_DELAY(pamh) pam_fail_delay ((pamh), 1) #else /* !HAVE_PAM_FAIL_DELAY */ # define PAM_NO_DELAY(pamh) /* */ #endif /* !HAVE_PAM_FAIL_DELAY */ /* On SunOS 5.6, and on Linux with PAM 0.64, pam_strerror() takes two args. On some other Linux systems with some other version of PAM (e.g., whichever Debian release comes with a 2.2.5 kernel) it takes one arg. I can't tell which is more "recent" or "correct" behavior, so configure figures out which is in use for us. Shoot me! */ #ifdef PAM_STRERROR_TWO_ARGS # define PAM_STRERROR(pamh, status) pam_strerror((pamh), (status)) #else /* !PAM_STRERROR_TWO_ARGS */ # define PAM_STRERROR(pamh, status) pam_strerror((status)) #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! (I've been told this is bug 4092227, and is fixed in Solaris 7.) (I've also been told that it's fixed in Solaris 2.6 by patch 106257-05.) */ 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. */ void pam_try_unlock(saver_info *si, Bool verbose_p, Bool (*valid_p)(const char *typed_passwd, Bool verbose_p)) { 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 */ 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; /* Initialize PAM. */ status = pam_start (service, si->user, &pc, &pamh); if (verbose_p) fprintf (stderr, "%s: pam_start (\"%s\", \"%s\", ...) ==> %d (%s)\n", blurb(), service, si->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"); 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! */ { int status2; /* On most systems, it doesn't matter whether the account modules are run, or whether they fail or succeed. On some systems, the account modules fail, because they were never configured properly, but it's necessary to run them anyway because certain PAM modules depend on side effects of the account modules having been run. And on still other systems, the account modules are actually used, and failures in them should be considered to be true! So: - We run the account modules on all systems. - Whether we ignore them is a configure option. It's all kind of a mess. */ status2 = pam_acct_mgmt (pamh, 0); if (verbose_p) fprintf (stderr, "%s: pam_acct_mgmt (...) ==> %d (%s)\n", blurb(), status2, PAM_STRERROR(pamh, status2)); /* HPUX for some reason likes to make PAM defines different from * everyone else's. */ #ifdef PAM_AUTHTOKEN_REQD if (status2 == PAM_AUTHTOKEN_REQD) #else if (status2 == PAM_NEW_AUTHTOK_REQD) #endif { status2 = pam_chauthtok (pamh, PAM_CHANGE_EXPIRED_AUTHTOK); if (verbose_p) fprintf (stderr, "%s: pam_chauthtok (...) ==> %d (%s)\n", blurb(), status2, PAM_STRERROR(pamh, status2)); } /* If 'configure' requested that we believe the results of PAM account module failures, then obey that status code. Otherwise ignore it. */ #ifdef PAM_CHECK_ACCOUNT_TYPE status = status2; #endif /* Each time we successfully authenticate, refresh credentials, for Kerberos/AFS/DCE/etc. If this fails, just ignore that failure and blunder along; it shouldn't matter. */ #if defined(__linux__) /* Apparently the Linux PAM library ignores PAM_REFRESH_CRED and only refreshes credentials when using PAM_REINITIALIZE_CRED. */ status2 = pam_setcred (pamh, PAM_REINITIALIZE_CRED); #else /* But Solaris requires PAM_REFRESH_CRED or extra prompts appear. */ status2 = pam_setcred (pamh, PAM_REFRESH_CRED); #endif if (verbose_p) fprintf (stderr, "%s: pam_setcred (...) ==> %d (%s)\n", blurb(), status2, PAM_STRERROR(pamh, status2)); } DONE: if (pamh) { int status2 = pam_end (pamh, status); pamh = 0; if (verbose_p) fprintf (stderr, "%s: pam_end (...) ==> %d (%s)\n", blurb(), status2, (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 */ } Bool pam_priv_init (int argc, char **argv, Bool verbose_p) { /* 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" 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 is unreadable or something (don't know if that actually happens.) */ const char dir[] = "/etc/pam.d"; const char file[] = "/etc/pam.d/" PAM_SERVICE_NAME; const char file2[] = "/etc/pam.conf"; struct stat st; # ifndef S_ISDIR # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) # endif if (stat (dir, &st) == 0 && S_ISDIR(st.st_mode)) { if (stat (file, &st) != 0) fprintf (stderr, "%s: warning: %s does not exist.\n" "%s: password authentication via PAM is unlikely to work.\n", blurb(), file, blurb()); } else if (stat (file2, &st) == 0) { FILE *f = fopen (file2, "r"); if (f) { Bool ok = False; char buf[255]; while (fgets (buf, sizeof(buf), f)) if (strstr (buf, PAM_SERVICE_NAME)) { ok = True; break; } fclose (f); if (!ok) { fprintf (stderr, "%s: warning: %s does not list the `%s' service.\n" "%s: password authentication via PAM is unlikely to work.\n", blurb(), file2, PAM_SERVICE_NAME, blurb()); } } /* else warn about file2 existing but being unreadable? */ } else { fprintf (stderr, "%s: warning: neither %s nor %s exist.\n" "%s: password authentication via PAM is unlikely to work.\n", blurb(), file2, file, blurb()); } /* Return true anyway, just in case. */ return True; } static int pam_conversation (int nmsgs, const struct pam_message **msg, struct pam_response **resp, void *vsaver_info) { int i, ret = -1; struct auth_message *messages = 0; struct auth_response *authresp = 0; struct pam_response *pam_responses; saver_info *si = (saver_info *) vsaver_info; Bool verbose_p; /* 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; /* Converting the PAM prompts into the XScreenSaver native format. * It was a design goal to collapse (INFO,PROMPT) pairs from PAM * into a single call to the unlock_cb function. The unlock_cb function * does that, but only if it is passed several prompts at a time. Most PAM * modules only send a single prompt at a time, but because there is no way * of telling whether there will be more prompts to follow, we can only ever * 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; if (verbose_p) fprintf (stderr, "%s: pam_conversation (", blurb()); for (i = 0; i < nmsgs; ++i) { if (verbose_p && i > 0) fprintf (stderr, ", "); messages[i].msg = msg[i]->msg; switch (msg[i]->msg_style) { case PAM_PROMPT_ECHO_OFF: messages[i].type = AUTH_MSGTYPE_PROMPT_NOECHO; if (verbose_p) fprintf (stderr, "ECHO_OFF"); break; case PAM_PROMPT_ECHO_ON: messages[i].type = AUTH_MSGTYPE_PROMPT_ECHO; if (verbose_p) fprintf (stderr, "ECHO_ON"); break; case PAM_ERROR_MSG: messages[i].type = AUTH_MSGTYPE_ERROR; if (verbose_p) fprintf (stderr, "ERROR_MSG"); break; case PAM_TEXT_INFO: messages[i].type = AUTH_MSGTYPE_INFO; if (verbose_p) fprintf (stderr, "TEXT_INFO"); break; default: messages[i].type = AUTH_MSGTYPE_PROMPT_ECHO; if (verbose_p) fprintf (stderr, "PROMPT_ECHO"); break; } if (verbose_p) fprintf (stderr, "=\"%s\"", msg[i]->msg ? msg[i]->msg : "(null)"); } 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; } end: 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); return PAM_CONV_ERR; } #endif /* NO_LOCKING -- whole file */ xscreensaver-5.42+dfsg1/driver/passwd-pwent.c000066400000000000000000000164261342162430400212570ustar00rootroot00000000000000/* passwd-pwent.c --- verifying typed passwords with the OS. * xscreensaver, Copyright (c) 1993-1998 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 #ifndef NO_LOCKING /* whole file */ #include #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_CRYPT_H # include #endif #include #include #include #ifndef VMS # include # include #else /* VMS */ # include "vms-pwd.h" #endif /* VMS */ #ifdef __bsdi__ # include # if _BSDI_VERSION >= 199608 # define BSD_AUTH # endif #endif /* __bsdi__ */ #if defined(HAVE_SHADOW_PASSWD) /* passwds live in /etc/shadow */ # include # define PWTYPE struct spwd * # define PWPSLOT sp_pwdp # define GETPW getspnam #elif defined(HAVE_ENHANCED_PASSWD) /* passwds live in /tcb/files/auth/ */ /* M.Matsumoto */ # include # include # define PWTYPE struct pr_passwd * # define PWPSLOT ufld.fd_encrypt # define GETPW getprpwnam #elif defined(HAVE_ADJUNCT_PASSWD) # include # include # include # define PWTYPE struct passwd_adjunct * # define PWPSLOT pwa_passwd # define GETPW getpwanam #elif defined(HAVE_HPUX_PASSWD) # include # include # define PWTYPE struct s_passwd * # define PWPSLOT pw_passwd # define GETPW getspwnam # define HAVE_BIGCRYPT #endif /* blargh */ #undef Bool #undef True #undef False #define Bool int #define True 1 #define False 0 extern const char *blurb(void); 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 #ifndef VMS static char * user_name (void) { /* I think that just checking $USER here is not the best idea. */ const char *u = 0; /* It has been reported that getlogin() returns the wrong user id on some very old SGI systems... And I've seen it return the string "rlogin" sometimes! Screw it, using getpwuid() should be enough... */ /* u = (char *) getlogin (); */ /* getlogin() fails if not attached to a terminal; in that case, use getpwuid(). (Note that in this case, we're not doing shadow stuff, since all we're interested in is the name, not the password. So that should still work. Right?) */ if (!u || !*u) { struct passwd *p = getpwuid (getuid ()); u = (p ? p->pw_name : 0); } 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) { return (pw && pw[0] != '*' && /* This would be sensible... */ strlen(pw) > 4); /* ...but this is what Solaris does. */ } static char * get_encrypted_passwd(const char *user) { char *result = 0; #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); } #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); } /* The manual for passwd(4) on HPUX 10.10 says: Password aging is put in effect for a particular user if his encrypted password in the password file is followed by a comma and a nonnull string of characters from the above alphabet. This string defines the "age" needed to implement password aging. So this means that passwd->pw_passwd isn't simply a string of cyphertext, it might have trailing junk. So, if there is a comma in the string, and that comma is beyond position 13, terminate the string before the comma. */ if (result && strlen(result) > 13) { char *s = strchr (result+13, ','); if (s) *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. */ if (!result) fprintf (stderr, "%s: couldn't get password of \"%s\"\n", blurb(), (user ? user : "(null)")); #endif /* !HAVE_PAM */ return result; } /* This has to be called before we've changed our effective user ID, because it might need privileges to get at the encrypted passwords. Returns false if we weren't able to get any passwords, and therefore, locking isn't possible. (It will also have written to stderr.) */ #ifndef VMS Bool pwent_priv_init (int argc, char **argv, Bool verbose_p) { char *u; #ifdef HAVE_ENHANCED_PASSWD set_auth_parameters(argc, argv); check_auth_parameters(); #endif /* HAVE_DEC_ENHANCED */ u = user_name(); encrypted_user_passwd = get_encrypted_passwd(u); encrypted_root_passwd = get_encrypted_passwd(ROOT); if (u) free (u); if (encrypted_user_passwd) return True; else return False; } Bool pwent_lock_init (int argc, char **argv, Bool verbose_p) { if (encrypted_user_passwd) return True; else return False; } static Bool passwds_match_p (const char *cleartext, const char *ciphertext) { char *s = 0; /* note that on some systems, crypt() may return null */ s = (char *) crypt (cleartext, ciphertext); if (s && !strcmp (s, ciphertext)) return True; #ifdef HAVE_BIGCRYPT /* There seems to be no way to tell at runtime if an HP machine is in "trusted" mode, and thereby, which of crypt() or bigcrypt() we should be calling to compare passwords. So call them both, and see which one works. */ s = (char *) bigcrypt (cleartext, ciphertext); if (s && !strcmp (s, ciphertext)) return True; #endif /* HAVE_BIGCRYPT */ return False; } /* This can be called at any time, and says whether the typed password belongs to either the logged in user (real uid, not effective); or to root. */ Bool pwent_passwd_valid_p (const char *typed_passwd, Bool verbose_p) { if (encrypted_user_passwd && passwds_match_p (typed_passwd, encrypted_user_passwd)) return True; #ifdef ALLOW_ROOT_PASSWD /* do not allow root to have a null password. */ else if (typed_passwd[0] && encrypted_root_passwd && passwds_match_p (typed_passwd, encrypted_root_passwd)) return True; #endif /* ALLOW_ROOT_PASSWD */ else return False; } #else /* VMS */ Bool pwent_lock_init (int argc, char **argv, Bool verbose_p) { return True; } #endif /* VMS */ #endif /* NO_LOCKING -- whole file */ xscreensaver-5.42+dfsg1/driver/passwd.c000066400000000000000000000254151342162430400201220ustar00rootroot00000000000000/* passwd.c --- verifying typed passwords with the OS. * xscreensaver, Copyright (c) 1993-2018 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 #ifndef NO_LOCKING /* whole file */ #include #include #include #ifdef HAVE_UNISTD_H # include #endif #include #include #include #ifndef VMS # include /* for getpwuid() */ #else /* VMS */ # include "vms-pwd.h" #endif /* VMS */ #ifdef HAVE_SYSLOG # include #endif /* HAVE_SYSLOG */ #include #include "xscreensaver.h" #include "auth.h" extern const char *blurb(void); extern void check_for_leaks (const char *where); /* 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))) 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 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.) */ struct auth_methods methods[] = { # ifdef HAVE_PAM { "PAM", 0, pam_priv_init, 0, pam_try_unlock, False, False }, # endif # ifdef HAVE_KERBEROS { "Kerberos", kerberos_lock_init, 0, kerberos_passwd_valid_p, 0, False, False }, # endif # ifdef PASSWD_HELPER_PROGRAM { "external", 0, ext_priv_init, ext_passwd_valid_p, 0, False, False }, # endif { "normal", pwent_lock_init, pwent_priv_init, pwent_passwd_valid_p, 0, False, False } }; # 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) { int i; Bool any_ok = False; for (i = 0; i < countof(methods); i++) { 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); 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) { int i; Bool any_ok = False; for (i = 0; i < countof(methods); i++) { if (!methods[i].priv_initted_p) /* Bail if lock_priv_init failed. */ continue; if (!methods[i].init) methods[i].initted_p = True; else methods[i].initted_p = methods[i].init (argc, argv, verbose_p); if (methods[i].initted_p) any_ok = True; else if (verbose_p) fprintf (stderr, "%s: initialization of %s passwords 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. */ static void try_unlock_password(saver_info *si, Bool verbose_p, Bool (*valid_p)(const char *typed_passwd, Bool verbose_p)) { struct auth_message message; struct auth_response *response = NULL; memset(&message, 0, sizeof(message)); if (verbose_p) fprintf(stderr, "%s: non-PAM password auth.\n", blurb()); /* 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); if (!response) return; 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->response) free(response->response); free(response); } /* Write a password failure to the system log. */ static void do_syslog (saver_info *si, Bool verbose_p) { # ifdef HAVE_SYSLOG struct passwd *pw = getpwuid (getuid ()); char *d = DisplayString (si->dpy); char *u = (pw && pw->pw_name ? pw->pw_name : "???"); int opt = 0; int fac = 0; # ifdef LOG_PID opt = LOG_PID; # endif # if defined(LOG_AUTHPRIV) fac = LOG_AUTHPRIV; # elif defined(LOG_AUTH) fac = LOG_AUTH; # else fac = LOG_DAEMON; # endif 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); 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(). */ void xss_authenticate(saver_info *si, Bool verbose_p) { int i, j; si->unlock_state = ul_read; 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); 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) { 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! */ fprintf (stderr, "%s: authentication via %s %s.\n", blurb(), methods[i].name, (si->unlock_state == ul_cancel ? "cancelled" : "timed out")); goto DONE; } } if (verbose_p) fprintf(stderr, "%s: All authentication mechanisms failed.\n", blurb()); 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); } DONE: if (si->auth_finished_cb) si->auth_finished_cb (si); } #endif /* NO_LOCKING -- whole file */ xscreensaver-5.42+dfsg1/driver/pdf2jpeg.m000066400000000000000000000111111342162430400203200ustar00rootroot00000000000000/* pdf2jpeg -- converts a PDF file to a JPEG file, using Cocoa * * Copyright (c) 2003, 2008 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. * * Inspired by clues provided by Jan Kujawa and Jonathan Hendry. */ #import #include #include int main (int argc, char** argv) { const char *progname = argv[0]; const char *infile = 0, *outfile = 0; double compression = 0.85; double scale = 1.0; int verbose = 0; int i; for (i = 1; i < argc; i++) { char c; if (argv[i][0] == '-' && argv[i][1] == '-') argv[i]++; if (!strcmp (argv[i], "-q") || !strcmp (argv[i], "-qual") || !strcmp (argv[i], "-quality")) { int q; if (1 != sscanf (argv[++i], " %d %c", &q, &c) || q < 5 || q > 100) { fprintf (stderr, "%s: quality must be 5 - 100 (%d)\n", progname, q); goto USAGE; } compression = q / 100.0; } else if (!strcmp (argv[i], "-scale")) { float s; if (1 != sscanf (argv[++i], " %f %c", &s, &c) || s <= 0 || s > 50) { fprintf (stderr, "%s: scale must be 0.0 - 50.0 (%f)\n", progname, s); goto USAGE; } scale = s; } else if (!strcmp (argv[i], "-verbose")) verbose++; else if (!strcmp (argv[i], "-v") || !strcmp (argv[i], "-vv") || !strcmp (argv[i], "-vvv")) verbose += strlen(argv[i])-1; else if (argv[i][0] == '-') { fprintf (stderr, "%s: unknown option %s\n", progname, argv[i]); goto USAGE; } else if (!infile) infile = argv[i]; else if (!outfile) outfile = argv[i]; else { USAGE: fprintf (stderr, "usage: %s [-verbose] [-scale N] [-quality NN] " "infile.pdf outfile.jpg\n", progname); exit (1); } } if (!infile || !outfile) goto USAGE; // Much of Cocoa needs one of these to be available. NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; //Need an NSApp instance to make [NSImage TIFFRepresentation] work NSApp = [NSApplication sharedApplication]; [NSApp autorelease]; if (verbose) fprintf (stderr, "%s: reading %s...\n", progname, infile); // Load the PDF file into an NSData object: NSData *pdf_data = [NSData dataWithContentsOfFile: [NSString stringWithCString:infile encoding:NSUTF8StringEncoding]]; // Create an NSPDFImageRep from the data: NSPDFImageRep *pdf_rep = [NSPDFImageRep imageRepWithData:pdf_data]; // Create an NSImage instance NSRect rect; rect.size = [pdf_rep size]; rect.size.width *= scale; rect.size.height *= scale; rect.origin.x = rect.origin.y = 0; NSImage *image = [[NSImage alloc] initWithSize:rect.size]; // Draw the PDFImageRep in the NSImage [image lockFocus]; [pdf_rep drawInRect:rect]; [image unlockFocus]; // Load the NSImage's contents into an NSBitmapImageRep: NSBitmapImageRep *bit_rep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; // Write the bitmapImageRep to a JPEG file: if (bit_rep == nil) { fprintf (stderr, "%s: error converting image?\n", argv[0]); exit (1); } if (verbose) fprintf (stderr, "%s: writing %s (%d%% quality)...\n", progname, outfile, (int) (compression * 100)); NSDictionary *props = [NSDictionary dictionaryWithObject: [NSNumber numberWithFloat:compression] forKey:NSImageCompressionFactor]; NSData *jpeg_data = [bit_rep representationUsingType:NSJPEGFileType properties:props]; [jpeg_data writeToFile: [NSString stringWithCString:outfile encoding:NSUTF8StringEncoding] atomically:YES]; [image release]; [pool release]; exit (0); } xscreensaver-5.42+dfsg1/driver/pdf2jpeg.man000066400000000000000000000026761342162430400206570ustar00rootroot00000000000000.TH XScreenSaver 1 "07-Sep-2003 (4.13)" "X Version 11" .SH NAME pdf2jpeg - converts a PDF file to a JPEG file using Cocoa .SH SYNOPSIS .B pdf2jpeg [\--verbose] [\--quality \fINN\fP] infile.pdf outfile.jpg .SH DESCRIPTION This reads a PDF file (for example, as written by the .BR screencapture (1) program) and writes a JPEG file. .SH OPTIONS .I pdf2jpeg accepts the following options: .TP 4 .B --verbose Print diagnostics. .TP 4 .B --quality \fINN\fP JPEG compression factor. Default 85%. .SH BUGS The input and output files must be files: pipes don't work. This program is Cocoa-specific, so it won't work on non-MacOS systems. This shouldn't need to be a part of the XScreenSaver distribution at all, but Apple is COMPLETELY INSANE and made .BR screencapture (1) only write PDFs, with no simple way to convert that to something less crazy. .SH SEE ALSO .BR screencapture (1), .BR xscreensaver\-getimage\-desktop (1) .SH COPYRIGHT Copyright \(co 2003 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 , 20-Oct-03. xscreensaver-5.42+dfsg1/driver/prefs.c000066400000000000000000001416571342162430400177470ustar00rootroot00000000000000/* dotfile.c --- management of the ~/.xscreensaver file. * xscreensaver, Copyright (c) 1998-2018 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 #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 #endif #include "version.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 (); struct passwd *p = getpwuid (uid); if (i_am_a_nobody (uid)) /* 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.) */ uid = 0; 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 ()); file = ""; } 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 : "???")); file = ""; } else { const char *home = p->pw_dir; 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); } } 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) { 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; } static int parse_init_file (saver_preferences *p) { 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; if (!name) return 0; if (stat(name, &st) != 0) { p->init_file_date = 0; return 0; } 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; } 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); return -1; } buf = (char *) malloc(buf_size); while (fgets (buf, buf_size-1, in)) { char *key, *value; int L = strlen(buf); line++; while (L > 2 && (buf[L-1] != '\n' || /* whole line didn't fit in buffer */ buf[L-2] == '\\')) /* or line ended with backslash */ { if (buf[L-2] == '\\') /* backslash-newline gets swallowed */ { buf[L-2] = 0; L -= 2; } buf_size += 1024; buf = (char *) realloc(buf, buf_size); if (!buf) exit(1); line++; if (!fgets (buf + L, buf_size-L-1, in)) break; L = strlen(buf); } /* Now handle other backslash escapes. */ { int i, j; for (i = 0; buf[i]; i++) if (buf[i] == '\\') { switch (buf[i+1]) { case 'n': buf[i] = '\n'; break; case 'r': buf[i] = '\r'; break; case 't': buf[i] = '\t'; break; default: buf[i] = buf[i+1]; break; } for (j = i+2; buf[j]; j++) buf[j-1] = buf[j]; buf[j-1] = 0; } } key = strip(buf); if (*key == '#' || *key == '!' || *key == ';' || *key == '\n' || *key == 0) continue; value = strchr (key, ':'); if (!value) { fprintf(stderr, "%s: %s:%d: unparsable line: %s\n", blurb(), name, line, key); continue; } else { *value++ = 0; value = strip(value); } if (!p->db) abort(); handle_entry (&p->db, key, value, name, line); } fclose (in); free(buf); p->init_file_date = write_date; 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); /* . */ } xscreensaver-5.42+dfsg1/driver/prefs.h000066400000000000000000000030451342162430400177400ustar00rootroot00000000000000/* xscreensaver, Copyright (c) 1993-2018 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_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); #endif /* __XSCREENSAVER_PREFS_H__ */ xscreensaver-5.42+dfsg1/driver/remote.c000066400000000000000000000345711342162430400201170ustar00rootroot00000000000000/* xscreensaver-command, Copyright (c) 1991-2009 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 #ifdef HAVE_SYS_SELECT_H # include #endif /* HAVE_SYS_SELECT_H */ #ifdef HAVE_UNISTD_H # include #endif #include /* for CARD32 */ #include #include #include /* for XGetClassHint() */ #include #include "remote.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; static XErrorHandler old_handler = 0; static Bool got_badwindow = False; static int BadWindow_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); } } static Window find_screensaver_window (Display *dpy, char **version) { 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; if (got_badwindow) { status = BadWindow; got_badwindow = False; } if (status == Success && type != None) { Window ret = kids[i]; if (version) *version = (char *) v; XFree (kids); return ret; } } if (kids) XFree (kids); return 0; } static int send_xscreensaver_command (Display *dpy, Atom command, long arg, Window *window_ret, char **error_ret) { int status = -1; char *v = 0; Window window = find_screensaver_window (dpy, &v); XWindowAttributes xgwa; char err[2048]; if (window_ret) *window_ret = window; if (!window) { sprintf (err, "no screensaver is running on display %s", DisplayString (dpy)); if (error_ret) { *error_ret = strdup (err); status = -1; goto DONE; } if (command == XA_EXIT) { /* Don't print an error if xscreensaver is already dead. */ status = 1; goto DONE; } fprintf (stderr, "%s: %s\n", progname, err); status = -1; goto DONE; } /* Select for property change events, so that we can read the response. */ XGetWindowAttributes (dpy, window, &xgwa); XSelectInput (dpy, window, xgwa.your_event_mask | PropertyChangeMask); if (command == XA_SCREENSAVER_STATUS || command == XA_SCREENSAVER_VERSION) { XClassHint hint; memset (&hint, 0, sizeof(hint)); if (!v || !*v) { sprintf (err, "version property not set on window 0x%x?", (unsigned int) window); if (error_ret) *error_ret = strdup (err); else fprintf (stderr, "%s: %s\n", progname, err); status = -1; goto DONE; } XGetClassHint(dpy, window, &hint); if (!hint.res_class) { sprintf (err, "class hints not set on window 0x%x?", (unsigned int) window); if (error_ret) *error_ret = strdup (err); else fprintf (stderr, "%s: %s\n", progname, err); status = -1; goto DONE; } fprintf (stdout, "%s %s", hint.res_class, v); if (command != XA_SCREENSAVER_STATUS) { fprintf (stdout, "\n"); } else { Atom type; int format; unsigned long nitems, bytesafter; unsigned char *dataP = 0; if (XGetWindowProperty (dpy, RootWindow (dpy, 0), XA_SCREENSAVER_STATUS, 0, 999, False, XA_INTEGER, &type, &format, &nitems, &bytesafter, &dataP) == Success && type && dataP) { Atom blanked; time_t tt; char *s; Atom *data = (Atom *) dataP; if (type != XA_INTEGER || nitems < 3) { STATUS_LOSE: if (data) free (data); fprintf (stdout, "\n"); fflush (stdout); fprintf (stderr, "bad status format on root window.\n"); status = -1; goto DONE; } blanked = (Atom) data[0]; tt = (time_t) data[1]; if (tt <= (time_t) 666000000L) /* early 1991 */ goto STATUS_LOSE; if (blanked == XA_BLANK) fputs (": screen blanked since ", stdout); else if (blanked == XA_LOCK) fputs (": screen locked since ", stdout); else if (blanked == 0) /* suggestions for a better way to phrase this are welcome. */ fputs (": screen non-blanked since ", stdout); else /* `blanked' has an unknown value - fail. */ goto STATUS_LOSE; s = ctime(&tt); if (s[strlen(s)-1] == '\n') s[strlen(s)-1] = 0; fputs (s, stdout); { int nhacks = nitems - 2; Bool any = False; int i; for (i = 0; i < nhacks; i++) if (data[i + 2] > 0) { any = True; break; } if (any && nhacks == 1) fprintf (stdout, " (hack #%d)\n", (int) data[2]); else if (any) { fprintf (stdout, " (hacks: "); for (i = 0; i < nhacks; i++) { fprintf (stdout, "#%d", (int) data[2 + i]); if (i != nhacks-1) fputs (", ", stdout); } fputs (")\n", stdout); } else fputs ("\n", stdout); } if (data) free (data); } else { if (dataP) XFree (dataP); fprintf (stdout, "\n"); fflush (stdout); fprintf (stderr, "no saver status on root window.\n"); status = -1; goto DONE; } } /* No need to read a response for these commands. */ status = 1; goto DONE; } else { XEvent event; long arg1 = arg; long arg2 = 0; if (arg < 0) abort(); else if (arg == 0 && command == XA_SELECT) abort(); else if (arg != 0 && command == XA_DEMO) { arg1 = 5000; /* version number of the XA_DEMO protocol, */ arg2 = arg; /* since it didn't use to take an argument. */ } event.xany.type = ClientMessage; event.xclient.display = dpy; event.xclient.window = window; event.xclient.message_type = XA_SCREENSAVER; event.xclient.format = 32; memset (&event.xclient.data, 0, sizeof(event.xclient.data)); 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)) { sprintf (err, "XSendEvent(dpy, 0x%x ...) failed.\n", (unsigned int) window); if (error_ret) *error_ret = strdup (err); else fprintf (stderr, "%s: %s\n", progname, err); status = -1; goto DONE; } } status = 0; DONE: if (v) free (v); XSync (dpy, 0); return status; } static Bool xscreensaver_command_event_p (Display *dpy, XEvent *event, XPointer arg) { return (event->xany.type == PropertyNotify && event->xproperty.state == PropertyNewValue && event->xproperty.atom == XA_SCREENSAVER_RESPONSE); } static int xscreensaver_command_response (Display *dpy, Window window, Bool verbose_p, Bool exiting_p, char **error_ret) { int sleep_count = 0; char err[2048]; XEvent event; Bool got_event = False; while (!(got_event = XCheckIfEvent(dpy, &event, &xscreensaver_command_event_p, 0)) && sleep_count++ < 10) { # if defined(HAVE_SELECT) /* Wait for an event, but don't wait longer than 1 sec. Note that we might do this multiple times if an event comes in, but it wasn't the event we're waiting for. */ int fd = XConnectionNumber(dpy); fd_set rset; struct timeval tv; tv.tv_sec = 1; tv.tv_usec = 0; FD_ZERO (&rset); FD_SET (fd, &rset); select (fd+1, &rset, 0, 0, &tv); # else /* !HAVE_SELECT */ sleep(1); # endif /* !HAVE_SELECT */ } if (!got_event) { sprintf (err, "no response to command."); if (error_ret) *error_ret = strdup (err); else fprintf (stderr, "%s: %s\n", progname, err); return -1; } else { Status st2; Atom type; int format; unsigned long nitems, bytesafter; unsigned char *msg = 0; XSync (dpy, False); if (old_handler) abort(); old_handler = XSetErrorHandler (BadWindow_ehandler); st2 = XGetWindowProperty (dpy, window, XA_SCREENSAVER_RESPONSE, 0, 1024, True, AnyPropertyType, &type, &format, &nitems, &bytesafter, &msg); XSync (dpy, False); XSetErrorHandler (old_handler); old_handler = 0; if (got_badwindow) { if (exiting_p) return 0; sprintf (err, "xscreensaver window unexpectedly deleted."); if (error_ret) *error_ret = strdup (err); else fprintf (stderr, "%s: %s\n", progname, err); return -1; } if (st2 == Success && type != None) { if (type != XA_STRING || format != 8) { sprintf (err, "unrecognized response property."); if (error_ret) *error_ret = strdup (err); else fprintf (stderr, "%s: %s\n", progname, err); if (msg) XFree (msg); return -1; } else if (!msg || (msg[0] != '+' && msg[0] != '-')) { sprintf (err, "unrecognized response message."); if (error_ret) *error_ret = strdup (err); else fprintf (stderr, "%s: %s\n", progname, err); if (msg) XFree (msg); return -1; } else { int ret = (msg[0] == '+' ? 0 : -1); sprintf (err, "%s: %s\n", progname, (char *) msg+1); if (error_ret) *error_ret = strdup (err); else if (verbose_p || ret != 0) fprintf ((ret < 0 ? stderr : stdout), "%s\n", err); XFree (msg); return ret; } } } return -1; /* warning suppression: not actually reached */ } int xscreensaver_command (Display *dpy, Atom command, long arg, Bool verbose_p, char **error_ret) { Window w = 0; int status = send_xscreensaver_command (dpy, command, arg, &w, error_ret); if (status == 0) status = xscreensaver_command_response (dpy, w, verbose_p, (command == XA_EXIT), error_ret); fflush (stdout); fflush (stderr); return (status < 0 ? status : 0); } void server_xscreensaver_version (Display *dpy, char **version_ret, char **user_ret, char **host_ret) { Window window = find_screensaver_window (dpy, 0); Atom type; int format; unsigned long nitems, bytesafter; if (version_ret) *version_ret = 0; if (user_ret) *user_ret = 0; if (host_ret) *host_ret = 0; if (!window) return; if (version_ret) { unsigned char *v = 0; XGetWindowProperty (dpy, window, XA_SCREENSAVER_VERSION, 0, 1, False, XA_STRING, &type, &format, &nitems, &bytesafter, &v); if (v) { *version_ret = strdup ((char *) v); XFree (v); } } if (user_ret || host_ret) { unsigned char *id = 0; const char *user = 0; const char *host = 0; XGetWindowProperty (dpy, window, XA_SCREENSAVER_ID, 0, 512, False, XA_STRING, &type, &format, &nitems, &bytesafter, &id); if (id && *id) { const char *old_tag = " on host "; const char *s = strstr ((char *) id, old_tag); if (s) { /* found ID of the form "1234 on host xyz". */ user = 0; host = s + strlen (old_tag); } else { char *o = 0, *p = 0, *c = 0; o = strchr ((char *) id, '('); if (o) p = strchr (o, '@'); if (p) c = strchr (p, ')'); if (c) { /* found ID of the form "1234 (user@host)". */ user = o+1; host = p+1; *p = 0; *c = 0; } } } if (user && *user && *user != '?') *user_ret = strdup (user); else *user_ret = 0; if (host && *host && *host != '?') *host_ret = strdup (host); else *host_ret = 0; if (id) XFree (id); } } xscreensaver-5.42+dfsg1/driver/remote.h000066400000000000000000000016061342162430400201150ustar00rootroot00000000000000/* xscreensaver-command, Copyright (c) 1991-1998 * 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. */ #ifndef _XSCREENSAVER_REMOTE_H_ #define _XSCREENSAVER_REMOTE_H_ extern int xscreensaver_command (Display *dpy, Atom command, long arg, Bool verbose_p, char **error_ret); extern void server_xscreensaver_version (Display *dpy, char **version_ret, char **user_ret, char **host_ret); #endif /* _XSCREENSAVER_REMOTE_H_ */ xscreensaver-5.42+dfsg1/driver/screens.c000066400000000000000000001030431342162430400202550ustar00rootroot00000000000000/* screens.c --- dealing with RANDR, Xinerama, and VidMode Viewports. * xscreensaver, Copyright (c) 1991-2008 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 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.) * * 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. * * 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.) * * 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. * * 3) Vidmode Viewports: * * 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). * * 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. * * Also, half the time it doesn't work at all: it tends 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. * * 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). * * 5a) Nvidia fucks it up: * * 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. * * 5b) Also sometimes RANDR says stupid shit like, "You have one * screen, and it has no available orientations or sizes." * */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #ifdef HAVE_RANDR # include #endif /* HAVE_RANDR */ #ifdef HAVE_XINERAMA # include #endif /* HAVE_XINERAMA */ #ifdef HAVE_XF86VMODE # 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. */ }; static Bool layouts_differ_p (monitor **a, monitor **b); static void free_monitors (monitor **monitors) { monitor **m2 = monitors; if (! monitors) return; while (*m2) { if ((*m2)->desc) free ((*m2)->desc); if ((*m2)->err) free ((*m2)->err); free (*m2); m2++; } free (monitors); } static char * append (char *s1, const char *s2) { char *s = (char *) malloc ((s1 ? strlen(s1) : 0) + (s2 ? strlen(s2) : 0) + 3); *s = 0; if (s1) strcat (s, s1); if (s1 && s2) strcat (s, "\n"); if (s2) strcat (s, s2); if (s1) free (s1); return s; } #ifdef HAVE_XINERAMA static monitor ** xinerama_scan_monitors (Display *dpy, char **errP) { Screen *screen = DefaultScreenOfDisplay (dpy); int event, error, nscreens, i; XineramaScreenInfo *xsi; monitor **monitors; if (! XineramaQueryExtension (dpy, &event, &error)) return 0; if (! XineramaIsActive (dpy)) return 0; xsi = XineramaQueryScreens (dpy, &nscreens); if (!xsi) return 0; monitors = (monitor **) calloc (nscreens + 1, sizeof(*monitors)); if (!monitors) return 0; for (i = 0; i < nscreens; i++) { monitor *m = (monitor *) calloc (1, sizeof (monitor)); monitors[i] = m; m->id = i; m->screen = screen; m->x = xsi[i].x_org; m->y = xsi[i].y_org; m->width = xsi[i].width; m->height = xsi[i].height; } return monitors; } #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 ** 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; 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 (! new_randr_p) /* RANDR 1.0 -- no Xinerama-like virtual screens. */ nscreens = ScreenCount (dpy); else /* RANDR 1.2 or newer -- built-in Xinerama */ { # 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 */ } if (nscreens <= 0) { *errP = append (*errP, "WARNING: RANDR reported no screens! Ignoring it."); return 0; } monitors = (monitor **) calloc (nscreens + 1, sizeof(*monitors)); if (!monitors) return 0; for (i = 0, j = 0; i < ScreenCount (dpy); i++) { Screen *screen = ScreenOfDisplay (dpy, i); if (! new_randr_p) /* RANDR 1.0 */ { XRRScreenConfiguration *rrc; monitor *m = (monitor *) calloc (1, sizeof (monitor)); monitors[i] = m; m->screen = screen; m->id = i; rrc = XRRGetScreenInfo (dpy, RootWindowOfScreen (screen)); if (rrc) { 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); } } 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 (crtci) XRRFreeCrtcInfo (crtci); XRRFreeOutputInfo (rroi); } XRRFreeScreenResources (res); # endif /* HAVE_RANDR_12 */ } } /* Work around more fucking brain damage. */ { int ok = 0; int i = 0; while (monitors[i]) { if (monitors[i]->width != 0 && monitors[i]->height != 0) ok++; i++; } if (! ok) { *errP = append (*errP, "WARNING: RANDR says all screens are 0x0! Ignoring it."); free_monitors (monitors); monitors = 0; } } return monitors; } #endif /* HAVE_RANDR */ static monitor ** basic_scan_monitors (Display *dpy, char **errP) { int nscreens = ScreenCount (dpy); int i; monitor **monitors = (monitor **) calloc (nscreens + 1, sizeof(*monitors)); if (!monitors) return 0; for (i = 0; i < nscreens; i++) { Screen *screen = ScreenOfDisplay (dpy, i); monitor *m = (monitor *) calloc (1, sizeof (monitor)); monitors[i] = m; m->id = i; m->screen = screen; m->x = 0; m->y = 0; m->width = WidthOfScreen (screen); m->height = HeightOfScreen (screen); } return monitors; } #if defined(HAVE_RANDR) && defined(HAVE_XINERAMA) /* From: Aaron Plattner Date: August 7, 2008 10:21:25 AM PDT To: linux-bugs@nvidia.com The NVIDIA X driver does not yet support RandR 1.2. The X server has a compatibility layer in it that allows RandR 1.2 clients to talk to RandR 1.1 drivers through an RandR 1.2 pseudo-output called "default". This reports the total combined resolution of the TwinView display, since it doesn't have any visibility into TwinView metamodes. There is no way for the driver to prevent the server from turning on this compatibility layer. The intention is for X client applications to continue to use the Xinerama extension to query the screen geometry. RandR 1.2 reports its own Xinerama info for this purpose. I would recommend against modifying xscreensaver to try to get this information from RandR. */ static monitor ** randr_versus_xinerama_fight (Display *dpy, monitor **randr_monitors, char **errP) { monitor **xinerama_monitors; if (!randr_monitors) return 0; xinerama_monitors = xinerama_scan_monitors (dpy, errP); if (!xinerama_monitors) return randr_monitors; if (! layouts_differ_p (randr_monitors, xinerama_monitors)) { free_monitors (xinerama_monitors); return randr_monitors; } else if ( randr_monitors[0] && !randr_monitors[1] && /* 1 monitor */ xinerama_monitors[0] && xinerama_monitors[1]) /* >1 monitor */ { *errP = append (*errP, "WARNING: RANDR reports 1 screen but Xinerama\n" "\t\treports multiple. Believing Xinerama."); free_monitors (randr_monitors); return xinerama_monitors; } else { *errP = append (*errP, "WARNING: RANDR and Xinerama report different\n" "\t\tscreen layouts! Believing RANDR."); free_monitors (xinerama_monitors); return randr_monitors; } } #endif /* HAVE_RANDR && HAVE_XINERAMA */ #ifdef DEBUG_MULTISCREEN /* If DEBUG_MULTISCREEN is defined, then in "-debug" mode, xscreensaver will pretend that it is changing the number of connected monitors every few seconds, using the geometries in the following list, for stress-testing purposes. */ static monitor ** debug_scan_monitors (Display *dpy, char **errP) { static const char * const geoms[] = { "1600x1028+0+22", "1024x768+0+22", "800x600+0+22", "800x600+0+22,800x600+800+22", "800x600+0+22,800x600+800+22,800x600+300+622", "800x600+0+22,800x600+800+22,800x600+0+622,800x600+800+622", "640x480+0+22,640x480+640+22,640x480+0+502,640x480+640+502", "640x480+240+22,640x480+0+502,640x480+640+502", "640x480+0+200,640x480+640+200", "800x600+400+22", "320x200+0+22,320x200+320+22,320x200+640+22,320x200+960+22,320x200+0+222,320x200+320+222,320x200+640+222,320x200+960+222,320x200+0+422,320x200+320+422,320x200+640+422,320x200+960+422,320x200+0+622,320x200+320+622,320x200+640+622,320x200+960+622,320x200+0+822,320x200+320+822,320x200+640+822,320x200+960+822" }; static int index = 0; monitor **monitors = (monitor **) calloc (100, sizeof(*monitors)); int nscreens = 0; Screen *screen = DefaultScreenOfDisplay (dpy); char *s = strdup (geoms[index]); char *token = strtok (s, ","); while (token) { monitor *m = calloc (1, sizeof (monitor)); char c; m->id = nscreens; m->screen = screen; if (4 != sscanf (token, "%dx%d+%d+%d%c", &m->width, &m->height, &m->x, &m->y, &c)) abort(); m->width -= 2; m->height -= 2; monitors[nscreens++] = m; token = strtok (0, ","); } free (s); index = (index+1) % countof(geoms); return monitors; } #endif /* DEBUG_MULTISCREEN */ #ifdef QUAD_MODE static monitor ** quadruple (monitor **monitors, Bool debug_p, char **errP) { int i, j, count = 0; monitor **monitors2; while (monitors[count]) count++; monitors2 = (monitor **) calloc (count * 4 + 1, sizeof(*monitors)); if (!monitors2) abort(); for (i = 0, j = 0; i < count; i++) { int k; for (k = 0; k < 4; k++) { monitors2[j+k] = (monitor *) calloc (1, sizeof (monitor)); *monitors2[j+k] = *monitors[i]; monitors2[j+k]->width /= (debug_p ? 4 : 2); monitors2[j+k]->height /= 2; monitors2[j+k]->id = (monitors[i]->id * 4) + k; monitors2[j+k]->name = (monitors[i]->name ? strdup (monitors[i]->name) : 0); } monitors2[j+1]->x += monitors2[j]->width; monitors2[j+2]->y += monitors2[j]->height; monitors2[j+3]->x += monitors2[j]->width; monitors2[j+3]->y += monitors2[j]->height; j += 4; } free_monitors (monitors); return monitors2; } #endif /* QUAD_MODE */ static monitor ** scan_monitors (saver_info *si) { saver_preferences *p = &si->prefs; monitor **monitors = 0; char *err = 0; # ifdef DEBUG_MULTISCREEN if (! monitors) monitors = debug_scan_monitors (si->dpy, &err); # endif # ifdef HAVE_RANDR if (! p->getviewport_full_of_lies_p) if (! monitors) monitors = randr_scan_monitors (si->dpy, &err); # ifdef HAVE_XINERAMA monitors = randr_versus_xinerama_fight (si->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); # endif if (! monitors) monitors = basic_scan_monitors (si->dpy, &err); # ifdef QUAD_MODE if (p->quad_p) monitors = quadruple (monitors, p->debug_p, &err); # endif if (monitors && err) monitors[0]->err = err; return monitors; } static Bool monitors_overlap_p (monitor *a, monitor *b) { /* Two rectangles overlap if the max of the tops is less than the min of the bottoms and the max of the lefts is less than the min of the rights. */ # undef MAX # undef MIN # define MAX(A,B) ((A)>(B)?(A):(B)) # define MIN(A,B) ((A)<(B)?(A):(B)) int maxleft = MAX(a->x, b->x); int maxtop = MAX(a->y, b->y); int minright = MIN(a->x + a->width - 1, b->x + b->width); int minbot = MIN(a->y + a->height - 1, b->y + b->height); return (maxtop < minbot && maxleft < minright); } static Bool plausible_aspect_ratio_p (monitor **monitors) { /* Modern wide-screen monitors come in the following aspect ratios: One monitor: If you tack a 640x480 monitor onto the right, the ratio is: 16 x 9 --> 1.78 852 x 480 --> 1.77 852+640 x 480 --> 3.11 "SD 480p" 1280 x 720 --> 1.78 1280+640 x 720 --> 2.67 "HD 720p" 1280 x 920 --> 1.39 1280+640 x 920 --> 2.09 1366 x 768 --> 1.78 1366+640 x 768 --> 2.61 "HD 768p" 1440 x 900 --> 1.60 1440+640 x 900 --> 2.31 1680 x 1050 --> 1.60 1680+640 x 1050 --> 2.21 1690 x 1050 --> 1.61 1690+640 x 1050 --> 2.22 1920 x 1080 --> 1.78 1920+640 x 1080 --> 2.37 "HD 1080p" 1920 x 1200 --> 1.60 1920+640 x 1200 --> 2.13 2560 x 1600 --> 1.60 2560+640 x 1600 --> 2.00 So that implies that if we ever see an aspect ratio >= 2.0, we can be pretty sure that the X server is lying to us, and that's actually two monitors, not one. */ if (monitors[0] && !monitors[1] && /* exactly 1 monitor */ monitors[0]->height && monitors[0]->width / (double) monitors[0]->height >= 1.9) return False; else return True; } /* Mark the ones that overlap, etc. */ static void check_monitor_sanity (monitor **monitors) { int i, j, count = 0; while (monitors[count]) count++; # define X1 monitors[i]->x # define X2 monitors[j]->x # define Y1 monitors[i]->y # define Y2 monitors[j]->y # define W1 monitors[i]->width # define W2 monitors[j]->width # define H1 monitors[i]->height # define H2 monitors[j]->height /* If a monitor is enclosed by any other monitor, that's insane. */ for (i = 0; i < count; i++) for (j = 0; j < count; j++) if (i != j && monitors[i]->sanity == S_SANE && monitors[j]->sanity == S_SANE && monitors[i]->screen == monitors[j]->screen && X2 >= X1 && Y2 >= Y1 && (X2+W2) <= (X1+W1) && (Y2+H2) <= (Y1+H1)) { if (X1 == X2 && Y1 == Y2 && W1 == W2 && H1 == H2) monitors[j]->sanity = S_DUPLICATE; else monitors[j]->sanity = S_ENCLOSED; monitors[j]->enemy = i; } /* After checking for enclosure, check for other lossage against earlier monitors. We do enclosure first so that we make sure to pick the larger one. */ for (i = 0; i < count; i++) for (j = 0; j < i; j++) { if (monitors[i]->sanity != S_SANE) continue; /* already marked */ if (monitors[j]->sanity != S_SANE) continue; if (monitors[i]->screen != monitors[j]->screen) continue; if (monitors_overlap_p (monitors[i], monitors[j])) { monitors[i]->sanity = S_OVERLAP; monitors[i]->enemy = j; } } /* Finally, make sure all monitors have sane positions and sizes. Xinerama sometimes reports 1024x768 VPs at -1936862040, -1953705044. */ for (i = 0; i < count; i++) { if (monitors[i]->sanity != S_SANE) continue; /* already marked */ if (X1 < 0 || Y1 < 0 || W1 <= 0 || H1 <= 0 || X1+W1 >= 0x7FFF || Y1+H1 >= 0x7FFF) { monitors[i]->sanity = S_OFFSCREEN; monitors[i]->enemy = 0; } } # undef X1 # undef X2 # undef Y1 # undef Y2 # undef W1 # undef W2 # undef H1 # undef H2 } static Bool layouts_differ_p (monitor **a, monitor **b) { if (!a || !b) return True; while (1) { if (!*a) break; if (!*b) break; if ((*a)->screen != (*b)->screen || (*a)->x != (*b)->x || (*a)->y != (*b)->y || (*a)->width != (*b)->width || (*a)->height != (*b)->height) return True; a++; b++; } if (*a) return True; if (*b) return True; return False; } void describe_monitor_layout (saver_info *si) { monitor **monitors = si->monitor_layout; int count = 0; int good_count = 0; int bad_count = 0; int implausible_p = !plausible_aspect_ratio_p (monitors); while (monitors[count]) { if (monitors[count]->sanity == S_SANE) good_count++; else bad_count++; count++; } if (monitors[0]->err) /* deferred error msg */ { char *token = strtok (monitors[0]->err, "\n"); while (token) { fprintf (stderr, "%s: %s\n", blurb(), token); token = strtok (0, "\n"); } free (monitors[0]->err); monitors[0]->err = 0; } if (count == 0) fprintf (stderr, "%s: no screens!\n", blurb()); else { int i; fprintf (stderr, "%s: screens in use: %d\n", blurb(), good_count); for (i = 0; i < count; i++) { monitor *m = monitors[i]; if (m->sanity != S_SANE) continue; fprintf (stderr, "%s: %3d/%d: %dx%d+%d+%d", blurb(), m->id, screen_number (m->screen), m->width, m->height, m->x, m->y); if (m->desc && *m->desc) fprintf (stderr, " (%s)", m->desc); fprintf (stderr, "\n"); } if (bad_count > 0) { fprintf (stderr, "%s: rejected screens: %d\n", blurb(), bad_count); for (i = 0; i < count; i++) { monitor *m = monitors[i]; monitor *e = monitors[m->enemy]; if (m->sanity == S_SANE) continue; fprintf (stderr, "%s: %3d/%d: %dx%d+%d+%d", blurb(), m->id, screen_number (m->screen), m->width, m->height, m->x, m->y); if (m->desc && *m->desc) fprintf (stderr, " (%s)", m->desc); fprintf (stderr, " -- "); switch (m->sanity) { case S_SANE: abort(); break; case S_ENCLOSED: fprintf (stderr, "enclosed by %d (%dx%d+%d+%d)\n", e->id, e->width, e->height, e->x, e->y); break; case S_DUPLICATE: fprintf (stderr, "duplicate of %d\n", e->id); break; case S_OVERLAP: fprintf (stderr, "overlaps %d (%dx%d+%d+%d)\n", e->id, e->width, e->height, e->x, e->y); break; case S_OFFSCREEN: fprintf (stderr, "off screen (%dx%d)\n", WidthOfScreen (e->screen), HeightOfScreen (e->screen)); break; case S_DISABLED: fprintf (stderr, "output disabled\n"); break; } } } if (implausible_p) fprintf (stderr, "%s: WARNING: single screen aspect ratio is %dx%d = %.2f\n" "%s: probable X server bug in Xinerama/RANDR!\n", blurb(), monitors[0]->width, monitors[0]->height, monitors[0]->width / (double) monitors[0]->height, 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; } xscreensaver-5.42+dfsg1/driver/screensaver-properties.desktop.in000066400000000000000000000003071342162430400251600ustar00rootroot00000000000000[Desktop Entry] Exec=xscreensaver-demo Icon=xscreensaver Terminal=false _Name=Screensaver _Comment=Change screensaver properties Type=Application Categories=Settings;DesktopSettings;Security;X-XFCE; xscreensaver-5.42+dfsg1/driver/setuid.c000066400000000000000000000246631342162430400201220ustar00rootroot00000000000000/* setuid.c --- management of runtime privileges. * xscreensaver, Copyright (c) 1993-1998, 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 * 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 /* 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 #endif #include /* for getpwnam() and struct passwd */ #include /* for getgrgid() and struct group */ static const char * uid_gid_string (uid_t uid, gid_t gid) { static char buf[255]; struct passwd *p = 0; struct group *g = 0; p = getpwuid (uid); g = getgrgid (gid); sprintf (buf, "%.100s/%.100s (%ld/%ld)", (p && p->pw_name ? p->pw_name : "???"), (g && g->gr_name ? g->gr_name : "???"), (long) uid, (long) gid); return buf; } 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 gids associated with the uid, e.g.: % groups root root : root bin daemon sys adm disk wheel However, setgroups() can only be called by root, and returns EPERM for other users even if the call would be a no-op (e.g., setting the group list to the current list.) So, to avoid that spurious error, before calling setgroups() we first check whether the current list of groups contains only one element, our target group. If so, we don't need to call setgroups(). */ static int setgroups_needed_p (uid_t target_group) { gid_t groups[1024]; int n, size; size = sizeof(groups) / sizeof(gid_t); n = getgroups (size - 1, groups); if (n < 0) { char buf [1024]; sprintf (buf, "%s: getgroups(%ld, ...)", blurb(), (long int)(size - 1)); perror (buf); return 1; } else if (n == 0) /* an empty list means only egid is in effect. */ return 0; else if (n == 1 && groups[0] == target_group) /* one element, the target */ return 0; else /* more than one, or the wrong one. */ return 1; } static int set_ids_by_number (uid_t uid, gid_t gid, char **message_ret) { int uid_errno = 0; int gid_errno = 0; int sgs_errno = 0; 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 systems really ought to be using -2 for "nobody", since that works. So, if we get a uid (or gid, for good measure) of -1, switch to -2 instead. Note that this must be done after we've looked up the user/group names with getpwuid(-1) and/or getgrgid(-1). */ if (gid == (gid_t) -1) gid = (gid_t) -2; if (uid == (uid_t) -1) uid = (uid_t) -2; errno = 0; if (setgroups_needed_p (gid) && setgroups (1, &gid) < 0) sgs_errno = errno ? errno : -1; errno = 0; if (setgid (gid) != 0) gid_errno = errno ? errno : -1; errno = 0; if (setuid (uid) != 0) uid_errno = errno ? errno : -1; 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; return 0; } else { char buf [1024]; gid_t groups[1024]; int n, size; if (sgs_errno) { sprintf (buf, "%s: couldn't setgroups to %.100s (%ld)", blurb(), (g && g->gr_name ? g->gr_name : "???"), (long) gid); if (sgs_errno == -1) fprintf(stderr, "%s: unknown error\n", buf); else { errno = sgs_errno; perror(buf); } fprintf (stderr, "%s: effective group list: ", blurb()); size = sizeof(groups) / sizeof(gid_t); n = getgroups (size - 1, groups); if (n < 0) fprintf (stderr, "unknown!\n"); else { int i; fprintf (stderr, "["); for (i = 0; i < n; i++) { g = getgrgid (groups[i]); if (i > 0) fprintf (stderr, ", "); if (g && g->gr_name) fprintf (stderr, "%s", g->gr_name); else fprintf (stderr, "%ld", (long) groups[i]); } fprintf (stderr, "]\n"); } } if (gid_errno) { sprintf (buf, "%s: couldn't set gid to %.100s (%ld)", blurb(), (g && g->gr_name ? g->gr_name : "???"), (long) gid); if (gid_errno == -1) fprintf(stderr, "%s: unknown error\n", buf); else { errno = gid_errno; perror(buf); } } if (uid_errno) { sprintf (buf, "%s: couldn't set uid to %.100s (%ld)", blurb(), (p && p->pw_name ? p->pw_name : "???"), (long) uid); if (uid_errno == -1) fprintf(stderr, "%s: unknown error\n", buf); else { errno = uid_errno; perror(buf); } } return -1; } } /* If we've been run as setuid or setgid to someone else (most likely root) turn off the extra permissions so that random user-specified programs don't get special privileges. (On some systems it is necessary to install this program as setuid root in order to read the passwd file to implement 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". */ void hack_uid (saver_info *si) { /* 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) { si->locking_disabled_p = True; si->nolock_reason = "running as root"; } /* 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 (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); } if (set_ids_by_number (p->pw_uid, p->pw_gid, &si->uid_message) != 0) saver_exit (si, -1, 0); } /* 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; } } } xscreensaver-5.42+dfsg1/driver/splash.c000066400000000000000000000664121342162430400201150ustar00rootroot00000000000000/* xscreensaver, Copyright (c) 1991-2018 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 "xscreensaver.h" #include "resources.h" #include "font-retry.h" #undef MAX #define MAX(a,b) ((a)>(b)?(a):(b)) 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); } int string_width (XFontStruct *font, char *s) { return XTextWidth(font, s, strlen(s)); } static void update_splash_window (saver_info *si); static void draw_splash_window (saver_info *si); static void destroy_splash_window (saver_info *si); static void unsplash_timer (XtPointer closure, XtIntervalId *id); static void do_demo (saver_screen_info *ssi); #ifdef PREFS_BUTTON static void do_prefs (saver_screen_info *ssi); #endif /* PREFS_BUTTON */ static void do_help (saver_screen_info *ssi); XFontStruct * splash_load_font (Display *dpy, char *name, char *class) { char *s = get_string_resource (dpy, name, class); XFontStruct *f; if (!s || !*s) s = "-*-helvetica-bold-r-*-*-*-140-*-*-*-*-*-*"; f = load_font_retry (dpy, s); if (!f) abort(); return f; } struct splash_dialog_data { saver_screen_info *prompt_screen; XtIntervalId timer; Dimension width; Dimension height; char *heading_label; char *body_label; char *body2_label; char *body3_label; char *body4_label; char *demo_label; #ifdef PREFS_BUTTON char *prefs_label; #endif /* PREFS_BUTTON */ char *help_label; XFontStruct *heading_font; XFontStruct *body_font; XFontStruct *button_font; Pixel foreground; Pixel background; Pixel border; Pixel button_foreground; Pixel button_background; Pixel shadow_top; Pixel shadow_bottom; Dimension logo_width; Dimension logo_height; Dimension internal_border; Dimension shadow_width; Dimension button_width, button_height; Dimension demo_button_x, demo_button_y; #ifdef PREFS_BUTTON Dimension prefs_button_x, prefs_button_y; #endif /* PREFS_BUTTON */ Dimension help_button_x, help_button_y; Pixmap logo_pixmap; Pixmap logo_clipmask; int logo_npixels; unsigned long *logo_pixels; int pressed; }; void make_splash_dialog (saver_info *si) { saver_preferences *p = &si->prefs; int x, y, bw; XSetWindowAttributes attrs; unsigned long attrmask = 0; splash_dialog_data *sp; saver_screen_info *ssi; Colormap cmap; Bool whyne = senesculent_p (); if (whyne) { /* If locking is not enabled, make sure they see the message. */ if (!p->lock_p) { si->prefs.splash_p = True; if (si->prefs.splash_duration < 5000) si->prefs.splash_duration = 5000; } si->prefs.splash_duration += 3000; } if (si->sp_data) return; if (!si->prefs.splash_p || si->prefs.splash_duration <= 0) return; ssi = &si->screens[mouse_screen (si)]; if (!ssi || !ssi->screen) return; /* WTF? Trying to splash while no screens connected? */ cmap = DefaultColormapOfScreen (ssi->screen); sp = (splash_dialog_data *) calloc (1, sizeof(*sp)); sp->prompt_screen = ssi; sp->heading_label = get_string_resource (si->dpy, "splash.heading.label", "Dialog.Label.Label"); sp->body_label = get_string_resource (si->dpy, "splash.body.label", "Dialog.Label.Label"); sp->body2_label = get_string_resource (si->dpy, "splash.body2.label", "Dialog.Label.Label"); sp->demo_label = get_string_resource (si->dpy, "splash.demo.label", "Dialog.Button.Label"); #ifdef PREFS_BUTTON sp->prefs_label = get_string_resource (si->dpy, "splash.prefs.label", "Dialog.Button.Label"); #endif /* PREFS_BUTTON */ sp->help_label = get_string_resource (si->dpy, "splash.help.label", "Dialog.Button.Label"); if (whyne) { sp->body3_label = strdup("WARNING: This version is very old!"); sp->body4_label = strdup("Please upgrade!"); } if (!sp->heading_label) sp->heading_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY"); if (!sp->body_label) sp->body_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY"); if (!sp->body2_label) sp->body2_label = strdup("ERROR: REESOURCES NOT INSTALLED CORRECTLY"); if (!sp->demo_label) sp->demo_label = strdup("ERROR"); #ifdef PREFS_BUTTON if (!sp->prefs_label) sp->prefs_label = strdup("ERROR"); #endif /* PREFS_BUTTON */ if (!sp->help_label) sp->help_label = strdup("ERROR"); /* Put the version number in the label. */ { char *s = (char *) malloc (strlen(sp->heading_label) + 20); sprintf(s, sp->heading_label, si->version); free (sp->heading_label); sp->heading_label = s; } sp->heading_font = splash_load_font (si->dpy, "splash.headingFont", "Dialog.Font"); sp->body_font = splash_load_font (si->dpy, "splash.bodyFont", "Dialog.Font"); sp->button_font = splash_load_font (si->dpy, "splash.buttonFont", "Dialog.Font"); sp->foreground = get_pixel_resource (si->dpy, cmap, "splash.foreground", "Dialog.Foreground"); sp->background = get_pixel_resource (si->dpy, cmap, "splash.background", "Dialog.Background"); sp->border = get_pixel_resource (si->dpy, cmap, "splash.borderColor", "Dialog.borderColor"); if (sp->foreground == sp->background) { /* Make sure the error messages show up. */ sp->foreground = BlackPixelOfScreen (ssi->screen); sp->background = WhitePixelOfScreen (ssi->screen); } sp->button_foreground = get_pixel_resource (si->dpy, cmap, "splash.Button.foreground", "Dialog.Button.Foreground"); sp->button_background = get_pixel_resource (si->dpy, cmap, "splash.Button.background", "Dialog.Button.Background"); sp->shadow_top = get_pixel_resource (si->dpy, cmap, "splash.topShadowColor", "Dialog.Foreground"); sp->shadow_bottom = get_pixel_resource (si->dpy, cmap, "splash.bottomShadowColor", "Dialog.Background"); sp->logo_width = get_integer_resource (si->dpy, "splash.logo.width", "Dialog.Logo.Width"); sp->logo_height = get_integer_resource (si->dpy, "splash.logo.height", "Dialog.Logo.Height"); sp->internal_border = get_integer_resource (si->dpy, "splash.internalBorderWidth", "Dialog.InternalBorderWidth"); sp->shadow_width = get_integer_resource (si->dpy, "splash.shadowThickness", "Dialog.ShadowThickness"); if (sp->logo_width == 0) sp->logo_width = 150; if (sp->logo_height == 0) sp->logo_height = 150; if (sp->internal_border == 0) sp->internal_border = 15; if (sp->shadow_width == 0) sp->shadow_width = 4; { int direction, ascent, descent; XCharStruct overall; sp->width = 0; sp->height = 0; /* Measure the heading_label. */ XTextExtents (sp->heading_font, sp->heading_label, strlen(sp->heading_label), &direction, &ascent, &descent, &overall); if (overall.width > sp->width) sp->width = overall.width; sp->height += ascent + descent; /* Measure the body_label. */ XTextExtents (sp->body_font, sp->body_label, strlen(sp->body_label), &direction, &ascent, &descent, &overall); if (overall.width > sp->width) sp->width = overall.width; sp->height += ascent + descent; /* Measure the body2_label. */ XTextExtents (sp->body_font, sp->body2_label, strlen(sp->body2_label), &direction, &ascent, &descent, &overall); if (overall.width > sp->width) sp->width = overall.width; sp->height += ascent + descent; /* Measure the optional body3_label. */ if (sp->body3_label) { XTextExtents (sp->heading_font, sp->body3_label, strlen(sp->body3_label), &direction, &ascent, &descent, &overall); if (overall.width > sp->width) sp->width = overall.width; XTextExtents (sp->heading_font, sp->body4_label, strlen(sp->body4_label), &direction, &ascent, &descent, &overall); if (overall.width > sp->width) sp->width = overall.width; sp->height += (ascent + descent) * 5; } { Dimension w2 = 0, w3 = 0, w4 = 0; Dimension h2 = 0, h3 = 0, h4 = 0; /* Measure the Demo button. */ XTextExtents (sp->button_font, sp->demo_label, strlen(sp->demo_label), &direction, &ascent, &descent, &overall); w2 = overall.width; h2 = ascent + descent; #ifdef PREFS_BUTTON /* Measure the Prefs button. */ XTextExtents (sp->button_font, sp->prefs_label, strlen(sp->prefs_label), &direction, &ascent, &descent, &overall); w3 = overall.width; h3 = ascent + descent; #else /* !PREFS_BUTTON */ w3 = 0; h3 = 0; #endif /* !PREFS_BUTTON */ /* Measure the Help button. */ XTextExtents (sp->button_font, sp->help_label, strlen(sp->help_label), &direction, &ascent, &descent, &overall); w4 = overall.width; h4 = ascent + descent; w2 = MAX(w2, w3); w2 = MAX(w2, w4); h2 = MAX(h2, h3); h2 = MAX(h2, h4); /* Add some horizontal padding inside the buttons. */ w2 += ascent; w2 += ((ascent + descent) / 2) + (sp->shadow_width * 2); h2 += ((ascent + descent) / 2) + (sp->shadow_width * 2); sp->button_width = w2; sp->button_height = h2; #ifdef PREFS_BUTTON w2 *= 3; #else /* !PREFS_BUTTON */ w2 *= 2; #endif /* !PREFS_BUTTON */ w2 += ((ascent + descent) * 2); /* for space between buttons */ if (w2 > sp->width) sp->width = w2; sp->height += h2; } sp->width += (sp->internal_border * 2); sp->height += (sp->internal_border * 3); if (sp->logo_height > sp->height) sp->height = sp->logo_height; else if (sp->height > sp->logo_height) sp->logo_height = sp->height; sp->logo_width = sp->logo_height; sp->width += sp->logo_width; } attrmask |= CWOverrideRedirect; attrs.override_redirect = True; attrmask |= CWEventMask; attrs.event_mask = (ExposureMask | ButtonPressMask | ButtonReleaseMask); { int sx = 0, sy = 0, w, h; x = ssi->x; y = ssi->y; w = ssi->width; h = ssi->height; if (si->prefs.debug_p) w /= 2; x = sx + (((w + sp->width) / 2) - sp->width); y = sy + (((h + sp->height) / 2) - sp->height); if (x < sx) x = sx; if (y < sy) y = sy; } bw = get_integer_resource (si->dpy, "splash.borderWidth", "Dialog.BorderWidth"); si->splash_dialog = XCreateWindow (si->dpy, RootWindowOfScreen(ssi->screen), x, y, sp->width, sp->height, bw, DefaultDepthOfScreen (ssi->screen), InputOutput, DefaultVisualOfScreen(ssi->screen), attrmask, &attrs); XSetWindowBackground (si->dpy, si->splash_dialog, sp->background); XSetWindowBorder (si->dpy, si->splash_dialog, sp->border); sp->logo_pixmap = xscreensaver_logo (ssi->screen, /* same visual as si->splash_dialog */ DefaultVisualOfScreen (ssi->screen), si->splash_dialog, cmap, sp->background, &sp->logo_pixels, &sp->logo_npixels, &sp->logo_clipmask, True); XMapRaised (si->dpy, si->splash_dialog); XSync (si->dpy, False); si->sp_data = sp; sp->timer = XtAppAddTimeOut (si->app, si->prefs.splash_duration, unsplash_timer, (XtPointer) si); draw_splash_window (si); XSync (si->dpy, False); } static void draw_splash_window (saver_info *si) { splash_dialog_data *sp = si->sp_data; XGCValues gcv; GC gc1, gc2; int vspacing, height; int x1, x2, x3, y1, y2; int sw; #ifdef PREFS_BUTTON int hspacing; int nbuttons = 3; #endif /* !PREFS_BUTTON */ height = (sp->heading_font->ascent + sp->heading_font->descent + sp->body_font->ascent + sp->body_font->descent + sp->body_font->ascent + sp->body_font->descent + sp->button_font->ascent + sp->button_font->descent); vspacing = ((sp->height - (4 * sp->shadow_width) - (2 * sp->internal_border) - height) / 5); if (vspacing < 0) vspacing = 0; if (vspacing > (sp->heading_font->ascent * 2)) vspacing = (sp->heading_font->ascent * 2); gcv.foreground = sp->foreground; gc1 = XCreateGC (si->dpy, si->splash_dialog, GCForeground, &gcv); gc2 = XCreateGC (si->dpy, si->splash_dialog, GCForeground, &gcv); x1 = sp->logo_width; x3 = sp->width - (sp->shadow_width * 2); y1 = sp->internal_border; /* top heading */ XSetFont (si->dpy, gc1, sp->heading_font->fid); sw = string_width (sp->heading_font, sp->heading_label); x2 = (x1 + ((x3 - x1 - sw) / 2)); y1 += sp->heading_font->ascent; XDrawString (si->dpy, si->splash_dialog, gc1, x2, y1, sp->heading_label, strlen(sp->heading_label)); y1 += sp->heading_font->descent; /* text below top heading */ XSetFont (si->dpy, gc1, sp->body_font->fid); y1 += vspacing + sp->body_font->ascent; sw = string_width (sp->body_font, sp->body_label); x2 = (x1 + ((x3 - x1 - sw) / 2)); XDrawString (si->dpy, si->splash_dialog, gc1, x2, y1, sp->body_label, strlen(sp->body_label)); y1 += sp->body_font->descent; y1 += sp->body_font->ascent; sw = string_width (sp->body_font, sp->body2_label); x2 = (x1 + ((x3 - x1 - sw) / 2)); XDrawString (si->dpy, si->splash_dialog, gc1, x2, y1, sp->body2_label, strlen(sp->body2_label)); y1 += sp->body_font->descent; if (sp->body3_label) { XSetFont (si->dpy, gc1, sp->heading_font->fid); y1 += sp->heading_font->ascent + sp->heading_font->descent; y1 += sp->heading_font->ascent; sw = string_width (sp->heading_font, sp->body3_label); x2 = (x1 + ((x3 - x1 - sw) / 2)); XDrawString (si->dpy, si->splash_dialog, gc1, x2, y1, sp->body3_label, strlen(sp->body3_label)); y1 += sp->heading_font->descent + sp->heading_font->ascent; sw = string_width (sp->heading_font, sp->body4_label); x2 = (x1 + ((x3 - x1 - sw) / 2)); XDrawString (si->dpy, si->splash_dialog, gc1, x2, y1, sp->body4_label, strlen(sp->body4_label)); y1 += sp->heading_font->descent; XSetFont (si->dpy, gc1, sp->body_font->fid); } /* The buttons */ XSetForeground (si->dpy, gc1, sp->button_foreground); XSetForeground (si->dpy, gc2, sp->button_background); /* y1 += (vspacing * 2);*/ y1 = sp->height - sp->internal_border - sp->button_height; x1 += sp->internal_border; y2 = (y1 + ((sp->button_height - (sp->button_font->ascent + sp->button_font->descent)) / 2) + sp->button_font->ascent); #ifdef PREFS_BUTTON hspacing = ((sp->width - x1 - (sp->shadow_width * 2) - sp->internal_border - (sp->button_width * nbuttons)) / 2); #endif x2 = x1 + ((sp->button_width - string_width(sp->button_font, sp->demo_label)) / 2); XFillRectangle (si->dpy, si->splash_dialog, gc2, x1, y1, sp->button_width, sp->button_height); XDrawString (si->dpy, si->splash_dialog, gc1, x2, y2, sp->demo_label, strlen(sp->demo_label)); sp->demo_button_x = x1; sp->demo_button_y = y1; #ifdef PREFS_BUTTON x1 += hspacing + sp->button_width; x2 = x1 + ((sp->button_width - string_width(sp->button_font,sp->prefs_label)) / 2); XFillRectangle (si->dpy, si->splash_dialog, gc2, x1, y1, sp->button_width, sp->button_height); XDrawString (si->dpy, si->splash_dialog, gc1, x2, y2, sp->prefs_label, strlen(sp->prefs_label)); sp->prefs_button_x = x1; sp->prefs_button_y = y1; #endif /* PREFS_BUTTON */ #ifdef PREFS_BUTTON x1 += hspacing + sp->button_width; #else /* !PREFS_BUTTON */ x1 = (sp->width - sp->button_width - sp->internal_border - (sp->shadow_width * 2)); #endif /* !PREFS_BUTTON */ x2 = x1 + ((sp->button_width - string_width(sp->button_font,sp->help_label)) / 2); XFillRectangle (si->dpy, si->splash_dialog, gc2, x1, y1, sp->button_width, sp->button_height); XDrawString (si->dpy, si->splash_dialog, gc1, x2, y2, sp->help_label, strlen(sp->help_label)); sp->help_button_x = x1; sp->help_button_y = y1; /* The logo */ x1 = sp->shadow_width * 6; y1 = sp->shadow_width * 6; x2 = sp->logo_width - (sp->shadow_width * 12); y2 = sp->logo_height - (sp->shadow_width * 12); if (sp->logo_pixmap) { Window root; int x, y; unsigned int w, h, bw, d; XGetGeometry (si->dpy, sp->logo_pixmap, &root, &x, &y, &w, &h, &bw, &d); XSetForeground (si->dpy, gc1, sp->foreground); XSetBackground (si->dpy, gc1, sp->background); XSetClipMask (si->dpy, gc1, sp->logo_clipmask); XSetClipOrigin (si->dpy, gc1, x1 + ((x2 - (int)w) /2), y1 + ((y2 - (int)h) / 2)); if (d == 1) XCopyPlane (si->dpy, sp->logo_pixmap, si->splash_dialog, gc1, 0, 0, w, h, x1 + ((x2 - (int)w) / 2), y1 + ((y2 - (int)h) / 2), 1); else XCopyArea (si->dpy, sp->logo_pixmap, si->splash_dialog, gc1, 0, 0, w, h, x1 + ((x2 - (int)w) / 2), y1 + ((y2 - (int)h) / 2)); } /* Solid border inside the logo box. */ #if 0 XSetForeground (si->dpy, gc1, sp->foreground); XDrawRectangle (si->dpy, si->splash_dialog, gc1, x1, y1, x2-1, y2-1); #endif /* The shadow around the logo */ draw_shaded_rectangle (si->dpy, si->splash_dialog, sp->shadow_width * 4, sp->shadow_width * 4, sp->logo_width - (sp->shadow_width * 8), sp->logo_height - (sp->shadow_width * 8), sp->shadow_width, sp->shadow_bottom, sp->shadow_top); /* The shadow around the whole window */ draw_shaded_rectangle (si->dpy, si->splash_dialog, 0, 0, sp->width, sp->height, sp->shadow_width, sp->shadow_top, sp->shadow_bottom); XFreeGC (si->dpy, gc1); XFreeGC (si->dpy, gc2); update_splash_window (si); } static void update_splash_window (saver_info *si) { splash_dialog_data *sp = si->sp_data; int pressed; if (!sp) return; pressed = sp->pressed; /* The shadows around the buttons */ draw_shaded_rectangle (si->dpy, si->splash_dialog, sp->demo_button_x, sp->demo_button_y, sp->button_width, sp->button_height, sp->shadow_width, (pressed == 1 ? sp->shadow_bottom : sp->shadow_top), (pressed == 1 ? sp->shadow_top : sp->shadow_bottom)); #ifdef PREFS_BUTTON draw_shaded_rectangle (si->dpy, si->splash_dialog, sp->prefs_button_x, sp->prefs_button_y, sp->button_width, sp->button_height, sp->shadow_width, (pressed == 2 ? sp->shadow_bottom : sp->shadow_top), (pressed == 2 ? sp->shadow_top : sp->shadow_bottom)); #endif /* PREFS_BUTTON */ draw_shaded_rectangle (si->dpy, si->splash_dialog, sp->help_button_x, sp->help_button_y, sp->button_width, sp->button_height, sp->shadow_width, (pressed == 3 ? sp->shadow_bottom : sp->shadow_top), (pressed == 3 ? sp->shadow_top : sp->shadow_bottom)); } static void destroy_splash_window (saver_info *si) { splash_dialog_data *sp = si->sp_data; saver_screen_info *ssi = sp->prompt_screen; Colormap cmap = DefaultColormapOfScreen (ssi->screen); Pixel black = BlackPixelOfScreen (ssi->screen); Pixel white = WhitePixelOfScreen (ssi->screen); if (sp->timer) XtRemoveTimeOut (sp->timer); if (si->splash_dialog) { XDestroyWindow (si->dpy, si->splash_dialog); si->splash_dialog = 0; } if (sp->heading_label) free (sp->heading_label); if (sp->body_label) free (sp->body_label); if (sp->body2_label) free (sp->body2_label); if (sp->body3_label) free (sp->body3_label); if (sp->body4_label) free (sp->body4_label); if (sp->demo_label) free (sp->demo_label); #ifdef PREFS_BUTTON if (sp->prefs_label) free (sp->prefs_label); #endif /* PREFS_BUTTON */ if (sp->help_label) free (sp->help_label); if (sp->heading_font) XFreeFont (si->dpy, sp->heading_font); if (sp->body_font) XFreeFont (si->dpy, sp->body_font); if (sp->button_font) XFreeFont (si->dpy, sp->button_font); if (sp->foreground != black && sp->foreground != white) XFreeColors (si->dpy, cmap, &sp->foreground, 1, 0L); if (sp->background != black && sp->background != white) XFreeColors (si->dpy, cmap, &sp->background, 1, 0L); if (sp->button_foreground != black && sp->button_foreground != white) XFreeColors (si->dpy, cmap, &sp->button_foreground, 1, 0L); if (sp->button_background != black && sp->button_background != white) XFreeColors (si->dpy, cmap, &sp->button_background, 1, 0L); if (sp->shadow_top != black && sp->shadow_top != white) XFreeColors (si->dpy, cmap, &sp->shadow_top, 1, 0L); if (sp->shadow_bottom != black && sp->shadow_bottom != white) XFreeColors (si->dpy, cmap, &sp->shadow_bottom, 1, 0L); if (sp->logo_pixmap) XFreePixmap (si->dpy, sp->logo_pixmap); if (sp->logo_clipmask) XFreePixmap (si->dpy, sp->logo_clipmask); if (sp->logo_pixels) { if (sp->logo_npixels) XFreeColors (si->dpy, cmap, sp->logo_pixels, sp->logo_npixels, 0L); free (sp->logo_pixels); sp->logo_pixels = 0; sp->logo_npixels = 0; } memset (sp, 0, sizeof(*sp)); free (sp); si->sp_data = 0; } void handle_splash_event (saver_info *si, XEvent *event) { splash_dialog_data *sp = si->sp_data; saver_screen_info *ssi; int which = 0; if (!sp) return; ssi = sp->prompt_screen; switch (event->xany.type) { case Expose: draw_splash_window (si); break; case ButtonPress: case ButtonRelease: if (event->xbutton.x >= sp->demo_button_x && event->xbutton.x < sp->demo_button_x + sp->button_width && event->xbutton.y >= sp->demo_button_y && event->xbutton.y < sp->demo_button_y + sp->button_height) which = 1; #ifdef PREFS_BUTTON else if (event->xbutton.x >= sp->prefs_button_x && event->xbutton.x < sp->prefs_button_x + sp->button_width && event->xbutton.y >= sp->prefs_button_y && event->xbutton.y < sp->prefs_button_y + sp->button_height) which = 2; #endif /* PREFS_BUTTON */ else if (event->xbutton.x >= sp->help_button_x && event->xbutton.x < sp->help_button_x + sp->button_width && event->xbutton.y >= sp->help_button_y && event->xbutton.y < sp->help_button_y + sp->button_height) which = 3; if (event->xany.type == ButtonPress) { sp->pressed = which; update_splash_window (si); if (which == 0) XBell (si->dpy, False); } else if (event->xany.type == ButtonRelease) { if (which && sp->pressed == which) { destroy_splash_window (si); sp = si->sp_data; switch (which) { case 1: do_demo (ssi); break; #ifdef PREFS_BUTTON case 2: do_prefs (ssi); break; #endif /* PREFS_BUTTON */ case 3: do_help (ssi); break; default: abort(); } } else if (which == 0 && sp->pressed == 0) { /* click and release on the window but not in a button: treat that as "dismiss the splash dialog." */ destroy_splash_window (si); sp = si->sp_data; } if (sp) sp->pressed = 0; update_splash_window (si); } break; default: break; } } static void unsplash_timer (XtPointer closure, XtIntervalId *id) { saver_info *si = (saver_info *) closure; if (si && si->sp_data) destroy_splash_window (si); } /* Button callbacks */ #ifdef VMS # define pid_t int # define fork vfork #endif /* VMS */ static void do_demo (saver_screen_info *ssi) { saver_info *si = ssi->global; saver_preferences *p = &si->prefs; const char *cmd = p->demo_command; if (cmd && *cmd) fork_and_exec (ssi, cmd); else fprintf (stderr, "%s: no demo-mode command has been specified.\n", blurb()); } #ifdef PREFS_BUTTON static void do_prefs (saver_screen_info *ssi) { saver_info *si = ssi->global; saver_preferences *p = &si->prefs; const char *cmd = p->prefs_command; if (command && *command) fork_and_exec (ssi, cmd); else fprintf (stderr, "%s: no preferences command has been specified.\n", blurb()); } #endif /* PREFS_BUTTON */ static void do_help (saver_screen_info *ssi) { saver_info *si = ssi->global; saver_preferences *p = &si->prefs; char *help_command = 0; if (!p->load_url_command || !*p->load_url_command) { fprintf (stderr, "%s: no URL command has been specified.\n", blurb()); return; } if (!p->help_url || !*p->help_url) { fprintf (stderr, "%s: no Help URL has been specified.\n", blurb()); return; } help_command = (char *) malloc (strlen (p->load_url_command) + (strlen (p->help_url) * 4) + 10); sprintf (help_command, p->load_url_command, p->help_url, p->help_url, p->help_url, p->help_url); fork_and_exec (ssi, help_command); free (help_command); } xscreensaver-5.42+dfsg1/driver/stderr.c000066400000000000000000000342031342162430400201170ustar00rootroot00000000000000/* stderr.c --- capturing stdout/stderr output onto the screensaver window. * xscreensaver, Copyright (c) 1991-2016 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. */ /* stderr hackery - Why Unix Sucks, reason number 32767. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #ifdef HAVE_UNISTD_H # include #endif #ifdef HAVE_FCNTL # include #endif #include #include "xscreensaver.h" #include "resources.h" #include "visual.h" FILE *real_stderr = 0; FILE *real_stdout = 0; /* It's ok for these to be global, since they refer to the one and only stderr stream, not to a particular screen or window or visual. */ static char stderr_buffer [4096]; static char *stderr_tail = 0; static time_t stderr_last_read = 0; static int stderr_stdout_read_fd = -1; static void make_stderr_overlay_window (saver_screen_info *); /* Recreates the stderr window or GCs: do this when the xscreensaver window on a screen has been re-created. */ void reset_stderr (saver_screen_info *ssi) { saver_info *si = ssi->global; if (si->prefs.debug_p) fprintf ((real_stderr ? real_stderr : stderr), "%s: resetting stderr\n", blurb()); ssi->stderr_text_x = 0; ssi->stderr_text_y = 0; if (ssi->stderr_gc) XFreeGC (si->dpy, ssi->stderr_gc); ssi->stderr_gc = 0; if (ssi->stderr_overlay_window) XDestroyWindow(si->dpy, ssi->stderr_overlay_window); ssi->stderr_overlay_window = 0; if (ssi->stderr_cmap) XFreeColormap(si->dpy, ssi->stderr_cmap); ssi->stderr_cmap = 0; } /* Erases any stderr text overlaying the screen (if possible) and resets the stderr output cursor to the upper left. Do this when the xscreensaver window is cleared. */ void clear_stderr (saver_screen_info *ssi) { saver_info *si = ssi->global; ssi->stderr_text_x = 0; ssi->stderr_text_y = 0; if (ssi->stderr_overlay_window) XClearWindow (si->dpy, ssi->stderr_overlay_window); } /* Draws the string on the screen's window. */ static void print_stderr_1 (saver_screen_info *ssi, char *string) { saver_info *si = ssi->global; Display *dpy = si->dpy; Screen *screen = ssi->screen; Window window = (ssi->stderr_overlay_window ? ssi->stderr_overlay_window : ssi->screensaver_window); int h_border = 20; int v_border = 20; char *head = string; char *tail; if (! ssi->stderr_font) { char *font_name = get_string_resource (dpy, "font", "Font"); if (!font_name) font_name = strdup ("fixed"); ssi->stderr_font = XLoadQueryFont (dpy, font_name); if (! ssi->stderr_font) ssi->stderr_font = XLoadQueryFont (dpy, "fixed"); ssi->stderr_line_height = (ssi->stderr_font->ascent + ssi->stderr_font->descent); free (font_name); } if (! ssi->stderr_gc) { XGCValues gcv; Pixel fg, bg; Colormap cmap = ssi->cmap; if (!ssi->stderr_overlay_window && get_boolean_resource(dpy, "overlayStderr", "Boolean")) { make_stderr_overlay_window (ssi); if (ssi->stderr_overlay_window) window = ssi->stderr_overlay_window; if (ssi->stderr_cmap) cmap = ssi->stderr_cmap; } fg = get_pixel_resource (dpy,cmap,"overlayTextForeground","Foreground"); bg = get_pixel_resource (dpy,cmap,"overlayTextBackground","Background"); gcv.font = ssi->stderr_font->fid; gcv.foreground = fg; gcv.background = bg; ssi->stderr_gc = XCreateGC (dpy, window, (GCFont | GCForeground | GCBackground), &gcv); } if (ssi->stderr_cmap) XInstallColormap(si->dpy, ssi->stderr_cmap); for (tail = string; *tail; tail++) { if (*tail == '\n' || *tail == '\r') { int maxy = HeightOfScreen (screen) - v_border - v_border; if (tail != head) XDrawImageString (dpy, window, ssi->stderr_gc, ssi->stderr_text_x + h_border, ssi->stderr_text_y + v_border + ssi->stderr_font->ascent, head, tail - head); ssi->stderr_text_x = 0; ssi->stderr_text_y += ssi->stderr_line_height; head = tail + 1; if (*tail == '\r' && *head == '\n') head++, tail++; if (ssi->stderr_text_y > maxy - ssi->stderr_line_height) { #if 0 ssi->stderr_text_y = 0; #else int offset = ssi->stderr_line_height * 5; XWindowAttributes xgwa; XGetWindowAttributes (dpy, window, &xgwa); XCopyArea (dpy, window, window, ssi->stderr_gc, 0, v_border + offset, xgwa.width, (xgwa.height - v_border - v_border - offset), 0, v_border); XClearArea (dpy, window, 0, xgwa.height - v_border - offset, xgwa.width, offset, False); ssi->stderr_text_y -= offset; #endif } } } if (tail != head) { int direction, ascent, descent; XCharStruct overall; XDrawImageString (dpy, window, ssi->stderr_gc, ssi->stderr_text_x + h_border, ssi->stderr_text_y + v_border + ssi->stderr_font->ascent, head, tail - head); XTextExtents (ssi->stderr_font, tail, tail - head, &direction, &ascent, &descent, &overall); ssi->stderr_text_x += overall.width; } } static void make_stderr_overlay_window (saver_screen_info *ssi) { saver_info *si = ssi->global; unsigned long transparent_pixel = 0; Visual *visual = get_overlay_visual (ssi->screen, &transparent_pixel); if (visual) { int depth = visual_depth (ssi->screen, visual); XSetWindowAttributes attrs; XWindowAttributes xgwa; unsigned long attrmask; XGetWindowAttributes (si->dpy, ssi->screensaver_window, &xgwa); if (si->prefs.debug_p) fprintf(real_stderr, "%s: using overlay visual 0x%0x for stderr text layer.\n", blurb(), (int) XVisualIDFromVisual (visual)); ssi->stderr_cmap = XCreateColormap(si->dpy, RootWindowOfScreen(ssi->screen), visual, AllocNone); attrmask = (CWColormap | CWBackPixel | CWBackingPixel | CWBorderPixel | CWBackingStore | CWSaveUnder); attrs.colormap = ssi->stderr_cmap; attrs.background_pixel = transparent_pixel; attrs.backing_pixel = transparent_pixel; attrs.border_pixel = transparent_pixel; attrs.backing_store = NotUseful; attrs.save_under = False; ssi->stderr_overlay_window = XCreateWindow(si->dpy, ssi->screensaver_window, 0, 0, xgwa.width, xgwa.height, 0, depth, InputOutput, visual, attrmask, &attrs); XMapRaised(si->dpy, ssi->stderr_overlay_window); } } /* Draws the string on each screen's window as error text. */ static void print_stderr (saver_info *si, char *string) { saver_preferences *p = &si->prefs; int i; /* In verbose mode, copy it to stderr as well. */ if (p->verbose_p) fprintf (real_stderr, "%s", string); for (i = 0; i < si->nscreens; i++) print_stderr_1 (&si->screens[i], string); } /* Polls the stderr buffer every few seconds and if it finds any text, writes it on all screens. */ static void stderr_popup_timer_fn (XtPointer closure, XtIntervalId *id) { saver_info *si = (saver_info *) closure; char *s = stderr_buffer; if (*s) { /* If too much data was printed, then something has gone haywire, so truncate it. */ char *trailer = "\n\n<< stderr diagnostics have been truncated >>\n\n"; int max = sizeof (stderr_buffer) - strlen (trailer) - 5; if (strlen (s) > max) strcpy (s + max, trailer); /* Now show the user. */ print_stderr (si, s); } stderr_tail = stderr_buffer; si->stderr_popup_timer = 0; } /* Called when data becomes available on the stderr pipe. Copies it into stderr_buffer where stderr_popup_timer_fn() can find it later. */ static void stderr_callback (XtPointer closure, int *fd, XtIntervalId *id) { saver_info *si = (saver_info *) closure; char *s; int left; int size; int read_this_time = 0; if (!fd || *fd < 0 || *fd != stderr_stdout_read_fd) abort(); if (stderr_tail == 0) stderr_tail = stderr_buffer; left = ((sizeof (stderr_buffer) - 2) - (stderr_tail - stderr_buffer)); s = stderr_tail; *s = 0; /* Read as much data from the fd as we can, up to our buffer size. */ if (left > 0) { while ((size = read (*fd, (void *) s, left)) > 0) { left -= size; s += size; read_this_time += size; } *s = 0; } else { char buf2 [1024]; /* The buffer is full; flush the rest of it. */ while (read (*fd, (void *) buf2, sizeof (buf2)) > 0) ; } stderr_tail = s; stderr_last_read = time ((time_t *) 0); /* Now we have read some data that we would like to put up in a dialog box. But more data may still be coming in - so don't pop up the dialog right now, but instead, start a timer that will pop it up a second from now. Should more data come in in the meantime, we will be called again, and will reset that timer again. So the dialog will only pop up when a second has elapsed with no new data being written to stderr. However, if the buffer is full (meaning lots of data has been written) then we don't reset the timer. */ if (read_this_time > 0) { if (si->stderr_popup_timer) XtRemoveTimeOut (si->stderr_popup_timer); si->stderr_popup_timer = XtAppAddTimeOut (si->app, 1 * 1000, stderr_popup_timer_fn, (XtPointer) si); } } /* If stderr capturing is desired, this replaces `stdout' and `stderr' with a pipe, so that any output written to them will show up on the screen as well as on the original value of those streams. */ void initialize_stderr (saver_info *si) { static Boolean done = False; int fds [2]; int in, out; int new_stdout, new_stderr; int stdout_fd = 1; int stderr_fd = 2; int flags = 0; Boolean stderr_dialog_p; if (done) return; done = True; real_stderr = stderr; real_stdout = stdout; stderr_dialog_p = get_boolean_resource (si->dpy, "captureStderr", "Boolean"); if (!stderr_dialog_p) return; if (pipe (fds)) { perror ("error creating pipe:"); return; } in = fds [0]; out = fds [1]; # ifdef HAVE_FCNTL # if defined(O_NONBLOCK) flags = O_NONBLOCK; # elif defined(O_NDELAY) flags = O_NDELAY; # else ERROR!! neither O_NONBLOCK nor O_NDELAY are defined. # endif /* Set both sides of the pipe to nonblocking - this is so that our reads (in stderr_callback) will terminate, and so that out writes (in the client programs) will silently fail when the pipe is full, instead of hosing the program. */ if (fcntl (in, F_SETFL, flags) != 0) { perror ("fcntl:"); return; } if (fcntl (out, F_SETFL, flags) != 0) { perror ("fcntl:"); return; } # endif /* !HAVE_FCNTL */ if (stderr_dialog_p) { FILE *new_stderr_file; FILE *new_stdout_file; new_stderr = dup (stderr_fd); if (new_stderr < 0) { perror ("could not dup() a stderr:"); return; } if (! (new_stderr_file = fdopen (new_stderr, "w"))) { perror ("could not fdopen() the new stderr:"); return; } real_stderr = new_stderr_file; close (stderr_fd); if (dup2 (out, stderr_fd) < 0) { perror ("could not dup() a new stderr:"); return; } new_stdout = dup (stdout_fd); if (new_stdout < 0) { perror ("could not dup() a stdout:"); return; } if (! (new_stdout_file = fdopen (new_stdout, "w"))) { perror ("could not fdopen() the new stdout:"); return; } real_stdout = new_stdout_file; close (stdout_fd); if (dup2 (out, stdout_fd) < 0) { perror ("could not dup() a new stdout:"); return; } close (out); } stderr_stdout_read_fd = in; XtAppAddInput (si->app, in, (XtPointer) XtInputReadMask, stderr_callback, (XtPointer) si); } /* If the "-log file" command-line option has been specified, open the file for append, and redirect stdout/stderr there. This is called very early, before initialize_stderr(). */ void stderr_log_file (saver_info *si) { int stdout_fd = 1; int stderr_fd = 2; const char *filename = get_string_resource (si->dpy, "logFile", "LogFile"); int fd; if (!filename || !*filename) return; fd = open (filename, O_WRONLY | O_APPEND | O_CREAT, 0666); if (fd < 0) { char buf[255]; FAIL: sprintf (buf, "%.100s: %.100s", blurb(), filename); perror (buf); fflush (stderr); fflush (stdout); exit (1); } fprintf (stderr, "%s: logging to file %s\n", blurb(), filename); if (dup2 (fd, stdout_fd) < 0) goto FAIL; if (dup2 (fd, stderr_fd) < 0) goto FAIL; fprintf (stderr, "\n\n" "##########################################################################\n" "%s: logging to \"%s\" at %s\n" "##########################################################################\n" "\n", blurb(), filename, timestring(0)); } /* If there is anything in the stderr buffer, flush it to the real stderr. This does no X operations. Call this when exiting to make sure any last words actually show up. */ void shutdown_stderr (saver_info *si) { fflush (stdout); fflush (stderr); if (!real_stderr || stderr_stdout_read_fd < 0) return; stderr_callback ((XtPointer) si, &stderr_stdout_read_fd, 0); if (stderr_tail && stderr_buffer < stderr_tail) { *stderr_tail = 0; fprintf (real_stderr, "%s", stderr_buffer); stderr_tail = stderr_buffer; } if (real_stdout) fflush (real_stdout); if (real_stderr) fflush (real_stderr); if (stdout != real_stdout) { dup2 (fileno(real_stdout), fileno(stdout)); fclose (real_stdout); real_stdout = stdout; } if (stderr != real_stderr) { dup2 (fileno(real_stderr), fileno(stderr)); fclose (real_stderr); real_stderr = stderr; } if (stderr_stdout_read_fd != -1) { close (stderr_stdout_read_fd); stderr_stdout_read_fd = -1; } } xscreensaver-5.42+dfsg1/driver/subprocs.c000066400000000000000000001115331342162430400204560ustar00rootroot00000000000000/* subprocs.c --- choosing, spawning, and killing screenhacks. * xscreensaver, Copyright (c) 1991-2017 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 /* not used for much... */ #ifndef ESRCH # include #endif #include /* sys/resource.h needs this for timeval */ #include /* for PATH_MAX */ #ifdef HAVE_SYS_WAIT_H # include /* for waitpid() and associated macros */ #endif #ifdef HAVE_SETRLIMIT # 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 #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); } #endif /* HAVE_SETRLIMIT && RLIMIT_AS */ } /* Management of child processes, and de-zombification. */ enum job_status { job_running, /* the process is still alive */ job_stopped, /* we have sent it a STOP signal */ job_killed, /* we have sent it a TERM signal */ job_dead /* we have wait()ed for it, and it's dead -- this state only occurs so that we can avoid calling free() from a signal handler. Shortly after going into this state, the list element will be removed. */ }; struct screenhack_job { char *name; pid_t pid; int screen; enum job_status status; time_t launched, killed; struct screenhack_job *next; }; static struct screenhack_job *jobs = 0; /* for debugging -- nothing calls this, but it's useful to invoke from gdb. */ void show_job_list (void); void show_job_list (void) { struct screenhack_job *job; 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, "\n"); } static void clean_job_list (void); static struct screenhack_job * make_job (pid_t pid, int screen, const char *cmd) { struct screenhack_job *job = (struct screenhack_job *) malloc (sizeof(*job)); static char name [1024]; const char *in = cmd; char *out = name; int got_eq = 0; clean_job_list(); AGAIN: while (isspace(*in)) in++; /* skip whitespace */ while (!isspace(*in) && *in != ':') { if (*in == '=') got_eq = 1; *out++ = *in++; /* snarf first token */ } if (got_eq) /* if the first token was FOO=bar */ { /* then get the next token instead. */ got_eq = 0; out = name; goto AGAIN; } while (isspace(*in)) in++; /* skip whitespace */ *out = 0; job->name = strdup(name); job->pid = pid; job->screen = screen; job->status = job_running; job->launched = time ((time_t *) 0); job->killed = 0; job->next = jobs; jobs = job; return jobs; } static void free_job (struct screenhack_job *job) { if (!job) return; else if (job == jobs) jobs = jobs->next; else { struct screenhack_job *job2, *prev; for (prev = 0, job2 = jobs; job2; prev = job2, job2 = job2->next) if (job2 == job) { prev->next = job->next; break; } } free(job->name); free(job); } /* Cleans out dead jobs from the jobs list -- this must only be called from the main thread, not from a signal handler. */ static void clean_job_list (void) { struct screenhack_job *job, *prev, *next; time_t now = time ((time_t *) 0); static time_t last_warn = 0; Bool warnedp = False; for (prev = 0, job = jobs, next = (job ? job->next : 0); job; prev = job, job = next, next = (job ? job->next : 0)) { if (job->status == job_dead) { if (prev) prev->next = next; free_job (job); job = prev; } else if (job->status == job_killed && now - job->killed > 10 && now - last_warn > 10) { fprintf (stderr, "%s: WARNING: pid %ld (%s) sent SIGTERM %ld seconds ago" " and did not die!\n", blurb(), (long) job->pid, job->name, (long) (now - job->killed)); warnedp = True; } } if (warnedp) last_warn = now; } static struct screenhack_job * find_job (pid_t pid) { struct screenhack_job *job; for (job = jobs; job; job = job->next) if (job->pid == pid) return job; 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--; } static int kill_job (saver_info *si, pid_t pid, int signal) { saver_preferences *p = &si->prefs; struct screenhack_job *job; int status = -1; 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 || job->status == job_killed) { if (p->verbose_p) fprintf (stderr, "%s: no child %ld to signal!\n", blurb(), (long) pid); goto DONE; } switch (signal) { case SIGTERM: job->status = job_killed; 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 */ default: abort(); } if (p->verbose_p) fprintf (stderr, "%s: %d: %s pid %lu (%s)\n", blurb(), job->screen, (job->status == job_killed ? "killing" : job->status == job_stopped ? "suspending" : "resuming"), (unsigned long) job->pid, job->name); status = kill (job->pid, signal); if (p->verbose_p && status < 0) { if (errno == ESRCH) fprintf (stderr, "%s: %d: child process %lu (%s) was already dead.\n", blurb(), job->screen, (unsigned long) job->pid, job->name); else { char buf [1024]; sprintf (buf, "%s: %d: couldn't kill child process %lu (%s)", blurb(), job->screen, (unsigned long) job->pid, job->name); perror (buf); } } 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) { saver_info *si = global_si_kludge; /* I hate C so much... */ in_signal_handler_p++; if (si->prefs.debug_p) { /* 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"); } if (block_sigchld_handler < 0) abort(); else if (block_sigchld_handler == 0) { block_sigchld(); await_dying_children (si); unblock_sigchld(); } init_sigchld(); in_signal_handler_p--; } #endif /* SIGCHLD */ #ifndef VMS static void await_dying_children (saver_info *si) { while (1) { int wait_status = 0; pid_t kid; errno = 0; kid = waitpid (-1, &wait_status, WNOHANG|WUNTRACED); 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"); } 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"); } } /* 0 means no more children to reap. -1 means error -- except "interrupted system call" isn't a "real" error, so if we get that, we should just try again. */ if (kid == 0 || (kid < 0 && errno != EINTR)) break; describe_dead_child (si, kid, wait_status); } } static void describe_dead_child (saver_info *si, pid_t kid, int wait_status) { 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; 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"); } if (job) job->status = job_dead; } else if (WIFSIGNALED (wait_status)) { if (p->verbose_p || !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"); } 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"); } if (job) job->status = job_stopped; } else { /* Don't call fprintf() from signal handlers, as it might malloc. 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. */ 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; } } #else /* VMS */ static void await_dying_children (saver_info *si) { return; } #endif /* VMS */ void init_sigchld (void) { #ifdef SIGCHLD # ifdef HAVE_SIGACTION /* Thanks to Tom Kelly */ static Bool sigchld_initialized_p = 0; if (!sigchld_initialized_p) { struct sigaction action, old; action.sa_handler = sigchld_handler; sigemptyset(&action.sa_mask); action.sa_flags = 0; 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 */ } 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; } static void print_path_error (const char *program) { 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"))) { # 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"); } } /* Executes the command in another process. Command may be any single command acceptable to /bin/sh. It may include wildcards, but no semicolons. If successful, the pid of the other process is returned. Otherwise, -1 is returned and an error may have been printed to stderr. */ pid_t fork_and_exec (saver_screen_info *ssi, const char *command) { saver_info *si = ssi->global; saver_preferences *p = &si->prefs; pid_t forked; switch ((int) (forked = fork ())) { case -1: { char buf [255]; sprintf (buf, "%s: couldn't fork", blurb()); perror (buf); break; } case 0: close (ConnectionNumber (si->dpy)); /* close display fd */ limit_subproc_memory (p->inferior_memory_limit, p->verbose_p); hack_subproc_environment (ssi->screen, ssi->screensaver_window); if (p->verbose_p) fprintf (stderr, "%s: %d: spawning \"%s\" in pid %lu.\n", blurb(), ssi->number, 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); exit (1); /* exits child fork */ break; default: /* parent */ (void) make_job (forked, ssi->number, command); break; } return forked; } void spawn_screenhack (saver_screen_info *ssi) { saver_info *si = ssi->global; saver_preferences *p = &si->prefs; XFlush (si->dpy); if (!monitor_powered_on_p (si)) { if (si->prefs.verbose_p) fprintf (stderr, "%s: %d: X says monitor has powered down; " "not launching a hack.\n", blurb(), ssi->number); return; } if (p->screenhacks_count) { screenhack *hack; pid_t forked; char buf [255]; int new_hack = -1; int retry_count = 0; Bool force = False; AGAIN: if (p->screenhacks_count < 1) { /* No hacks at all */ new_hack = -1; } else if (p->screenhacks_count == 1) { /* Exactly one hack in the list */ new_hack = 0; } else if (si->selection_mode == -1) { /* Select the next hack, wrapping. */ new_hack = (ssi->current_hack + 1) % p->screenhacks_count; } else if (si->selection_mode == -2) { /* Select the previous hack, wrapping. */ if (ssi->current_hack < 0) new_hack = p->screenhacks_count - 1; else new_hack = ((ssi->current_hack + p->screenhacks_count - 1) % p->screenhacks_count); } else if (si->selection_mode > 0) { /* Select a specific hack, by number (via the ACTIVATE command.) */ new_hack = ((si->selection_mode - 1) % p->screenhacks_count); force = True; } else if (p->mode == ONE_HACK && p->selected_hack >= 0) { /* Select a specific hack, by number (via "One Saver" mode.) */ new_hack = p->selected_hack; force = True; } else if (p->mode == BLANK_ONLY || p->mode == DONT_BLANK) { new_hack = -1; } else if (p->mode == RANDOM_HACKS_SAME && ssi->number != 0) { /* Use the same hack that's running on screen 0. (Assumes this function was called on screen 0 first.) */ new_hack = si->screens[0].current_hack; } else /* (p->mode == RANDOM_HACKS) */ { /* Select a random hack (but not the one we just ran.) */ while ((new_hack = random () % p->screenhacks_count) == ssi->current_hack) ; } if (new_hack < 0) /* don't run a hack */ { ssi->current_hack = -1; if (si->selection_mode < 0) si->selection_mode = 0; return; } ssi->current_hack = new_hack; hack = p->screenhacks[ssi->current_hack]; /* If the hack is disabled, or there is no visual for this hack, then try again (move forward, or backward, or re-randomize.) Unless this hack was specified explicitly, in which case, use it regardless. */ if (force) select_visual_of_hack (ssi, hack); if (!force && (!hack->enabled_p || !on_path_p (hack->command) || !select_visual_of_hack (ssi, hack))) { if (++retry_count > (p->screenhacks_count*4)) { /* Uh, oops. Odds are, there are no suitable visuals, and we're looping. Give up. (This is totally lame, what we should do is make a list of suitable hacks at the beginning, then only loop over them.) */ if (p->verbose_p) fprintf(stderr, "%s: %d: no programs enabled, or no suitable visuals.\n", blurb(), ssi->number); return; } else 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) { case -1: /* fork failed */ 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"); break; default: ssi->pid = forked; break; } } store_saver_status (si); /* store current hack number */ } void kill_screenhack (saver_screen_info *ssi) { saver_info *si = ssi->global; 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 */ } /* 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) { Bool any_running_p = False; int i; for (i = 0; i < si->nscreens; i++) { saver_screen_info *ssi = &si->screens[i]; if (ssi->pid) 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. */ 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) { pid_t forked; int fds [2]; int in, out; int errfds[2]; int errin = -1, errout = -1; char buf[1024]; char *av[10]; int ac = 0; av[ac++] = "xscreensaver-gl-helper"; av[ac] = 0; if (pipe (fds)) { perror ("error creating pipe:"); return 0; } in = fds [0]; out = fds [1]; if (!si->prefs.verbose_p) { if (pipe (errfds)) { perror ("error creating pipe:"); return 0; } errin = errfds [0]; 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); } case 0: { close (in); /* don't need this one */ close (ConnectionNumber (si->dpy)); /* close display fd */ if (dup2 (out, STDOUT_FILENO) < 0) /* pipe stdout */ { perror ("could not dup() a new stdout:"); return 0; } if (! si->prefs.verbose_p) { close(errin); if (dup2 (errout, STDERR_FILENO) < 0) { perror ("could not dup() a new stderr:"); return 0; } } hack_subproc_environment (screen, 0); /* set $DISPLAY */ execvp (av[0], av); /* shouldn't return. */ if (errno != ENOENT /* || si->prefs.verbose_p */ ) { /* Ignore "no such file or directory" errors. Issue all other exec errors, though. */ sprintf (buf, "%s: running %s", blurb(), av[0]); perror (buf); } exit (1); /* exits fork */ break; } default: { int result = 0; int wait_status = 0; pid_t pid = -1; FILE *f = fdopen (in, "r"); unsigned long v = 0; char c; close (out); /* don't need this one */ *buf = 0; if (! fgets (buf, sizeof(buf)-1, f)) *buf = 0; fclose (f); if (! si->prefs.verbose_p) { close (errout); close (errin); } /* 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. */ if (1 == sscanf (buf, "0x%lx %c", &v, &c)) result = (int) v; if (result == 0) { if (si->prefs.verbose_p) { int L = strlen(buf); fprintf (stderr, "%s: %s did not report a GL visual!\n", blurb(), av[0]); if (L && buf[L-1] == '\n') buf[--L] = 0; if (*buf) fprintf (stderr, "%s: %s said: \"%s\"\n", blurb(), av[0], buf); } return 0; } else { Visual *v = id_to_visual (screen, result); if (si->prefs.verbose_p) fprintf (stderr, "%s: %d: %s: GL visual is 0x%X%s.\n", blurb(), screen_number (screen), av[0], result, (v == DefaultVisualOfScreen (screen) ? " (default)" : "")); return v; } } } 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(); } } xscreensaver-5.42+dfsg1/driver/test-apm.c000066400000000000000000000046111342162430400203460ustar00rootroot00000000000000/* test-apm.c --- playing with the APM library. * xscreensaver, Copyright (c) 1999 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 #define countof(x) (sizeof((x))/sizeof(*(x))) char *progname = 0; 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 void apm_cb (XtPointer closure, int *fd, XtInputId *id) { apm_event_t events[100]; int n, i; while ((n = apm_get_events (*fd, 0, events, countof(events))) > 0) for (i = 0; i < n; i++) { fprintf (stderr, "%s: APM event 0x%x: %s.\n", blurb(), events[i], apm_event_name (events[i])); #if 0 switch (events[i]) { case APM_SYS_STANDBY: case APM_USER_STANDBY: case APM_SYS_SUSPEND: case APM_USER_SUSPEND: case APM_CRITICAL_SUSPEND: break; } #endif } } int main (int argc, char **argv) { XtAppContext app; Widget toplevel_shell = XtAppInitialize (&app, progclass, 0, 0, &argc, argv, 0, 0, 0); Display *dpy = XtDisplay (toplevel_shell); int fd; XtInputId id; XtGetApplicationNameAndClass (dpy, &progname, &progclass); fd = apm_open (); if (fd <= 0) { fprintf (stderr, "%s: couldn't initialize APM.\n", blurb()); exit (1); } id = XtAppAddInput(app, fd, (XtPointer) (XtInputReadMask | XtInputWriteMask), apm_cb, 0); XtAppMainLoop (app); exit (0); } xscreensaver-5.42+dfsg1/driver/test-fade.c000066400000000000000000000070751342162430400204770ustar00rootroot00000000000000/* test-fade.c --- playing with colormap and/or gamma fading. * xscreensaver, Copyright (c) 2001, 2004 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 "xscreensaver.h" #include "fade.h" #ifdef HAVE_SGI_VC_EXTENSION # include #endif #ifdef HAVE_XF86VMODE_GAMMA # include #endif XrmDatabase db = 0; char *progname = 0; char *progclass = "XScreenSaver"; #define SGI_VC_NAME "SGI-VIDEO-CONTROL" #define XF86_VIDMODE_NAME "XFree86-VidModeExtension" int main (int argc, char **argv) { int seconds = 3; int ticks = 20; int delay = 1; int op, event, error, major, minor; XtAppContext app; 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); db = XtDatabase (dpy); current_maps = (Colormap *) calloc(sizeof(Colormap), ScreenCount(dpy)); for (i = 0; i < ScreenCount(dpy); i++) current_maps[i] = DefaultColormap (dpy, i); 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); else { # ifdef HAVE_XF86VMODE_GAMMA if (!XF86VidModeQueryVersion (dpy, &major, &minor)) fprintf(stderr, "%s: unable to get " XF86_VIDMODE_NAME " version\n", progname); else fprintf(stderr, "%s: " XF86_VIDMODE_NAME " version %d.%d\n", progname, major, minor); # else /* !HAVE_XF86VMODE_GAMMA */ fprintf(stderr, "%s: no support for display's " XF86_VIDMODE_NAME " extension\n", progname); # endif /* !HAVE_XF86VMODE_GAMMA */ } fprintf (stderr, "%s: fading %d screen%s\n", progname, ScreenCount(dpy), ScreenCount(dpy) == 1 ? "" : "s"); while (1) { XSync (dpy, False); fprintf(stderr, "%s: out...", progname); fflush(stderr); fade_screens (dpy, current_maps, 0, 0, seconds, ticks, True, False); fprintf(stderr, "done.\n"); fflush(stderr); if (delay) sleep (delay); fprintf(stderr,"%s: in...", progname); fflush(stderr); fade_screens (dpy, current_maps, 0, 0, seconds, ticks, False, False); fprintf(stderr, "done.\n"); fflush(stderr); if (delay) sleep (delay); } } xscreensaver-5.42+dfsg1/driver/test-grab.c000066400000000000000000000056611342162430400205120ustar00rootroot00000000000000/* test-uid.c --- playing with grabs. * xscreensaver, Copyright (c) 1999, 2004 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 char *progname = 0; char *progclass = "XScreenSaver"; #define ALL_POINTER_EVENTS \ (ButtonPressMask | ButtonReleaseMask | EnterWindowMask | \ LeaveWindowMask | PointerMotionMask | PointerMotionHintMask | \ Button1MotionMask | Button2MotionMask | Button3MotionMask | \ Button4MotionMask | Button5MotionMask | ButtonMotionMask) int main (int argc, char **argv) { XtAppContext app; int kstatus, mstatus; Cursor cursor = 0; int delay = 60 * 15; 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" : "???")); XSync(dpy, False); if (kstatus == GrabSuccess || mstatus == GrabSuccess) { 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); } exit (0); } xscreensaver-5.42+dfsg1/driver/test-mlstring.c000066400000000000000000000226231342162430400214330ustar00rootroot00000000000000/* * (c) 2007, Quest Software, Inc. All rights reserved. * * This file is part of XScreenSaver, * Copyright (c) 1993-2004 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. */ #include #include #include #include "mlstring.c" /* hokey, but whatever */ #define WRAP_WIDTH_PX 100 #undef Bool #undef True #undef False typedef int Bool; #define True 1 #define False 0 #define SKIPPED -1 #define SUCCESS 0 #define FAILURE 1 #define FAIL(msg, ...) \ do { \ ++failcount; \ fprintf(stderr, "[FAIL] "); \ fprintf(stderr, msg, __VA_ARGS__); \ putc('\n', stderr); \ return FAILURE; \ } while (0) #define SUCCEED(testname) \ do { \ fprintf(stderr, "[SUCCESS] %s\n", (testname)); \ } while (0) #define SKIP(testname) \ do { \ fprintf(stderr, "[SKIPPED] %s\n", (testname)); \ } while (0) extern mlstring* mlstring_allocate(const char *msg); extern void mlstring_wrap(mlstring *mstr, XFontStruct *font, Dimension width); static int failcount = 0; static char *mlstring_to_cstr(const mlstring *mlstr) { char *cstr; size_t cstrlen = 0, alloclen = 1024; const struct mlstr_line *line; cstr = malloc(alloclen); if (!cstr) return NULL; cstr[0] = '\0'; for (line = mlstr->lines; line; line = line->next_line) { /* Extend the buffer if necessary. */ if (cstrlen + strlen(line->line) + 1 > alloclen) { cstr = realloc(cstr, alloclen *= 2); if (!cstr) return NULL; } /* If this is not the first line */ if (line != mlstr->lines) { /* Append a newline character */ cstr[cstrlen] = '\n'; ++cstrlen; cstr[cstrlen] = '\0'; } strcat(cstr, line->line); cstrlen += strlen(line->line); } return cstr; } /* Pass -1 for expect_min or expect_exact to not check that value. * expect_empty_p means an empty line is expected at some point in the string. * Also ensures that the string was not too wide after wrapping. */ static int mlstring_expect_lines(const mlstring *mlstr, int expect_min, int expect_exact, Bool expect_empty_p) { int count; Bool got_empty_line = False; const struct mlstr_line *line = mlstr->lines; for (count = 0; line; line = line->next_line) { if (line->line[0] == '\0') { if (!expect_empty_p) FAIL("Not expecting empty lines, but got one on line %d of [%s]", count + 1, mlstring_to_cstr(mlstr)); got_empty_line = True; } ++count; } if (expect_empty_p && !got_empty_line) FAIL("Expecting an empty line, but none found in [%s]", mlstring_to_cstr(mlstr)); if (expect_exact != -1 && expect_exact != count) FAIL("Expected %d lines, got %d", expect_exact, count); if (expect_min != -1 && count < expect_min) FAIL("Expected at least %d lines, got %d", expect_min, count); return SUCCESS; } static int mlstring_expect(const char *msg, int expect_lines, const mlstring *mlstr, Bool expect_empty_p) { char *str, *str_top; const struct mlstr_line *cur; int linecount = 0; /* Duplicate msg so we can chop it up */ str_top = strdup(msg); if (!str_top) return SKIPPED; /* Replace all newlines with NUL */ str = str_top; while ((str = strchr(str, '\n'))) *str++ = '\0'; /* str is now used to point to the expected string */ str = str_top; for (cur = mlstr->lines; cur; cur = cur->next_line) { ++linecount; if (strcmp(cur->line, str)) FAIL("lines didn't match; expected [%s], got [%s]", str, cur->line); str += strlen(str) + 1; /* Point to the next expected string */ } free(str_top); return mlstring_expect_lines(mlstr, -1, expect_lines, expect_empty_p); } /* Ensures that the width has been set properly after wrapping */ static int check_width(const char *msg, const mlstring *mlstr) { if (mlstr->overall_width == 0) FAIL("Overall width was zero for string [%s]", msg); if (mlstr->overall_width > WRAP_WIDTH_PX) FAIL("Overall width was %hu but the maximum wrap width was %d", mlstr->overall_width, WRAP_WIDTH_PX); return SUCCESS; } /* FAIL() actually returns the wrong return codes in main, but it * prints a message which is what we want. */ #define TRY_NEW(str, numl, expect_empty) \ do { \ mlstr = mlstring_allocate((str)); \ if (!mlstr) \ FAIL("%s", #str); \ if (SUCCESS == mlstring_expect((str), (numl), mlstr, (expect_empty))) \ SUCCEED(#str); \ free(mlstr); \ } while (0) /* Expects an XFontStruct* font, and tries to wrap to 100px */ #define TRY_WRAP(str, minl, expect_empty) \ do { \ mltest = mlstring_allocate((str)); \ if (!mltest) \ SKIP(#str); \ else { \ mlstring_wrap(mltest, font, WRAP_WIDTH_PX); \ check_width((str), mltest); \ if (SUCCESS == mlstring_expect_lines(mltest, (minl), -1, (expect_empty))) \ SUCCEED(#str); \ free(mltest); \ mltest = NULL; \ } \ } while (0) /* Ideally this function would use stub functions rather than real Xlib. * Then it would be possible to test for exact line counts, which would be * more reliable. * It also doesn't handle Xlib errors. * * Don't print anything based on the return value of this function, it only * returns a value so that I can use the FAIL() macro without warning. * * Anyone who understands this function wins a cookie ;) */ static int test_wrapping(void) { Display *dpy = NULL; XFontStruct *font = NULL; mlstring *mltest = NULL; int ok = 0; int chars_per_line, chars_first_word, i; const char *test_short = "a"; const char *test_hardwrap = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; const char *test_withnewlines = "a\nb"; char *test_softwrap = NULL; dpy = XOpenDisplay(NULL); if (!dpy) goto end; font = XLoadQueryFont(dpy, "fixed"); if (!font) goto end; TRY_WRAP(test_short, 1, False); TRY_WRAP(test_hardwrap, 2, False); TRY_WRAP(test_withnewlines, 2, False); /* See if wrapping splits on word boundaries like it should */ chars_per_line = WRAP_WIDTH_PX / font->max_bounds.width; if (chars_per_line < 3) goto end; /* Allocate for 2 lines + \0 */ test_softwrap = malloc(chars_per_line * 2 + 1); if (!test_softwrap) goto end; /* 2 = strlen(' a'); that is, the minimum space required to start a new word * on the same line. */ chars_first_word = chars_per_line - 2; for (i = 0; i < chars_first_word; ++i) { test_softwrap[i] = 'a'; /* first word */ test_softwrap[i + chars_per_line] = 'b'; /* second word */ } /* space between first & second words */ test_softwrap[chars_first_word] = ' '; /* first char of second word (last char of first line) */ test_softwrap[chars_first_word + 1] = 'b'; /* after second word */ test_softwrap[chars_per_line * 2] = '\0'; mltest = mlstring_allocate(test_softwrap); mlstring_wrap(mltest, font, WRAP_WIDTH_PX); /* reusing 'i' for a moment here to make freeing mltest easier */ i = strlen(mltest->lines->line); free(mltest); if (i != chars_first_word) FAIL("Soft wrap failed, expected the first line to be %d chars, but it was %d.", chars_first_word, i); SUCCEED("Soft wrap"); ok = 1; end: if (test_softwrap) free(test_softwrap); if (font) XFreeFont(dpy, font); if (dpy) XCloseDisplay(dpy); if (!ok) SKIP("wrapping"); return ok ? SUCCESS : SKIPPED; /* Unused, actually */ } int main(int argc, char *argv[]) { const char *oneline = "1Foo"; const char *twolines = "2Foo\nBar"; const char *threelines = "3Foo\nBar\nWhippet"; const char *trailnewline = "4Foo\n"; const char *trailnewlines = "5Foo\n\n"; const char *embeddednewlines = "6Foo\n\nBar"; mlstring *mlstr; TRY_NEW(oneline, 1, False); TRY_NEW(twolines, 2, False); TRY_NEW(threelines, 3, False); TRY_NEW(trailnewline, 2, True); TRY_NEW(trailnewlines, 3, True); TRY_NEW(embeddednewlines, 3, True); (void) test_wrapping(); fprintf(stdout, "%d test failures.\n", failcount); return !!failcount; } /* vim:ts=8:sw=2:noet */ xscreensaver-5.42+dfsg1/driver/test-passwd.c000066400000000000000000000210231342162430400210660ustar00rootroot00000000000000/* xscreensaver, Copyright (c) 1998-2017 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 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 # include "config.h" #endif #include #include #include #include #include #include #include #include #include #include "xscreensaver.h" #include "resources.h" #include "version.h" #include "visual.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; void idle_timer (XtPointer closure, XtIntervalId *id) { 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 i; 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 }; 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; memset(&sip, 0, sizeof(sip)); memset(&ssip, 0, sizeof(ssip)); si->nscreens = 1; si->screens = si->default_screen = &ssip; ssip.global = si; global_si_kludge = si; real_stderr = stderr; real_stdout = stdout; 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 progclass = "XScreenSaver"; if (!setlocale (LC_CTYPE, "")) fprintf (stderr, "%s: warning: could not set default locale\n", progname); 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); ssip.width = WidthOfScreen(ssip.screen); ssip.height = HeightOfScreen(ssip.screen); db = p->db; XtGetApplicationNameAndClass (si->dpy, &progname, &progclass); load_init_file (si->dpy, &si->prefs); } p->verbose_p = True; pw = getpwuid (getuid ()); si->user = strdup (pw->pw_name); /* si->nscreens = 0; si->screens = si->default_screen = 0; */ while (1) { #ifndef NO_LOCKING if (which == PASS) { si->unlock_cb = gui_auth_conv; si->auth_finished_cb = auth_finished_cb; 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); } xscreensaver-5.42+dfsg1/driver/test-randr.c000066400000000000000000000264631342162430400207100ustar00rootroot00000000000000/* test-randr.c --- playing with the Resize And Rotate extension. * xscreensaver, Copyright (c) 2004-2008 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 char *progname = 0; 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 ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error) { error_handler_hit_p = True; return 0; } int main (int argc, char **argv) { int event_number = -1, error_number = -1; int major = -1, minor = -1; int nscreens = 0; int i; XtAppContext app; Widget toplevel_shell = XtAppInitialize (&app, progclass, 0, 0, &argc, argv, 0, 0, 0); Display *dpy = XtDisplay (toplevel_shell); XtGetApplicationNameAndClass (dpy, &progname, &progclass); 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", blurb()); major = -1; } else { fprintf(stderr, "%s: XRRQueryExtension(dpy, ...) ==> %d, %d\n", blurb(), event_number, error_number); if (!XRRQueryVersion(dpy, &major, &minor)) { fprintf(stderr, "%s: XRRQueryVersion(dpy, ...) ==> False\n", blurb()); fprintf(stderr, "%s: server didn't report RANDR version numbers?\n", blurb()); } else fprintf(stderr, "%s: XRRQueryVersion(dpy, ...) ==> %d, %d\n", blurb(), major, minor); } for (i = 0; i < nscreens; i++) { XRRScreenConfiguration *rrc; XErrorHandler old_handler; XSync (dpy, False); error_handler_hit_p = False; old_handler = XSetErrorHandler (ignore_all_errors_ehandler); rrc = (major >= 0 ? XRRGetScreenInfo (dpy, RootWindow (dpy, i)) : 0); XSync (dpy, False); XSetErrorHandler (old_handler); XSync (dpy, False); if (error_handler_hit_p) { fprintf(stderr, "%s: XRRGetScreenInfo(dpy, %d) ==> X error:\n", blurb(), i); /* do it again without the error handler to print the error */ rrc = XRRGetScreenInfo (dpy, RootWindow (dpy, i)); } else if (rrc) { SizeID current_size = -1; Rotation current_rotation = ~0; fprintf (stderr, "\n%s: Screen %d\n", blurb(), i); current_size = XRRConfigCurrentConfiguration (rrc, ¤t_rotation); /* Times */ # if 0 /* #### This is wrong -- I don't understand what these two timestamp numbers represent, or how they correlate to the wall clock or to each other. */ { Time server_time, config_time; server_time = XRRConfigTimes (rrc, &config_time); if (config_time == 0 || server_time == 0) fprintf (stderr, "%s: config has never been changed\n", blurb()); else fprintf (stderr, "%s: config changed %lu seconds ago\n", blurb(), (unsigned long) (server_time - config_time)); } # endif /* Rotations */ { Rotation available, current; available = XRRConfigRotations (rrc, ¤t); fprintf (stderr, "%s: Available Rotations:\t", blurb()); if (available & RR_Rotate_0) fprintf (stderr, " 0"); if (available & RR_Rotate_90) fprintf (stderr, " 90"); if (available & RR_Rotate_180) fprintf (stderr, " 180"); if (available & RR_Rotate_270) fprintf (stderr, " 270"); if (! (available & (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270))) fprintf (stderr, " none"); fprintf (stderr, "\n"); if (current_rotation != current) fprintf (stderr, "%s: WARNING: rotation inconsistency: 0x%X vs 0x%X\n", blurb(), current_rotation, current); fprintf (stderr, "%s: Current Rotation:\t", blurb()); if (current & RR_Rotate_0) fprintf (stderr, " 0"); if (current & RR_Rotate_90) fprintf (stderr, " 90"); if (current & RR_Rotate_180) fprintf (stderr, " 180"); if (current & RR_Rotate_270) fprintf (stderr, " 270"); if (! (current & (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270))) fprintf (stderr, " none"); fprintf (stderr, "\n"); fprintf (stderr, "%s: Available Reflections:\t", blurb()); if (available & RR_Reflect_X) fprintf (stderr, " X"); if (available & RR_Reflect_Y) fprintf (stderr, " Y"); if (! (available & (RR_Reflect_X | RR_Reflect_Y))) fprintf (stderr, " none"); fprintf (stderr, "\n"); fprintf (stderr, "%s: Current Reflections:\t", blurb()); if (current & RR_Reflect_X) fprintf (stderr, " X"); if (current & RR_Reflect_Y) fprintf (stderr, " Y"); if (! (current & (RR_Reflect_X | RR_Reflect_Y))) fprintf (stderr, " none"); fprintf (stderr, "\n"); } /* Sizes */ { int nsizes, j; XRRScreenSize *rrsizes; rrsizes = XRRConfigSizes (rrc, &nsizes); if (nsizes <= 0) fprintf (stderr, "%s: sizes:\t none\n", blurb()); else for (j = 0; j < nsizes; j++) { short *rates; int nrates, k; fprintf (stderr, "%s: %c size %d: %d x %d\t rates:", blurb(), (j == current_size ? '+' : ' '), j, rrsizes[j].width, rrsizes[j].height); rates = XRRConfigRates (rrc, j, &nrates); if (nrates == 0) fprintf (stderr, " none?"); else for (k = 0; k < nrates; k++) fprintf (stderr, " %d", rates[k]); fprintf (stderr, "\n"); /* don't free 'rates' */ } /* don't free 'rrsizes' */ } XRRFreeScreenConfigInfo (rrc); } else if (major >= 0) { fprintf(stderr, "%s: XRRGetScreenInfo(dpy, %d) ==> NULL\n", blurb(), i); } # ifdef HAVE_RANDR_12 if (major > 1 || (major == 1 && minor >= 2)) { int j; XRRScreenResources *res = XRRGetScreenResources (dpy, RootWindow (dpy, i)); fprintf (stderr, "\n"); for (j = 0; j < res->noutput; j++) { int k; XRROutputInfo *rroi = XRRGetOutputInfo (dpy, res, res->outputs[j]); fprintf (stderr, "%s: Output %d: %s: %s (%d)\n", blurb(), j, rroi->name, (rroi->connection == RR_Disconnected ? "disconnected" : rroi->connection == RR_UnknownConnection ? "unknown" : "connected"), (int) rroi->crtc); for (k = 0; k < rroi->ncrtc; k++) { XRRCrtcInfo *crtci = XRRGetCrtcInfo (dpy, res, rroi->crtcs[k]); fprintf(stderr, "%s: %c CRTC %d (%d): %dx%d+%d+%d\n", blurb(), (rroi->crtc == rroi->crtcs[k] ? '+' : ' '), k, (int) rroi->crtcs[k], crtci->width, crtci->height, crtci->x, crtci->y); XRRFreeCrtcInfo (crtci); } XRRFreeOutputInfo (rroi); fprintf (stderr, "\n"); } XRRFreeScreenResources (res); } # endif /* HAVE_RANDR_12 */ } if (major > 0) { Window w[20]; XWindowAttributes xgwa[20]; for (i = 0; i < nscreens; i++) { XRRSelectInput (dpy, RootWindow (dpy, i), RRScreenChangeNotifyMask); w[i] = RootWindow (dpy, i); XGetWindowAttributes (dpy, w[i], &xgwa[i]); } XSync (dpy, False); fprintf (stderr, "\n%s: awaiting events...\n\n" "\t(If you resize the screen or add/remove monitors, this should\n" "\tnotice that and print stuff. Otherwise, hit ^C.)\n\n", progname); while (1) { XEvent event; XNextEvent (dpy, &event); if (event.type == event_number + RRScreenChangeNotify) { XRRScreenChangeNotifyEvent *xrr_event = (XRRScreenChangeNotifyEvent *) &event; int screen = XRRRootToScreen (dpy, xrr_event->window); fprintf (stderr, "%s: screen %d: RRScreenChangeNotify event\n", progname, screen); fprintf (stderr, "%s: screen %d: old size: \t%d x %d\n", progname, screen, DisplayWidth (dpy, screen), DisplayHeight (dpy, screen)); fprintf (stderr, "%s: screen %d: old root 0x%lx:\t%d x %d\n", progname, screen, (unsigned long) w[screen], xgwa[screen].width, xgwa[screen].height); XRRUpdateConfiguration (&event); XSync (dpy, False); fprintf (stderr, "%s: screen %d: new size: \t%d x %d\n", progname, screen, DisplayWidth (dpy, screen), DisplayHeight (dpy, screen)); w[screen] = RootWindow (dpy, screen); XGetWindowAttributes (dpy, w[screen], &xgwa[screen]); fprintf (stderr, "%s: screen %d: new root 0x%lx:\t%d x %d\n", progname, screen, (unsigned long) w[screen], xgwa[screen].width, xgwa[screen].height); fprintf (stderr, "\n"); } else { fprintf (stderr, "%s: event %d\n", progname, event.type); } } } XSync (dpy, False); exit (0); } xscreensaver-5.42+dfsg1/driver/test-screens.c000066400000000000000000000135371342162430400212420ustar00rootroot00000000000000/* test-screens.c --- some test cases for the "monitor sanity" checks. * xscreensaver, Copyright (c) 2008 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 /* 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" #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) { switch (san) { case S_SANE: return "OK"; case S_ENCLOSED: return "ENC"; case S_DUPLICATE: return "DUP"; case S_OVERLAP: return "OVR"; case S_OFFSCREEN: return "OFF"; case S_DISABLED: return "DIS"; default: abort(); break; } } static void test (int testnum, const char *screens, const char *desired) { monitor *monitors[100]; char result[2048]; char *out = result; int i, nscreens = 0; char *token = strtok (strdup(screens), ","); while (token) { monitor *m = calloc (1, sizeof (monitor)); char c; m->id = (testnum * 1000) + nscreens; if (5 == sscanf (token, "%dx%d+%d+%d@%d%c", &m->width, &m->height, &m->x, &m->y, (int *) &m->screen, &c)) ; else if (4 != sscanf (token, "%dx%d+%d+%d%c", &m->width, &m->height, &m->x, &m->y, &c)) { fprintf (stderr, "%s: unparsable geometry: %s\n", blurb(), token); exit (1); } monitors[nscreens] = m; nscreens++; token = strtok (0, ","); } monitors[nscreens] = 0; check_monitor_sanity (monitors); *out = 0; for (i = 0; i < nscreens; i++) { monitor *m = monitors[i]; if (out != result) *out++ = ','; if (m->sanity == S_SANE) { sprintf (out, "%dx%d+%d+%d", m->width, m->height, m->x, m->y); if (m->screen) sprintf (out + strlen(out), "@%d", (int) m->screen); } else strcpy (out, failstr (m->sanity)); out += strlen(out); } *out = 0; if (!strcmp (result, desired)) fprintf (stderr, "%s: test %2d OK\n", blurb(), testnum); else fprintf (stderr, "%s: test %2d FAILED:\n" "%s: given: %s\n" "%s: wanted: %s\n" "%s: got: %s\n", blurb(), testnum, blurb(), screens, blurb(), desired, blurb(), result); # if 0 { saver_info SI; SI.monitor_layout = monitors; describe_monitor_layout (&SI); } # endif } static void run_tests(void) { int i = 1; # define A(a) test (i++, a, a); # define B(a,b) test (i++, a, b) A(""); A("1024x768+0+0"); A("1024x768+0+0,1024x768+1024+0"); A("1024x768+0+0,1024x768+0+768"); A("1024x768+0+0,1024x768+0+768,1024x768+1024+0"); A("800x600+0+0,800x600+0+0@1,800x600+10+0@2"); B("1024x768+999999+0", "OFF"); B("1024x768+-999999+-999999", "OFF"); B("1024x768+0+0,1024x768+0+0", "1024x768+0+0,DUP"); B("1024x768+0+0,1024x768+0+0,1024x768+0+0", "1024x768+0+0,DUP,DUP"); B("1024x768+0+0,1024x768+1024+0,1024x768+0+0", "1024x768+0+0,1024x768+1024+0,DUP"); B("1280x1024+0+0,1024x768+0+64,800x600+0+0,640x480+0+0,720x400+0+0", "1280x1024+0+0,ENC,ENC,ENC,ENC"); B("1024x768+0+64,1280x1024+0+0,800x600+0+0,640x480+0+0,800x600+0+0,720x400+0+0", "ENC,1280x1024+0+0,ENC,ENC,ENC,ENC"); B("1024x768+0+64,1280x1024+0+0,800x600+0+0,640x480+0+0,1280x1024+0+0,720x400+0+0", "ENC,1280x1024+0+0,ENC,ENC,DUP,ENC"); B("720x400+0+0,640x480+0+0,800x600+0+0,1024x768+0+64,1280x1024+0+0", "ENC,ENC,ENC,ENC,1280x1024+0+0"); B("1280x1024+0+0,800x600+1280+0,800x600+1300+0", "1280x1024+0+0,800x600+1280+0,OVR"); B("1280x1024+0+0,800x600+1280+0,800x600+1300+0,1280x1024+0+0,800x600+1280+0", "1280x1024+0+0,800x600+1280+0,OVR,DUP,DUP"); /* +-------------+----+ +------+---+ 1: 1440x900, widescreen display | : | | 3+4 : | 2: 1280x1024, conventional display | 1+2 : 1 | +......+ | 3: 1024x768, laptop | : | | 3 | 4: 800x600, external projector +.............+----+ +----------+ | 2 | | | +-------------+ */ B("1440x900+0+0,1280x1024+0+0,1024x768+1440+0,800x600+1440+0", "1440x900+0+0,OVR,1024x768+1440+0,ENC"); B("800x600+0+0,800x600+0+0,800x600+800+0", "800x600+0+0,DUP,800x600+800+0"); B("1600x1200+0+0,1360x768+0+0", "1600x1200+0+0,ENC"); B("1600x1200+0+0,1360x768+0+0,1600x1200+0+0@1,1360x768+0+0@1", "1600x1200+0+0,ENC,1600x1200+0+0@1,ENC"); } int main (int argc, char **argv) { char *s; progname = argv[0]; s = strrchr(progname, '/'); if (s) progname = s+1; if (argc != 1) { fprintf (stderr, "usage: %s\n", argv[0]); exit (1); } run_tests(); exit (0); } xscreensaver-5.42+dfsg1/driver/test-uid.c000066400000000000000000000107041342162430400203520ustar00rootroot00000000000000/* test-uid.c --- playing with setuid. * xscreensaver, Copyright (c) 1998, 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 * 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 static void print(void) { int uid = getuid(); int gid = getgid(); int euid = geteuid(); int egid = getegid(); struct passwd *p = 0; struct group *g = 0; gid_t groups[1024]; int n, size; p = getpwuid (uid); g = getgrgid (gid); fprintf(stderr, "real user/group: %ld/%ld (%s/%s)\n", (long) uid, (long) gid, (p && p->pw_name ? p->pw_name : "???"), (g && g->gr_name ? g->gr_name : "???")); p = getpwuid (euid); g = getgrgid (egid); fprintf(stderr, "eff. user/group: %ld/%ld (%s/%s)\n", (long)euid, (long)egid, (p && p->pw_name ? p->pw_name : "???"), (g && g->gr_name ? g->gr_name : "???")); size = sizeof(groups) / sizeof(gid_t); n = getgroups(size - 1, groups); if (n < 0) perror("getgroups failed"); else { int i; fprintf (stderr, "eff. group list: ["); for (i = 0; i < n; i++) { g = getgrgid (groups[i]); fprintf(stderr, "%s%s=%ld", (i == 0 ? "" : ", "), (g->gr_name ? g->gr_name : "???"), (long) groups[i]); } fprintf (stderr, "]\n"); } } int main (int argc, char **argv) { int i; struct passwd *p = 0; struct group *g = 0; if (argc <= 1) { fprintf(stderr, "usage: %s [ user/group ... ]\n" "\tEach argument may be a user name, or user/group.\n" "\tThis program will attempt to setuid/setgid to each\n" "\tin turn, and report the results. The user and group\n" "\tnames may be strings, or numeric.\n", argv[0]); exit(1); } print(); for (i = 1; i < argc; i++) { char *user = argv[i]; char *group = strchr(user, '/'); if (!group) group = strchr(user, '.'); if (group) *group++ = 0; if (group && *group) { long gid = 0; int was_numeric = 0; g = 0; if (*group == '-' || (*group >= '0' && *group <= '9')) if (1 == sscanf(group, "%ld", &gid)) { g = getgrgid (gid); was_numeric = 1; } if (!g) g = getgrnam(group); if (g) { gid = g->gr_gid; group = g->gr_name; } else { if (was_numeric) { fprintf(stderr, "no group numbered %s.\n", group); group = ""; } else { fprintf(stderr, "no group named %s.\n", group); goto NOGROUP; } } fprintf(stderr, "setgroups(1, [%ld]) \"%s\"", gid, group); { gid_t g2 = gid; if (setgroups(1, &g2) == 0) fprintf(stderr, " succeeded.\n"); else perror(" failed"); } fprintf(stderr, "setgid(%ld) \"%s\"", gid, group); if (setgid(gid) == 0) fprintf(stderr, " succeeded.\n"); else perror(" failed"); NOGROUP: ; } if (user && *user) { long uid = 0; int was_numeric = 0; p = 0; if (*user == '-' || (*user >= '0' && *user <= '9')) if (1 == sscanf(user, "%ld", &uid)) { p = getpwuid (uid); was_numeric = 1; } if (!p) p = getpwnam(user); if (p) { uid = p->pw_uid; user = p->pw_name; } else { if (was_numeric) { fprintf(stderr, "no user numbered \"%s\".\n", user); user = ""; } else { 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"); else perror(" failed"); NOUSER: ; } print(); } fprintf(stderr, "running \"whoami\" and \"groups\" in a sub-process reports:\n"); fflush(stdout); fflush(stderr); system ("/bin/sh -c 'echo \"`whoami` / `groups`\"'"); fflush(stdout); fflush(stderr); exit(0); } xscreensaver-5.42+dfsg1/driver/test-vp.c000066400000000000000000000132631342162430400202210ustar00rootroot00000000000000/* test-xinerama.c --- playing with XF86VidModeGetViewPort * xscreensaver, Copyright (c) 2004 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 char *progname = 0; 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 ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error) { error_handler_hit_p = True; return 0; } static int screen_count (Display *dpy) { int n = ScreenCount(dpy); int xn = 0; int event_number, error_number; if (!XineramaQueryExtension (dpy, &event_number, &error_number)) { fprintf(stderr, "%s: XineramaQueryExtension(dpy, ...) ==> False\n", blurb()); goto DONE; } else fprintf(stderr, "%s: XineramaQueryExtension(dpy, ...) ==> %d, %d\n", blurb(), event_number, error_number); if (!XineramaIsActive(dpy)) { fprintf(stderr, "%s: XineramaIsActive(dpy) ==> False\n", blurb()); goto DONE; } else { int major, minor; XineramaScreenInfo *xsi; fprintf(stderr, "%s: XineramaIsActive(dpy) ==> True\n", blurb()); if (!XineramaQueryVersion(dpy, &major, &minor)) { fprintf(stderr, "%s: XineramaQueryVersion(dpy, ...) ==> False\n", blurb()); goto DONE; } else fprintf(stderr, "%s: XineramaQueryVersion(dpy, ...) ==> %d, %d\n", blurb(), major, minor); xsi = XineramaQueryScreens (dpy, &xn); if (xsi) XFree (xsi); } DONE: fprintf (stderr, "\n"); fprintf (stderr, "%s: X client screens: %d\n", blurb(), n); fprintf (stderr, "%s: Xinerama screens: %d\n", blurb(), xn); fprintf (stderr, "\n"); if (xn > n) return xn; else return n; } int main (int argc, char **argv) { int event_number, error_number; int major, minor; int nscreens = 0; int i; XtAppContext app; 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", blurb()); exit(1); } else fprintf(stderr, "%s: XF86VidModeQueryExtension(dpy, ...) ==> %d, %d\n", blurb(), event_number, error_number); if (!XF86VidModeQueryVersion(dpy, &major, &minor)) { fprintf(stderr, "%s: XF86VidModeQueryVersion(dpy, ...) ==> False\n", blurb()); fprintf(stderr, "%s: server didn't report XF86VidMode version numbers?\n", blurb()); } else fprintf(stderr, "%s: XF86VidModeQueryVersion(dpy, ...) ==> %d, %d\n", blurb(), major, minor); nscreens = screen_count (dpy); for (i = 0; i < nscreens; i++) { int result = 0; int x = 0, y = 0, dot = 0; XF86VidModeModeLine ml = { 0, }; XErrorHandler old_handler; XSync (dpy, False); error_handler_hit_p = False; old_handler = XSetErrorHandler (ignore_all_errors_ehandler); result = XF86VidModeGetViewPort (dpy, i, &x, &y); XSync (dpy, False); XSetErrorHandler (old_handler); XSync (dpy, False); if (error_handler_hit_p) { fprintf(stderr, "%s: XF86VidModeGetViewPort(dpy, %d, ...) ==> X error\n", blurb(), i); continue; } if (! result) fprintf(stderr, "%s: XF86VidModeGetViewPort(dpy, %d, ...) ==> %d\n", blurb(), i, result); result = XF86VidModeGetModeLine (dpy, i, &dot, &ml); if (! result) fprintf(stderr, "%s: XF86VidModeGetModeLine(dpy, %d, ...) ==> %d\n", blurb(), i, result); fprintf (stderr, "%s: screen %d: %dx%d; viewport: %dx%d+%d+%d\n", blurb(), i, DisplayWidth (dpy, i), DisplayHeight (dpy, i), ml.hdisplay, ml.vdisplay, x, y ); fprintf (stderr, "%s: hsync start %d; end %d; total %d; skew %d;\n", blurb(), ml.hsyncstart, ml.hsyncend, ml.htotal, ml.hskew); fprintf (stderr, "%s: vsync start %d; end %d; total %d; flags 0x%04x;\n", blurb(), ml.vsyncstart, ml.vsyncend, ml.vtotal, ml.flags); fprintf (stderr, "\n"); } XSync (dpy, False); exit (0); } xscreensaver-5.42+dfsg1/driver/test-xdpms.c000066400000000000000000000117551342162430400207330ustar00rootroot00000000000000/* test-xdpms.c --- playing with the XDPMS extension. * xscreensaver, Copyright (c) 1998-2011 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 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; 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 ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error) { error_handler_hit_p = True; return 0; } int main (int argc, char **argv) { int delay = 10; int event_number, error_number; int major, minor; CARD16 standby, suspend, off; CARD16 state; BOOL onoff; XtAppContext app; 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", blurb()); exit(1); } else fprintf(stderr, "%s: DPMSQueryExtension(dpy, ...) ==> %d, %d\n", blurb(), event_number, error_number); if (!DPMSCapable(dpy)) { fprintf(stderr, "%s: DPMSCapable(dpy) ==> False\n", blurb()); fprintf(stderr, "%s: server says hardware doesn't support DPMS.\n", blurb()); exit(1); } else fprintf(stderr, "%s: DPMSCapable(dpy) ==> True\n", blurb()); if (!DPMSGetVersion(dpy, &major, &minor)) { fprintf(stderr, "%s: DPMSGetVersion(dpy, ...) ==> False\n", blurb()); fprintf(stderr, "%s: server didn't report XDPMS version numbers?\n", blurb()); } else fprintf(stderr, "%s: DPMSGetVersion(dpy, ...) ==> %d, %d\n", blurb(), major, minor); if (!DPMSGetTimeouts(dpy, &standby, &suspend, &off)) { fprintf(stderr, "%s: DPMSGetTimeouts(dpy, ...) ==> False\n", blurb()); fprintf(stderr, "%s: server didn't report DPMS timeouts?\n", blurb()); } else fprintf(stderr, "%s: DPMSGetTimeouts(dpy, ...)\n" "\t ==> standby = %d, suspend = %d, off = %d\n", blurb(), standby, suspend, off); while (1) { if (!DPMSInfo(dpy, &state, &onoff)) { fprintf(stderr, "%s: DPMSInfo(dpy, ...) ==> False\n", blurb()); fprintf(stderr, "%s: couldn't read DPMS state?\n", blurb()); onoff = 0; state = -1; } else { fprintf(stderr, "%s: DPMSInfo(dpy, ...) ==> %s, %s\n", blurb(), (state == DPMSModeOn ? "DPMSModeOn" : state == DPMSModeStandby ? "DPMSModeStandby" : state == DPMSModeSuspend ? "DPMSModeSuspend" : state == DPMSModeOff ? "DPMSModeOff" : "???"), (onoff == 1 ? "On" : onoff == 0 ? "Off" : "???")); } if (state == DPMSModeStandby || state == DPMSModeSuspend || state == DPMSModeOff) { XErrorHandler old_handler; int st; 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); XSync (dpy, False); st = DPMSForceLevel (dpy, DPMSModeOn); XSync (dpy, False); if (error_handler_hit_p) st = -666; fprintf (stderr, "%s: DPMSForceLevel (dpy, DPMSModeOn) ==> %s\n", blurb(), (st == -666 ? "X Error" : st ? "Ok" : "Error")); } sleep (delay); } } xscreensaver-5.42+dfsg1/driver/test-xinerama.c000066400000000000000000000060471342162430400214020ustar00rootroot00000000000000/* test-xinerama.c --- playing with the Xinerama extension. * xscreensaver, Copyright (c) 2003 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 char *progname = 0; 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) { int event_number, error_number; int major, minor; int nscreens = 0; XineramaScreenInfo *xsi; int i; XtAppContext app; 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", blurb()); exit(1); } else fprintf(stderr, "%s: XineramaQueryExtension(dpy, ...) ==> %d, %d\n", blurb(), event_number, error_number); if (!XineramaIsActive(dpy)) { fprintf(stderr, "%s: XineramaIsActive(dpy) ==> False\n", blurb()); fprintf(stderr, "%s: server says Xinerama is turned off.\n", blurb()); exit(1); } else fprintf(stderr, "%s: XineramaIsActive(dpy) ==> True\n", blurb()); if (!XineramaQueryVersion(dpy, &major, &minor)) { fprintf(stderr, "%s: XineramaQueryVersion(dpy, ...) ==> False\n", blurb()); fprintf(stderr, "%s: server didn't report Xinerama version numbers?\n", blurb()); } else fprintf(stderr, "%s: XineramaQueryVersion(dpy, ...) ==> %d, %d\n", blurb(), major, minor); xsi = XineramaQueryScreens (dpy, &nscreens); fprintf(stderr, "%s: %d Xinerama screens\n", blurb(), nscreens); for (i = 0; i < nscreens; i++) fprintf (stderr, "%s: screen %d: %dx%d+%d+%d\n", blurb(), xsi[i].screen_number, xsi[i].width, xsi[i].height, xsi[i].x_org, xsi[i].y_org); XFree (xsi); XSync (dpy, False); exit (0); } xscreensaver-5.42+dfsg1/driver/test-yarandom.c000066400000000000000000000030061342162430400214000ustar00rootroot00000000000000/* test-yarandom.c --- generate a file of random bytes for analysis. * xscreensaver, Copyright (c) 2018 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 "yarandom.h" char *progname = 0; int main (int argc, char **argv) { unsigned long i, n; char *f; FILE *fd; progname = argv[0]; if (argc != 3) { fprintf(stderr, "usage: %s bytes outfile\n", argv[0]); exit(1); } n = atol (argv[1]); f = argv[2]; # undef ya_rand_init ya_rand_init(0); fd = fopen (f, "w"); if (!fd) { perror (f); exit (1); } n /= sizeof(uint32_t); for (i = 0; i < n; i++) { union { uint32_t i; char s[sizeof(uint32_t)]; } rr; rr.i = random(); if (! fwrite (rr.s, sizeof(rr.s), 1, fd)) { perror ("write"); exit (1); } } fclose (fd); fprintf (stderr, "%s: %s: wrote %ld bytes\n", progname, f, i * sizeof(uint32_t)); exit(0); } xscreensaver-5.42+dfsg1/driver/timers.c000066400000000000000000001643671342162430400201360ustar00rootroot00000000000000/* timers.c --- detecting when the user is idle, and other timer-related tasks. * xscreensaver, Copyright (c) 1991-2017 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 #ifdef HAVE_XMU # ifndef VMS # include # else /* VMS */ # include # endif /* VMS */ # else /* !HAVE_XMU */ # include "xmu.h" #endif /* !HAVE_XMU */ #ifdef HAVE_XIDLE_EXTENSION #include #endif /* HAVE_XIDLE_EXTENSION */ #ifdef HAVE_MIT_SAVER_EXTENSION #include #endif /* HAVE_MIT_SAVER_EXTENSION */ #ifdef HAVE_SGI_SAVER_EXTENSION #include #endif /* HAVE_SGI_SAVER_EXTENSION */ #ifdef HAVE_RANDR #include #endif /* HAVE_RANDR */ #include "xscreensaver.h" #undef ABS #define ABS(x)((x)<0?-(x):(x)) #undef MAX #define MAX(x,y)((x)>(y)?(x):(y)) #ifdef HAVE_PROC_INTERRUPTS static Bool proc_interrupts_activity_p (saver_info *si); #endif /* HAVE_PROC_INTERRUPTS */ static void check_for_clock_skew (saver_info *si); void idle_timer (XtPointer closure, XtIntervalId *id) { saver_info *si = (saver_info *) closure; /* What an amazingly shitty design. Not only does Xt execute timeout events from XtAppNextEvent() instead of from XtDispatchEvent(), but there is no way to tell Xt to block until there is an X event OR a timeout happens. Once your timeout proc is called, XtAppNextEvent() still won't return until a "real" X event comes in. So this function pushes a stupid, gratuitous, unnecessary event back on the event queue to force XtAppNextEvent to return Right Fucking Now. When the code in sleep_until_idle() sees an event of type XAnyEvent, which the server never generates, it knows that a timeout has occurred. */ 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); /* If we are the timer that just went off, clear the pointer to the id. */ if (id) { if (si->timer_id && *id != si->timer_id) abort(); /* oops, scheduled timer twice?? */ si->timer_id = 0; } } void schedule_wakeup_event (saver_info *si, Time when, Bool verbose_p) { if (si->timer_id) { if (verbose_p) fprintf (stderr, "%s: idle_timer already running\n", blurb()); return; } /* Wake up periodically to ask the server if we are idle. */ si->timer_id = XtAppAddTimeOut (si->app, when, idle_timer, (XtPointer) si); if (verbose_p) fprintf (stderr, "%s: starting idle_timer (%ld, %ld)\n", blurb(), when, si->timer_id); } static void notice_events (saver_info *si, Window window, Bool top_p) { saver_preferences *p = &si->prefs; XWindowAttributes attrs; unsigned long events; Window root, parent, *kids; unsigned int nkids; int screen_no; if (XtWindowToWidget (si->dpy, window)) /* If it's one of ours, don't mess up its event mask. */ return; if (!XQueryTree (si->dpy, window, &root, &parent, &kids, &nkids)) return; if (window == root) top_p = False; /* Figure out which screen this window is on, for the diagnostics. */ for (screen_no = 0; screen_no < si->nscreens; screen_no++) if (root == RootWindowOfScreen (si->screens[screen_no].screen)) break; XGetWindowAttributes (si->dpy, window, &attrs); events = ((attrs.all_event_masks | attrs.do_not_propagate_mask) & (KeyPressMask | PropertyChangeMask)); /* Select for SubstructureNotify on all windows. Select for PropertyNotify on all windows. Select for KeyPress on all windows that already have it selected. Note that we can't select for ButtonPress, because of X braindamage: only one client at a time may select for ButtonPress on a given window, though any number can select for KeyPress. Someone explain *that* to me. So, if the user spends a while clicking the mouse without ever moving the mouse or touching the keyboard, we won't know that they've been active, and the screensaver will come on. That sucks, but I don't know how to get around it. Since X presents mouse wheels as clicks, this applies to those, too: scrolling through a document using only the mouse wheel doesn't count as activity... Fortunately, /proc/interrupts helps, on systems that have it. Oh, if it's a PS/2 mouse, not serial or USB. This sucks! */ XSelectInput (si->dpy, window, SubstructureNotifyMask | PropertyChangeMask | events); if (top_p && p->debug_p && (events & KeyPressMask)) { /* Only mention one window per tree (hack hack). */ fprintf (stderr, "%s: %d: selected KeyPress on 0x%lX\n", blurb(), screen_no, (unsigned long) window); top_p = False; } if (kids) { while (nkids) notice_events (si, kids [--nkids], top_p); XFree ((char *) kids); } } int BadWindow_ehandler (Display *dpy, XErrorEvent *error) { /* When we notice a window being created, we spawn a timer that waits 30 seconds or so, and then selects events on that window. This error handler is used so that we can cope with the fact that the window may have been destroyed <30 seconds after it was created. */ if (error->error_code == BadWindow || error->error_code == BadMatch || error->error_code == BadDrawable) return 0; else return saver_ehandler (dpy, error); } struct notice_events_timer_arg { saver_info *si; Window w; }; static void notice_events_timer (XtPointer closure, XtIntervalId *id) { struct notice_events_timer_arg *arg = (struct notice_events_timer_arg *) closure; XErrorHandler old_handler = XSetErrorHandler (BadWindow_ehandler); saver_info *si = arg->si; Window window = arg->w; free(arg); notice_events (si, window, True); XSync (si->dpy, False); XSetErrorHandler (old_handler); } void start_notice_events_timer (saver_info *si, Window w, Bool verbose_p) { saver_preferences *p = &si->prefs; struct notice_events_timer_arg *arg = (struct notice_events_timer_arg *) malloc(sizeof(*arg)); arg->si = si; arg->w = w; XtAppAddTimeOut (si->app, p->notice_events_timeout, notice_events_timer, (XtPointer) arg); if (verbose_p) fprintf (stderr, "%s: starting notice_events_timer for 0x%X (%lu)\n", blurb(), (unsigned int) w, p->notice_events_timeout); } /* When the screensaver is active, this timer will periodically change the running program. */ void cycle_timer (XtPointer closure, XtIntervalId *id) { saver_info *si = (saver_info *) closure; saver_preferences *p = &si->prefs; Time how_long = p->cycle; if (si->selection_mode > 0 && screenhack_running_p (si)) /* 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. */ how_long = 1000 * 60 * 60; if (si->dbox_up_p) { if (p->verbose_p) fprintf (stderr, "%s: dialog box up; delaying hack change.\n", blurb()); how_long = 30000; /* 30 secs */ } else { int i; maybe_reload_init_file (si); for (i = 0; i < si->nscreens; i++) kill_screenhack (&si->screens[i]); raise_window (si, True, True, False); if (!si->throttled_p) for (i = 0; i < si->nscreens; i++) spawn_screenhack (&si->screens[i]); else { if (p->verbose_p) fprintf (stderr, "%s: not launching new hack (throttled.)\n", blurb()); } } if (how_long > 0) { si->cycle_id = XtAppAddTimeOut (si->app, how_long, cycle_timer, (XtPointer) si); if (p->debug_p) fprintf (stderr, "%s: starting cycle_timer (%ld, %ld)\n", blurb(), how_long, si->cycle_id); } else { if (p->debug_p) fprintf (stderr, "%s: not starting cycle_timer: how_long == %ld\n", blurb(), (unsigned long) how_long); } } void activate_lock_timer (XtPointer closure, XtIntervalId *id) { saver_info *si = (saver_info *) closure; saver_preferences *p = &si->prefs; if (p->verbose_p) fprintf (stderr, "%s: timed out; activating lock.\n", blurb()); set_locked_p (si, True); } /* Call this when user activity (or "simulated" activity) has been noticed. */ void reset_timers (saver_info *si) { saver_preferences *p = &si->prefs; if (si->using_mit_saver_extension || si->using_sgi_saver_extension) return; if (si->timer_id) { if (p->debug_p) fprintf (stderr, "%s: killing idle_timer (%ld, %ld)\n", blurb(), p->timeout, si->timer_id); XtRemoveTimeOut (si->timer_id); si->timer_id = 0; } schedule_wakeup_event (si, p->timeout, p->debug_p); /* sets si->timer_id */ if (si->cycle_id) abort (); /* no cycle timer when inactive */ si->last_activity_time = time ((time_t *) 0); /* This will (hopefully, supposedly) tell the server to re-set its DPMS timer. Without this, the -deactivate clientmessage would prevent xscreensaver from blanking, but would not prevent the monitor from powering down. */ #if 0 /* #### With some servers, this causes the screen to flicker every time a key is pressed! Ok, I surrender. I give up on ever having DPMS work properly. */ XForceScreenSaver (si->dpy, ScreenSaverReset); /* And if the monitor is already powered off, turn it on. You'd think the above would do that, but apparently not? */ monitor_power_on (si, True); #endif } /* Returns true if a mouse has moved since the last time we checked. Small motions (of less than "hysteresis" pixels/second) are ignored. */ static Bool device_pointer_moved_p (saver_info *si, poll_mouse_data *last_poll_mouse, poll_mouse_data *this_poll_mouse, Bool mods_p, const char *debug_type, int debug_id) { saver_preferences *p = &si->prefs; unsigned int distance, dps; unsigned long seconds = 0; Bool moved_p = False; distance = MAX (ABS (last_poll_mouse->root_x - this_poll_mouse->root_x), ABS (last_poll_mouse->root_y - this_poll_mouse->root_y)); seconds = (this_poll_mouse->time - last_poll_mouse->time); /* When the screen is blanked, we get MotionNotify events, but when not blanked, we poll only every 5 seconds, and that's not enough resolution to do hysteresis based on a 1 second interval. So, assume that any motion we've seen during the 5 seconds when our eyes were closed happened in the last 1 second instead. */ if (seconds > 1) seconds = 1; dps = (seconds <= 0 ? distance : (distance / seconds)); /* Motion only counts if the rate is more than N pixels per second. */ if (dps >= p->pointer_hysteresis && distance > 0) moved_p = True; /* If the mouse is not on this screen but used to be, that's motion. If the mouse was not on this screen, but is now, that's motion. */ { Bool on_screen_p = (this_poll_mouse->root_x != -1 && this_poll_mouse->root_y != -1); Bool was_on_screen_p = (last_poll_mouse->root_x != -1 && last_poll_mouse->root_y != -1); if (on_screen_p != was_on_screen_p) moved_p = True; } if (p->debug_p && (distance != 0 || moved_p)) { fprintf (stderr, "%s: %s %d: pointer %s", blurb(), debug_type, debug_id, (moved_p ? "moved: " : "ignored:")); if (last_poll_mouse->root_x == -1) fprintf (stderr, "off screen"); else fprintf (stderr, "%d,%d", last_poll_mouse->root_x, last_poll_mouse->root_y); fprintf (stderr, " -> "); if (this_poll_mouse->root_x == -1) fprintf (stderr, "off screen"); else fprintf (stderr, "%d,%d", this_poll_mouse->root_x, this_poll_mouse->root_y); if (last_poll_mouse->root_x != -1 && this_poll_mouse->root_x != -1) fprintf (stderr, " (%d,%d; %d/%lu=%d)", ABS(last_poll_mouse->root_x - this_poll_mouse->root_x), ABS(last_poll_mouse->root_y - this_poll_mouse->root_y), distance, seconds, dps); fprintf (stderr, ".\n"); } if (!moved_p && mods_p && this_poll_mouse->mask != last_poll_mouse->mask) { moved_p = True; if (p->debug_p) fprintf (stderr, "%s: %s %d: modifiers changed: 0x%04x -> 0x%04x.\n", blurb(), debug_type, debug_id, last_poll_mouse->mask, this_poll_mouse->mask); } last_poll_mouse->child = this_poll_mouse->child; last_poll_mouse->mask = this_poll_mouse->mask; if (moved_p || seconds > 0) { last_poll_mouse->time = this_poll_mouse->time; last_poll_mouse->root_x = this_poll_mouse->root_x; last_poll_mouse->root_y = this_poll_mouse->root_y; } return moved_p; } /* Returns true if core mouse pointer has moved since the last time we checked. */ static Bool pointer_moved_p (saver_screen_info *ssi, Bool mods_p) { saver_info *si = ssi->global; Window root; poll_mouse_data this_poll_mouse; int x, y; /* don't check xinerama pseudo-screens. */ if (!ssi->real_screen_p) return False; this_poll_mouse.time = time ((time_t *) 0); if (!XQueryPointer (si->dpy, ssi->screensaver_window, &root, &this_poll_mouse.child, &this_poll_mouse.root_x, &this_poll_mouse.root_y, &x, &y, &this_poll_mouse.mask)) { /* If XQueryPointer() returns false, the mouse is not on this screen. */ this_poll_mouse.root_x = -1; this_poll_mouse.root_y = -1; this_poll_mouse.child = 0; this_poll_mouse.mask = 0; } else si->last_activity_screen = ssi; return device_pointer_moved_p(si, &(ssi->last_poll_mouse), &this_poll_mouse, mods_p, "screen", ssi->number); } /* When we aren't using a server extension, this timer is used to periodically wake up and poll the mouse position, which is possibly more reliable than selecting motion events on every window. */ static void check_pointer_timer (XtPointer closure, XtIntervalId *id) { int i; saver_info *si = (saver_info *) closure; saver_preferences *p = &si->prefs; Bool active_p = False; if (!si->using_proc_interrupts && (si->using_xidle_extension || si->using_mit_saver_extension || si->using_sgi_saver_extension)) /* If an extension is in use, we should not be polling the mouse. Unless we're also checking /proc/interrupts, in which case, we should. */ abort (); if (id && *id == si->check_pointer_timer_id) /* this is us - it's expired */ si->check_pointer_timer_id = 0; if (si->check_pointer_timer_id) /* only queue one at a time */ XtRemoveTimeOut (si->check_pointer_timer_id); si->check_pointer_timer_id = /* now re-queue */ XtAppAddTimeOut (si->app, p->pointer_timeout, check_pointer_timer, (XtPointer) si); for (i = 0; i < si->nscreens; i++) { saver_screen_info *ssi = &si->screens[i]; if (pointer_moved_p (ssi, True)) active_p = True; } #ifdef HAVE_PROC_INTERRUPTS if (!active_p && si->using_proc_interrupts && proc_interrupts_activity_p (si)) { active_p = True; } #endif /* HAVE_PROC_INTERRUPTS */ if (active_p) reset_timers (si); check_for_clock_skew (si); } /* An unfortunate situation is this: the saver is not active, because the user has been typing. The machine is a laptop. The user closes the lid and suspends it. The CPU halts. Some hours later, the user opens the lid. At this point, Xt's timers will fire, and xscreensaver will blank the screen. So far so good -- well, not really, but it's the best that we can do, since the OS doesn't send us a signal *before* shutdown -- but if the user had delayed locking (lockTimeout > 0) then we should start off in the locked state, rather than only locking N minutes from when the lid was opened. Also, eschewing fading is probably a good idea, to clamp down as soon as possible. We only do this when we'd be polling the mouse position anyway. This amounts to an assumption that machines with APM support also have /proc/interrupts. Now here's a thing that sucks about this: if the user actually changes the time of the machine, it will either trigger or delay the triggering of a lock. On most systems, that requires root, but I'll bet at least some GUI configs let non-root do it. Also, NTP attacks. On Linux 2.6.39+ systems, there exists clock_gettime(CLOCK_BOOTTIME) which would allow us to detect the "laptop CPU had been halted" state independently of changes in wall-clock time. But of course that's not portable. When the wall clock changes, what do Xt timers do, anyway? If I have a timer set for 30 seconds from now, and adjust the wall clock +15 seconds, does the timer fire 30 seconds from now or 15? I actually have no idea. It does not appear to be specified. */ static void check_for_clock_skew (saver_info *si) { saver_preferences *p = &si->prefs; time_t now = time ((time_t *) 0); long shift = now - si->last_wall_clock_time; if (p->debug_p) { int i = (si->last_wall_clock_time == 0 ? 0 : shift); fprintf (stderr, "%s: checking wall clock for hibernation (%d:%02d:%02d).\n", blurb(), (i / (60 * 60)), ((i / 60) % 60), (i % 60)); } if (si->last_wall_clock_time != 0 && shift > (p->timeout / 1000)) { if (p->verbose_p) fprintf (stderr, "%s: wall clock has jumped by %ld:%02ld:%02ld%s\n", blurb(), (shift / (60 * 60)), ((shift / 60) % 60), (shift % 60), (p->mode == DONT_BLANK ? " while saver disabled" : "")); /* If the saver is entirely disabled, there's no need to do the emergency-blank-and-lock thing. */ if (p->mode != DONT_BLANK) { si->emergency_lock_p = True; idle_timer ((XtPointer) si, 0); } } si->last_wall_clock_time = now; } static void dispatch_event (saver_info *si, XEvent *event) { /* If this is for the splash dialog, pass it along. Note that the password dialog is handled with its own event loop, so events for that window will never come through here. */ if (si->splash_dialog && event->xany.window == si->splash_dialog) handle_splash_event (si, event); XtDispatchEvent (event); } static void swallow_unlock_typeahead_events (saver_info *si, XEvent *e) { XEvent event; char buf [100]; int i = 0; memset (buf, 0, sizeof(buf)); event = *e; do { if (event.xany.type == KeyPress) { char s[2]; int size = XLookupString ((XKeyEvent *) &event, s, 1, 0, 0); if (size != 1) continue; switch (*s) { case '\010': case '\177': /* Backspace */ if (i > 0) i--; break; case '\025': case '\030': /* Erase line */ case '\012': case '\015': /* Enter */ case '\033': /* ESC */ i = 0; break; case '\040': /* Space */ if (i == 0) break; /* ignore space at beginning of line */ /* else, fall through */ default: buf [i++] = *s; break; } } } while (i < sizeof(buf)-1 && XCheckMaskEvent (si->dpy, KeyPressMask, &event)); buf[i] = 0; if (si->unlock_typeahead) { memset (si->unlock_typeahead, 0, strlen(si->unlock_typeahead)); free (si->unlock_typeahead); } if (i > 0) si->unlock_typeahead = strdup (buf); else si->unlock_typeahead = 0; memset (buf, 0, sizeof(buf)); } /* methods of detecting idleness: explicitly informed by SGI SCREEN_SAVER server event; explicitly informed by MIT-SCREEN-SAVER server event; poll server idle time with XIDLE extension; select events on all windows, and note absence of recent events; note that /proc/interrupts has not changed in a while; activated by clientmessage. methods of detecting non-idleness: read events on the xscreensaver window; explicitly informed by SGI SCREEN_SAVER server event; explicitly informed by MIT-SCREEN-SAVER server event; select events on all windows, and note events on any of them; note that a client updated their window's _NET_WM_USER_TIME property; note that /proc/interrupts has changed; deactivated by clientmessage. I trust that explains why this function is a big hairy mess. */ void sleep_until_idle (saver_info *si, Bool until_idle_p) { saver_preferences *p = &si->prefs; /* We have to go through this union bullshit because gcc-4.4.0 has stricter struct-aliasing rules. Without this, the optimizer can fuck things up. */ union { XEvent x_event; # ifdef HAVE_RANDR XRRScreenChangeNotifyEvent xrr_event; # endif /* HAVE_RANDR */ # ifdef HAVE_MIT_SAVER_EXTENSION XScreenSaverNotifyEvent sevent; # endif /* HAVE_MIT_SAVER_EXTENSION */ } event; /* We need to select events on all windows if we're not using any extensions. Otherwise, we don't need to. */ Bool scanning_all_windows = !(si->using_xidle_extension || si->using_mit_saver_extension || si->using_sgi_saver_extension); /* We need to periodically wake up and check for idleness if we're not using any extensions, or if we're using the XIDLE extension. The other two extensions explicitly deliver events when we go idle/non-idle, so we don't need to poll. */ Bool polling_for_idleness = !(si->using_mit_saver_extension || si->using_sgi_saver_extension); /* Whether we need to periodically wake up and check to see if the mouse has moved. We only need to do this when not using any extensions. The reason this isn't the same as `polling_for_idleness' is that the "idleness" poll can happen (for example) 5 minutes from now, whereas the mouse-position poll should happen with low periodicity. We don't need to poll the mouse position with the XIDLE extension, but we do need to periodically wake up and query the server with that extension. For our purposes, polling /proc/interrupts is just like polling the mouse position. It has to happen on the same kind of schedule. */ Bool polling_mouse_position = (si->using_proc_interrupts || !(si->using_xidle_extension || si->using_mit_saver_extension || si->using_sgi_saver_extension) || si->using_xinput_extension); const char *why = 0; /* What caused the idle-state to change? */ if (until_idle_p) { if (polling_for_idleness) /* This causes a no-op event to be delivered to us in a while, so that we come back around through the event loop again. */ schedule_wakeup_event (si, p->timeout, p->debug_p); if (polling_mouse_position) /* Check to see if the mouse has moved, and set up a repeating timer to do so periodically (typically, every 5 seconds.) */ check_pointer_timer ((XtPointer) si, 0); } while (1) { XtAppNextEvent (si->app, &event.x_event); switch (event.x_event.xany.type) { case 0: /* our synthetic "timeout" event has been signalled */ if (until_idle_p) { Time idle; /* We may be idle; check one last time to see if the mouse has moved, just in case the idle-timer went off within the 5 second window between mouse polling. If the mouse has moved, then check_pointer_timer() will reset last_activity_time. */ if (polling_mouse_position) check_pointer_timer ((XtPointer) si, 0); #ifdef HAVE_XIDLE_EXTENSION if (si->using_xidle_extension) { /* The XIDLE extension uses the synthetic event to prod us into re-asking the server how long the user has been idle. */ if (! XGetIdleTime (si->dpy, &idle)) { fprintf (stderr, "%s: XGetIdleTime() failed.\n", blurb()); saver_exit (si, 1, 0); } } else #endif /* HAVE_XIDLE_EXTENSION */ #ifdef HAVE_MIT_SAVER_EXTENSION if (si->using_mit_saver_extension) { /* We don't need to do anything in this case - the synthetic event isn't necessary, as we get sent specific events to wake us up. In fact, this event generally shouldn't be being delivered when the MIT extension is in use. */ idle = 0; } else #endif /* HAVE_MIT_SAVER_EXTENSION */ #ifdef HAVE_SGI_SAVER_EXTENSION if (si->using_sgi_saver_extension) { /* We don't need to do anything in this case - the synthetic event isn't necessary, as we get sent specific events to wake us up. In fact, this event generally shouldn't be being delivered when the SGI extension is in use. */ idle = 0; } else #endif /* HAVE_SGI_SAVER_EXTENSION */ { /* Otherwise, no server extension is in use. The synthetic event was to tell us to wake up and see if the user is now idle. Compute the amount of idle time by comparing the `last_activity_time' to the wall clock. The l_a_t was set by calling `reset_timers()', which is called only in only two situations: when polling the mouse position has revealed the the mouse has moved (user activity) or when we have read an event (again, user activity.) */ idle = 1000 * (si->last_activity_time - time ((time_t *) 0)); } if (idle >= p->timeout) { /* Look, we've been idle long enough. We're done. */ why = "timeout"; goto DONE; } else if (si->emergency_lock_p) { /* Oops, the wall clock has jumped far into the future, so we need to lock down in a hurry! */ why = "large wall clock change"; goto DONE; } else { /* The event went off, but it turns out that the user has not yet been idle for long enough. So re-signal the event. Be economical: if we should blank after 5 minutes, and the user has been idle for 2 minutes, then set this timer to go off in 3 minutes. */ if (polling_for_idleness) schedule_wakeup_event (si, p->timeout - idle, p->debug_p); } } break; case ClientMessage: if (handle_clientmessage (si, &event.x_event, until_idle_p)) { why = "ClientMessage"; goto DONE; } break; case CreateNotify: /* A window has been created on the screen somewhere. If we're supposed to scan all windows for events, prepare this window. */ if (scanning_all_windows) { Window w = event.x_event.xcreatewindow.window; start_notice_events_timer (si, w, p->debug_p); } break; case KeyPress: case ButtonPress: /* Ignore release events so that hitting ESC at the password dialog doesn't result in the password dialog coming right back again when the fucking release key is seen! */ /* case KeyRelease:*/ /* case ButtonRelease:*/ case MotionNotify: if (p->debug_p) { Window root=0, window=0; int x=-1, y=-1; const char *type = 0; if (event.x_event.xany.type == MotionNotify) { /*type = "MotionNotify";*/ root = event.x_event.xmotion.root; window = event.x_event.xmotion.window; x = event.x_event.xmotion.x_root; y = event.x_event.xmotion.y_root; } else if (event.x_event.xany.type == KeyPress) { type = "KeyPress"; root = event.x_event.xkey.root; window = event.x_event.xkey.window; x = y = -1; } else if (event.x_event.xany.type == ButtonPress) { type = "ButtonPress"; root = event.x_event.xkey.root; window = event.x_event.xkey.window; x = event.x_event.xmotion.x_root; y = event.x_event.xmotion.y_root; } if (type) { int i; for (i = 0; i < si->nscreens; i++) if (root == RootWindowOfScreen (si->screens[i].screen)) break; fprintf (stderr,"%s: %d: %s on 0x%lx", blurb(), i, type, (unsigned long) window); /* Be careful never to do this unless in -debug mode, as this could expose characters from the unlock password. */ if (p->debug_p && event.x_event.xany.type == KeyPress) { KeySym keysym; char c = 0; XLookupString (&event.x_event.xkey, &c, 1, &keysym, 0); fprintf (stderr, " (%s%s)", (event.x_event.xkey.send_event ? "synthetic " : ""), XKeysymToString (keysym)); } if (x == -1) fprintf (stderr, "\n"); else fprintf (stderr, " at %d,%d.\n", x, y); } } /* If any widgets want to handle this event, let them. */ dispatch_event (si, &event.x_event); /* If we got a MotionNotify event, figure out what screen it was on and poll the mouse there: if the mouse hasn't moved far enough to count as "real" motion, then ignore this event. */ if (event.x_event.xany.type == MotionNotify) { int i; for (i = 0; i < si->nscreens; i++) if (event.x_event.xmotion.root == RootWindowOfScreen (si->screens[i].screen)) break; if (i < si->nscreens) { if (!pointer_moved_p (&si->screens[i], False)) continue; } } /* We got a user event. If we're waiting for the user to become active, this is it. If we're waiting until the user becomes idle, reset the timers (since now we have longer to wait.) */ if (!until_idle_p) { if (si->demoing_p && (event.x_event.xany.type == MotionNotify || event.x_event.xany.type == KeyRelease)) /* When we're demoing a single hack, mouse motion doesn't cause deactivation. Only clicks and keypresses do. */ ; else { /* If we're not demoing, then any activity causes deactivation. */ why = (event.x_event.xany.type == MotionNotify ?"mouse motion": event.x_event.xany.type == KeyPress?"keyboard activity": event.x_event.xany.type == ButtonPress ? "mouse click" : "unknown user activity"); goto DONE; } } else reset_timers (si); break; case PropertyNotify: /* Starting in late 2014, GNOME programs don't actually select for or receive KeyPress events: they do it behind the scenes through some kind of Input Method magic, even when running in an en_US locale. However, those applications *do* update the WM_USER_TIME property on their own windows every time they recieve a secret KeyPress, so we must *also* monitor that property on every window, and treat changes to it as identical to KeyPress. _NET_WM_USER_TIME is documented (such as it is) here: http://standards.freedesktop.org/wm-spec/latest/ar01s05.html #idm139870829932528 Specifically: "Contains the XServer time at which last user activity in this window took place. [...] A client [...] might, for example, use the timestamp of the last KeyPress or ButtonPress event." As of early 2016, KDE4 does something really stupid, though: some hidden power management thing reduces the display brightness 150 seconds after the screen is blanked -- and sets a WM_USER_TIME property on a hidden "kded4" window whose time is in the distant past (the time at which the X server launched). So we ignore any WM_USER_TIME whose timestamp is more than a couple seconds old. */ if (event.x_event.xproperty.state == PropertyNewValue && event.x_event.xproperty.atom == XA_NET_WM_USER_TIME) { int threshold = 2; /* seconds */ Bool bogus_p = True; Window w = event.x_event.xproperty.window; Atom type; int format; unsigned long nitems, bytesafter; unsigned char *data = 0; Cardinal user_time = 0; XErrorHandler old_handler = XSetErrorHandler (BadWindow_ehandler); if (XGetWindowProperty (si->dpy, w, XA_NET_WM_USER_TIME, 0L, 1L, False, XA_CARDINAL, &type, &format, &nitems, &bytesafter, &data) == Success && data && type == XA_CARDINAL && format == 32 && nitems == 1) { long diff; user_time = ((Cardinal *) data)[0]; diff = event.x_event.xproperty.time - user_time; if (diff >= 0 && diff < threshold) bogus_p = False; } if (data) XFree (data); why = "WM_USER_TIME"; if (p->debug_p) { XWindowAttributes xgwa; int i; XGetWindowAttributes (si->dpy, w, &xgwa); for (i = 0; i < si->nscreens; i++) if (xgwa.root == RootWindowOfScreen (si->screens[i].screen)) break; fprintf (stderr,"%s: %d: %s = %ld%s on 0x%lx\n", blurb(), i, why, (unsigned long) user_time, (bogus_p ? " (bad)" : ""), (unsigned long) w); } XSync (si->dpy, False); XSetErrorHandler (old_handler); if (bogus_p) break; else if (until_idle_p) reset_timers (si); else goto DONE; } break; default: #ifdef HAVE_MIT_SAVER_EXTENSION if (event.x_event.type == si->mit_saver_ext_event_number) { /* This event's number is that of the MIT-SCREEN-SAVER server extension. This extension has one event number, and the event itself contains sub-codes that say what kind of event it was (an "idle" or "not-idle" event.) */ if (event.sevent.state == ScreenSaverOn) { int i = 0; if (p->verbose_p) fprintf (stderr, "%s: MIT ScreenSaverOn event received.\n", blurb()); /* Get the "real" server window(s) out of the way as soon as possible. */ 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); } if (event.sevent.kind != ScreenSaverExternal) { fprintf (stderr, "%s: ScreenSaverOn event wasn't of type External!\n", blurb()); } if (until_idle_p) { why = "MIT ScreenSaverOn"; goto DONE; } } else if (event.sevent.state == ScreenSaverOff) { if (p->verbose_p) fprintf (stderr, "%s: MIT ScreenSaverOff event received.\n", blurb()); if (!until_idle_p) { why = "MIT ScreenSaverOff"; goto DONE; } } else fprintf (stderr, "%s: unknown MIT-SCREEN-SAVER event %d received!\n", blurb(), event.sevent.state); } else #endif /* HAVE_MIT_SAVER_EXTENSION */ #ifdef HAVE_SGI_SAVER_EXTENSION if (event.x_event.type == (si->sgi_saver_ext_event_number + ScreenSaverStart)) { /* The SGI SCREEN_SAVER server extension has two event numbers, and this event matches the "idle" event. */ if (p->verbose_p) fprintf (stderr, "%s: SGI ScreenSaverStart event received.\n", blurb()); if (until_idle_p) { why = "SGI ScreenSaverStart"; goto DONE; } } else if (event.x_event.type == (si->sgi_saver_ext_event_number + ScreenSaverEnd)) { /* The SGI SCREEN_SAVER server extension has two event numbers, and this event matches the "idle" event. */ if (p->verbose_p) fprintf (stderr, "%s: SGI ScreenSaverEnd event received.\n", blurb()); if (!until_idle_p) { why = "SGI ScreenSaverEnd"; goto DONE; } } else #endif /* HAVE_SGI_SAVER_EXTENSION */ #ifdef HAVE_XINPUT /* If we got a MotionNotify event, check to see if the mouse has moved far enough to count as "real" motion, if not, then ignore this event. */ if ((si->num_xinput_devices > 0) && (event.x_event.type == si->xinput_DeviceMotionNotify)) { XDeviceMotionEvent *dme = (XDeviceMotionEvent *) &event; poll_mouse_data *last_poll_mouse = NULL; int d; for (d = 0; d < si->num_xinput_devices; d++) { if (si->xinput_devices[d].device->device_id == dme->deviceid) { last_poll_mouse = &(si->xinput_devices[d].last_poll_mouse); break; } } if (last_poll_mouse) { poll_mouse_data this_poll_mouse; this_poll_mouse.root_x = dme->x_root; this_poll_mouse.root_y = dme->y_root; this_poll_mouse.child = dme->subwindow; this_poll_mouse.mask = dme->device_state; this_poll_mouse.time = dme->time / 1000; /* milliseconds */ if (!device_pointer_moved_p (si, last_poll_mouse, &this_poll_mouse, False, "device", dme->deviceid)) continue; } else if (p->debug_p) fprintf (stderr, "%s: received MotionNotify from unknown device %d\n", blurb(), (int) dme->deviceid); } if ((!until_idle_p) && (si->num_xinput_devices > 0) && (event.x_event.type == si->xinput_DeviceMotionNotify || event.x_event.type == si->xinput_DeviceButtonPress)) /* Ignore DeviceButtonRelease, see ButtonRelease comment above. */ { dispatch_event (si, &event.x_event); if (si->demoing_p && event.x_event.type == si->xinput_DeviceMotionNotify) /* When we're demoing a single hack, mouse motion doesn't cause deactivation. Only clicks and keypresses do. */ ; else /* If we're not demoing, then any activity causes deactivation. */ { why = (event.x_event.type == si->xinput_DeviceMotionNotify ? "XI mouse motion" : event.x_event.type == si->xinput_DeviceButtonPress ? "XI mouse click" : "unknown XINPUT event"); goto DONE; } } else #endif /* HAVE_XINPUT */ #ifdef HAVE_RANDR if (si->using_randr_extension && (event.x_event.type == (si->randr_event_number + RRScreenChangeNotify))) { /* The Resize and Rotate extension sends an event when the size, rotation, or refresh rate of any screen has changed. */ if (p->verbose_p) { /* XRRRootToScreen is in Xrandr.h 1.4, 2001/06/07 */ int screen = XRRRootToScreen (si->dpy, event.xrr_event.window); fprintf (stderr, "%s: %d: screen change event received\n", blurb(), screen); } # ifdef RRScreenChangeNotifyMask /* Inform Xlib that it's ok to update its data structures. */ XRRUpdateConfiguration (&event.x_event); /* Xrandr.h 1.9, 2002/09/29 */ # endif /* RRScreenChangeNotifyMask */ /* Resize the existing xscreensaver windows and cached ssi data. */ if (update_screen_layout (si)) { if (p->verbose_p) { fprintf (stderr, "%s: new layout:\n", blurb()); describe_monitor_layout (si); } resize_screensaver_window (si); } } else #endif /* HAVE_RANDR */ /* Just some random event. Let the Widgets handle it, if desired. */ dispatch_event (si, &event.x_event); } } DONE: if (p->verbose_p) { if (! why) why = "unknown reason"; fprintf (stderr, "%s: %s (%s)\n", blurb(), (until_idle_p ? "user is idle" : "user is active"), why); } /* If there's a user event on the queue, swallow it. If we're using a server extension, and the user becomes active, we get the extension event before the user event -- so the keypress or motion or whatever is still on the queue. This makes "unfade" not work, because it sees that event, and bugs out. (This problem doesn't exhibit itself without an extension, because in that case, there's only one event generated by user activity, not two.) */ if (!until_idle_p && si->locked_p) swallow_unlock_typeahead_events (si, &event.x_event); else while (XCheckMaskEvent (si->dpy, (KeyPressMask|ButtonPressMask|PointerMotionMask), &event.x_event)) ; if (si->check_pointer_timer_id) { XtRemoveTimeOut (si->check_pointer_timer_id); si->check_pointer_timer_id = 0; } if (si->timer_id) { XtRemoveTimeOut (si->timer_id); si->timer_id = 0; } if (until_idle_p && si->cycle_id) /* no cycle timer when inactive */ abort (); } /* Some crap for dealing with /proc/interrupts. On Linux systems, it's possible to see the hardware interrupt count associated with the keyboard. We can therefore use that as another method of detecting idleness. Why is it a good idea to do this? Because it lets us detect keyboard activity that is not associated with X events. For example, if the user has switched to another virtual console, it's good for xscreensaver to not be running graphics hacks on the (non-visible) X display. The common complaint that checking /proc/interrupts addresses is that the user is playing Quake on a non-X console, and the GL hacks are perceptibly slowing the game... This is tricky for a number of reasons. * First, we must be sure to only do this when running on an X server that is on the local machine (because otherwise, we'd be reacting to the wrong keyboard.) The way we do this is by noting that the $DISPLAY is pointing to display 0 on the local machine. It *could* be that display 1 is also on the local machine (e.g., two X servers, each on a different virtual-terminal) but it's also possible that screen 1 is an X terminal, using this machine as the host. So we can't take that chance. * Second, one can only access these interrupt numbers in a completely and utterly brain-damaged way. You would think that one would use an ioctl for this. But no. The ONLY way to get this information is to open the pseudo-file /proc/interrupts AS A FILE, and read the numbers out of it TEXTUALLY. Because this is Unix, and all the world's a file, and the only real data type is the short-line sequence of ASCII bytes. Now it's all well and good that the /proc/interrupts pseudo-file exists; that's a clever idea, and a useful API for things that are already textually oriented, like shell scripts, and users doing interactive debugging sessions. But to make a *C PROGRAM* open a file and parse the textual representation of integers out of it is just insane. * Third, you can't just hold the file open, and fseek() back to the beginning to get updated data! If you do that, the data never changes. And I don't want to call open() every five seconds, because I don't want to risk going to disk for any inodes. It turns out that if you dup() it early, then each copy gets fresh data, so we can get around that in this way (but for how many releases, one might wonder?) * Fourth, the format of the output of the /proc/interrupts file is undocumented, and has changed several times already! In Linux 2.0.33, even on a multiprocessor machine, it looks like this: 0: 309453991 timer 1: 4771729 keyboard but in Linux 2.2 and 2.4 kernels with MP machines, it looks like this: CPU0 CPU1 0: 1671450 1672618 IO-APIC-edge timer 1: 13037 13495 IO-APIC-edge keyboard and in Linux 2.6, it's gotten even goofier: now there are two lines labelled "i8042". One of them is the keyboard, and one of them is the PS/2 mouse -- and of course, you can't tell them apart, except by wiggling the mouse and noting which one changes: CPU0 CPU1 1: 32051 30864 IO-APIC-edge i8042 12: 476577 479913 IO-APIC-edge i8042 Joy! So how are we expected to parse that? Well, this code doesn't parse it: it saves the first line with the string "keyboard" (or "i8042") in it, and does a string-comparison to note when it has changed. If there are two "i8042" lines, we assume the first is the keyboard and the second is the mouse (doesn't matter which is which, really, as long as we don't compare them against each other.) Thanks to Nat Friedman for figuring out most of this crap. Note that if you have a serial or USB mouse, or a USB keyboard, it won't detect it. That's because there's no way to tell the difference between a serial mouse and a general serial port, and all USB devices look the same from here. It would be somewhat unfortunate to have the screensaver turn off when the modem on COM1 burped, or when a USB disk was accessed. */ #ifdef HAVE_PROC_INTERRUPTS #define PROC_INTERRUPTS "/proc/interrupts" Bool query_proc_interrupts_available (saver_info *si, const char **why) { /* We can use /proc/interrupts if $DISPLAY points to :0, and if the "/proc/interrupts" file exists and is readable. */ FILE *f; if (why) *why = 0; if (!display_is_on_console_p (si)) { if (why) *why = "not on primary console"; return False; } f = fopen (PROC_INTERRUPTS, "r"); if (!f) { if (why) *why = "does not exist"; return False; } fclose (f); return True; } static Bool proc_interrupts_activity_p (saver_info *si) { static FILE *f0 = 0; FILE *f1 = 0; int fd; static char last_kbd_line[255] = { 0, }; static char last_ptr_line[255] = { 0, }; char new_line[sizeof(last_kbd_line)]; Bool checked_kbd = False, kbd_changed = False; Bool checked_ptr = False, ptr_changed = False; int i8042_count = 0; if (!f0) { /* First time -- open the file. */ f0 = fopen (PROC_INTERRUPTS, "r"); if (!f0) { char buf[255]; sprintf(buf, "%s: error opening %s", blurb(), PROC_INTERRUPTS); perror (buf); goto FAIL; } # if defined(HAVE_FCNTL) && defined(FD_CLOEXEC) /* Close this fd upon exec instead of inheriting / leaking it. */ if (fcntl (fileno (f0), F_SETFD, FD_CLOEXEC) != 0) perror ("fcntl: CLOEXEC:"); # endif } if (f0 == (FILE *) -1) /* means we got an error initializing. */ return False; fd = dup (fileno (f0)); if (fd < 0) { char buf[255]; sprintf(buf, "%s: could not dup() the %s fd", blurb(), PROC_INTERRUPTS); perror (buf); goto FAIL; } f1 = fdopen (fd, "r"); if (!f1) { char buf[255]; sprintf(buf, "%s: could not fdopen() the %s fd", blurb(), PROC_INTERRUPTS); perror (buf); goto FAIL; } /* Actually, I'm unclear on why this fseek() is necessary, given the timing of the dup() above, but it is. */ if (fseek (f1, 0, SEEK_SET) != 0) { char buf[255]; sprintf(buf, "%s: error rewinding %s", blurb(), PROC_INTERRUPTS); perror (buf); goto FAIL; } /* Now read through the pseudo-file until we find the "keyboard", "PS/2 mouse", or "i8042" lines. */ while (fgets (new_line, sizeof(new_line)-1, f1)) { Bool i8042_p = !!strstr (new_line, "i8042"); if (i8042_p) i8042_count++; if (strchr (new_line, ',')) { /* Ignore any line that has a comma on it: this is because a setup like this: 12: 930935 XT-PIC usb-uhci, PS/2 Mouse is really bad news. It *looks* like we can note mouse activity from that line, but really, that interrupt gets fired any time any USB device has activity! So we have to ignore any shared IRQs. */ } else if (!checked_kbd && (strstr (new_line, "keyboard") || (i8042_p && i8042_count == 1))) { /* Assume the keyboard interrupt is the line that says "keyboard", or the *first* line that says "i8042". */ kbd_changed = (*last_kbd_line && !!strcmp (new_line, last_kbd_line)); strcpy (last_kbd_line, new_line); checked_kbd = True; } else if (!checked_ptr && (strstr (new_line, "PS/2 Mouse") || (i8042_p && i8042_count == 2))) { /* Assume the mouse interrupt is the line that says "PS/2 mouse", or the *second* line that says "i8042". */ ptr_changed = (*last_ptr_line && !!strcmp (new_line, last_ptr_line)); strcpy (last_ptr_line, new_line); checked_ptr = True; } if (checked_kbd && checked_ptr) break; } if (checked_kbd || checked_ptr) { fclose (f1); if (si->prefs.debug_p && (kbd_changed || ptr_changed)) fprintf (stderr, "%s: /proc/interrupts activity: %s\n", blurb(), ((kbd_changed && ptr_changed) ? "mouse and kbd" : kbd_changed ? "kbd" : ptr_changed ? "mouse" : "ERR")); return (kbd_changed || ptr_changed); } /* If we got here, we didn't find either a "keyboard" or a "PS/2 Mouse" line in the file at all. */ fprintf (stderr, "%s: no keyboard or mouse data in %s?\n", blurb(), PROC_INTERRUPTS); FAIL: if (f1) fclose (f1); if (f0 && f0 != (FILE *) -1) fclose (f0); f0 = (FILE *) -1; return False; } #endif /* HAVE_PROC_INTERRUPTS */ /* This timer goes off every few minutes, whether the user is idle or not, to try and clean up anything that has gone wrong. It calls disable_builtin_screensaver() so that if xset has been used, or some other program (like xlock) has messed with the XSetScreenSaver() settings, they will be set back to sensible values (if a server extension is in use, messing with xlock can cause xscreensaver to never get a wakeup event, and could cause monitor power-saving to occur, and all manner of heinousness.) If the screen is currently blanked, it raises the window, in case some other window has been mapped on top of it. If the screen is currently blanked, and there is no hack running, it clears the window, in case there is an error message printed on it (we don't want the error message to burn in.) */ static void watchdog_timer (XtPointer closure, XtIntervalId *id) { saver_info *si = (saver_info *) closure; saver_preferences *p = &si->prefs; disable_builtin_screensaver (si, False); /* 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->dpms_enabled_p && p->mode != DONT_BLANK), p->dpms_quickoff_p, p->dpms_standby / 1000, p->dpms_suspend / 1000, p->dpms_off / 1000, False); if (si->screen_blanked_p) { Bool running_p = screenhack_running_p (si); if (si->dbox_up_p) { if (si->prefs.debug_p) fprintf (stderr, "%s: dialog box is up: not raising screen.\n", blurb()); } else { if (si->prefs.debug_p) fprintf (stderr, "%s: watchdog timer raising %sscreen.\n", blurb(), (running_p ? "" : "and clearing ")); raise_window (si, True, True, running_p); } if (screenhack_running_p (si) && !monitor_powered_on_p (si)) { int i; if (si->prefs.verbose_p) fprintf (stderr, "%s: X says 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, True); } } void reset_watchdog_timer (saver_info *si, Bool on_p) { saver_preferences *p = &si->prefs; if (si->watchdog_id) { XtRemoveTimeOut (si->watchdog_id); si->watchdog_id = 0; } if (on_p && p->watchdog_timeout) { 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); } } /* It's possible that a race condition could have led to the saver window being unexpectedly still mapped. This can happen like so: - screen is blanked - hack is launched - that hack tries to grab a screen image (it does this by first unmapping the saver window, then remapping it.) - hack unmaps window - hack waits - user becomes active - hack re-maps window (*) - driver kills subprocess - driver unmaps window (**) The race is that (*) might have been sent to the server before the client process was killed, but, due to scheduling randomness, might not have been received by the server until after (**). In other words, (*) and (**) might happen out of order, meaning the driver will unmap the window, and then after that, the recently-dead client will re-map it. This leaves the user locked out (it looks like a desktop, but it's not!) To avoid this: after un-blanking the screen, we launch a timer that wakes up once a second for ten seconds, and makes damned sure that the window is still unmapped. */ void de_race_timer (XtPointer closure, XtIntervalId *id) { saver_info *si = (saver_info *) closure; saver_preferences *p = &si->prefs; int secs = 1; if (id == 0) /* if id is 0, this is the initialization call. */ { si->de_race_ticks = 10; if (p->verbose_p) fprintf (stderr, "%s: starting de-race timer (%d seconds.)\n", blurb(), si->de_race_ticks); } else { int i; XSync (si->dpy, False); for (i = 0; i < si->nscreens; i++) { saver_screen_info *ssi = &si->screens[i]; Window w = ssi->screensaver_window; XWindowAttributes xgwa; XGetWindowAttributes (si->dpy, w, &xgwa); if (xgwa.map_state != IsUnmapped) { if (p->verbose_p) fprintf (stderr, "%s: %d: client race! emergency unmap 0x%lx.\n", blurb(), i, (unsigned long) w); XUnmapWindow (si->dpy, w); } else if (p->debug_p) fprintf (stderr, "%s: %d: (de-race of 0x%lx is cool.)\n", blurb(), i, (unsigned long) w); } XSync (si->dpy, False); si->de_race_ticks--; } if (id && *id == si->de_race_id) si->de_race_id = 0; if (si->de_race_id) abort(); if (si->de_race_ticks <= 0) { si->de_race_id = 0; if (p->verbose_p) fprintf (stderr, "%s: de-race completed.\n", blurb()); } else { si->de_race_id = XtAppAddTimeOut (si->app, secs * 1000, de_race_timer, closure); } } xscreensaver-5.42+dfsg1/driver/types.h000066400000000000000000000420221342162430400177630ustar00rootroot00000000000000/* xscreensaver, Copyright (c) 1993-2014 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_TYPES_H__ #define __XSCREENSAVER_TYPES_H__ 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; char *visual; char *name; char *command; }; typedef enum { RANDOM_HACKS, ONE_HACK, BLANK_ONLY, DONT_BLANK, RANDOM_HACKS_SAME } saver_mode; 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. */ struct saver_preferences { XrmDatabase db; /* The resource database into which the init file is merged, and out of which the preferences are parsed. */ time_t init_file_date; /* The date (from stat()) of the .xscreensaver file the last time this process read or 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 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. */ # ifdef QUAD_MODE Bool quad_p; /* whether to run four savers per monitor */ # endif screenhack **screenhacks; /* the programs to run */ int screenhacks_count; saver_mode mode; /* hack-selection mode */ 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 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 in "Blank Only" mode */ Time dpms_standby; /* how long until monitor goes black */ Time dpms_suspend; /* how long until monitor power-saves */ Time dpms_off; /* how long until monitor powers down */ 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. */ text_mode tmode; /* How we generate text to display. */ char *text_literal; /* used when tmode is TEXT_LITERAL. */ char *text_file; /* used when tmode is TEXT_FILE. */ 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. */ int auth_warning_slack; /* Don't warn about login failures if they all happen within this many seconds of a successful login. */ }; /* 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. */ struct saver_info { 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 */ Visual **best_gl_visuals; /* visuals for GL hacks on screen N */ /* ======================================================================= 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. */ 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' */ 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; }; /* 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. */ struct saver_screen_info { saver_info *global; int number; /* The internal ordinal of this screen, counting Xinerama rectangles as separate screens. */ int real_screen_number; /* The number of the underlying X screen on which this rectangle lies. */ Screen *screen; /* The X screen in question. */ int x, y, width, height; /* The size and position of this rectangle on its underlying X screen. */ 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. */ 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 reasons. This is definitive (even a false value here overrides prefs->install_cmap_p.) */ Visual *current_visual; /* The visual of the window. */ int current_depth; /* How deep the visual (and the window) are. */ 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 /* ======================================================================= 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 ======================================================================= */ poll_mouse_data last_poll_mouse; /* Used only when no server exts. */ /* ======================================================================= subprocs ======================================================================= */ 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; }; #endif /* __XSCREENSAVER_TYPES_H__ */ xscreensaver-5.42+dfsg1/driver/vms-getpwnam.c000066400000000000000000000067451342162430400212530ustar00rootroot00000000000000/* * getpwnam(name) - retrieves a UAF entry * * Author: Patrick L. Mahan * Location: TGV, Inc * Date: 15-Nov-1991 * * Purpose: Provides emulation for the UNIX getpwname routine. * * Modification History * * Date | Who | Version | Reason * ------------+-----------+---------------+--------------------------- * 15-Nov-1991 | PLM | 1.0 | First Write */ #define PASSWDROUTINES #include #include #include #include #include #include #include "vms-pwd.h" struct uic { unsigned short uid; unsigned short gid; }; #define TEST(ptr, str) { if (ptr == NULL) { \ fprintf(stderr, "getpwnam: memory allocation failure for \"%s\"\n", \ str); \ return ((struct passwd *)(NULL)); \ } } struct passwd *getpwnam(name) char *name; { int istatus; int UserNameLen; int UserOwnerLen; int UserDeviceLen; int UserDirLen; static char UserName[13]; static char UserOwner[32]; static char UserDevice[32]; static char UserDir[64]; char *cptr, *sptr; unsigned long int UserPwd[2]; unsigned short int UserSalt; unsigned long int UserEncrypt; struct uic UicValue; struct passwd *entry; struct dsc$descriptor_s VMSNAME = {strlen(name), DSC$K_DTYPE_T, DSC$K_CLASS_S, name}; struct itmlist3 { unsigned short int length; unsigned short int item; unsigned long int addr; unsigned long int retaddr; } ItemList[] = { {12, UAI$_USERNAME, (unsigned long)&UserName, (unsigned long)&UserNameLen}, {8, UAI$_PWD, (unsigned long)&UserPwd, 0}, {4, UAI$_UIC, (unsigned long)&UicValue, 0}, {32, UAI$_OWNER, (unsigned long)&UserOwner, (unsigned long)&UserOwnerLen}, {32, UAI$_DEFDEV, (unsigned long)&UserDevice, (unsigned long)&UserDeviceLen}, {64, UAI$_DEFDIR, (unsigned long)&UserDir, (unsigned long)&UserDirLen}, {2, UAI$_SALT, (unsigned long)&UserSalt, 0}, {4, UAI$_ENCRYPT, (unsigned long)&UserEncrypt, 0}, {0, 0, 0, 0} }; UserNameLen = 0; istatus = sys$getuai (0, 0, &VMSNAME, &ItemList, 0, 0, 0); if (!(istatus & 1)) { fprintf (stderr, "getpwnam: unable to retrieve passwd entry for %s\n", name); fprintf (stderr, "getpwnam: vms error number is 0x%x\n", istatus); return ((struct passwd *)NULL); } entry = (struct passwd *) calloc (1, sizeof(struct passwd)); TEST(entry, "PASSWD_ENTRY"); entry->pw_uid = UicValue.uid; entry->pw_gid = UicValue.gid; entry->pw_salt = UserSalt; entry->pw_encrypt = UserEncrypt; sptr = UserName; cptr = calloc (UserNameLen+1, sizeof(char)); TEST(cptr, "USERNAME"); strncpy (cptr, sptr, UserNameLen); cptr[UserNameLen] = '\0'; entry->pw_name = cptr; cptr = calloc(8, sizeof(char)); TEST(cptr, "PASSWORD"); memcpy(cptr, UserPwd, 8); entry->pw_passwd = cptr; sptr = UserOwner; sptr++; cptr = calloc ((int)UserOwner[0]+1, sizeof(char)); TEST(cptr, "FULLNAME"); strncpy (cptr, sptr, (int)UserOwner[0]); cptr[(int)UserOwner[0]] = '\0'; entry->pw_gecos = cptr; cptr = calloc ((int)UserDevice[0]+(int)UserDir[0]+1, sizeof(char)); TEST(cptr, "HOME"); sptr = UserDevice; sptr++; strncpy (cptr, sptr, (int)UserDevice[0]); sptr = UserDir; sptr++; strncat (cptr, sptr, (int)UserDir[0]); cptr[(int)UserDevice[0]+(int)UserDir[0]] = '\0'; entry->pw_dir = cptr; cptr = calloc (strlen("SYS$SYSTEM:LOGINOUT.EXE")+1, sizeof(char)); TEST(cptr,"SHELL"); strcpy (cptr, "SYS$SYSTEM:LOGINOUT.EXE"); entry->pw_shell = cptr; return (entry); } xscreensaver-5.42+dfsg1/driver/vms-hpwd.c000066400000000000000000000040751342162430400203650ustar00rootroot00000000000000/* * VAX/VMS Password hashing routines: * * uses the System Service SYS$HASH_PASSWORD * * 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. * */ #include #include #include #include /* * Hashing routine */ hash_vms_password(output_buf,input_buf,input_length,username,encryption_type,salt) char *output_buf; char *input_buf; int input_length; char *username; int encryption_type; unsigned short salt; { struct dsc$descriptor_s password; struct dsc$descriptor_s user; /* * Check the VMS Version. If this is V5.4 or later, then * we can use the new system service SYS$HASH_PASSWORD. Else * fail and return garbage. */ static char VMS_Version[32]; struct { unsigned short int Size; unsigned short int Code; char *Buffer; unsigned short int *Resultant_Size; } Item_List[2]={32, SYI$_VERSION, VMS_Version, 0, 0, 0}; struct {int Size; char *Ptr;} Descr1; /* * Get the information */ sys$getsyiw(0,0,0,Item_List,0,0,0); /* * Call the old routine if this isn't V5.4 or later... */ #ifndef __DECC if ((VMS_Version[1] < '5') || ((VMS_Version[1] == '5') && (VMS_Version[3] < '4'))) { printf("Unsupported OS version\n"); return(1); } #endif /* !__DECC */ /* * Call the SYS$HASH_PASSWORD system service... */ password.dsc$b_dtype = DSC$K_DTYPE_T; password.dsc$b_class = DSC$K_CLASS_S; password.dsc$w_length = input_length; password.dsc$a_pointer = input_buf; user.dsc$b_dtype = DSC$K_DTYPE_T; user.dsc$b_class = DSC$K_CLASS_S; user.dsc$w_length = strlen(username); user.dsc$a_pointer = username; sys$hash_password (&password, encryption_type, salt, &user, output_buf); } xscreensaver-5.42+dfsg1/driver/vms-pwd.h000066400000000000000000000013731342162430400202200ustar00rootroot00000000000000/* @(#)pwd.h 1.7 89/08/24 SMI; from S5R2 1.1 */ #ifndef __pwd_h #define __pwd_h #ifdef vax11c #include #else #include #endif /* vax11c */ #ifdef PASSWDROUTINES #define EXTERN #else #define EXTERN extern #endif /* PASSWDROUTINES */ struct passwd { char *pw_name; char *pw_passwd; int pw_uid; int pw_gid; short pw_salt; int pw_encrypt; char *pw_age; char *pw_comment; char *pw_gecos; char *pw_dir; char *pw_shell; }; #ifndef _POSIX_SOURCE extern struct passwd *getpwent(); struct comment { char *c_dept; char *c_name; char *c_acct; char *c_bin; }; #endif EXTERN struct passwd *getpwuid(/* uid_t uid */); EXTERN struct passwd *getpwnam(/* char *name */); #endif /* !__pwd_h */ xscreensaver-5.42+dfsg1/driver/vms-validate.c000066400000000000000000000032401342162430400212050ustar00rootroot00000000000000/* * validate a password for a user * * 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. */ /* * Includes */ #include #include #include #include "vms-pwd.h" int hash_vms_password(char *output_buf,char *input_buf,int input_length, char *username,int encryption_type,unsigned short salt); /* * * Validate a VMS UserName/Password pair. * */ int validate_user(name,password) char *name; char *password; { char password_buf[64]; char username_buf[31]; char encrypt_buf[8]; register int i; register char *cp,*cp1; struct passwd *user_entry; /* * Get the users UAF entry */ user_entry = getpwnam(name); /* * If user_entry == NULL then we got a bad error * return -1 to indicate a bad error */ if (user_entry == NULL) return (-1); /* * Uppercase the password */ cp = password; cp1 = password_buf; while (*cp) if (islower(*cp)) *cp1++ = toupper(*cp++); else *cp1++ = *cp++; /* * Get the length of the password */ i = strlen(password); /* * Encrypt the password */ hash_vms_password(encrypt_buf,password_buf,i,user_entry->pw_name, user_entry->pw_encrypt, user_entry->pw_salt); if (memcmp(encrypt_buf,user_entry->pw_passwd,8) == 0) return(1); else return(0); } xscreensaver-5.42+dfsg1/driver/vms_axp.opt000066400000000000000000000002401342162430400206430ustar00rootroot00000000000000[-.UTILS]UTILS.OLB_AXP/LIB SYS$SHARE:DECW$XMLIBSHR.EXE/SHARE SYS$SHARE:DECW$XMULIBSHR.EXE/SHARE SYS$SHARE:DECW$XTSHR.EXE/SHARE SYS$SHARE:DECW$XLIBSHR.EXE/SHARE xscreensaver-5.42+dfsg1/driver/vms_axp_12.opt000066400000000000000000000002511342162430400211470ustar00rootroot00000000000000[-.UTILS]UTILS.OLB_AXP/LIB SYS$SHARE:DECW$XMLIBSHR12.EXE/SHARE SYS$SHARE:DECW$XMULIBSHRR5.EXE/SHARE SYS$SHARE:DECW$XTLIBSHRR5.EXE/SHARE SYS$SHARE:DECW$XLIBSHR.EXE/SHARE xscreensaver-5.42+dfsg1/driver/vms_decc.opt000066400000000000000000000002411342162430400207520ustar00rootroot00000000000000[-.UTILS]UTILS.OLB_DECC/LIB SYS$SHARE:DECW$XMLIBSHR.EXE/SHARE SYS$SHARE:DECW$XMULIBSHR.EXE/SHARE SYS$SHARE:DECW$XTSHR.EXE/SHARE SYS$SHARE:DECW$XLIBSHR.EXE/SHARE xscreensaver-5.42+dfsg1/driver/vms_decc_12.opt000066400000000000000000000002521342162430400212560ustar00rootroot00000000000000[-.UTILS]UTILS.OLB_DECC/LIB SYS$SHARE:DECW$XMLIBSHR12.EXE/SHARE SYS$SHARE:DECW$XMULIBSHRR5.EXE/SHARE SYS$SHARE:DECW$XTLIBSHRR5.EXE/SHARE SYS$SHARE:DECW$XLIBSHR.EXE/SHARE xscreensaver-5.42+dfsg1/driver/windows.c000066400000000000000000001623241342162430400203140ustar00rootroot00000000000000/* windows.c --- turning the screen black; dealing with visuals, virtual roots. * xscreensaver, Copyright (c) 1991-2014 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 #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 #include /* for XSetClassHint() */ #include #include /* for time() */ #include /* for the signal names */ #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 #endif /* HAVE_XF86VMODE */ #ifdef HAVE_XINERAMA # 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 "visual.h" #include "fade.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 kill_xsetroot_data_1 (Display *dpy, Window window, Atom prop, const char *atom_name, Bool verbose_p) { 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); } } 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); } static void save_real_vroot (saver_screen_info *ssi) { saver_info *si = ssi->global; Display *dpy = si->dpy; Screen *screen = ssi->screen; 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); } 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) { 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; } 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; } } } 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)); 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()); 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); 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) { 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; } 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 */ static void initialize_screensaver_window_1 (saver_screen_info *ssi) { saver_info *si = ssi->global; saver_preferences *p = &si->prefs; Bool install_cmap_p = ssi->install_cmap_p; /* not p->install_cmap_p */ /* 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... */ XColor black; XSetWindowAttributes attrs; unsigned long attrmask; static Bool printed_visual_info = False; /* only print the message once. */ Window horked_window = 0; black.red = black.green = black.blue = 0; if (ssi->cmap == DefaultColormapOfScreen (ssi->screen)) ssi->cmap = 0; if (ssi->current_visual != DefaultVisualOfScreen (ssi->screen)) /* It's not the default visual, so we have no choice but to install. */ install_cmap_p = True; if (install_cmap_p) { if (! ssi->cmap) { ssi->cmap = XCreateColormap (si->dpy, RootWindowOfScreen (ssi->screen), ssi->current_visual, AllocNone); if (! XAllocColor (si->dpy, ssi->cmap, &black)) abort (); ssi->black_pixel = black.pixel; } } else { Colormap def_cmap = DefaultColormapOfScreen (ssi->screen); if (ssi->cmap) { XFreeColors (si->dpy, ssi->cmap, &ssi->black_pixel, 1, 0); if (ssi->cmap != ssi->demo_cmap && ssi->cmap != def_cmap) XFreeColormap (si->dpy, ssi->cmap); } ssi->cmap = def_cmap; ssi->black_pixel = BlackPixelOfScreen (ssi->screen); } attrmask = (CWOverrideRedirect | CWEventMask | CWBackingStore | CWColormap | 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.colormap = ssi->cmap; attrs.background_pixel = ssi->black_pixel; attrs.backing_pixel = ssi->black_pixel; attrs.border_pixel = ssi->black_pixel; if (!p->verbose_p || printed_visual_info) ; else if (ssi->current_visual == DefaultVisualOfScreen (ssi->screen)) { fprintf (stderr, "%s: %d: visual ", blurb(), ssi->number); describe_visual (stderr, ssi->screen, ssi->current_visual, install_cmap_p); } else { fprintf (stderr, "%s: using visual: ", blurb()); describe_visual (stderr, ssi->screen, ssi->current_visual, install_cmap_p); fprintf (stderr, "%s: default visual: ", blurb()); describe_visual (stderr, ssi->screen, DefaultVisualOfScreen (ssi->screen), ssi->install_cmap_p); } printed_visual_info = True; #ifdef HAVE_MIT_SAVER_EXTENSION if (si->using_mit_saver_extension) { 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); } #endif /* HAVE_MIT_SAVER_EXTENSION */ if (ssi->screensaver_window) { XWindowChanges changes; unsigned int changesmask = CWX|CWY|CWWidth|CWHeight|CWBorderWidth; changes.x = ssi->x; changes.y = ssi->y; changes.width = ssi->width; 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))) { horked_window = ssi->screensaver_window; ssi->screensaver_window = 0; } } if (!ssi->screensaver_window) { ssi->screensaver_window = XCreateWindow (si->dpy, RootWindowOfScreen (ssi->screen), ssi->x, ssi->y, ssi->width, ssi->height, 0, ssi->current_depth, InputOutput, ssi->current_visual, attrmask, &attrs); reset_stderr (ssi); 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; } if (p->verbose_p) 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); ssi->cursor = XCreatePixmapCursor (si->dpy, bit, bit, &black, &black, 0, 0); XFreePixmap (si->dpy, bit); } XSetWindowBackground (si->dpy, ssi->screensaver_window, ssi->black_pixel); if (si->demoing_p) XUndefineCursor (si->dpy, ssi->screensaver_window); else XDefineCursor (si->dpy, ssi->screensaver_window, ssi->cursor); } void initialize_screensaver_window (saver_info *si) { int i; for (i = 0; i < si->nscreens; i++) initialize_screensaver_window_1 (&si->screens[i]); } /* 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 the size of the saver windows to the new sizes of the screens. */ void resize_screensaver_window (saver_info *si) { saver_preferences *p = &si->prefs; int i; for (i = 0; i < si->nscreens; i++) { saver_screen_info *ssi = &si->screens[i]; XWindowAttributes xgwa; /* Make sure a window exists -- it might not if a monitor was just added for the first time. */ if (! ssi->screensaver_window) { initialize_screensaver_window_1 (ssi); if (p->verbose_p) fprintf (stderr, "%s: %d: newly added window 0x%lx %dx%d+%d+%d\n", blurb(), i, (unsigned long) ssi->screensaver_window, ssi->width, ssi->height, ssi->x, ssi->y); } /* Make sure the window is the right size -- it might not be if the monitor changed resolution, or if a badly-behaved hack screwed with it. */ XGetWindowAttributes (si->dpy, ssi->screensaver_window, &xgwa); if (xgwa.x != ssi->x || xgwa.y != ssi->y || xgwa.width != ssi->width || xgwa.height != ssi->height) { XWindowChanges changes; unsigned int changesmask = CWX|CWY|CWWidth|CWHeight|CWBorderWidth; changes.x = ssi->x; changes.y = ssi->y; changes.width = ssi->width; changes.height = ssi->height; changes.border_width = 0; if (p->verbose_p) fprintf (stderr, "%s: %d: resize 0x%lx from %dx%d+%d+%d to %dx%d+%d+%d\n", blurb(), i, (unsigned long) ssi->screensaver_window, 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)) fprintf (stderr, "%s: %d: someone horked our saver window" " (0x%lx)! Unable to resize it!\n", blurb(), i, (unsigned long) ssi->screensaver_window); } /* Now (if blanked) make sure that it's mapped and running a hack -- it might not be if we just added it. (We also might be re-using an old window that existed for a previous monitor that was removed and re-added.) 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); 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); } } } /* Kill off any savers running on no-longer-extant monitors. */ for (; i < si->ssi_count; i++) { saver_screen_info *ssi = &si->screens[i]; if (ssi->pid) kill_screenhack (ssi); 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) { saver_preferences *p = &si->prefs; int i; if (si->demoing_p) inhibit_fade = True; if (si->emergency_lock_p) inhibit_fade = True; if (!dont_clear) initialize_screensaver_window (si); reset_watchdog_timer (si, True); if (p->fade_p && si->fading_possible_p && !inhibit_fade) { Window *current_windows = (Window *) calloc(sizeof(Window), si->nscreens); Colormap *current_maps = (Colormap *) calloc(sizeof(Colormap), si->nscreens); 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, ssi->black_pixel); } 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); #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; } } /* couldn't figure out where the mouse is? Oh well. */ return 0; } 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; 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); si->screen_blanked_p = True; si->blank_time = time ((time_t *) 0); si->last_wall_clock_time = 0; store_saver_status (si); /* store blank time */ return True; } void unblank_screen (saver_info *si) { saver_preferences *p = &si->prefs; Bool unfade_p = (si->fading_possible_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) { Window *current_windows = (Window *) calloc(sizeof(Window), si->nscreens); 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()); 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()); } else { for (i = 0; i < si->nscreens; i++) { saver_screen_info *ssi = &si->screens[i]; if (ssi->cmap) { Colormap c = DefaultColormapOfScreen (ssi->screen); /* avoid technicolor */ 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; XGetInputFocus (si->dpy, &focus, &revert_to); if (focus && focus != PointerRoot && focus != None) { XWindowAttributes xgwa; xgwa.colormap = 0; XGetWindowAttributes (si->dpy, focus, &xgwa); if (xgwa.colormap && xgwa.colormap != DefaultColormapOfScreen (xgwa.screen)) XInstallColormap (si->dpy, xgwa.colormap); } } 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)); 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]; } Bool select_visual (saver_screen_info *ssi, const char *visual_name) { XWindowAttributes xgwa; saver_info *si = ssi->global; saver_preferences *p = &si->prefs; Bool install_cmap_p = p->install_cmap_p; Bool was_installed_p = (ssi->cmap != DefaultColormapOfScreen(ssi->screen)); Visual *new_v = 0; Bool got_it; /* On some systems (most recently, MacOS X) OpenGL programs get confused when you kill one and re-start another on the same window. So maybe it's best to just always destroy and recreate the xscreensaver window when changing hacks, instead of trying to reuse the old one? */ Bool always_recreate_window_p = True; get_screen_gl_visual (si, 0); /* let's probe all the GL visuals early */ /* We make sure the existing window is actually on ssi->screen before trying to use it, in case things moved around radically when monitors were added or deleted. If we don't do this we could get a BadMatch even though the depths match. I think. */ memset (&xgwa, 0, sizeof(xgwa)); if (ssi->screensaver_window) XGetWindowAttributes (si->dpy, ssi->screensaver_window, &xgwa); if (visual_name && *visual_name) { if (!strcmp(visual_name, "default-i") || !strcmp(visual_name, "Default-i") || !strcmp(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")) { visual_name = "default"; install_cmap_p = False; } else if (!strcmp(visual_name, "gl") || !strcmp(visual_name, "Gl") || !strcmp(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); } if (!new_v) new_v = get_visual (ssi->screen, visual_name, True, False); } else { new_v = ssi->default_visual; } got_it = !!new_v; if (new_v && new_v != DefaultVisualOfScreen(ssi->screen)) /* It's not the default visual, so we have no choice but to install. */ install_cmap_p = True; ssi->install_cmap_p = install_cmap_p; if ((ssi->screen != xgwa.screen) || (new_v && (always_recreate_window_p || (ssi->current_visual != new_v) || (install_cmap_p != was_installed_p)))) { Colormap old_c = ssi->cmap; Window old_w = ssi->screensaver_window; if (! new_v) new_v = ssi->current_visual; if (p->verbose_p) { fprintf (stderr, "%s: %d: visual ", blurb(), ssi->number); describe_visual (stderr, ssi->screen, new_v, install_cmap_p); #if 0 fprintf (stderr, "%s: from ", blurb()); describe_visual (stderr, ssi->screen, ssi->current_visual, was_installed_p); #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); /* 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", blurb(), ssi->number, (unsigned long) old_w); if (old_c && old_c != DefaultColormapOfScreen (ssi->screen) && old_c != ssi->demo_cmap) XFreeColormap (si->dpy, old_c); } return got_it; } xscreensaver-5.42+dfsg1/driver/xdpyinfo.c000066400000000000000000000760171342162430400204650ustar00rootroot00000000000000/* * $ TOG: xdpyinfo.c /main/35 1998/02/09 13:57:05 kaleb $ * * xdpyinfo - print information about X display connecton * * Copyright 1988, 1998 The Open Group All Rights Reserved. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * * Author: Jim Fulton, MIT X Consortium * * GLX and Overlay support added by Jamie Zawinski , 11-Nov-99 * * To compile: * cc -DHAVE_GLX xdpyinfo.c -o xdpyinfo -lGL -lX11 -lXext [-lXtst] -lm * * Other defines to consider: * -DMITSHM -DHAVE_XDBE -DHAVE_XIE -DHAVE_XTEST -DHAVE_SYNC * -DHAVE_XRECORD */ #include #include #include /* for CARD32 */ #include #ifdef HAVE_XIE #include #endif /* HAVE_XIE */ #ifdef HAVE_XTEST #include #endif /* HAVE_XTEST */ #ifdef HAVE_XSYNC #include #endif /* HAVE_XSYNC */ #ifdef HAVE_XDBE #include #endif /* HAVE_XDBE */ #ifdef HAVE_XRECORD #include #endif /* HAVE_XRECORD */ #ifdef MITSHM #include #endif #include #include #ifdef HAVE_GLX # include # include #endif /* HAVE_GLX */ #define HAVE_OVERLAY /* jwz: no compile-time deps, so do this all the time */ char *ProgramName; Bool queryExtensions = False; static int StrCmp(a, b) char **a, **b; { return strcmp(*a, *b); } #ifdef HAVE_GLX /* Added by jwz, 11-Nov-99 */ static void print_glx_versions (dpy) 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. Note also that we can't protect these calls by only doing them when the GLX extension is present, because with Mesa, the server doesn't have that extension (but the GL library works anyway.) */ int scr = DefaultScreen (dpy); const char *vend, *vers; vend = glXQueryServerString (dpy, scr, GLX_VENDOR); if (!vend) return; vers = glXQueryServerString (dpy, scr, GLX_VERSION); printf ("GLX vendor: %s (%s)\n", vend, (vers ? vers : "unknown version")); } static void print_glx_visual_info (dpy, vip) Display *dpy; XVisualInfo *vip; { int status, value = False; status = glXGetConfig (dpy, vip, GLX_USE_GL, &value); if (status == GLX_NO_EXTENSION) /* dpy does not support the GLX extension. */ return; if (status == GLX_BAD_VISUAL || value == False) { printf (" GLX supported: no\n"); return; } else { printf (" GLX supported: yes\n"); } if (!glXGetConfig (dpy, vip, GLX_LEVEL, &value) && value != 0) printf (" GLX level: %d\n", value); if (!glXGetConfig (dpy, vip, GLX_RGBA, &value) && value) { int r=0, g=0, b=0, a=0; glXGetConfig (dpy, vip, GLX_RED_SIZE, &r); glXGetConfig (dpy, vip, GLX_GREEN_SIZE, &g); glXGetConfig (dpy, vip, GLX_BLUE_SIZE, &b); glXGetConfig (dpy, vip, GLX_ALPHA_SIZE, &a); printf (" GLX type: RGBA (%2d, %2d, %2d, %2d)\n", r, g, b, a); r=0, g=0, b=0, a=0; glXGetConfig (dpy, vip, GLX_ACCUM_RED_SIZE, &r); glXGetConfig (dpy, vip, GLX_ACCUM_GREEN_SIZE, &g); glXGetConfig (dpy, vip, GLX_ACCUM_BLUE_SIZE, &b); glXGetConfig (dpy, vip, GLX_ACCUM_ALPHA_SIZE, &a); printf (" GLX accum: RGBA (%2d, %2d, %2d, %2d)\n", r, g, b, a); } else { value = 0; glXGetConfig (dpy, vip, GLX_BUFFER_SIZE, &value); printf (" GLX type: indexed (%d)\n", value); } # if 0 /* redundant */ if (!glXGetConfig (dpy, vip, GLX_X_VISUAL_TYPE_EXT, &value)) printf (" GLX class: %s\n", (value == GLX_TRUE_COLOR_EXT ? "TrueColor" : value == GLX_DIRECT_COLOR_EXT ? "DirectColor" : value == GLX_PSEUDO_COLOR_EXT ? "PseudoColor" : value == GLX_STATIC_COLOR_EXT ? "StaticColor" : value == GLX_GRAY_SCALE_EXT ? "Grayscale" : value == GLX_STATIC_GRAY_EXT ? "StaticGray" : "???")); # endif # ifdef GLX_VISUAL_CAVEAT_EXT if (!glXGetConfig (dpy, vip, GLX_VISUAL_CAVEAT_EXT, &value) && value != GLX_NONE_EXT) printf (" GLX rating: %s\n", (value == GLX_NONE_EXT ? "none" : value == GLX_SLOW_VISUAL_EXT ? "slow" : # ifdef GLX_NON_CONFORMANT_EXT value == GLX_NON_CONFORMANT_EXT ? "non-conformant" : # endif "???")); # endif if (!glXGetConfig (dpy, vip, GLX_DOUBLEBUFFER, &value)) printf (" GLX double-buffer: %s\n", (value ? "yes" : "no")); if (!glXGetConfig (dpy, vip, GLX_STEREO, &value) && value) printf (" GLX stereo: %s\n", (value ? "yes" : "no")); if (!glXGetConfig (dpy, vip, GLX_AUX_BUFFERS, &value) && value != 0) printf (" GLX aux buffers: %d\n", value); if (!glXGetConfig (dpy, vip, GLX_DEPTH_SIZE, &value)) printf (" GLX depth size: %d\n", value); if (!glXGetConfig (dpy, vip, GLX_STENCIL_SIZE, &value) && value != 0) printf (" GLX stencil size: %d\n", value); # if defined(GL_SAMPLE_BUFFERS) # define SB GL_SAMPLE_BUFFERS # define SM GL_SAMPLES # elif defined(GLX_SAMPLE_BUFFERS) # define SB GLX_SAMPLE_BUFFERS # define SM GLX_SAMPLES # elif defined(GLX_SAMPLE_BUFFERS_ARB) # define SB GLX_SAMPLE_BUFFERS_ARB # define SM GLX_SAMPLES_ARB # elif defined(GLX_SAMPLE_BUFFERS_SGIS) # define SB GLX_SAMPLE_BUFFERS_SGIS # define SM GLX_SAMPLES_SGIS # endif # ifdef SB if (!glXGetConfig (dpy, vip, SB, &value) && value != 0) { int bufs = value; if (!glXGetConfig (dpy, vip, SM, &value)) printf (" GLX multisample: %d, %d\n", bufs, value); } # endif /* SB */ if (!glXGetConfig (dpy, vip, GLX_TRANSPARENT_TYPE_EXT, &value) && value != GLX_NONE_EXT) { if (value == GLX_NONE_EXT) printf (" GLX transparency: none\n"); else if (value == GLX_TRANSPARENT_INDEX_EXT) { if (!glXGetConfig (dpy, vip, GLX_TRANSPARENT_INDEX_VALUE_EXT,&value)) printf (" GLX transparency: indexed (%d)\n", value); } else if (value == GLX_TRANSPARENT_RGB_EXT) { int r=0, g=0, b=0, a=0; glXGetConfig (dpy, vip, GLX_TRANSPARENT_RED_VALUE_EXT, &r); glXGetConfig (dpy, vip, GLX_TRANSPARENT_GREEN_VALUE_EXT, &g); glXGetConfig (dpy, vip, GLX_TRANSPARENT_BLUE_VALUE_EXT, &b); glXGetConfig (dpy, vip, GLX_TRANSPARENT_ALPHA_VALUE_EXT, &a); printf (" GLX transparency: RGBA (%2d, %2d, %2d, %2d)\n", r, g, b, a); } } } #endif /* HAVE_GLX */ #ifdef HAVE_OVERLAY /* Added by jwz, 11-Nov-99 */ /* If the server's root window contains a SERVER_OVERLAY_VISUALS property, then that identifies the visuals which correspond to the video hardware's overlay planes. Windows created in these kinds of visuals may have transparent pixels that let other layers shine through. This might not be an X Consortium standard, but it turns out that SGI, HP, DEC, and IBM all use this same mechanism. So that's close enough for me. Documentation on the SERVER_OVERLAY_VISUALS property can be found at: http://www.hp.com/xwindow/sharedInfo/Whitepapers/Visuals/server_overlay_visuals.html */ struct overlay { CARD32 visual_id; CARD32 transparency; /* 0: none; 1: pixel; 2: mask */ CARD32 value; /* the transparent pixel */ CARD32 layer; /* -1: underlay; 0: normal; 1: popup; 2: overlay */ }; struct overlay_list { int count; struct overlay *list; }; static struct overlay_list *overlays = 0; static void find_overlay_info (dpy) Display *dpy; { int screen; Atom OVERLAY = XInternAtom (dpy, "SERVER_OVERLAY_VISUALS", False); overlays = (struct overlay_list *) calloc (sizeof (struct overlay_list), ScreenCount (dpy)); for (screen = 0; screen < ScreenCount (dpy); screen++) { Window window = RootWindow (dpy, screen); Atom actual_type; int actual_format; unsigned long nitems, bytes_after; struct overlay *data = 0; int result = XGetWindowProperty (dpy, window, OVERLAY, 0, (65536 / sizeof (long)), False, OVERLAY, &actual_type, &actual_format, &nitems, &bytes_after, (unsigned char **) &data); if (result == Success && actual_type == OVERLAY && actual_format == 32 && nitems > 0) { overlays[screen].count = (nitems / (sizeof(struct overlay) / sizeof(CARD32))); overlays[screen].list = data; } else if (data) XFree((char *) data); } } static void print_overlay_visual_info (vip) XVisualInfo *vip; { int i; int vis = vip->visualid; int scr = vip->screen; if (!overlays) return; for (i = 0; i < overlays[scr].count; i++) if (vis == overlays[scr].list[i].visual_id) { struct overlay *ov = &overlays[scr].list[i]; printf (" Overlay info: layer %ld (%s), ", (long) ov->layer, (ov->layer == -1 ? "underlay" : ov->layer == 0 ? "normal" : ov->layer == 1 ? "popup" : ov->layer == 2 ? "overlay" : "???")); 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); else printf ("opaque\n"); } } #endif /* HAVE_OVERLAY */ void print_extension_info (dpy) Display *dpy; { int n = 0; char **extlist = XListExtensions (dpy, &n); printf ("number of extensions: %d\n", n); if (extlist) { register int i; int opcode, event, error; qsort(extlist, n, sizeof(char *), StrCmp); for (i = 0; i < n; i++) { if (!queryExtensions) { printf (" %s\n", extlist[i]); continue; } XQueryExtension(dpy, extlist[i], &opcode, &event, &error); printf (" %s (opcode: %d", extlist[i], opcode); if (event) printf (", base event: %d", event); if (error) printf (", base error: %d", error); printf(")\n"); } /* do not free, Xlib can depend on contents being unaltered */ /* XFreeExtensionList (extlist); */ } } void print_display_info (dpy) Display *dpy; { char dummybuf[40]; char *cp; int minkeycode, maxkeycode; int i, n; long req_size; XPixmapFormatValues *pmf; Window focuswin; int focusrevert; printf ("name of display: %s\n", DisplayString (dpy)); printf ("version number: %d.%d\n", ProtocolVersion (dpy), ProtocolRevision (dpy)); printf ("vendor string: %s\n", ServerVendor (dpy)); printf ("vendor release number: %d\n", VendorRelease (dpy)); #ifdef HAVE_GLX print_glx_versions (dpy); #endif /* HAVE_GLX */ 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)); switch (BitmapBitOrder (dpy)) { case LSBFirst: cp = "LSBFirst"; break; case MSBFirst: cp = "MSBFirst"; break; default: sprintf (dummybuf, "unknown order %d", BitmapBitOrder (dpy)); cp = dummybuf; break; } printf ("bitmap unit, bit order, padding: %d, %s, %d\n", BitmapUnit (dpy), cp, BitmapPad (dpy)); switch (ImageByteOrder (dpy)) { case LSBFirst: cp = "LSBFirst"; break; case MSBFirst: cp = "MSBFirst"; break; default: sprintf (dummybuf, "unknown order %d", ImageByteOrder (dpy)); cp = dummybuf; break; } printf ("image byte order: %s\n", cp); pmf = XListPixmapFormats (dpy, &n); printf ("number of supported pixmap formats: %d\n", n); if (pmf) { printf ("supported pixmap formats:\n"); for (i = 0; i < n; i++) { printf (" depth %d, bits_per_pixel %d, scanline_pad %d\n", pmf[i].depth, pmf[i].bits_per_pixel, pmf[i].scanline_pad); } XFree ((char *) pmf); } /* * when we get interfaces to the PixmapFormat stuff, insert code here */ XDisplayKeycodes (dpy, &minkeycode, &maxkeycode); printf ("keycode range: minimum %d, maximum %d\n", minkeycode, maxkeycode); XGetInputFocus (dpy, &focuswin, &focusrevert); printf ("focus: "); switch (focuswin) { case PointerRoot: printf ("PointerRoot\n"); break; case None: printf ("None\n"); break; default: printf("window 0x%lx, revert to ", focuswin); switch (focusrevert) { case RevertToParent: printf ("Parent\n"); break; case RevertToNone: printf ("None\n"); break; case RevertToPointerRoot: printf ("PointerRoot\n"); break; default: /* should not happen */ printf ("%d\n", focusrevert); break; } break; } print_extension_info (dpy); printf ("default screen number: %d\n", DefaultScreen (dpy)); printf ("number of screens: %d\n", ScreenCount (dpy)); } void print_visual_info (vip) XVisualInfo *vip; { char errorbuf[40]; /* for sprintfing into */ char *class = NULL; /* for printing */ switch (vip->class) { case StaticGray: class = "StaticGray"; break; case GrayScale: class = "GrayScale"; break; case StaticColor: class = "StaticColor"; break; case PseudoColor: class = "PseudoColor"; break; case TrueColor: class = "TrueColor"; break; case DirectColor: class = "DirectColor"; break; default: sprintf (errorbuf, "unknown class %d", vip->class); class = errorbuf; break; } printf (" visual:\n"); printf (" visual id: 0x%lx\n", vip->visualid); printf (" class: %s\n", class); printf (" depth: %d plane%s\n", vip->depth, vip->depth == 1 ? "" : "s"); if (vip->class == TrueColor || vip->class == DirectColor) printf (" available colormap entries: %d per subfield\n", vip->colormap_size); else printf (" available colormap entries: %d\n", vip->colormap_size); printf (" red, green, blue masks: 0x%lx, 0x%lx, 0x%lx\n", vip->red_mask, vip->green_mask, vip->blue_mask); printf (" significant bits in color specification: %d bits\n", vip->bits_per_rgb); } void print_screen_info (dpy, scr) Display *dpy; int scr; { Screen *s = ScreenOfDisplay (dpy, scr); /* opaque structure */ XVisualInfo viproto; /* fill in for getting info */ XVisualInfo *vip; /* retured info */ int nvi; /* number of elements returned */ int i; /* temp variable: iterator */ char eventbuf[80]; /* want 79 chars per line + nul */ static char *yes = "YES", *no = "NO", *when = "WHEN MAPPED"; double xres, yres; int ndepths = 0, *depths = NULL; unsigned int width, height; /* * there are 2.54 centimeters to an inch; so there are 25.4 millimeters. * * dpi = N pixels / (M millimeters / (25.4 millimeters / 1 inch)) * = N pixels / (M inch / 25.4) * = N * 25.4 pixels / M inch */ xres = ((((double) DisplayWidth(dpy,scr)) * 25.4) / ((double) DisplayWidthMM(dpy,scr))); yres = ((((double) DisplayHeight(dpy,scr)) * 25.4) / ((double) DisplayHeightMM(dpy,scr))); printf ("\n"); printf ("screen #%d:\n", scr); printf (" dimensions: %dx%d pixels (%dx%d millimeters)\n", DisplayWidth (dpy, scr), DisplayHeight (dpy, scr), DisplayWidthMM(dpy, scr), DisplayHeightMM (dpy, scr)); printf (" resolution: %dx%d dots per inch\n", (int) (xres + 0.5), (int) (yres + 0.5)); depths = XListDepths (dpy, scr, &ndepths); if (!depths) ndepths = 0; printf (" depths (%d): ", ndepths); for (i = 0; i < ndepths; i++) { printf ("%d", depths[i]); if (i < ndepths - 1) { putchar (','); putchar (' '); } } putchar ('\n'); if (depths) XFree ((char *) depths); printf (" root window id: 0x%lx\n", RootWindow (dpy, scr)); printf (" depth of root window: %d plane%s\n", DisplayPlanes (dpy, scr), DisplayPlanes (dpy, scr) == 1 ? "" : "s"); printf (" number of colormaps: minimum %d, maximum %d\n", MinCmapsOfScreen(s), MaxCmapsOfScreen(s)); 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", BlackPixel (dpy, scr), WhitePixel (dpy, scr)); printf (" options: backing-store %s, save-unders %s\n", (DoesBackingStore (s) == NotUseful) ? no : ((DoesBackingStore (s) == Always) ? yes : when), DoesSaveUnders (s) ? yes : no); XQueryBestSize (dpy, CursorShape, RootWindow (dpy, scr), 65535, 65535, &width, &height); if (width == 65535 && height == 65535) printf (" largest cursor: unlimited\n"); else printf (" largest cursor: %dx%d\n", width, height); printf (" current input event mask: 0x%lx\n", EventMaskOfScreen (s)); (void) print_event_mask (eventbuf, 79, 4, EventMaskOfScreen (s)); nvi = 0; viproto.screen = scr; vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi); printf (" number of visuals: %d\n", nvi); printf (" default visual id: 0x%lx\n", XVisualIDFromVisual (DefaultVisual (dpy, scr))); for (i = 0; i < nvi; i++) { print_visual_info (vip+i); #ifdef HAVE_OVERLAY print_overlay_visual_info (vip+i); #endif /* HAVE_OVERLAY */ #ifdef HAVE_GLX print_glx_visual_info (dpy, vip+i); #endif /* HAVE_GLX */ } if (vip) XFree ((char *) vip); } /* * The following routine prints out an event mask, wrapping events at nice * boundaries. */ #define MASK_NAME_WIDTH 25 static struct _event_table { char *name; long value; } event_table[] = { { "KeyPressMask ", KeyPressMask }, { "KeyReleaseMask ", KeyReleaseMask }, { "ButtonPressMask ", ButtonPressMask }, { "ButtonReleaseMask ", ButtonReleaseMask }, { "EnterWindowMask ", EnterWindowMask }, { "LeaveWindowMask ", LeaveWindowMask }, { "PointerMotionMask ", PointerMotionMask }, { "PointerMotionHintMask ", PointerMotionHintMask }, { "Button1MotionMask ", Button1MotionMask }, { "Button2MotionMask ", Button2MotionMask }, { "Button3MotionMask ", Button3MotionMask }, { "Button4MotionMask ", Button4MotionMask }, { "Button5MotionMask ", Button5MotionMask }, { "ButtonMotionMask ", ButtonMotionMask }, { "KeymapStateMask ", KeymapStateMask }, { "ExposureMask ", ExposureMask }, { "VisibilityChangeMask ", VisibilityChangeMask }, { "StructureNotifyMask ", StructureNotifyMask }, { "ResizeRedirectMask ", ResizeRedirectMask }, { "SubstructureNotifyMask ", SubstructureNotifyMask }, { "SubstructureRedirectMask ", SubstructureRedirectMask }, { "FocusChangeMask ", FocusChangeMask }, { "PropertyChangeMask ", PropertyChangeMask }, { "ColormapChangeMask ", ColormapChangeMask }, { "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 */ { struct _event_table *etp; int len; int bitsfound = 0; buf[0] = buf[lastcol] = '\0'; /* just in case */ #define INDENT() { register int i; len = indent; \ for (i = 0; i < indent; i++) buf[i] = ' '; } INDENT (); for (etp = event_table; etp->name; etp++) { if (mask & etp->value) { if (len + MASK_NAME_WIDTH > lastcol) { puts (buf); INDENT (); } strcpy (buf+len, etp->name); len += MASK_NAME_WIDTH; bitsfound++; } } if (bitsfound) puts (buf); #undef INDENT return (bitsfound); } void print_standard_extension_info(dpy, extname, majorrev, minorrev) Display *dpy; char *extname; int majorrev, minorrev; { int opcode, event, error; printf("%s version %d.%d ", extname, majorrev, minorrev); XQueryExtension(dpy, extname, &opcode, &event, &error); printf ("opcode: %d", opcode); if (event) printf (", base event: %d", event); if (error) printf (", base error: %d", error); printf("\n"); } int print_multibuf_info(dpy, extname) Display *dpy; char *extname; { int i, j; /* temp variable: iterator */ int nmono, nstereo; /* count */ XmbufBufferInfo *mono_info = NULL, *stereo_info = NULL; /* arrays */ static char *fmt = " visual id, max buffers, depth: 0x%lx, %d, %d\n"; int scr = 0; int majorrev, minorrev; if (!XmbufGetVersion(dpy, &majorrev, &minorrev)) return 0; print_standard_extension_info(dpy, extname, majorrev, minorrev); for (i = 0; i < ScreenCount (dpy); i++) { if (!XmbufGetScreenInfo (dpy, RootWindow(dpy, scr), &nmono, &mono_info, &nstereo, &stereo_info)) { fprintf (stderr, "%s: unable to get multibuffer info for screen %d\n", ProgramName, scr); } else { printf (" screen %d number of mono multibuffer types: %d\n", i, nmono); for (j = 0; j < nmono; j++) { printf (fmt, mono_info[j].visualid, mono_info[j].max_buffers, mono_info[j].depth); } printf (" number of stereo multibuffer types: %d\n", nstereo); for (j = 0; j < nstereo; j++) { printf (fmt, stereo_info[j].visualid, stereo_info[j].max_buffers, stereo_info[j].depth); } if (mono_info) XFree ((char *) mono_info); if (stereo_info) XFree ((char *) stereo_info); } } return 1; } /* end print_multibuf_info */ /* XIE stuff */ #ifdef HAVE_XIE char *subset_names[] = { NULL, "FULL", "DIS" }; char *align_names[] = { NULL, "Alignable", "Arbitrary" }; char *group_names[] = { /* 0 */ "Default", /* 2 */ "ColorAlloc", /* 4 */ "Constrain", /* 6 */ "ConvertFromRGB", /* 8 */ "ConvertToRGB", /* 10 */ "Convolve", /* 12 */ "Decode", /* 14 */ "Dither", /* 16 */ "Encode", /* 18 */ "Gamut", /* 20 */ "Geometry", /* 22 */ "Histogram", /* 24 */ "WhiteAdjust" }; int print_xie_info(dpy, extname) Display *dpy; char *extname; { XieExtensionInfo *xieInfo; int i; int ntechs; XieTechnique *techs; XieTechniqueGroup prevGroup; if (!XieInitialize(dpy, &xieInfo )) return 0; print_standard_extension_info(dpy, extname, xieInfo->server_major_rev, xieInfo->server_minor_rev); printf(" service class: %s\n", subset_names[xieInfo->service_class]); printf(" alignment: %s\n", align_names[xieInfo->alignment]); printf(" uncnst_mantissa: %d\n", xieInfo->uncnst_mantissa); printf(" uncnst_min_exp: %d\n", xieInfo->uncnst_min_exp); printf(" uncnst_max_exp: %d\n", xieInfo->uncnst_max_exp); printf(" cnst_levels:"); for (i = 0; i < xieInfo->n_cnst_levels; i++) printf(" %d", xieInfo->cnst_levels[i]); printf("\n"); if (!XieQueryTechniques(dpy, xieValAll, &ntechs, &techs)) return 1; prevGroup = -1; for (i = 0; i < ntechs; i++) { if (techs[i].group != prevGroup) { printf(" technique group: %s\n", group_names[techs[i].group >> 1]); prevGroup = techs[i].group; } printf(" %s\tspeed: %d needs_param: %s number: %d\n", techs[i].name, techs[i].speed, (techs[i].needs_param ? "True " : "False"), techs[i].number); } return 1; } /* end print_xie_info */ #endif /* HAVE_XIE */ #ifdef HAVE_XTEST int print_xtest_info(dpy, extname) Display *dpy; char *extname; { int majorrev, minorrev, foo; if (!XTestQueryExtension(dpy, &foo, &foo, &majorrev, &minorrev)) return 0; print_standard_extension_info(dpy, extname, majorrev, minorrev); return 1; } #endif /* HAVE_XTEST */ #ifdef HAVE_XSYNC int print_sync_info(dpy, extname) Display *dpy; char *extname; { int majorrev, minorrev; XSyncSystemCounter *syscounters; int ncounters, i; if (!XSyncInitialize(dpy, &majorrev, &minorrev)) return 0; print_standard_extension_info(dpy, extname, majorrev, minorrev); syscounters = XSyncListSystemCounters(dpy, &ncounters); printf(" system counters: %d\n", ncounters); for (i = 0; i < ncounters; i++) { printf(" %s id: 0x%08x resolution_lo: %d resolution_hi: %d\n", syscounters[i].name, syscounters[i].counter, XSyncValueLow32(syscounters[i].resolution), XSyncValueHigh32(syscounters[i].resolution)); } XSyncFreeSystemCounterList(syscounters); return 1; } #endif /* HAVE_XSYNC */ int print_shape_info(dpy, extname) Display *dpy; char *extname; { int majorrev, minorrev; if (!XShapeQueryVersion(dpy, &majorrev, &minorrev)) return 0; print_standard_extension_info(dpy, extname, majorrev, minorrev); return 1; } #ifdef MITSHM int print_mitshm_info(dpy, extname) Display *dpy; char *extname; { int majorrev, minorrev; Bool sharedPixmaps; if (!XShmQueryVersion(dpy, &majorrev, &minorrev, &sharedPixmaps)) return 0; print_standard_extension_info(dpy, extname, majorrev, minorrev); printf(" shared pixmaps: "); if (sharedPixmaps) { int format = XShmPixmapFormat(dpy); printf("yes, format: %d\n", format); } else { printf("no\n"); } return 1; } #endif /* MITSHM */ #ifdef HAVE_XDBE int print_dbe_info(dpy, extname) Display *dpy; char *extname; { int majorrev, minorrev; XdbeScreenVisualInfo *svi; int numscreens = 0; int iscrn, ivis; if (!XdbeQueryExtension(dpy, &majorrev, &minorrev)) return 0; print_standard_extension_info(dpy, extname, majorrev, minorrev); svi = XdbeGetVisualInfo(dpy, (Drawable *)NULL, &numscreens); for (iscrn = 0; iscrn < numscreens; iscrn++) { printf(" Double-buffered visuals on screen %d\n", iscrn); for (ivis = 0; ivis < svi[iscrn].count; ivis++) { printf(" visual id 0x%lx depth %d perflevel %d\n", svi[iscrn].visinfo[ivis].visual, svi[iscrn].visinfo[ivis].depth, svi[iscrn].visinfo[ivis].perflevel); } } XdbeFreeVisualInfo(svi); return 1; } #endif /* HAVE_XDBE */ #ifdef HAVE_XRECORD int print_record_info(dpy, extname) Display *dpy; char *extname; { int majorrev, minorrev; if (!XRecordQueryVersion(dpy, &majorrev, &minorrev)) return 0; print_standard_extension_info(dpy, extname, majorrev, minorrev); return 1; } #endif /* HAVE_XRECORD */ /* utilities to manage the list of recognized extensions */ typedef int (*ExtensionPrintFunc)( #if NeedFunctionPrototypes Display *, char * #endif ); typedef struct { char *extname; ExtensionPrintFunc printfunc; Bool printit; } ExtensionPrintInfo; ExtensionPrintInfo known_extensions[] = { #ifdef MITSHM {"MIT-SHM", print_mitshm_info, False}, #endif /* MITSHM */ {MULTIBUFFER_PROTOCOL_NAME, print_multibuf_info, False}, {"SHAPE", print_shape_info, False}, #ifdef HAVE_XSYNC {SYNC_NAME, print_sync_info, False}, #endif /* HAVE_XSYNC */ #ifdef HAVE_XIE {xieExtName, print_xie_info, False}, #endif /* HAVE_XIE */ #ifdef HAVE_XTEST {XTestExtensionName, print_xtest_info, False}, #endif /* HAVE_XTEST */ #ifdef HAVE_XDBE {"DOUBLE-BUFFER", print_dbe_info, False}, #endif /* HAVE_XDBE */ #ifdef HAVE_XRECORD {"RECORD", print_record_info, False} #endif /* HAVE_XRECORD */ /* add new extensions here */ /* wish list: PEX XKB LBX */ }; int num_known_extensions = sizeof known_extensions / sizeof known_extensions[0]; void print_known_extensions(f) FILE *f; { int i; for (i = 0; i < num_known_extensions; i++) { fprintf(f, "%s ", known_extensions[i].extname); } } void mark_extension_for_printing(extname) char *extname; { int i; if (strcmp(extname, "all") == 0) { for (i = 0; i < num_known_extensions; i++) known_extensions[i].printit = True; } else { for (i = 0; i < num_known_extensions; i++) { if (strcmp(extname, known_extensions[i].extname) == 0) { known_extensions[i].printit = True; return; } } printf("%s extension not supported by %s\n", extname, ProgramName); } } void print_marked_extensions(dpy) Display *dpy; { int i; for (i = 0; i < num_known_extensions; i++) { if (known_extensions[i].printit) { printf("\n"); if (! (*known_extensions[i].printfunc)(dpy, known_extensions[i].extname)) { printf("%s extension not supported by server\n", known_extensions[i].extname); } } } } static void usage () { fprintf (stderr, "usage: %s [options]\n", ProgramName); fprintf (stderr, "-display displayname\tserver to query\n"); fprintf (stderr, "-queryExtensions\tprint info returned by XQueryExtension\n"); fprintf (stderr, "-ext all\t\tprint detailed info for all supported extensions\n"); fprintf (stderr, "-ext extension-name\tprint detailed info for extension-name if one of:\n "); print_known_extensions(stderr); fprintf (stderr, "\n"); exit (1); } int main (argc, argv) 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]; for (i = 1; i < argc; i++) { char *arg = argv[i]; int len = strlen(arg); if (!strncmp("-display", arg, len)) { if (++i >= argc) usage (); displayname = argv[i]; } else if (!strncmp("-queryExtensions", arg, len)) { queryExtensions = True; } else if (!strncmp("-ext", arg, len)) { if (++i >= argc) usage (); mark_extension_for_printing(argv[i]); } else usage (); } dpy = XOpenDisplay (displayname); if (!dpy) { fprintf (stderr, "%s: unable to open display \"%s\".\n", ProgramName, XDisplayName (displayname)); exit (1); } #ifdef HAVE_OVERLAY find_overlay_info (dpy); #endif /* HAVE_OVERLAY */ print_display_info (dpy); for (i = 0; i < ScreenCount (dpy); i++) { print_screen_info (dpy, i); } print_marked_extensions(dpy); XCloseDisplay (dpy); exit (0); } xscreensaver-5.42+dfsg1/driver/xscreensaver-command.c000066400000000000000000000355071342162430400227500ustar00rootroot00000000000000/* xscreensaver-command, Copyright (c) 1991-2013 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 #ifdef HAVE_UNISTD_H # include #endif /* #include / * for CARD32 */ #include #include #include /* for XGetClassHint() */ #include #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 "remote.h" #include "version.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; static Atom XA_ACTIVATE, XA_DEACTIVATE, XA_CYCLE, XA_NEXT, XA_PREV; 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 length ISO C89 compilers are required to support" in the usage string... */ # endif static char *usage = "\n\ usage: %s -