There could have been a way using the preprocessor - at least with GCC.
GCC has a number of non-standard predefined macros. The one which could help here is '__BASE_FILE__'. Within the scope of an included file, it holds the name of the base file - the file that includes it.
It's unfortunate though that you can't use string literals in preprocessor comparisons.
Something like this, placed in the header file in question, assuming the .c file in which it's only allowed to be included is name 'allowed.c', would have been a candidate:
#if __BASE_FILE__ != "allowed.c"
#error Included in the wrong file!
#endif
But the preprocessor can't use string literals in this context, so it just gives an error (token ""allowed.c"" is not valid in preprocessor expressions). That's too bad.
Now if you can find a clever way of using this '__BASE_FILE__' macro to achieve the same result, there you go...