1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

restore build on ancient Mac OS X (re: 22e044c3)

For some reason that I can't be bothered to investigate, gcc 3.3 on
my museum-grade PowerMac G5 running Mac OS X 10.3 doesn't like -lm
when compiling the output{...}end blocks in features/pty and
features/dll. The compilation fails silently. But some other
systems require the -lm for it to work.

Thankfully iffe has a syntax for trying a test repeatedly with
different flags (a.k.a. prerequisites). From 'iffe --man':

    -     Prereq grouping mark; prereqs before the first - are
          passed to all feature tests. Subsequent groups are
          attempted in left-to-right order until the first
          successful group is found.

src/cmd/builtin/features/pty,
src/lib/libdll/features/dll:
- Try compiling the output{...}end block once with -lm and, if that
  fails, try once without -lm before erroring out.
This commit is contained in:
Martijn Dekker 2022-07-03 19:21:32 +02:00
parent 366efa4b06
commit d79a34b327
2 changed files with 15 additions and 6 deletions

View file

@ -11,7 +11,8 @@ lib openpty,_getpty,ptsname -lutil
lib grantpt,unlockpt,posix_openpt stdlib.h
lib cfmakeraw termios.h
tst - -lm output{
# try once with -lm, once without
tst - -lm - - output{
#include <fcntl.h>
#if _lib_ptsname
#include <stdlib.h>
@ -50,8 +51,11 @@ tst - -lm output{
return 0;
}
}end fail{
echo "$0: Output block failed to compile. Export IFFEFLAGS=-d1 to debug." >&2
exit 1
case ${_features_pty_TRIEDONCE-no} in
no) _features_pty_TRIEDONCE=yes ;;
*) echo "$0: Output block failed to compile. Export IFFEFLAGS=-d1 to debug." >&2
exit 1 ;;
esac
}end
extern _getpty char* (int*, int, mode_t, int)

View file

@ -73,7 +73,9 @@ tst run{
esac
echo "#define _DLL_NEXT_PATH \"$lib\""
}end
tst - -lm output{
# try once with -lm, once without
tst - -lm - - output{
#include <math.h>
#if defined(__MVS__) && !defined(__SUSV3)
#define __SUSV3 1
@ -261,6 +263,9 @@ tst - -lm output{
return 0;
}
}end fail{
echo "$0: Output block failed to compile. Export IFFEFLAGS=-d1 to debug." >&2
exit 1
case ${_features_dll_TRIEDONCE-no} in
no) _features_dll_TRIEDONCE=yes ;;
*) echo "$0: Output block failed to compile. Export IFFEFLAGS=-d1 to debug." >&2
exit 1 ;;
esac
}end