1
dnl ------ compiler.m4 ------
2
dnl Check CC specific characteristics
4
dnl $1 is the $CC option to check for.
5
dnl $2 is a boolean value (1 for true or 0 for false),
6
dnl whether the option should be activated in
7
dnl CFLAGS if available
8
dnl Defaults to true, if not specified
10
AC_DEFUN([GGI_CC_CHECK4_OPTION],
13
AC_MSG_CHECKING([if $CC has -$1 option])
18
AC_LANG_PROGRAM([[#include <stdio.h>]],
19
[[printf("Hello World\n");]])
28
if test $activate -eq 0 -o "$cc_tmp" != "yes"; then
33
AC_MSG_RESULT([$cc_tmp])
35
AS_VAR_SET(AS_TR_SH(m4_tolower([cc_has_$1])), $cc_tmp)
41
dnl Check if -Werror-implicit-function-declaration kills the build.
43
dnl AIX 4.2 is missing a prototype for (at least) snprintf.
44
dnl Cygwin 1.5.11 is missing a prototype for (at least) siginterrupt.
45
dnl HP/UX 11.11 is missing a prototype for (at least) strtoull.
46
dnl True64 (version?) is missing a prototype for (at least) strtoull.
48
AC_DEFUN([GGI_CHECK_IMPLICIT_DECLARATIONS],
51
dnl First check, if we _have_ -Werror-implicit-function-declaration
52
GGI_CC_CHECK4_OPTION([Werror-implicit-function-declaration], 0)
54
if test "$cc_has_werror_implicit_function_declaration" = "yes"; then
55
ggi_test_funcs="strncasecmp snprintf siginterrupt strtoull"
57
dnl Now check for some headers ...
58
AC_CHECK_HEADERS([string.h strings.h signal.h])
60
dnl ... for the declarations
61
for func in $ggi_test_funcs; do
62
AC_CHECK_DECLS($func,[],[],
69
dnl ... and for the symbols.
70
AC_CHECK_FUNCS($ggi_test_funcs)
72
AC_MSG_CHECKING([if the system is missing declarations])
74
for func in $ggi_test_funcs; do
75
decl_var=AS_TR_SH([ac_cv_have_decl_$func])
76
func_var=AS_TR_SH([ac_cv_func_$func])
78
if eval "test \"x\${$decl_var}\" = \"xno\" -a \
79
\"x\${$func_var}\" = \"xyes\""; then
80
cc_has_werror_implicit_function_declaration="no"
84
dnl When we can use -Werror-implicit-function-declaration, then
85
dnl there are no declarations missing. Thus the result output
87
if test $cc_has_werror_implicit_function_declaration = "yes"; then
99
dnl ----- dllext.m4 -----
100
dnl Suffix detection for runtime loadable libraries.
102
AC_DEFUN([GGI_DLLEXT],
105
AC_MSG_CHECKING([for shared library extension])
107
*-*-mingw* | *-*-cygwin*)
114
AC_MSG_RESULT([$DLLEXT])
123
dnl ------ extrapaths.m4 ------
124
dnl Let user add extra includes and libs
126
AC_DEFUN([GGI_EXTRA_PATHS],
129
AC_ARG_WITH([extra-includes],
130
[ --with-extra-includes=DIR
131
add extra include paths (separator ':')],
132
use_extra_includes="$withval",
133
use_extra_includes=NO
136
if test -n "$use_extra_includes" && \
137
test "$use_extra_includes" != "NO"; then
140
for dir in ${use_extra_includes} ; do
141
if test -d "$dir" ; then
142
extra_includes="$extra_includes -I$dir"
145
extra_includes="$extra_includes -include $dir"
149
CPPFLAGS="$CPPFLAGS $extra_includes"
152
AC_ARG_WITH([extra-libs],
153
[ --with-extra-libs=DIR add extra library paths (separator ':')],
154
use_extra_libs="$withval",
157
if test -n "$use_extra_libs" && \
158
test "$use_extra_libs" != "NO"; then
161
for dir in $use_extra_libs; do
162
if test -d "$dir" ; then
163
extra_libraries="$extra_libraries -L$dir"
165
extra_libraries="$extra_libraries -l$dir"
169
LDFLAGS="$LDFLAGS $extra_libraries"
172
AC_SUBST(extra_includes)
173
AC_SUBST(extra_libraries)
179
dnl ------ os.m4 ------
180
dnl Add your OS here, if not listed
182
AC_DEFUN([GGI_CHECKOS],
221
AM_CONDITIONAL(OS_WIN32, [test $os = "os_win32_cygwin" -o $os = "os_win32_mingw" -o $os = "os_win32_pw32"])
222
AM_CONDITIONAL(OS_WIN32_CYGWIN, test $os = "os_win32_cygwin")
223
AM_CONDITIONAL(OS_WIN32_MINGW, test $os = "os_win32_mingw")
224
AM_CONDITIONAL(OS_WIN32_PW32, test $os = "os_win32_pw32")
226
AM_CONDITIONAL(OS_DARWIN, test $os = "os_darwin")
227
AM_CONDITIONAL(OS_FREEBSD, test $os = "os_freebsd")
228
AM_CONDITIONAL(OS_LINUX, test $os = "os_linux")
229
AM_CONDITIONAL(OS_NETBSD, test $os = "os_netbsd")
230
AM_CONDITIONAL(OS_OPENBSD, test $os = "os_openbsd")
231
AM_CONDITIONAL(OS_SOLARIS, test $os = "os_solaris")
232
AM_CONDITIONAL(OS_AIX, test $os = "os_aix")
233
AM_CONDITIONAL(OS_DEFAULT, test $os = "os_default")
240
dnl ------ rellibdir.m4 -----
241
dnl Find a relative path that takes us from static_sysconfdir/ggi_subdir
242
dnl to static_libdir/ggi_subdir.
244
dnl This macro is easily fooled with //, /./ and /../ combinations.
245
dnl Also, I'm very far from a script guru. This macro can probably
246
dnl be written in a couple of lines if you know the right script
249
AC_DEFUN([GGI_SYSCONF_TO_LIB],
251
rel_ggisysconfdir="$static_sysconfdir/$ggi_subdir"
252
rel_ggilibdir="$static_libdir/$ggi_subdir"
254
until test "$again" = "no"; do
260
for cdir in $rel_ggisysconfdir; do
262
if test -n "$again"; then
263
if test -n "$newcdir"; then
264
newcdir="$newcdir/$cdir"
272
for ldir in $rel_ggilibdir; do
274
if test -z "$again"; then
275
if test "$ldir" = "$cdir"; then
286
if test -n "$newldir"; then
287
newldir="$newldir/$ldir"
293
rel_ggisysconfdir="$newcdir"
294
rel_ggilibdir="$newldir"
298
for cdir in $rel_ggisysconfdir; do
299
rel_ggilibdir="../$rel_ggilibdir"
303
ggi_sysconfdir_to_libdir="$rel_ggilibdir"
307
dnl ----- strings.m4 -----
308
dnl Check for safe and secure string functions
310
AC_DEFUN([GGI_CHECK_STRING_FUNCS],
313
dnl strings.h exists on SYSV systems
314
dnl and contains strcasecmp() and strncasecmp()
315
AC_CHECK_HEADERS(string.h strings.h)
317
AC_CHECK_FUNCS([strcasecmp strncasecmp \
318
strncat strncpy snprintf vsnprintf \
319
strlcpy strlcat asprintf \
320
strtol strtoul strtoll strtoull])
326
dnl ----- checklib.m4 -----
327
dnl Check for libs using libtool
329
AC_DEFUN([GGI_CHECK_LIB],
332
CC="$SHELL ./libtool --mode=link $CC"
333
AC_CHECK_LIB($1, $2, [
340
dnl ----- checkint.m4 -----
341
dnl Add fallback if C99 inttypes are not there...
342
AC_DEFUN([GGI_NEED_INTTYPES],
344
if test "$ac_cv_header_inttypes_h" != "yes"; then
345
AC_DEFINE(GG_NEED_INTTYPES, 1,
346
[Tell libgg to define integer types when building])