File: configure.in

package info (click to toggle)
ipfm 0.11.5-4.2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 356 kB
  • ctags: 129
  • sloc: ansic: 1,148; yacc: 328; sh: 210; makefile: 146; lex: 130
file content (209 lines) | stat: -rw-r--r-- 5,391 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
dnl
dnl autoconf for ipfm.
dnl Copyright (c) 1999 Robert CHERAMY <tibob@via.ecp.fr>
dnl Copyright (c) 2001 Lo�c Tortay & IN2P3 Computing Center <tortay@cc.in2p3.fr>
dnl

dnl Initialisation
AC_INIT(Makefile.in)
AC_CONFIG_HEADER(source/config.h)

dnl Version
VERSION=`cat $srcdir/VERSION`
AC_SUBST(VERSION)

echo "Configuring ipfm $VERSION..."
echo

dnl Checks for uname.
AC_CHECK_PROG(UNAME, uname, uname)
if test "x$UNAME" = "x"; then
  echo
  echo "No uname. can't find your OS"
  echo
  exit 1
fi

dnl Finds out OS.
AC_MSG_CHECKING(your OS)
system=`$UNAME`
case $system in
  Linux)
    AC_MSG_RESULT(Linux)
    AC_DEFINE(__OS_LINUX__)
    ;;
  FreeBSD)
    AC_MSG_RESULT(FreeBSD)
    AC_DEFINE(__OS_FREEBSD__)
    ;;
  OpenBSD)
    AC_MSG_RESULT(OpenBSD)
    AC_DEFINE(__OS_OPENBSD__)
    ;;
  SunOS)
    AC_MSG_RESULT(SunOS)
    AC_DEFINE(__OS_SUNOS__)
    LIBS="$LIBS -lnsl -lsocket"
    ;;
  AIX)
    AC_MSG_RESULT(AIX)
    AC_DEFINE(__OS_AIX__)
    ;;
  HP-UX)
    AC_MSG_RESULT(HPUX)
    AC_DEFINE(__OS_HPUX__)
    ;;
  OSF1)
    AC_MSG_RESULT(OSF1)
    AC_DEFINE(__OS_OSF1__)
    ;;
esac

dnl
dnl Checks for programs.
dnl
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LEX
AC_PROG_RANLIB
AC_PROG_YACC
AC_PATH_PROG(AR, ar)

if test -z "$AR" ; then
        AC_MSG_ERROR(You need 'ar' in order to compile ipfm)
fi

dnl
dnl Checks for libpcap
dnl

AC_MSG_CHECKING(for local libpcap)
dnl checks for local libpcap lib
pcapdirs=`ls .. | grep libpcap | sed -e 's:/$::' -e 's:^:../:' | tr '\n' ' '`
libpcap=FAIL
for pcapdir in `echo $pcapdirs` ; do
  pcapdir=`pwd`/$pcapdir
  if test -d $pcapdir -a -f $pcapdir/libpcap.a -a -f $pcapdir/pcap.h ; then
    libpcap=$pcapdir/libpcap.a
    AC_MSG_RESULT(Using $libpcap)
    INCLS="-I$pcapdir"
    break
  fi
done

dnl checks for pcap install
if test "x$libpcap" = "xFAIL" ; then
  AC_MSG_RESULT(no)
  AC_CHECK_LIB(pcap, main, libpcap="-lpcap", AC_MSG_ERROR(You need libpcap in order to use ipfm))
  pcapdir=""
  dnl I ought to put here a test to find where pcap.h is
  AC_CHECK_HEADER(pcap.h,, NO_PCAP_H=1)
  if test "x$NO_PCAP_H" = "x1"; then
    AC_MSG_CHECKING(for exotic pcap.h places)
    if test -r /usr/include/pcap/pcap.h; then
      INCLS="$INCLS -I/usr/include/pcap"
      AC_MSG_RESULT(/usr/include/pcap/)
    else if test -r /usr/local/include/pcap.h; then
      INCLS="$INCLS -I/usr/local/include"
      AC_MSG_RESULT(/usr/local/include/)
    else
      AC_MSG_WARN(pcap.h not found.)
      AC_MSG_WARN(Specify pcap.h PATH in source/Makefile (INCLS=-I/pcap/path))
    fi; fi
  fi
