File: configure.ac

package info (click to toggle)
apachetop 0.19.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 324 kB
  • sloc: cpp: 3,005; makefile: 25; sh: 1
file content (172 lines) | stat: -rw-r--r-- 3,886 bytes parent folder | download
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
# Process this file with autoconf to produce a configure script.

AC_INIT([apachetop],[0.19.7],[https://github.com/tessus/apachetop/issues])

AC_DEFUN([AC_CONFIG_NICE],
[
  test -f $1 && mv $1 $1.old
  rm -f $1.old
  cat >$1<<EOF
#! /bin/sh
#
# Created by configure

EOF

  for var in CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LIBS CC CXX; do
    eval val=\$$var
    if test -n "$val"; then
      echo "$var='$val' \\" >> $1
    fi
  done

  for arg in [$]0 "[$]@"; do
    echo "'[$]arg' \\" >> $1
  done
  echo '"[$]@"' >> $1
  chmod +x $1
])
AC_CONFIG_NICE(config.nice)

AM_SILENT_RULES([yes])
AC_CONFIG_SRCDIR(src/apachetop.cc)

AC_CONFIG_AUX_DIR(config)

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE

PKG_PROG_PKG_CONFIG

# Add non-standard directories to the include path
AC_ARG_WITH(libraries,
    [
  --with-libraries=<path> additional place to look for libraries],
    [LDFLAGS="$LDFLAGS -L $withval"],
    ,
)
# Add non-standard includes to the include path
AC_ARG_WITH(includes,
    [
  --with-includes=<path> additional place to look for header files],
    [CPPFLAGS="$CPPFLAGS -I $withval"],
    ,
)


# Checks for programs.
AC_PROG_CXX
AC_LANG([C++])

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h \
        string.h strings.h sys/socket.h time.h sys/time.h \
        limits.h sys/param.h])

# Checks for typedefs, structures, and compiler characteristics.
#AC_HEADER_STDBOOL # not in 2.53?
AC_C_CONST
AC_HEADER_TIME
AC_STRUCT_TM
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_SYS_LARGEFILE

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([inet_aton memset strchr strdup kqueue strerror strstr])

# pcre {{{
AC_ARG_WITH(pcre,
    [  --with-pcre=<path>      prefix of pcre installation (eg /usr/local)],
    [
        CPPFLAGS="$CPPFLAGS -I $withval/include"
        LDFLAGS="$LDFLAGS -L $withval/lib"
    ]
)

AC_CHECK_HEADERS(pcre.h,
    AC_SEARCH_LIBS([pcre_compile], [pcre]) ,
    AC_MSG_WARN([*** pcre.h not found -- consider using --with-pcre])
)
# }}}

# fam {{{
AC_ARG_WITH(fam,
    [  --with-fam=<path>      prefix of fam installation (eg /usr/local)],
    [
        CPPFLAGS="$CPPFLAGS -I $withval/include"
        LDFLAGS="$LDFLAGS -L $withval/lib"
    ]
)

AC_CHECK_HEADERS(fam.h,
    AC_SEARCH_LIBS([FAMOpen], [fam]) ,
    AC_MSG_WARN([*** fam.h not found -- consider using --with-fam])
)
# }}}

# adns {{{
AC_ARG_WITH(adns,
    [  --with-adns=<path>     prefix of adns installation (eg /usr/local)],
    [
        CPPFLAGS="$CPPFLAGS -I $withval/include"
        LDFLAGS="$LDFLAGS -L $withval/lib"
    ]
)

AC_CHECK_HEADERS(adns.h,
    AC_SEARCH_LIBS([adns_submit], [adns]) ,
    AC_MSG_WARN([*** adns.h not found -- consider using --with-adns])
)
# }}}

# --with-logfile {{{
AC_ARG_WITH(logfile,
    [
  --with-logfile=<log>    location of default logfile],
    [AC_DEFINE_UNQUOTED(DEFAULT_LOGFILE, "$withval", [Optionally override the DEFAULT_LOGFILE in apachetop.h])],
    ,
)
# }}}

AC_SEARCH_LIBS([socket], [socket])
AC_SEARCH_LIBS([inet_addr], [nsl])

NCURSES_FOUND=no
PKG_CHECK_MODULES(NCURSES, ncurses, [
		  LIBS="$LIBS $NCURSES_LIBS"
		  NCURSES_FOUND=yes
		 ])

AS_IF([test "x$NCURSES_FOUND" != "xyes"], [
	AC_SEARCH_LIBS([attron], [ncurses])
	AC_SEARCH_LIBS([tgetstr], [termcap])
	AC_SEARCH_LIBS([mvprintw], [curses ncurses] ,
	    [] ,
	    [
	        AC_MSG_ERROR([No useful curses library found!])
	    ]
	)
])

AC_SEARCH_LIBS([readline], [readline],
    [
        AC_DEFINE(HAVE_READLINE,1,[Define if you have readline library])
        AC_SUBST(HAVE_READLINE)
    ] ,
    [
        AC_MSG_ERROR(readline library not found)
    ]
)


# everything is in CPPFLAGS up to this point, now we move to CXXFLAGS
# this is mostly done for pcre test, AC_CHECK_HEADERS wants to use CPP
#CXXFLAGS="$CXXFLAGS $CPPFLAGS"
AC_SUBST(CXXFLAGS)

AC_CONFIG_FILES([Makefile man/Makefile src/Makefile])
AC_OUTPUT