File: configure.in

package info (click to toggle)
gps 1.1.0.0-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,212 kB
  • ctags: 987
  • sloc: cpp: 11,600; sh: 381; makefile: 319; ansic: 227; perl: 17
file content (347 lines) | stat: -rw-r--r-- 11,252 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
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
dnl $Header: /home/gps/cvsroot/gps/configure.in,v 1.35 2002/04/28 19:33:21 bergo Exp $

dnl configure.in for gps
dnl 1999-2002 Felipe Bergo (bergo@seul.org)
dnl Everything here is GPL'd
dnl Have fun (but try having fun and keep this working!!).

dnl Process this file with autoconf to produce a configure script.
AC_INIT(gps.cc)
AC_CONFIG_HEADER(transient.h)
AC_PREREQ(2.0)

CXXFLAGS=

AC_CHECK_PROG(GNU_MAKE,make,yes)
AC_CHECK_PROG(GOTSED,sed,yes,no)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL

networking=yes
AC_ARG_ENABLE(netwatch,
  [  --enable-netwatch           enable netwatch feature and network pollers (yes)]
,
  [if test x$enableval = xno; then
    networking=no
  fi])

if test x$networking = xyes ; then
	networking=yes
	AC_DEFINE(ENABLE_NETWORK)
fi

AC_HEADER_STDC
AC_HEADER_CHECK(dirent.h,,AC_MSG_ERROR(required header file missing))
AC_HEADER_CHECK(errno.h,,AC_MSG_ERROR(required header file missing))
AC_HEADER_CHECK(fcntl.h,,AC_MSG_ERROR(required header file missing))
AC_HEADER_CHECK(netdb.h,,AC_MSG_ERROR(required header file missing))
AC_HEADER_CHECK(netinet/in.h,,AC_MSG_ERROR(required header file missing))
AC_HEADER_CHECK(pthread.h,,AC_MSG_ERROR(required header file missing))
AC_HEADER_CHECK(pwd.h,,AC_MSG_ERROR(required header file missing))
AC_HEADER_CHECK(signal.h,,AC_MSG_ERROR(required header file missing))
AC_HEADER_CHECK(sys/socket.h,,AC_MSG_ERROR(required header file missing))
AC_HEADER_CHECK(sys/stat.h,,AC_MSG_ERROR(required header file missing))
AC_HEADER_CHECK(sys/types.h,,AC_MSG_ERROR(required header file missing))
AC_HEADER_CHECK(time.h,,AC_MSG_ERROR(required header file missing))
AC_HEADER_CHECK(unistd.h,,AC_MSG_ERROR(required header file missing))
AC_CHECK_TYPE(socklen_t,int)

dnl check OS type (via uname)

AC_PATH_PROG(UNAMEPATH,uname,no)

if test "$UNAMEPATH" = "no" ; then
	AC_MSG_ERROR(** Error: uname not found - unable to determine system type **)
fi

AC_MSG_CHECKING(operating system type)
OSTYPE=`$UNAMEPATH -s`
AC_MSG_RESULT("$OSTYPE")

AC_MSG_CHECKING(operating system release)
OSREL=`$UNAMEPATH -r`
AC_MSG_RESULT("$OSREL")

SYSDEF="UNKNOWN"
POLLING_LINUX_PROC_FS=0
POLLING_FREEBSD=0
POLLING_UNIX_PIPED_TOP=0

SYSTEM_DEPENDENT_LIBS=" "
SYSTEM_DEPENDENT_FLAGS=" "
THIS_SYSTEM="UNKNOWN"
PRECOMPILE_TARGETS=

