[asterisk-dev] policy for managing headers
Luigi Rizzo
rizzo at icir.org
Fri Nov 16 04:58:25 CST 2007
I am trying to figure out the policy in asterisk for managing
include files. This is a bit critical for portability and cross
builds to non-unix, because there are differences in the location
name and content of include files. These differences are hopefully
detected by 'configure', and better dealt with in a central place.
The status now is the following:
* autoconfig.h is required (and forced by the top level Makefile)
for all files. This only defines constants resulting from autoconf
and manually set build options.
* asterisk.h is presumably required by all files (though some don't include it).
In turn, this includes asterisk/compat.h and asterisk/paths.h
* asterisk/compat.h includes a small set of basic headers
(right now inttypes.h sys/types.h stdarg.h) and then defines
some things in case they are not available in the system headers.
Other than this, most or all sources seem to include their own set
of headers, often discarding the findings of 'configure'.
My proposal would be to let asterisk/compat.h deal with at least
the most common headers, or those that might have platform-specific
names or locations (most noticeably socket.h and the various
network-related ones).
Sources would still include their own "asterisk/somesubsystem.h"
headers, but at least this should reduce/simplify the management
of header files and reduce the chance of errors.
See a partial list below preceded by the number of occurrences in
the asterisk source tree.
Comments/objections ?
cheers
luigi
371 <stdio.h>
366 <string.h>
361 <stdlib.h>
281 "asterisk.h"
255 "asterisk/logger.h"
245 "asterisk/channel.h"
242 <unistd.h>
208 "asterisk/module.h"
194 "asterisk/lock.h"
190 "asterisk/options.h"
187 "asterisk/utils.h"
173 "asterisk/pbx.h"
170 <errno.h>
157 <sys/types.h>
131 "asterisk/file.h"
120 "asterisk/app.h"
105 "asterisk/config.h"
90 "asterisk/cli.h"
79 <netinet/in.h>
79 <ctype.h>
77 <fcntl.h>
74 <sys/time.h>
59 <sys/stat.h>
59 "asterisk/linkedlists.h"
53 <signal.h>
53 <arpa/inet.h>
53 "asterisk/translate.h"
50 "asterisk/callerid.h"
43 <sys/socket.h>
43 "asterisk/sched.h"
42 <math.h>
42 #include
More information about the asterisk-dev
mailing list