Signup/Sign In
PUBLISHED ON: FEBRUARY 15, 2023

How to use autoscan command in Linux?

Linux autoscan is a command line tool that is used to generate a configure.in file from an existing source code directory. The configure.in file is used as a template for the configure script, which is a shell script that is used to configure a software package for installation on a specific system. The configure script is generated from the configure.in file using the autoconf command.

configure.in and configure.ac files:

The "configure.in" file was the older version of the "configure.ac" file used in Autoconf projects. It was replaced by the "configure.ac" file in Autoconf version 2.50. The "configure.ac" file is used to specify the project's information and the macros that are required for the configure script. It is written in the M4 language (macro processing language).

configure.scan file:

The "configure.scan" file is generated by the autoscan command and contains a list of the required macros for the configure script. It is used as a starting point for the "configure.ac" file.

Install autoscan tool

Debian based - apt install autoconf
Alpine - apk add autoconf
Arch Linux - pacman -S autoconf
CentOS - yum install autoconf
Fedora - dnf install autoconf
OS X - brew install autoconf
Raspbian - apt-get install autoconf
Docker - docker run cmd.cat/autoscan autoscan

Syntax of autoscan command

$ autoscan [OPTIONS]... [Source_Directory]

Options in autoscan command

-d, --debug don't remove temporary files created by this command.
-B, --prepend-include=DIR prepend directory DIR to search path in Library directories.
-I, --include=DIR append directory DIR to the search path in Library directories.
-v, --verbose verbosely report processing.
--help display this help and exit.
--version output version information and exit.

Autoscan command in linux terminal

Example usage of autoscan command

To use the autoscan command, the source code for the project needs to be present in a separate directory. The command is then run from the root directory of the project as follows:

$ autoscan

This generates the configure.scan file in the root directory of the project. The configure.scan file can then be edited to remove the unnecessary macros and add any additional macros that are required.

To generate the configure.ac file from the configure.scan file, the following command can be used:

$ mv configure.scan configure.ac

The configure script can now be generated using the autoconf command:

$ autoconf

This generates the configure script in the root directory of the project.

Conclusion

The Linux autoscan command is a essential tool for creating the initial "configure.ac" file for an Autoconf project. It scans the source code and creates a list of required macros in the configure.scan file, which can then be used to create the configure script using the autoconf command. The configure script is in the configuration of the build process for the project and can be customised using the configure.ac file.



About the author:
Pradeep has expertise in Linux, Go, Nginx, Apache, CyberSecurity, AppSec and various other technical areas. He has contributed to numerous publications and websites, providing his readers with insightful and informative content.