2
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
3
# local automake definitions for ntop
4
## (this file is processed with 'automake' to produce Makefile.in)
5
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
7
# Copyright (c) 1998, 2000 Luca Deri <deri@ntop.org>
8
# Updated 1Q 2000 Rocco Carbone <rocco@ntop.org>
10
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
12
# This program is free software; you can redistribute it and/or modify
13
# it under the terms of the GNU General Public License as published by
14
# the Free Software Foundation; either version 2 of the License, or
15
# (at your option) any later version.
17
# This program is distributed in the hope that it will be useful,
18
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
# GNU General Public License for more details.
22
# You should have received a copy of the GNU General Public License
23
# along with this program; if not, write to the Free Software
24
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28
dnl> Check for an ANSI C typedef in a header
31
dnl> AC_CHECK_TYPEDEF(<typedef>, <header>)
33
dnl> #undef HAVE_<typedef>
36
AC_DEFUN(AC_CHECK_TYPEDEF,[dnl
37
AC_REQUIRE([AC_HEADER_STDC])dnl
38
AC_MSG_CHECKING(for typedef $1)
39
AC_CACHE_VAL(ac_cv_typedef_$1,
42
<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl
45
], ac_cv_typedef_$1=yes, ac_cv_typedef_$1=no)])dnl
46
AC_MSG_RESULT($ac_cv_typedef_$1)
47
if test $ac_cv_typedef_$1 = yes; then
48
AC_DEFINE(HAVE_[]translit($1, [a-z], [A-Z]))
54
dnl> Check whether compiler option works
57
dnl> AC_COMPILER_OPTION(<name>, <display>, <option>,
58
dnl> <action-success>, <action-failure>)
61
AC_DEFUN(AC_COMPILER_OPTION,[dnl
62
AC_MSG_CHECKING(for compiler option $2)
63
AC_CACHE_VAL(ac_cv_compiler_option_$1,[
64
cat >conftest.$ac_ext <<EOF
65
int main() { return 0; }
67
${CC-cc} -c $CFLAGS $CPPFLAGS $3 conftest.$ac_ext 1>conftest.out 2>conftest.err
68
if test $? -ne 0 -o -s conftest.err; then
69
ac_cv_compiler_option_$1=no
71
ac_cv_compiler_option_$1=yes
73
rm -f conftest.$ac_ext conftest.out conftest.err
75
if test ".$ac_cv_compiler_option_$1" = .yes; then
76
ifelse([$4], , :, [$4])
78
ifelse([$5], , :, [$5])
80
AC_MSG_RESULT([$ac_cv_compiler_option_$1])
85
dnl> Debugging Support
88
dnl> AC_CHECK_DEBUGGING
91
AC_DEFUN(AC_CHECK_DEBUGGING,[dnl
92
AC_ARG_ENABLE(debug,dnl
93
[ --enable-debug build for debugging (default=no)],
95
if test ".$ac_cv_prog_gcc" = ".yes"; then
98
* ) CFLAGS="$CFLAGS -O2" ;;
102
* ) CFLAGS="$CFLAGS -g" ;;
106
* ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CFLAGS="$CFLAGS -pipe") ;;
108
AC_COMPILER_OPTION(ggdb3, -ggdb3, -ggdb3, CFLAGS="$CFLAGS -ggdb3")
110
*-*-freebsd*|*-*-solaris* ) CFLAGS="$CFLAGS -pedantic" ;;
112
CFLAGS="$CFLAGS -Wall"
113
WMORE="-Wshadow -Wpointer-arith -Wcast-align -Winline"
114
WMORE="$WMORE -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
115
AC_COMPILER_OPTION(wmore, -W<xxx>, $WMORE, CFLAGS="$CFLAGS $WMORE")
119
* ) CFLAGS="$CFLAGS -g" ;;
125
if test ".$ac_cv_prog_gcc" = ".yes"; then
128
* ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CFLAGS="$CFLAGS -pipe") ;;
132
*-g* ) CFLAGS=`echo "$CFLAGS" |\
133
sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
136
*-g* ) CXXFLAGS=`echo "$CXXFLAGS" |\
137
sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
141
AC_MSG_CHECKING(for compilation debug mode)
142
AC_MSG_RESULT([$msg])
143
if test ".$msg" = .enabled; then
149
dnl> Optimization Support
152
dnl> AC_CHECK_OPTIMIZE
155
AC_DEFUN(AC_CHECK_OPTIMIZE,[dnl
156
AC_ARG_ENABLE(optimize,dnl
157
[ --enable-optimize build with optimization (default=no)],
159
if test ".$ac_cv_prog_gcc" = ".yes"; then
163
* ) CFLAGS="$CFLAGS -O2" ;;
167
* ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CFLAGS="$CFLAGS -pipe") ;;
169
OPT_CFLAGS='-funroll-loops -fstrength-reduce -fomit-frame-pointer -ffast-math'
170
AC_COMPILER_OPTION(optimize_std, [-f<xxx> for optimizations], $OPT_CFLAGS, CFLAGS="$CFLAGS $OPT_CFLAGS")
173
OPT_CFLAGS='-malign-functions=4 -malign-jumps=4 -malign-loops=4'
174
AC_COMPILER_OPTION(optimize_x86, [-f<xxx> for Intel x86 CPU], $OPT_CFLAGS, CFLAGS="$CFLAGS $OPT_CFLAGS")
178
# compiler is NOT gcc
181
* ) CFLAGS="$CFLAGS -O" ;;
185
AC_COMPILER_OPTION(fast, -fast, -fast, CFLAGS="$CFLAGS -fast")
193
AC_MSG_CHECKING(for compilation optimization mode)
194
AC_MSG_RESULT([$msg])