What are various options / arguments for "./configure" in Linux - linux

I have seen that while installing new software in Linux, I always have to use first configure it.
But sometimes we need to pass various options like I did today to install lxml:
./configure --with-python=/opt/python27/bin/python
--prefix=/usr/local
--with-libxml-prefix=/usr/local
--with-libxml-include-prefix=/usr/local/include
--with-libxml-libs-prefix=/usr/local/lib
Now I want to know that how will the person know that what type of paramaters like --with-python can be used?
I mean:
Are those parameters same across all software packages or they vary software to software?
I even tried to read documentation as well, but no one mentions those parameters.

./configure --help
That will show you all options for that particular configure script.

Some are the same across all configure scripts produced by Autoconf (which is most of them, but not all); for instance --prefix is basically universal. Others are peculiar to the particular configure script.

./configure --help is always helpful. But I would say more about that in some packages not only is there a configure script in the top source directory but also the possible subdirectories. So, for knowing all possible parameters which can be passed to the configure script in the top source directory you should also have a look at the configure scripts in each possible subdirectory.
For example, in the top source directory of binutils-2.34 tarball there are --with-sysroot and --with-lib-path parameters with configure script. If you type ./configure --help under the top source directory, there are no document items for both of them because they are documented in the configure script under the subdirectory ld/. So you should type ./ld/configure --help.

I know about configure --help but the information provided is "light". The following GNU resources contain useful additional information:
Installation directory variables
Release process

Related

I am using coverity to analyse node-ts template for a service. What should I use to build it?

Steps:
Installed coverity
Configured compiler
cov-configure --javascript
cov-configure --cs
I am stuck at the build step of cov-build. Yarn is used to run and configure the service. But I am not sure what coverity wants here.
I tried a couple of npm run commands, every time end up getting this:
[WARNING] No files were emitted. This may be due to a problem with your configuration
or because no files were actually compiled by your build command.
Please make sure you have configured the compilers actually used in the compilation.
I also tried different compilers, but no luck.
What should be done in this case?
You need to do a file system capture for Javascript files. You can accomplish this by running cov-build with the --no-command flag.
cov-build --dir CoverityIntermedediateDir --no-command --fs-capture-list list.txt
Lets break down these commands:
--dir: intermediate directory to store the emitted results (used for cov-analyze later).
--no-command: Do not run a build command and to look for certain file types
--fs-capture-list: Use the file that is provided to specify which files to look at and possibly emit to the intermediate directory.
A recommended way to generate the list.txt file is to grab it from your source control. If using git run:
git ls-files > list.txt
I want to also point out that if you don't have a convenient way to get a file listing in order to use the --fs-capture-list command you can use --fs-capture-search command and pair that with a filter to exclude the node_modules directory.
The coverity forums have some useful questions and answers:
Node.js File system capture
Really, the best place to look is at the documentation. There are several examples of what you want to do in their guides.

How to specify the location in ./configure or make when building package from source?

Suppose I want to install a package under /opt, which of the three should be appended with "prefix"? I read a few materials and still am very confused. Thank you.
In which command(s) should I add the location?
./configure prefix=/opt
make prefix=/opt
make prefix=/opt install
An Autotools-based build system affords you two main alternatives: you may specify the installation prefix (and other installation locations) either at configuration time or at build time.
To specify at configuration time, you use the --prefix option to the configure script, as ./configure --help will describe to you. For example,
./configure --prefix=/opt/mypackage
Typically, one then proceeds with unadorned
make
sudo make install
To specify at build time, you configure without the --prefix option, maybe simply
./configure
then you specify the prefix via the corresponding make variable. It might in some cases suffice to specify it only to make install, but in others you need to specify it to both make runs, so it is wisest to adopt that as a general rule:
make prefix=/opt/mypackage
sudo make install prefix=/opt/mypackage
I note also that nothing should be installed directly in /opt -- that is, /opt/bin, /opt/lib, etc. It ought instead to be installed in per-package subdirectories of /opt, possibly even grouped under provider-associated subdirectories.

How to configure a makefile?

I wanted to compile glibc source code.so I used "make && make install" command but it gave an error that I first need to configure it and I don't know how to configure it.so how to configure that makefile
You need to run the command ./configure first. This will configure the makefile.
However, it would really be helpful first to read the README file that is in whatever package you are trying to make. They will (or should) have examples on how to install the package.
For example, usually ./configure will take options.. like where you want the package installed, or using a specific compiler or library options.

Linux configure/make, --prefix?

Bear with me, this one's not very easy to explain...
I'm trying to configure, make and make install Xfce into my buildroot build directory. When configuring I'm using
--prefix=/home/me/somefolder/mybuild/output/target
so that it builds to the right folder, however when it's compressed and run I get errors from various config files where it's looking for files in
/home/me/somefolder/mybuild/output/target
(which of course doesn't exist.)
How do I set what folder to build into, yet set a different root directory for the config files to use?
Do configure --help and see what other options are available.
It is very common to provide different options to override different locations. By standard, --prefix overrides all of them, so you need to override config location after specifying the prefix. This course of actions usually works for every automake-based project.
The worse case scenario is when you need to modify the configure script, or even worse, generated makefiles and config.h headers. But yeah, for Xfce you can try something like this:
./configure --prefix=/home/me/somefolder/mybuild/output/target --sysconfdir=/etc
I believe that should do it.
In my situation, --prefix= failed to update the path correctly under some warnings or failures. please see the below link for the answer.
https://stackoverflow.com/a/50208379/1283198

Makefile.am ... what are those?

I've stumbled on a make file "Makefile.am" and I tried to use "make -f Makefile.am" on it to no avail. What am I doing wrong?
It's an automake script/makefile. You can learn everything about automake, autoconf, libtool and such through the called autobook.
Basically, the steps would be to run automake, then autoconf, then configure, then make to build the software you have. These steps are neccessary to build the configure script, that automatically search for needed libraries and such on your system.
The process is not easy, unless your software also includes an already generated "configure" file. If so, the only thing you have to do (mostly) is to just run ./configure, then make, then make install to install the software to a default location. If you want to change configure options, you can also look at ./configure --help.
You stumbled upon an automake file, which is used to create a Makefile from the source, in this case Makefile.am.
From http://developer.gnome.org/doc/GGAD/z70.html, they explain it as:
automake processes Makefile.am to produce a standards-compliant Makefile.in. automake does a lot of work for you: it keeps up with dependencies between source files, for example. It creates all the standard targets, such as install and clean. It also creates more complex targets: simply typing make dist creates a standard .tar.gz file if your Makefile.am is correct.
Basically, you should run 'automake' to make the Makefile, and you will probably run into the same situation with the configure script with 'autoconf'.
Automake: http://www.gnu.org/software/automake/
Wikipedia article on automake: http://en.wikipedia.org/wiki/Automake
If you are trying to compile a 3rd party application from source, there is usually a 'configure' script located at the top of the source tree. If you run ./configure --help from that location, you'll get a list of options you can set. Usually, --prefix is the most common to use.
After running the script, you'll get standard Makefile's generated from the automake files. From there, you can just execute make normally.
Standard build steps for linux packages are:
./configure
make
make install
see "man automake" or google for autotools. likely you'll want to run something like autogen.sh first.

Resources