Posts

Showing posts from May, 2023

GNU Autotools II - "Hello world" project with tests

Spanish version / Versión en Español In order to explore the concepts from the first post in a more practical fashion, today we will look at a step by step guide for creating a C programming language project built and tested using Autotools . 1: Application entry point This will be src/main.c . It's typical to have a src directory for source code, because when the project grows, it will probably need other top-level directories such as man for man pages , data for data files, and so on. src/main.c #include <config.h> #include <stdio.h> int main (void) { puts("Hello World!"); puts("This is " PACKAGE_STRING "."); return 0; } Including config.h is necessary because that's where PACKAGE_STRING will be defined. In turn, config.h will be generated by Autotools. 2: Top-level configure.ac file All configure.ac files contain Autoconf instructions which control the generation of the configure script. These

GNU Autotools II - Hola mundo con tests

Versión en inglés / English version Para bajar a tierra los conceptos del primer post , hoy seguiremos paso a paso la creación de un proyecto en lenguaje C usando Autotools como sistema de build . 1: Punto de entrada En primer lugar, se crea el punto de entrada del programa, src/main.c . Es típico tener un directorio src para el código fuente, ya que al evolucionar el proyecto, probablemente se agreguen directorios como man para páginas de ayuda ( man pages ), data para archivos de datos, etc. src/main.c #include <config.h> #include <stdio.h> int main (void) { puts("Hello World!"); puts("This is " PACKAGE_STRING "."); return 0; } La inclusión de config.h viene dada porque ese archivo será generado por Autotools, y es donde estará definido PACKAGE_STRING. 2: Archivo configure.ac raíz Los archivos configure.ac contienen instrucciones Autoconf que controlan la generación del script configure . Dichas instru