1 |
# -*- Autoconf -*- |
2 |
# Process this file with autoconf to produce a configure script. |
3 |
# |
4 |
# configure.in for libstatgrab |
5 |
# $Id: configure.in,v 1.34 2003/10/08 17:49:21 tdb Exp $ |
6 |
# |
7 |
|
8 |
# Change these to change the package name and version |
9 |
AC_INIT(libstatgrab, 0.6, bugs@i-scream.org) |
10 |
AM_INIT_AUTOMAKE(libstatgrab, 0.6) |
11 |
|
12 |
# Revision number (automatically updated) |
13 |
AC_REVISION($Revision: 1.34 $) |
14 |
|
15 |
# Might work with older autoconfs... but tested on 2.57 |
16 |
AC_PREREQ(2.57) |
17 |
|
18 |
# The file we use to pass #define's to the source |
19 |
AM_CONFIG_HEADER([config.h]) |
20 |
|
21 |
# Checks for programs |
22 |
AC_PROG_CC |
23 |
AC_PROG_INSTALL |
24 |
AC_PROG_LIBTOOL |
25 |
|
26 |
# Checks for header files |
27 |
AC_HEADER_STDC |
28 |
|
29 |
# Checks for typedefs, structures, and compiler characteristics |
30 |
AC_C_CONST |
31 |
|
32 |
# Checks for library functions |
33 |
AC_FUNC_MALLOC |
34 |
AC_FUNC_REALLOC |
35 |
AC_CHECK_FUNCS(atoll) |
36 |
|
37 |
# Default needing setgid to false |
38 |
AM_CONDITIONAL(SETGIDBINS, false) |
39 |
|
40 |
# Set things up for different OS's |
41 |
# We define the name of the OS so the code can act accordingly |
42 |
# We also need to add the right LDFLAGS |
43 |
case $host_os in |
44 |
solaris2.[[6-7]]) |
45 |
AC_CHECK_HEADERS([kstat.h],,[AC_MSG_ERROR([need kstat.h])]) |
46 |
AC_DEFINE(SOLARIS, , [Building on Solaris 2.x]) |
47 |
AC_DEFINE(SOL7, , [Building on Solaris 2.7]) |
48 |
LINKFLAGS="-lkstat" |
49 |
;; |
50 |
solaris2.*) |
51 |
AC_CHECK_HEADERS([kstat.h],,[AC_MSG_ERROR([need kstat.h])]) |
52 |
AC_DEFINE(SOLARIS, , [Building on Solaris 2.x]) |
53 |
LINKFLAGS="-lkstat" |
54 |
;; |
55 |
freebsd4.*) |
56 |
AC_DEFINE(FREEBSD, , [Building on FreeBSD]) |
57 |
AM_CONDITIONAL(SETGIDBINS, true) |
58 |
LINKFLAGS="-lkvm -ldevstat" |
59 |
;; |
60 |
freebsd5.*) |
61 |
AC_DEFINE(FREEBSD, , [Building on FreeBSD]) |
62 |
AC_DEFINE(FREEBSD5, , [Building on FreeBSD 5.x]) |
63 |
AM_CONDITIONAL(SETGIDBINS, true) |
64 |
LINKFLAGS="-lkvm -ldevstat" |
65 |
;; |
66 |
linux-gnu) |
67 |
AC_DEFINE(LINUX, , [Building on GNU/Linux]) |
68 |
;; |
69 |
*) |
70 |
AC_MSG_ERROR([Cannot build on unknown OS: $host_os]) |
71 |
;; |
72 |
esac |
73 |
|
74 |
# User specified curses/ncurses prefix |
75 |
AC_ARG_WITH([curses-prefix], |
76 |
[ --with-curses-prefix=PATH curses (or ncurses) is in PATH], |
77 |
[ |
78 |
if test -d "$withval/lib"; then |
79 |
SAIDARLIBS="-L${withval}/lib ${SAIDARLIBS}" |
80 |
fi |
81 |
if test -d "$withval/include"; then |
82 |
SAIDARCPPFLAGS="-I${withval}/include -I${withval}/include/ncurses ${SAIRDARCPPFLAGS}" |
83 |
fi |
84 |
] |
85 |
) |
86 |
|
87 |
# Check if user wants to disable statgrab |
88 |
AM_CONDITIONAL(STATGRAB, true) |
89 |
AC_ARG_ENABLE(statgrab, |
90 |
[ --disable-statgrab disable building of statgrab], |
91 |
[ |
92 |
if test "x$enableval" = "xno" ; then |
93 |
AM_CONDITIONAL(STATGRAB, false) |
94 |
fi |
95 |
] |
96 |
) |
97 |
|
98 |
# Check if user wants to disable saidar |
99 |
AM_CONDITIONAL(SAIDAR, true) |
100 |
AC_ARG_ENABLE(saidar, |
101 |
[ --disable-saidar disable building of saidar], |
102 |
[ |
103 |
if test "x$enableval" = "xno" ; then |
104 |
AM_CONDITIONAL(SAIDAR, false) |
105 |
fi |
106 |
], |
107 |
[ |
108 |
# saidar needs curses |
109 |
# (if we don't find curses we disable saidar) |
110 |
MP_WITH_CURSES |
111 |
] |
112 |
) |
113 |
|
114 |
# Check if the user would prefer not to build examples |
115 |
AM_CONDITIONAL(EXAMPLES, true) |
116 |
AC_ARG_ENABLE(examples, |
117 |
[ --disable-examples disable building of examples], |
118 |
[ |
119 |
if test "x$enableval" = "xno" ; then |
120 |
AM_CONDITIONAL(EXAMPLES, false) |
121 |
fi |
122 |
] |
123 |
) |
124 |
|
125 |
# Check if user wants to install manpages |
126 |
AM_CONDITIONAL(MANPAGES, true) |
127 |
AC_ARG_ENABLE(manpages, |
128 |
[ --disable-manpages disable installation of manpages], |
129 |
[ |
130 |
if test "x$enableval" = "xno" ; then |
131 |
AM_CONDITIONAL(MANPAGES, false) |
132 |
fi |
133 |
] |
134 |
) |
135 |
|
136 |
# Check if the user wants to turn off setgid binaries |
137 |
# (only really relevant on FreeBSD) |
138 |
AC_ARG_ENABLE(setgid-binaries, |
139 |
[ --disable-setgid-binaries disable binaries being setgid], |
140 |
[ |
141 |
if test "x$enableval" = "xno" ; then |
142 |
AM_CONDITIONAL(SETGIDBINS, false) |
143 |
fi |
144 |
] |
145 |
) |
146 |
|
147 |
# User specified pkgconfig dir |
148 |
AC_ARG_WITH([pkgconfig-dir], |
149 |
[ --with-pkgconfig-dir=PATH pkgconfig lib directory (PREFIX/lib/pkgconfig)], |
150 |
[ PKGCONFIG_DIR=$withval ], |
151 |
[ PKGCONFIG_DIR="\$(libdir)/pkgconfig" ] |
152 |
) |
153 |
AC_SUBST(PKGCONFIG_DIR) |
154 |
|
155 |
# The LIBS and CPPFLAGS that saidar needs |
156 |
AC_SUBST(SAIDARLIBS) |
157 |
AC_SUBST(SAIDARCPPFLAGS) |
158 |
|
159 |
# The flags needed to link to libstatgrab |
160 |
# (ie. our dependencies) |
161 |
AC_SUBST(LINKFLAGS) |
162 |
|
163 |
# And finish by changing these files |
164 |
AC_CONFIG_FILES([Makefile src/Makefile src/libstatgrab/Makefile src/statgrab/Makefile docs/Makefile examples/Makefile libstatgrab.pc src/statgrab/statgrab-make-mrtg-config src/statgrab/statgrab-make-mrtg-index src/saidar/Makefile]) |
165 |
|
166 |
AC_OUTPUT |