Messing around with autoconf

  • I’m trying to build a user interface for docker to assist with some of the basic docker commands instead of having to learn/remember all docker related concepts.
  • After checking out a few GUI frameworks I’ve decided to go with something that’s robust and has good cross platform support. Decision is to go with GTK4.
  • I’ve created simple C programs before but it turns out that setting up one with GTK on linux is proving to be more difficult than anticipated. Previously working with wxWidgets was a much more seamless experience but the UI is a bit theme options are a bit limiting. Some of the main headaches with GTK4 (and possibly with earlier versions too) is that it’s difficult to find/install/link all GTK dependencies.
  • After some research I’ve attempted to find these libraries manually but they just continue down a rabbit hole. A post I’ve come across suggests to rather just make use of autoconf which is what I’ve trying to achieve now and hopefully document some of the basics in this article.
  • Getting started with autoconf:
    • The GNU build system consists of AutoMake, GNULib and Libtool
    • Autoconf is only required for build time and not required for runtime
    • The goal of autoconf is to make the configure task painless
    • Automake allows you to specify your build needs in Makefile.am
    • Libtool handles all the requirements for building shared libraries for you
    • To create a configure file with AutoConf you need a file called configure.ac
    • Writing configure.ac
      • The autoscan program can give you a good start to creating the configure.ac file.
      • Autoconf uses a language that’s a layer on top of sh (Bourne shell). A superset of sh you may say.
      • Every configure.ac must contain an AC_INIT call at the start and AC_OUTPUT at the end
      • E.g. structure:
        AC_INIT(package, version, bug-report-address)
        information on the package
        checks for programs
        checks for libraries
        checks for header files
        checks for types
        checks for structures
        checks for compiler characteristics
        checks for library functions
        checks for system services
        AC_CONFIG_FILES([file…])
        AC_OUTPUT
      • At the root of you project run autoscan. This will produce the file configure.scan.
      • Then rename configure.scan to configure.ac.
      • To create the final configure (sh file) file run autoconf without any arguments.
  • bookmark, https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.pdf , page 14
  • Reference: https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.pdf

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *