GNU Autoconf 2.13 for EMX

Current patchlevel: 2

Original author: Juan Jose Garcia Ripoll
Modified by Hung-Chi Chu

Table of contents

Introduction

Well I quite like OS/2 and spend much of my free time tweaking Linux programs to work with it. And sometimes I even get it!

What I've found that makes porting more difficult is sometimes building all those makefiles and configuration headers. Under Linux and most Unix like O.S. you would run a configure script that guesses most of your system peculiarities (Name of the C/C++ compiler, which headers and libraries are present, whether a function is broken...). But OS/2 is not Unix --nor even similar-- and there are enough differences to break up those configuration scripts, even if you already have a good sh-like shell.

OK, it was the state of the question until now. This port of Autoconf introduces a set of scripts and macro files able to build scripts that work well under OS/2 with EMX using all those wonderful ports of GNU utilities. But hey, that's not all. Now those scripts will work under unix as well!

How it works

Most Linux programs come with a configure script that has the purpose of guessing important system defaults. Currently, most of those scripts are built with a tool named Autoconf, from the FSF, which takes in one or two macro files (configure.in & aclocal.m4) and using the M4 macro processor and another internal set of macro files (mainly acgeneral.m4 & acspecific.m4) creates a third one, named configure. What I've done is tweaking the internal macro files, so that the code they produce is well suited to run under EMX with a filesystem that allows long file names. This release is a major rewriting of the port. The most important changes are listed in the following section.

News and changes since 2.12 port

This version is not only a patch release. All of the previously introduced changes have been arranged in a way that make them GNU compliant and unix compatible. I hope this changes to become part of a new official release of Autoconf. Help me to get it!

Requirements for running Autoconf

Here's a list of the EMX programs you'll need. Most of them are at Leo or Hobbes. And you must also be working on HPFS that allows long file names.

Installation from the pre-built package

Installation from the official sources

Using autoconf

Tips and tricks

Drive unit names and extensions

Unix programs don't know about disk units names, such as 'C:'. I've made Autoconf understand drive unit names, but this doesn't mean that your program does.

In the configuration process Autoconf may introduce absolute pathnames in the code of your program. This will typically happen, either when config.h is created, or by explicit defines when compiling. You might have to add code to let the user override these paths.

OTOH, you might find hand-made rules in aclocal.m4 or in configure.in that check whether a path reference is absolute or not. Typically it looks like in this example:

...
case "$LD" in
  /*)	ac_program_LD="$LD";;
  *)	#some other stuff
...
This must be fixed in the following compatible mode:
...
case "$LD" in
changequote(, )dnl
  /* | [a-zA-Z]:*) ac_program_LD="$LD";;
changequote([, ])dnl
  *)    #some other stuff
...
The fixed rule recognizes drive unit names. Also, as the colon ":" is not a valid path character under unix, it causes no big harm.

Compilation flags

Autoconf's default flags for compiling programs are, as of this release
	CC=gcc.exe
	MAKE=make
	CXX=gcc.exe
	CPP="gcc.exe -E"
	CFLAGS="-O2 -Zmt"
	CXXFLAGS="-O2 -Zmt"
	LDFLAGS="-Zmt -Zcrtdll -Zsysv-signals -Zbin-files"
	CONFIG_SHELL=sh.exe

The flags can be overriden. Either edit the generated configure file or set environment variables

[From within CMD.EXE]
	set MAKE=x11make.exe
	set CFLAGS=-O2
	set CFLAGS=-O2
	set LDFLAGS=-Zexe -Zcrtdll -Zsysv-signals
[From within SH.EXE]
	export MAKE=x11make.exe
	export CFLAGS=-O2
	export CFLAGS=-O2
	export LDFLAGS="-Zexe -Zcrtdll -Zsysv-signals"
or let the configure program run and, at the end, edit config.status changing the variables to suit your needs. (See below)

The default settings are good for X11 programs and won't harm when porting any other kind of application. If you opt to use them, please follow these two rules (extracted from the XFree86/OS2 porting guide):

The config.status file

This script contains all of the configuration parameters and is responsible for converting the *.in files into usable ones. Some tips about this script:

Non portable rules

There are that programs need to guess system dependent features that Autoconf currently doesn't know about. This is usually achieved with rules that are stored in aclocal.m4. Some of these rules are just a set of standard checks put together, but some other are non-portable ones (in the sense that they may not work under OS/2).

The following sections explain how rules are to be modified in order to make them OS/2 compatible. These changes are simple ones and should be notified to the maintainers together with an explanation of where to get this port of Autoconf and its compatible nature.

File names

This release introduces two variables which are used to name executable binary and library file. ac_cv_exeext is ".exe" for OS/2 and empty for Unix. ac_cv_libpre is empty for OS/2 and "lib" for Unix. Sometimes you should modify some Unix formatted filenames and add the variables.

Path separator

The path separator is stored in the PATH_IFS environment variable and is ";" under OS/2 and ":" elsewhere. You can modify configure.in or aclocal.m4 when necessary to replace the Unix path separator ":" with ${PATH_IFS}.

An example

An example shows how to modify aclocal.m4 is following:

	[case "$LD" in
	  /*)
	  ac_cv_path_LD="$LD" # Let the user override the test with a path.
	  ;;
	  *)
	  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
	  for ac_dir in $PATH; do
	    test -z "$ac_dir" && ac_dir=.
	    if test -f "$ac_dir/ld"; then
		...
	    fi
	  done
	  IFS="$ac_save_ifs"
	  ;;
	esac])
The fixed version is
	[case "$LD" in
        changequote(, )dnl
	  /*|[a-zA-Z]:*)
        changequote([, ])dnl
	  ac_cv_path_LD="$LD" # Let the user override the test with a path.
	  ;;
	  *)
	  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${PATH_IFS}"
	  for ac_dir in $PATH; do
	    test -z "$ac_dir" && ac_dir=.
	    if test -f "$ac_dir/ld$ac_cv_exeext"; then
		...
	    fi
	  done
	  IFS="$ac_save_ifs"
          ;;
	esac])

Bug reports

If you miss a feature in autoconf, or find something doesn't work, please e-mail me.

When reporting bugs, follow these steps:

Greetings and notes

We must thank Juan Jose Garcia Ripoll for hist GREATE port, Alexander Mai for his many comments on the project, and T.E.Dickey for pointing out some bugs.

Remember:


Maintainer: Hung-Chi Chu