case $OSTYPE in
	Linux)
		LINUXPROC='./checklinuxprocfs.sh'
		if $LINUXPROC = 0 ; then
			AC_DEFINE(HAVELINUXPROCFS,1)
			AC_DEFINE(ENABLE_SYSINFO,1)
			POLLING_LINUX_PROC_FS=1
			AC_CHECK_LIB(pthread,pthread_create,,AC_MSG_ERROR(required library missing))
			SYSTEM_DEPENDENT_LIBS="-lpthread"
		fi
		THIS_SYSTEM="Linux"
		SYS_MAJOR=ZZ_LINUX
		SYS_MINOR=ZZ_GNULINUX
	;;
	SunOS)
		AC_DEFINE(HAVESUNOS,1)
		AC_CHECK_LIB(pthread,pthread_create,,AC_MSG_ERROR(required library missing))
		SYSTEM_DEPENDENT_LIBS="-lpthread"
		THIS_SYSTEM="SunOS"
		SYS_MAJOR=ZZ_SOLARIS
		SYS_MINOR=ZZ_SLOWLARIS
		AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
		AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
	;;
	FreeBSD)
		AC_DEFINE(HAVEFREEBSD,1)
		AC_DEFINE(ENABLE_SYSINFO,1)
		POLLING_FREEBSD=1
		AC_HEADER_CHECK(kvm.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
		AC_HEADER_CHECK(limits.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
		AC_HEADER_CHECK(osreldate.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
		AC_HEADER_CHECK(nlist.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
		AC_HEADER_CHECK(sys/conf.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
		AC_HEADER_CHECK(sys/dkstat.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
		AC_HEADER_CHECK(sys/lock.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
		AC_HEADER_CHECK(sys/param.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
		AC_HEADER_CHECK(sys/proc.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
		AC_HEADER_CHECK(sys/sysctl.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
		AC_HEADER_CHECK(sys/user.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
		AC_HEADER_CHECK(sys/vmmeter.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
		AC_HEADER_CHECK(vm/vm.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
		AC_HEADER_CHECK(vm/vm_map.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
		AC_HEADER_CHECK(vm/vm_param.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
                case $OSREL in
			1* | 2* | 3*)
				AC_HEADER_CHECK(sys/rlist.h,,AC_MSG_ERROR(FreeBSD-specific header file missing))
				SYSTEM_DEPENDENT_FLAGS=
			;;
			4* | 5*)
				AC_CHECK_PROG(GOTPERL,perl,yes,no)
				PRECOMPILE_TARGETS=vmmap_hack
				SYSTEM_DEPENDENT_FLAGS="-traditional"
			;;
		esac
		AC_CHECK_LIB(kvm,kvm_open,,AC_MSG_ERROR(required library missing))
		AC_CHECK_LIB(c_r,pthread_create,,AC_MSG_ERROR(required library missing))
		SYSTEM_DEPENDENT_LIBS="-lkvm -lc_r"
		THIS_SYSTEM="FreeBSD"
		SYS_MAJOR=ZZ_BSD
		SYS_MINOR=ZZ_FREEBSD
	;;
esac

dnl piped top

POLLTOP="./checkpipedtop.sh"
if $POLLTOP = 0 ; then
 AC_DEFINE(HAVETOP,1)
 POLLING_UNIX_PIPED_TOP=1
fi

AC_SUBST(SYSTEM_DEPENDENT_LIBS)
AC_SUBST(SYSTEM_DEPENDENT_FLAGS)
AC_SUBST(THIS_SYSTEM)
AC_SUBST(SYS_MAJOR)
AC_SUBST(SYS_MINOR)
AC_SUBST(PRECOMPILE_TARGETS)

dnl end of polling method check

dnl now gtk (needed for gPS but not for rgpsp)

ALL_TOPLEVEL_TARGETS=" "

AC_PATH_PROG(GTKCONFIG,gtk-config,no)

dnl gaaaaaaaaaack!!!! autoconf won't look
dnl into /usr/X11R6/bin even though it's in
dnl the path, and freebsd refuses to place
dnl config binaries in decent places.

if test "$GTKCONFIG" = "no" ; then
	if test -x /usr/X11R6/bin/gtk13-config ; then
		GTKCONFIG=/usr/X11R6/bin/gtk13-config
	fi
	if test -x /usr/X11R6/bin/gtk12-config ; then
		GTKCONFIG=/usr/X11R6/bin/gtk12-config
	fi
fi


if test "$GTKCONFIG" = "no" ; then
AC_MSG_WARN(
[
-(GTK-CONFIG NOT FOUND)-----------------------------------------
 gtk-config wasn't found. This means that you either don't have
 Gtk+ OR have a pretty old one OR have a broken installation.
 Take a look at the file README for information on downloading
 and installing all required libraries.
         **                                       **
          THE GPS MAIN PROGRAM WILL NOT BE COMPILED
         **                                       **
 Unless you really want to compile just the remote pollers
 (used for watching networked computers with an already
 compiled GPS) proceeding with compilation won't give you
 a working GPS installation. The configure script will
 resume in 10 seconds.
----------------------------------------------------------------
])
  sleep 10
  GTK_LIBS=" "
  GTK_FLAGS=" "

else
  dnl check for gtk-version
  GTK_LIBS=`$GTKCONFIG --libs`
  GTK_FLAGS=`$GTKCONFIG --cflags`

  dnl test for Gtk+ >= 1.2.1
  AC_MSG_CHECKING(for gtk+ >= 1.2.1)

  dnl copied from gtk+'s aclocal.m4. These guys must love sed
  GTK_MAJOR=`$GTKCONFIG --version | \
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
  GTK_MINOR=`$GTKCONFIG --version | \
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
  GTK_MICRO=`$GTKCONFIG --version | \
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`

  GTK121_FINE=1

  if test $GTK_MAJOR -lt 1 ; then
    GTK121_FINE=0
  else
    if test $GTK_MAJOR -eq 1 ; then
      if test $GTK_MINOR -lt 2 ; then
	  GTK121_FINE=0
      fi
      if test $GTK_MINOR -eq 2 ; then
	  if test $GTK_MICRO -lt 1 ; then
	      GTK121_FINE=0
       	  fi
      fi
    fi  
  fi

  if test "$GTK121_FINE" = "1" ; then
      AC_MSG_RESULT(yes)
      ALL_TOPLEVEL_TARGETS="$ALL_TOPLEVEL_TARGETS do_gps"
  else
      AC_MSG_RESULT(no)
      AC_MSG_WARN(
[
-(GTK VERSION MISMATCH)-----------------------------------------
 You need gtk+ >= 1.2.1

 Read the README file for information on needed libraries and
 how to get them.
         **                                       **
          THE GPS MAIN PROGRAM WILL NOT BE COMPILED
         **                                       **
 Unless you really want to compile just the remote pollers
 (used for watching networked computers with an already
 compiled GPS) proceeding with compilation won't give you
 a working GPS installation. The configure script will
 resume in 10 seconds.
----------------------------------------------------------------
]
)
  sleep 10
  fi
fi

AC_SUBST(GTK_LIBS)
AC_SUBST(GTK_FLAGS)

AC_DEFINE(GPS_RELEASE,"1.1.0")
GPS_RELEASE="1.1.0"
AC_SUBST(GPS_RELEASE)

dnl setup the compile table for the rgpsp source tree

TMPVAL=" "
if test "$POLLING_LINUX_PROC_FS" != "0" ; then
	TMPVAL="$TMPVAL rgpsp_linux"
fi

if test "$POLLING_FREEBSD" != "0" ; then
	TMPVAL="$TMPVAL rgpsp_freebsd"
fi

if test "$POLLING_UNIX_PIPED_TOP" != "0" ; then
	TMPVAL="$TMPVAL rgpsp_rtop"
fi

ALL_RGPSP="$TMPVAL"
AC_SUBST(ALL_RGPSP)

if test x$networking = xyes ; then
	ALL_TOPLEVEL_TARGETS="$ALL_TOPLEVEL_TARGETS do_rgpsp"
fi
AC_SUBST(ALL_TOPLEVEL_TARGETS)

AC_OUTPUT(Makefile rgpsp/Makefile rgpsp/rtop/Makefile rgpsp/linux/Makefile rgpsp/freebsd/Makefile gps.spec systype.h)

dnl end of rgpsp symbol definition

METHODCOUNT=0

echo "--------------------------------------------------------------------------"
echo "gPS will be compiled with the following polling modes:"
echo "(The default will be the first of this list)"
echo

if test "$POLLING_LINUX_PROC_FS" != "0"  ; then
 echo "* Linux /proc fs polling   (OS: Linux        , Architecture: Any)"
 METHODCOUNT=$((1+$METHODCOUNT))
fi

if test "$POLLING_FREEBSD" != "0"  ; then
 echo "* FreeBSD polling          (OS: FreeBSD      , Architecture: i386)"
 METHODCOUNT=$((1+$METHODCOUNT))
fi

if test "$POLLING_UNIX_PIPED_TOP" != "0"  ; then
 echo "* top polling (piped)      (OS: Generic Unix , Architecture: Any)"
 METHODCOUNT=$((1+$METHODCOUNT))
fi

if test "$METHODCOUNT" = "0"; then
	echo "No polling methods have been found. When not"
	echo "in directly supported systems (Linux/FreeBSD), the only"
	echo "method available is top polling. As top polling has not"
	echo "been acknowledged, this system may not have top or"
	echo "have a not supported one. You can download a working"
	echo "top from ftp://ftp.groupsys.com/pub/top"
	echo
	echo "Compiling without a polling method makes no sense,"
	echo "fix it before you compile."
fi

echo
dnl echo "Total: $METHODCOUNT"
echo "--------------------------------------------------------------------------"
echo

if test "$OSTYPE" = "FreeBSD"; then
	echo "****************************************************************"
	echo "* FreeBSD Notices                                              *"
	echo "*--------------------------------------------------------------*"
	echo "* Compilation may generate lots of warnings. Don't report them *"
	echo "* as bugs, most of the warnings are caused by GTK+ headers and *"
	echo "* and the blatant refusal to make FreeBSD system includes      *"
	echo "* friendly to C++ compilers.                                   *"
	echo "*--------------------------------------------------------------*"
	echo "* You need GNU make to compile this. BSD's make will not do.   *"
	echo "* Download is available from ftp://ftp.gnu.org, be careful not *"
	echo "* to overwrite your BSD make binary with a GNU make binary.    *"
	echo "* If you isntalled the GNU make port, it's called gmake.       *"
	echo "****************************************************************"
	echo
fi