Does emacs have an option or some internal command that displays build time settings and whatever features it supports?
A good example is the
nginx -V command which lists the
./configure options it was compiled with.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
Take a look at the
Here's an example, which is the result of running
C-h v system-configuration-options
system-configuration-options is a variable defined in `C source code'. Its value is "--prefix=/usr/local/emacs 'CFLAGS=-O2 -march=native -pipe -falign-functions=64 -fomit-frame-pointer -ftracer -funit-at-a-time -fweb -fforce-addr -fpeel-loops -funswitch-loops -frename-registers -mfpmath=sse -ffast-math -fno-finite-math-only -fstack-check' PKG_CONFIG_PATH=/usr/share/pkgconfig" Documentation: String containing the configuration options Emacs was built with. For more information check the manuals.
Here is how to print the contents on the command line:
emacs -nw -q --batch --eval '(message system-configuration-options)'
Dunno about a command-line switch, but:
If you use library
emacsbug+.el, which enhances standard library
emacsbug.el, then you can use command
ebp-insert-version with a prefix arg, to insert the complete version info, including some build info, in the current buffer. This is the same version info that is included when you use command
report-emacs-bug. For example:
In GNU Emacs 25.2.1 (x86_64-w64-mingw32) of 2017-04-24 Windowing system distributor `Microsoft Corp.', version 6.1.7601 Configured using: `configure --without-dbus --without-compress-install 'CFLAGS=-O2 -static -g3''
emacsbug+.el, you can use standard command
emacs-version, to give you a subset of that info. With a prefix arg it inserts the info in the current buffer. For example:
GNU Emacs 25.2.1 (x86_64-w64-mingw32) of 2017-04-24
In addition to
system-configuration-options which lists the options that were used for the invocation of
configure when the emacs executable was built, there is also
system-configuration-features which were the features that were enabled (either explicitly or by default) for that
configure run. Here's what emacs-27.2 on Fedora 33 says about these two variables:
system-configuration-options is a variable defined in ‘C source code’. Its value is "--build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3 --with-gpm=no --with-xwidgets --with-modules --with-harfbuzz --with-cairo --with-json build_alias=x86_64-redhat-linux-gnu host_alias=x86_64-redhat-linux-gnu CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' LDFLAGS=-Wl,-z,relro PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig" Documentation: String containing the configuration options Emacs was built with.
system-configuration-features is a variable defined in ‘C source code’. Its value is "XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER GMP" Probably introduced at or before Emacs version 25.1. Documentation: String listing some of the main features this Emacs was compiled with. An element of the form "FOO" generally means that HAVE_FOO was defined during the build. This is mainly intended for diagnostic purposes in bug reports. Don’t rely on it for testing whether a feature you want to use is available.
I don't know why the last paragraph says not to rely on it for testing (I guess there are better methods to test for specific features, e.g.
libgnutls-version), but it should probably be heeded. Nevertheless, it is a useful summary. BTW, here's a bash command line to see it:
strings $(command -v emacs) | grep Id
emacs --batch --eval '(message system-config-features)'