fi
LIBS="$LIBS $libpcap"
AC_SUBST(INCLS)

dnl Checks for typedefs, structures, and compiler characteristics.
if test "x$CC" = "xgcc" ; then
  WARNINGS="-Wall"
  AC_SUBST(WARNINGS)
fi

dnl
dnl Checks for library functions.
dnl
AC_MSG_CHECKING(for strftime)
AC_TRY_COMPILE([#include <time.h>],
                        [strftime(NULL, 0, NULL, NULL);],
                        [AC_DEFINE(HAVE_STRFTIME)
                        AC_MSG_RESULT(yes)],
               [AC_MSG_ERROR(You need strftime support in order to compile ipfm)])

AC_MSG_CHECKING(for snprintf)
AC_TRY_COMPILE([#include <stdio.h>],
                        [snprintf(NULL, 0, NULL);],
                        [AC_DEFINE(HAVE_SNPRINTF)
                        AC_MSG_RESULT(yes)],
               [AC_MSG_ERROR(You need snprintf support in order to compile ipfm)])

lockf_found=yes
AC_MSG_CHECKING(for lockf)
AC_TRY_COMPILE([#include <unistd.h>],
                        [lockf(0, 0, 0);],
                        [AC_DEFINE(HAVE_LOCKF)
                        AC_MSG_RESULT(yes)],
            [AC_MSG_RESULT(no) lockf_found=no])

flock_found=yes
AC_MSG_CHECKING(for flock)
AC_TRY_COMPILE([#include <fcntl.h>],
                       [flock(0, 0);],
                       [AC_DEFINE(HAVE_FLOCK)
                       AC_MSG_RESULT(yes)],
            [AC_MSG_RESULT(no) flockf_found=no])

if test $lockf_found = "no" -a $flock_found = "no" ; then
       AC_MSG_ERROR(You need either flock or lockf support in order to compile ipfm)
fi

AC_CHECK_FUNC(daemon, 
        [AC_DEFINE(HAVE_DAEMON)],
        [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
)

AC_CHECK_FUNCS(strlcat strlcpy inet_aton inet_ntoa)


dnl
dnl Checks for useful types
dnl

dnl AC_CHECK_TYPE(unsigned long long int, unsigned long)
dnl AC_CHECK_TYPE(long long, longlong)
dnl if test  $ac_cv_type_long_long = no; then
dnl     AC_MSG_ERROR(You need an \`\`long long int\'\' in order to use ipfm))
dnl fi
dnl AC_MSG_CHECKING(for long long int)
dnl AC_TRY_COMPILE(, [unsigned long long int ulli;]
dnl                    [AC_DEFINE(HAVE_LONGLONG)
dnl                    AC_MSG_RESULT(yes)],
dnl            [AC_MSG_RESULT(no)])
dnl            [AC_MSG_ERROR(You need long long int support in order to compile ipfm)])

AC_CHECK_TYPE(u_int32_t, uint32_t)
if test $ac_cv_type_u_int32_t = no; then
        AC_CHECK_TYPE(uint32_t, unsigned long int)
fi

AC_CHECK_TYPE(u_int8_t, uint8_t)
if test $ac_cv_type_u_int8_t = no; then
        AC_CHECK_TYPE(uint8_t, unsigned char)
fi

dnl
dnl Generate output files
dnl

AC_DEFINE_UNQUOTED(VERSION, "$VERSION")

AC_OUTPUT(Makefile Makefile.common source/Makefile source/missing/Makefile doc/Makefile)

echo
make configdump
echo
echo Please check this is correct and modify Makefile.common 
echo and source/config.h in consequence.
echo You can now type \`\` make \'\'.