mnm-sys / tezdhar

A fast and unbeatable chess engine written in C
GNU General Public License v3.0
3 stars 1 forks source link

GNU Automake and Autobuild configure scripts and Makefiles should be provided to build code for any platform like Unix, Mac, Win, etc. #2

Closed mnm-sys closed 2 years ago

mnm-sys commented 2 years ago
    GNU Automake and Autobuild configure scripts and Makefiles should be provided to build code for any platform like Unix, Mac, Win, etc.

Originally posted by @mnm-sys in https://github.com/mnm-sys/tezdhar/issues/1#issuecomment-1271102941

mnm-sys commented 2 years ago

Write configure.ac -> Makefile.am

The primary components of Autotools are:

automake autoconf make

Additionally, these files are required:

NEWS README AUTHORS ChangeLog You don’t have to actively use the files, and they can be symlinks to a monolithic document (like README.md) that encompasses all of that information, but they must be present.

Autotools configuration Create a file called configure.ac at your project’s root directory. This file is used by autoconf to create the configure shell script that users run before building. The file must contain, at the very least, the AC_INIT and AC_OUTPUT [M4 macros]

The macros to create a Makefile are AM_INIT_AUTOMAKE, which accepts no arguments, and AC_CONFIG_FILES, which accepts the name you want to call your output file.

Finally, you must add a macro to account for the compiler your project needs. The macro you use obviously depends on your project. If your project is written in C++, the appropriate macro is AC_PROG_CXX, while a project written in C requires AC_PROG_CC, and so on

bootstrap the build infrastructure. First, run autoreconf to generate the configure script that users invoke before running make. Use the –install option to bring in auxiliary files, such as a symlink to depcomp, a script to generate dependencies during the compiling process, and a copy of the compile script, a wrapper for compilers to account for syntax variance, and so on.

$ autoreconf --install
configure.ac:3: installing './compile'
configure.ac:2: installing './install-sh'
configure.ac:2: installing './missing'

use the aclocal program to generate your aclocal.m4 for you To build the Makefile run commands in following order:

aclocal
autoconf
automake --add-missing
autoreconf --install

Now you can run ‘automake --add-missing’ to generate your Makefile.in and grab any auxiliary files you might need, and you’re done!

Note that running autoreconf is only needed initially when the GNU Build System does not exist. When you later change some instructions in a Makefile.am or configure.ac, the relevant part of the build system will be regenerated automatically when you execute make.

autoreconf is a script that calls autoconf, automake, and a bunch of other commands in the right order. If you are beginning with these tools, it is not important to figure out in which order all of these tools should be invoked and why. However, because Autoconf and Automake have separate manuals, the important point to understand is that autoconf is in charge of creating configure from configure.ac, while automake is in charge of creating Makefile.ins from Makefile.ams and configure.ac. This should at least direct you to the right manual when seeking answers.

The command autoscan can also suggest a few of the tests your package may need (see Using autoscan to Create configure.ac in The Autoconf Manual).

autoreconf also detects missing auxiliary scripts. When used with the --install option, autoreconf will try to add missing scripts to the directory specified by AC_CONFIG_AUX_DIR, or to the top level of the source tree if AC_CONFIG_AUX_DIR was not used. It can always do this for the scripts needed by Autoconf core macros: install-sh, config.sub, and config.guess. Many other commonly-needed scripts are installed by the third-party tools that autoreconf knows how to run, such as missing for Automake and ltmain.sh for Libtool.

mnm-sys commented 2 years ago

CI/CD Working is failing due to following error: configure: error: cannot find required auxiliary files: compile missing install-sh