Added
Link Here
|
1 |
dnl Process this file with autoconf to produce a configure script. |
2 |
AC_INIT([oer], [1.0.66]) |
3 |
AC_CONFIG_SRCDIR([oer.c]) |
4 |
AC_CONFIG_HEADER([config.h]) |
5 |
|
6 |
dnl This is the default destination |
7 |
AC_PREFIX_DEFAULT([$HOME/oer]) |
8 |
|
9 |
dnl Checks for programs. |
10 |
AC_PROG_CC |
11 |
AC_PROG_MAKE_SET |
12 |
AC_PROG_INSTALL |
13 |
|
14 |
dnl we need uname |
15 |
AC_CHECK_PROG(UNAME,uname,uname) |
16 |
|
17 |
AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug], [enable runtime debugging (You should also set CFLAGS="-g")])], [debug=$enableval], [debug=no]) |
18 |
AC_ARG_ENABLE(opt, [AS_HELP_STRING([--disable-opt], [disable automatic setting of optimization compiler switches])], [opt="$enableval"], [opt=yes]) |
19 |
AC_ARG_ENABLE([strip], [AS_HELP_STRING([--disable-strip], [Disable automatic stripping of binaries])], [enable_strip="$enableval"], [enable_strip=yes]) |
20 |
|
21 |
AC_MSG_CHECKING(system type) |
22 |
SYSTEM_TYPE=`${UNAME}` |
23 |
AC_MSG_RESULT($SYSTEM_TYPE) |
24 |
|
25 |
IRIX=no |
26 |
AS_IF([test "x$SYSTEM_TYPE" = "xIRIX"], |
27 |
[IRIX=yes |
28 |
enable_strip=no |
29 |
]) |
30 |
|
31 |
AS_IF([test "$debug" = "yes"], |
32 |
[AC_DEFINE([DEBUG], [], [Add debugging codepaths])]) |
33 |
|
34 |
dnl for devs... |
35 |
MYCFLAGSADDGCC="-Wstrict-prototypes -Wall" |
36 |
|
37 |
dnl strip binaries by default |
38 |
AS_IF([test "$enable_strip" = "yes" -a "x$IRIX" = "xno"], |
39 |
[MYLDFLAGSADDCC="$MYLDFLAGSADDCC -s" |
40 |
MYLDFLAGSADDGCC="$MYLDFLAGSADDGCC -s"]) |
41 |
|
42 |
AS_IF([test "$opt" = "yes"], |
43 |
[MYCFLAGSADDCC="$MYCFLAGSADDCC -O" |
44 |
MYCFLAGSADDGCC="$MYCFLAGSADDGCC -O2"]) |
45 |
|
46 |
dnl system specific compile settings |
47 |
if test "x${SYSTEM_TYPE}" = "xHP-UX"; then |
48 |
MYCFLAGSADDCC="${MYCFLAGSADDCC} -Ae" |
49 |
fi |
50 |
if test "x${SYSTEM_TYPE}" = "xOSF1"; then |
51 |
MYCFLAGSADDCC="${MYCFLAGSADDCC} -std -no_intrinsics" |
52 |
fi |
53 |
dnl newer SunOS/Solaris have different signal() behaviour |
54 |
if test "x${SYSTEM_TYPE}" = "xSunOS"; then |
55 |
AC_DEFINE([NEW_SIGNALS], [], [Support Solaris's signal() behaviour]) |
56 |
fi |
57 |
if test "x$IRIX" = "xIRIX"; then |
58 |
MYCFLAGSADDCC="$MYCFLAGSADDCC -std -no_intrinsics" |
59 |
fi |
60 |
|
61 |
dnl Append compiler CFLAGS and LDFLAGS |
62 |
dnl assume gcc. Checking x$CC = xgcc is not enough -- there's ${HOST}-gcc, for example... |
63 |
dnl Check that compiler works with the flags we've generated, falling |
64 |
dnl back from GCC flags -> generic/system-specific flags -> no flags. |
65 |
CFLAGS_save="$CFLAGS" |
66 |
CPPFLAGS_save="$CPPFLAGS" |
67 |
LDFLAGS_save="$LDFLAGS" |
68 |
|
69 |
dnl GCC |
70 |
CFLAGS="$CFLAGS_save $MYCFLAGSADDGCC" |
71 |
LDFLAGS="$LDFLAGS_save $MYLDFLAGSADDGCC" |
72 |
|
73 |
AC_COMPILE_IFELSE( |
74 |
[AC_LANG_PROGRAM( |
75 |
[[#include <stdio.h>]], |
76 |
[[fprintf(stderr, "Hello, gcc world!\n");]])], |
77 |
[:], |
78 |
[ |
79 |
dnl system-specific/generic |
80 |
CFLAGS="$CFLAGS_save $MYCFLAGSADDCC" |
81 |
LDFLAGS="$LDFLAGS_save $MYLDFLAGSADDCC" |
82 |
AC_COMPILE_IFELSE( |
83 |
[AC_LANG_PROGRAM( |
84 |
[[#include <stdio.h>]], |
85 |
[[fprintf(stderr, "Hello, system-specific world!\n");]])], |
86 |
[:], |
87 |
[ |
88 |
dnl no flags (user flags only) |
89 |
CFLAGS="$CFLAGS_save" |
90 |
LDFLAGS="$LDFLAGS_save"])]) |
91 |
|
92 |
dnl Find out source code size |
93 |
LINES=`wc -l *.h *.c | tail -1 | sed 's/total/\ /' | tr -d ' '` |
94 |
CHARS=`wc -c *.h *.c | tail -1 | sed 's/total/\ /' | tr -d ' '` |
95 |
|
96 |
dnl export to config.h |
97 |
AC_DEFINE_UNQUOTED(SOURCE_LINES,${LINES},[Number of source lines]) |
98 |
AC_DEFINE_UNQUOTED(SOURCE_CHARS,${CHARS},[Number of characters in the source]) |
99 |
|
100 |
dnl Checks for libraries (except IRIX) |
101 |
if test "${IRIX}" = "no"; then |
102 |
AC_CHECK_LIB(crypt,crypt) |
103 |
AC_CHECK_LIB(socket,socket) |
104 |
AC_CHECK_LIB(nsl,connect) |
105 |
AC_CHECK_LIB(dns,gethostbyname) |
106 |
AC_CHECK_LIB(dl,dlopen) |
107 |
fi |
108 |
|
109 |
dnl Checks for header files. |
110 |
AC_HEADER_STDC |
111 |
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h strings.h crypt.h) |
112 |
|
113 |
dnl FreeBSD doesn't like ctype.h to be included, why only The Red Devil knows |
114 |
if test "x${SYSTEM_TYPE}" != "xFreeBSD"; then |
115 |
AC_CHECK_HEADERS(ctype.h) |
116 |
else |
117 |
AC_MSG_WARN([ |
118 |
Disabling ctype.h because of FreeBSD. You can safely |
119 |
ignore the implicit declaration of function isxxxxx messages. |
120 |
]) |
121 |
fi |
122 |
|
123 |
dnl check for uname |
124 |
AC_CHECK_FUNCS(uname) |
125 |
|
126 |
dnl check for getaddrinfo |
127 |
AC_CHECK_FUNCS(getaddrinfo) |
128 |
if test "${ac_cv_func_getaddrinfo}" = "no"; then |
129 |
AC_MSG_ERROR([ |
130 |
Your system does not support the getaddrinfo function call. |
131 |
(you could try oer 1.0-62 or older.) |
132 |
]) |
133 |
fi |
134 |
|
135 |
dnl check for locale |
136 |
AC_CHECK_HEADERS(locale.h) |
137 |
|
138 |
dnl Checks for typedefs, structures, and compiler characteristics. |
139 |
AC_C_CONST |
140 |
AC_TYPE_SIZE_T |
141 |
AC_HEADER_TIME |
142 |
AC_STRUCT_TM |
143 |
|
144 |
dnl Checks for library functions. |
145 |
AC_TYPE_SIGNAL |
146 |
AC_CHECK_FUNCS(snprintf) |
147 |
if test "${ac_cv_func_snprintf}" = "no"; then |
148 |
AC_MSG_WARN([ |
149 |
Your system does not have snprintf, using unsafe vsprintf alternative |
150 |
]) |
151 |
fi |
152 |
AC_CHECK_FUNCS(vsprintf) |
153 |
if test "${ac_cv_func_vsprintf}" = "no"; then |
154 |
AC_MSG_ERROR([ |
155 |
Your system does not even have vsprintf. Get a real system! |
156 |
]) |
157 |
fi |
158 |
AC_CHECK_FUNCS(vfprintf) |
159 |
if test "${ac_cv_func_vfprintf}" = "no"; then |
160 |
AC_MSG_ERROR([ |
161 |
Your system does not have vfprintf. Get a real system! |
162 |
]) |
163 |
fi |
164 |
|
165 |
AC_CONFIG_FILES([ |
166 |
Makefile |
167 |
]) |
168 |
AC_OUTPUT |
169 |
|
170 |
AC_MSG_RESULT([ |
171 |
Type "make" to compile oer |
172 |
]) |