Determining system type

Paul De Bra debra at alice.UUCP
Mon Mar 6 03:05:04 AEST 1989


In article <15406 at cup.portal.com> gregh at cup.portal.com (Greg S Hinton) writes:
}Is there a "standard" -- or optimal -- way to determine at compile time
}whether one is on a BSD or AT&T (Ver7, SysIII, SysV) system?
}This is the best I've been able to come up with so far:
}
}#include <stat.h>
}
}#if defined(S_ISOCK)
}
}/* BSD stuff */
}
}#else
}
}/* AT&T stuff */
}
}#endif
}
}
}Anyone have a better way?

The #if and #ifdef is indeed the "standard" way to do this. The real problem
is to have a make-procedure figure out what system you have. There are a
number of "clues" in the system files which can help (look for files /vmunix,
/xenix, /usr/include/string.h, /usr/include/strings.h, etc. etc, and with
a lot of work you script may decide what system you have).
There are also compiler-dependent flags. #ifdef sparc comes to mind.
But then there will always be flags you have to set by hand, like whether
you want to compile something for sunview or x11...

So the way to have these flags in the C-program is standard, but there is
no standard and/or optimal to determine the flags to give to the compiler.

Anyone with brilliant new ideas?

Paul.
-- 
------------------------------------------------------
|debra at research.att.com   | uunet!research!debra     |
------------------------------------------------------



More information about the Comp.unix.questions mailing list