File: configure.ac

package info (click to toggle)
driftnet 1.1.5-1.1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 844 kB
  • ctags: 455
  • sloc: ansic: 3,157; sh: 1,464; makefile: 54
file content (185 lines) | stat: -rw-r--r-- 4,219 bytes parent folder | download | duplicates (2)
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
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#

AC_PREREQ([2.69])
AC_INIT([driftnet], [1.1.5], [david.sephirot@gmail.com])
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_SRCDIR([src/driftnet.c])
AC_CONFIG_HEADERS(src/[config.h])

AC_ARG_ENABLE([display],
    [AC_HELP_STRING([--disable-display], [disable display (default is no)])],
    ,
    [enable_display=yes])

if test "x$enable_display" = xno; then
    AC_DEFINE([NO_DISPLAY_WINDOW], [1], [Compile without support for a display window])
fi
AM_CONDITIONAL(ENABLE_DISPLAY, test "x$enable_display" = xyes)

AC_ARG_ENABLE([debug],
	[AC_HELP_STRING([--disable-debug], [disable debugging (default is no)])],
    ,
    [enable_debug=yes])

if test "x$enable_debug" = xyes; then
    CFLAGS="-O2 -g -DDEBUG"
else
	CFLAGS="-O2 -DNDEBUG"
fi
#AM_CONDITIONAL(ENABLE_DEBUG, test "$enable_debug" = "yes")

#
# Checks for programs.
#

AC_PROG_CC
AC_PROG_INSTALL
#AM_PROG_CC_C_O
PKG_PROG_PKG_CONFIG

AM_PROG_AR
AC_PROG_RANLIB

#
# Checks for libraries.
#

AC_CHECK_LIB([jpeg],
    [jpeg_read_header],
    [],
    [AC_MSG_ERROR([cannot find lib jpeg])] )

AC_CHECK_LIB([pcap],
    [pcap_open_live],
    [],
    [AC_MSG_ERROR([cannot find lib pcap])] )

AC_CHECK_LIB([png],
    [png_read_info],
    [],
    [AC_MSG_ERROR([cannot find lib png])] )

AC_CHECK_LIB([pthread],
    [pthread_create],
    [],
    [AC_MSG_ERROR([cannot find lib pthread])] )

AC_CHECK_LIB([gif],
    [DGifOpenFileHandle],
    [],
    [AC_MSG_ERROR([cannot find lib gif])] )

if test "x$enable_display" = xyes; then

	AC_CHECK_LIB([glib-2.0],
        [g_free],
        [],
		[AC_MSG_ERROR([cannot find lib glib-2.x])])

	AC_CHECK_LIB([gobject-2.0],
        [g_signal_connect_data],
        [],
		[AC_MSG_ERROR([cannot find lib libgobject-2.0])])

	AC_CHECK_LIB([gtk-x11-2.0],
        [gtk_main],
        [],
		[AC_MSG_ERROR([cannot find lib gtk-2.x])])

#	AC_CHECK_LIB([gthread-2.0],
#        [g_thread_init],
#        [],
#		[AC_MSG_ERROR([cannot find lib libgthread-2.0])])

	AC_CHECK_LIB([gdk-x11-2.0],
        [gdk_window_get_state],
        [],
		[AC_MSG_ERROR([cannot find lib gdk-x11-2.0])])

#	AC_CHECK_LIB([Xrender],
#        [XRenderComposite],
#        [],
#		[AC_MSG_ERROR([cannot find lib XRender])])

	GTK_CFLAGS="$(${PKG_CONFIG} --cflags gtk+-x11-2.0 glib-2.0 gobject-2.0 gdk-x11-2.0)"
    #gthread-2.0)"

    AC_SUBST(GTK_CFLAGS)
fi

#
# Checks for header files.
#

AC_CHECK_HEADERS(
    [arpa/inet.h fcntl.h limits.h netinet/in.h stdlib.h string.h sys/socket.h \
        sys/time.h unistd.h sys/types.h stdint.h inttypes.h],
    [],
    [])

#
# Checks for typedefs, structures, and compiler characteristics.
#

AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T

# Check for byte order.
AC_C_BIGENDIAN(
    [AC_DEFINE(DRIFTNET_BIG_ENDIAN, [1], [Define if byte order is big endian.])],
    [AC_DEFINE(DRIFTNET_LITTLE_ENDIAN, [1], [Define if byte order is litle endian.])],
    [AC_MSG_ERROR([unknown endianess ?])],
    [AC_MSG_ERROR([unknown endianess ?])]
)

AC_C_INLINE

#
# Checks for library functions.
#

AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([dup2 inet_ntoa memchr memset mkdir rmdir strcasecmp strchr strdup strerror strncasecmp strrchr])

# nanosleep seems to exist in librt or libposix4 on Solaris
sleep_func=no
AC_SEARCH_LIBS([nanosleep],
    [libc rt posix4],
    [AC_CHECK_FUNCS([nanosleep], sleep_func=nanosleep, [])],
    [])

if test x$sleep_func = xno; then
    AC_CHECK_FUNCS([usleep],
        [sleep_func=usleep],
        [AC_MSG_ERROR([cannot find any usable sleep function])])
fi

AC_CONFIG_FILES([Makefile src/Makefile src/media/Makefile src/display/Makefile])
AC_OUTPUT

echo \
"-------------------------------------------------

 ${PACKAGE_NAME} Version ${PACKAGE_VERSION}

 Prefix: '${prefix}'
 Compiler: '${CC} ${CFLAGS}'

 Package features:
   - enable display: ${enable_display}
   - enable debug: ${enable_debug}

 Now type:
   - 'make' to build the package
   - 'make install' to install everything

--------------------------------------------------"