14

Lots of open source software is distributed in source code with autotools build system. In order to build such software i issue ./configure && make. But for some software i need to build only subset of it - for example, in SRP i'm interested only in library and not in terminal or ftp client. To specify what to build ./configure script accepts --disable-, --enable-, --with-, --without- etc command-line keys that are listed in ./configure --help, "Features and packages" section.

Given third-party open source archive with ./configure script is it any way i can easily get list of all features available to enable-disable? Of course such information is available in source code, for example in makefile.am and makefile.in - but they are huge and hard to read. Maybe easier way exist, something like ./configure --list-features?

grigoryvp
  • 40,413
  • 64
  • 174
  • 277
  • 1
    possible duplicate of [What are various options / arguments for "./configure" in Linux](http://stackoverflow.com/questions/6227875/what-are-various-options-arguments-for-configure-in-linux) – ptomato Dec 07 '11 at 10:07

2 Answers2

14

./configure --help will do the trick.

This shows any --enable-X or --with-X arguments that are defined using the macros AC_ARG_ENABLE or AC_ARG_WITH, as well as a list of environment variables that the configure script will pay attention to, such as CC.

In some large projects that are organized as a series of sub-projects each with their own configure script, you may need to do ./configure --help=recursive to see all the features/packages for all the sub-projects.

pavon
  • 16,574
  • 1
  • 23
  • 25
ptomato
  • 56,175
  • 13
  • 112
  • 165
  • 5
    But sometimes it displays only general help - does this means that i can't use any additional options? What about options like --with-gcc=clang that is not listed at all – grigoryvp Dec 07 '11 at 11:21
  • That means there are no `--enable-X` or `--with-X` options defined. You can always run `CC=clang ./configure`; these variables are listed in the last section, labeled "Some influential environment variables". – ptomato Dec 07 '11 at 19:39
  • This won't always work. For example I'm looking at one that describes '-disable-FEATURE', but does not give a list of "FEATURES". –  Apr 20 '13 at 03:32
  • It always shows `--disable-FEATURE` even when none are defined. If no specific FEATUREs are listed, then none are defined. – ptomato Apr 21 '13 at 17:38
  • @ptomato, are you saying `./configure --help` shows all the possible FEATURES? Thanks. – Adam Lee Mar 31 '14 at 22:20
  • I downvoted because there are, in fact, cases where an --enable-X can be used but is not documented in ./configure --help. For instance, I am trying to learn from "Linux From Scratch" and here (https://www.linuxfromscratch.org/lfs/view/stable/chapter05/gcc-pass1.html) it mentions that I have to use options such as "--enable-initfini-array" but running ./configure --help | grep "array" doesn't return anything. ./configure --help | grep "FEATURE" only returns --disable-FEATURE and --enable-FEATURE[=ARG] – Adrian Apr 24 '21 at 16:14
  • @Adrian Are you sure you are running the correct configure script? I cloned gcc and ran gcc/configure --help, and it definitely shows that option in the help text. Looking at https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/acinclude.m4;h=f9f6a07b0402f5a1bfed251ea469e232da605218;hb=HEAD#l281 it's clearly intended to have help text – ptomato Apr 27 '21 at 23:36
  • @ptomato I found the problem: I was running ./configure from the top directory instead of using the gcc/ subdirectory that you can find inside the gcc source code. My bad. Here, have my upvote. Oh crap. My vote is locked until you edit your answer. Can you add a   ? – Adrian Apr 28 '21 at 14:17
  • It's probably a good idea to add some of the clarifications from the comments, anyway. – ptomato Apr 28 '21 at 20:21
4

AFAIK, if configure.ac uses the AC_ARG_ENABLE and AC_ARG_WITH macros, the options should show up in the help output. I don't know why a package would try to circumvent this, unless it's an old script. A search of the configure.ac or configure.in script for these macros might help.

Brett Hale
  • 21,653
  • 2
  • 61
  • 90