01 April 2018

Autotools

System: Slackware Linux (version 14.0)
CPUs: Intel(R) Atom(TM) CPU N270 @1.60GHz
Deps: 9menu-master.zip

This entry will look at using GNU autotools.

https://github.com/arnoldrobbins/9menu
9menu-master.zip

Download a copy of the above .zip file, extract it, remove the Imakefile, Makefile, and Makefile.noimake, files, and then run autoscan.

sh-4.2$ cd 9menu-master
sh-4.2$ rm Imakefile Makefile*
sh-4.2$ autoscan
sh-4.2$ cat configure.scan
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AC_CONFIG_SRCDIR([9menu.c])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC

# Checks for libraries.

# Checks for header files.
AC_PATH_X
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/param.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_CHECK_FUNCS([getcwd putenv strchr strrchr])

AC_OUTPUT
sh-4.2$

Modify configure.scan as follows.

  AC_PREREQ([2.69])
- AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
+ AC_INIT([9menu], [1.9])
  AC_CONFIG_SRCDIR([9menu.c])
+ AM_INIT_AUTOMAKE([1.11.5 -Wall -Werror foreign])
  AC_CONFIG_HEADERS([config.h])
+
+ # Add variable and value.
+ LIBS="-lX11"

  # Checks for programs.

  AC_CHECK_FUNCS([getcwd putenv strchr strrchr])

+ AC_CONFIG_FILES([Makefile])
  AC_OUTPUT

sh-4.2$ cp configure.scan configure.ac
sh-4.2$ autoheader
sh-4.2$ aclocal
/usr/share/aclocal/imlib.m4:9: warning: underquoted definition of AM_PATH_IMLIB
/usr/share/aclocal/imlib.m4:9:   run info '(automake)Extending aclocal'
/usr/share/aclocal/imlib.m4:9:   or see http://www.gnu.org/software/automake/manual/automake.html#Extending-aclocal
sh-4.2$ cat << 'EOF-Makefile.am' > 'Makefile.am'
> bin_PROGRAMS = 9menu
> 9menu_SOURCES = 9menu.c
> dist_man_MANS = 9menu.1
> EOF-Makefile.am
sh-4.2$ pushd /usr/share/automake-1.11
/usr/share/automake-1.11 ~/9menu-master
sh-4.2$ cp COPYING INSTALL depcomp install-sh missing $HOME/9menu-master
sh-4.2$ popd
~/9menu-master
sh-4.2$ touch AUTHORS NEWS
sh-4.2$ autoconf
sh-4.2$ automake
sh-4.2$ ./configure --prefix=/usr --mandir=/usr/man
checking for a BSD-compatible install... /bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for X... libraries , headers
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking for unistd.h... (cached) yes
checking for pid_t... yes
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for getcwd... yes
checking for putenv... yes
checking for strchr... yes
checking for strrchr... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
sh-4.2$ make
(CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/eric/9menu-master/missing --run autoheader)
rm -f stamp-h1
touch config.h.in
cd . && /bin/sh ./config.status config.h
config.status: creating config.h
make  all-am
make[1]: Entering directory `/home/eric/9menu-master'
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT 9menu.o -MD -MP -MF .deps/9menu.Tpo -c -o 9menu.o 9menu.c
mv -f .deps/9menu.Tpo .deps/9menu.Po
gcc  -g -O2   -o 9menu 9menu.o  -lX11
make[1]: Leaving directory `/home/eric/9menu-master'
sh-4.2$ exit

I wrote this Post when faced with the xmkmf output as adding an 'x' to the man
page file extension.

A.D. Robbins on 25 April 2018 pushed my suggestions to delete the @(#) SCCS
marker in 9menu.c, and modify the 2nd example in 9menu.1 to use gv instead of
ghostview; also changing the remote example to use ssh instead of rsh.

NB: The 9menu '-label' argument obviously will not work with window managers
which do not render 'window decorations'.

Last updated: 26-04-2018