File: configure.ac

package info (click to toggle)
ion 3.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 23,700 kB
  • ctags: 10,983
  • sloc: ansic: 141,798; sh: 22,848; makefile: 7,818; python: 1,638; sql: 311; perl: 197; awk: 178; xml: 50; java: 19
file content (392 lines) | stat: -rw-r--r-- 12,146 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
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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# configure.ac for ION
# Samuel Jero
# June 14, 2013
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.60)
AC_INIT(ion, open source 3.2.1, http://korgano.eecs.ohiou.edu/mailman/listinfo/ion-bugs)
IS_NASA_B=0

#  Josh Schendel removed the -Werror on 05/15/2012 per issue #355 to deal with
#  all of the portability warnings introduced by autoconf v2.69 and
#  automake v1.12.
#AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign])
AM_INIT_AUTOMAKE([subdir-objects -Wall foreign])

# some source file that will ensure that you are in the right directory.
AC_CONFIG_SRCDIR([ici/include/ion.h])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])


# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
#Automake v1.12 wants AM_PROG_AR, but it doesn't exist <v1.12 so do this
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_MAKE_SET
LT_INIT



# Check Platform and Architecture
m4_include([./dccp_macro.m4])
AM_CFLAGS=""
AM_LDFLAGS=""
AM_LIBTOOLFLAGS=""
PLATFORM=""
case $host_os in
	darwin*)
		AC_DEFINE([darwin],[1],[Build Darwin specific platform code.])
		AC_DEFINE([unix],[1],[Build Unix specific platform code.])
		PLATFORM="darwin"
		if test $host_cpu = "x86_64" ; then
			AM_CFLAGS="$AM_CFLAGS -Dunix -Ddarwin -DSPACE_ORDER=3 -m64 "
			echo "Build 64-bit Darwin specific platform code."
		else
			AM_CFLAGS="$AM_CFLAGS -Dunix -Ddarwin -DSPACE_ORDER=2 -m32 "
			echo "Build 32-bit Darwin specific platform code."

		fi
		;;
	linux*)
		PLATFORM="linux"
		if test $host_cpu = "x86_64" ; then
			AC_DEFINE([linux],[1],[Build 64-bit Linux specific platform code.])
			AM_CFLAGS="$AM_CFLAGS -Dlinux -DSPACE_ORDER=3 -fno-strict-aliasing"
			echo "Build 64-bit Linux specific platform code."
		else
			AC_DEFINE([linux],[1],[Build 32-bit Linux specific platform code.])
			AM_CFLAGS="$AM_CFLAGS -Dlinux -fno-strict-aliasing"
			echo "Build 32-bit Linux specific platform code."
		fi
		#check for DCCP support
		CHECK_DCCP()
		;;

	cygwin*)  
		AC_DEFINE([cygwin],[1],[Build Cygwin specific platform code.]) 
		PLATFORM="cygwin"
		;;
	interix*) 
		AC_DEFINE([interix],[1],[Build Interix specific platform code.])
		PLATFORM="iterix"
		;;
  	*bsd*) 
		AC_DEFINE([freebsd],[1],[Build Freebsd specific platform code.])
		PLATFORM="bsd"
   		if test $host_cpu = "x86_64" ; then
   			AM_CFLAGS="$AM_CFLAGS -Dfreebsd -DSPACE_ORDER=3 -m64 "
			echo "Build 64-bit Freebsd specific platform code."
			
    	else
    		AM_CFLAGS="$AM_CFLAGS  -Dfreebsd -DSPACE_ORDER=2 -m32 "
			echo "Build 32-bit Freebsd specific platform code."
    	fi
    	;;
	solaris*)
		PLATFORM="solaris"
		if test $host_cpu = "sparc" ; then
			AC_DEFINE([solaris],[1],[Build Solaris specific platform code.])
			AM_LDFLAGS="$AM_LDFLAGS -lrt -lsocket -lnsl"
			AM_CFLAGS="$AM_CFLAGS  -Dsolaris -Dunix -D__SVR4 -D_REENTRANT -fno-strict-aliasing -fno-builtin -DSPACE_ORDER=3"
			echo "Build Solaris/SPARC specific platform code."
		else
			AC_DEFINE([solaris],[1],[Build Solaris specific platform code.])
			AM_LDFLAGS="$AM_LDFLAGS  -lrt -lsocket -lnsl"
			AM_CFLAGS="$AM_CFLAGS  -Dsolaris -Dunix -D__SVR4 -D_REENTRANT -fno-strict-aliasing -DSPACE_ORDER=3"
			echo "Build Solaris specific platform code."
		fi
		# Do bitness check
		AS_IF([test "x$ISAINFO" != "xno"],
      		[isainfo_b=`isainfo -b`],
      		[isainfo_b="x"])
      	if test "$isainfo_b" = "64"; then
      		AM_CFLAGS="$AM_CFLAGS -m64"
      		echo "Build 64-bit code"
      	else
      		AM_CFLAGS="$AM_CFLAGS -m32"
      		echo "Build 32-bit code"
      	fi
		;;
	vxworks*) 
		AC_DEFINE([vxworks],[1],[Build VXWorks specific platform code.]) 
		PLATFORM="vxworks"
		;;
esac


##Process user flags

#
# allow the user running configure to disable ACS
#
AC_ARG_ENABLE(
    acs,
    [AC_HELP_STRING([--disable-acs], [disable Aggregate Custody Signals])],
    [],
    [AM_CFLAGS="$AM_CFLAGS -DENABLE_BPACS"
     ENABLE_BPACS=yes])
AM_CONDITIONAL(ENABLE_BPACS, test "x$ENABLE_BPACS" = "xyes")

#
# allow the user running configure to disable IMC
#
AC_ARG_ENABLE(
    imc,
    [AC_HELP_STRING([--disable-imc], [disable Interplanetary Multicast])],
    [],
    [AM_CFLAGS="$AM_CFLAGS -DENABLE_IMC"
     ENABLE_IMC=yes])
AM_CONDITIONAL(ENABLE_IMC, test "x$ENABLE_IMC" = "xyes")

#
# Try to enable DCCP support
#
AC_ARG_ENABLE(
    dccp,
    [AC_HELP_STRING([--enable-dccp], [Enable Support for DCCP as a convergence layer])],
    [AC_DEFINE([build_dccp],[1],[DCCP only supported on Linux >=3.2.0])],
    [])

#
# Control building /contrib utlities
#
AC_ARG_ENABLE(
	contrib,
	[AC_HELP_STRING([--disable-contrib],[Disable building third-party contributed utilities])],
	[case "${enableval}" in
		yes) BUILD_CONTRIB=yes;;
		no)  BUILD_CONTRIB=no;;
		*) AC_MSG_ERROR([bad value ${enableval} for --enable-contrib]);;
	esac],
	[BUILD_CONTRIB=yes])
AM_CONDITIONAL(BUILD_CONTRIB, test "x$BUILD_CONTRIB" = "xyes")

#
# Allow user to disable crypto... if crypto is even enabled
#
if test "$IS_NASA_B" = "1"; then
	# To Disable crypto, use "./configure --disable-crypto"
	AC_ARG_ENABLE([crypto],
		[  --disable-crypto    Turn off cryptography],
		[case "${enableval}" in
			yes) crypto=true ;;
			no)  crypto=false ;;
		*) AC_MSG_ERROR([bad value ${enableval} for --disable-crypto]) ;;
		esac],[crypto=true])
	
	AM_CONDITIONAL([CRYPTO], [test x$crypto = xtrue])

	if test x$crypto = xtrue; then
		echo ""
		#DoStuff
	else
		AC_SUBST( [CRYPTO_LIBS], [""] )
	fi

	AC_DEFINE([NASA_PROTECTED_FLIGHT_CODE],[1],[Build ION NASA protected flight code])
else
	AM_CONDITIONAL([CRYPTO], [false])
	AC_SUBST( [CRYPTO_LIBS], [""] )
fi

#
# Control whether AMS debugging info is printed.
#
if test "$IS_NASA_B" = "0"; then
	AC_ARG_ENABLE([ams-debug],
		[  --enable-ams-debug    Enable AMS debugging info],
		[ AC_DEFINE([AMSDEBUG], 1, [Enable AMS debugging info]) ])
fi

#
# Dynamically choose whether or not to instrument code for gcov code coverage
# Default is not to instrument the code for gcov code coverage.
# 
AC_ARG_WITH([gcov],
[AS_HELP_STRING([--with-gcov], [Turn on code coverage instrumentation])],
[gcov=yes;],
[])
if test "x$gcov" = "xyes" ; then
	echo "Instrument code for gcov coverage analysis... yes"
	CFLAGS="$CFLAGS -g -O0 -fprofile-arcs -ftest-coverage"
	LDFLAGS="$LDFLAGS -fprofile-arcs -ftest-coverage -lgcov"
else
	echo "Instrument code for gcov coverage analysis... no"
fi
AM_CONDITIONAL([ENABLE_GCOV], [test "x$gcov" = "xyes"])

#
# Dynamically choose whether or not to build against expat libraries.
# Expat is needed by AMS if XML configuration files are used.
# Default is not to build against libexpat.
#
AC_ARG_WITH([expat],
[AS_HELP_STRING([--with-expat], [Turn on libexpat requirements])],
[expat=yes;],
[])
if test "x$expat" = "xyes" ; then
	echo "Build against libexpat... yes"
else
	echo "Build against libexpat... no"
	CFLAGS="$CFLAGS -DNOEXPAT"
fi
AM_CONDITIONAL([ENABLE_EXPAT], [test "x$expat" = "xyes"])


#
# If valgrind is present, allow special MTAKE/MRELEASE valgrind tutors.
#
AC_ARG_ENABLE([valgrind], AC_HELP_STRING([--disable-valgrind],[Do not enable valgrind debugging [default=check]]),
              [ ], [ enable_valgrind=check ])

if test "x$enable_valgrind" != xno; then
  AC_CHECK_HEADER(valgrind/valgrind.h, 
                  [AC_DEFINE([HAVE_VALGRIND_VALGRIND_H], [1], [enable valgrind macros])
                   valgrind_present=yes],
                  [valgrind_present=no])

  if test "x$enable_valgrind" == xyes && test "x$valgrind_present" == xno; then
    # User specifically requested valgrind but we can't find it.
    AC_MSG_ERROR([valgrind/valgrind.h not found but --enable-valgrind requested])
  fi

  if test "x$valgrind_present" == xyes; then
    # Valgrind < 3.6.1-1 (Debian/Ubuntu) and gcc >= 4.6 triggers "unused-but-set-variable"
    # warnings in the valgrind macros.  This version is present in debian unstable
    # 10/11, and Ubuntu 11.10.
    AC_MSG_CHECKING([if valgrind is compatible with -Wunused-but-set])
    ORIGCFLAGS=$CFLAGS
    CFLAGS="$CFLAGS -Wall -Werror"
    AC_COMPILE_IFELSE(
    [AC_LANG_PROGRAM([[#include <valgrind/valgrind.h>]],
                     [[VALGRIND_MALLOCLIKE_BLOCK(1, 100, 0, 1);
                       VALGRIND_FREELIKE_BLOCK(1, 0);]])],
    [AC_MSG_RESULT([yes]); valgrind_wunused_but_set_compat=yes],
    [AC_MSG_RESULT([no]); valgrind_wunused_but_set_compat=no])
    CFLAGS="$ORIGCFLAGS"

    # If not compatible with -Wset-but-not-used, then disable this warning.
    if test "x$valgrind_wunused_but_set_compat" == "xno"; then
      AC_MSG_NOTICE([adding -Wno-unused-but-set-variable to VALGRIND_COMPAT_CFLAGS])
      AC_SUBST([VALGRIND_COMPAT_CFLAGS], [-Wno-unused-but-set-variable])
    fi
  fi
fi




# Check for libraries.
ORIGCFLAGS="$CFLAGS"
CFLAGS="$AM_CFLAGS $CFLAGS"
AC_CHECK_LIB(
	[expat], 
	[XML_GetCurrentLineNumber], 
	[ AC_SUBST( [EXPAT_LIBS], ["-lexpat"] ) ],
	[ AM_COND_IF([ENABLE_EXPAT], AC_MSG_ERROR([You need to install the libexpat1-dev library to build with expat.]), AC_MSG_WARN([If you wish to use XML configuration files for AMS you will need to compile against the Expat XML development libraries.  To do this install the libexpat1-dev library then recompile ION using the "./configure --with-expat" flag.]) )]
)

AC_CHECK_LIB(
	[pthread], 
	[pthread_create], 
	[ AM_LDFLAGS="$AM_LDFLAGS -lpthread" ],
	[AC_MSG_ERROR([You need pthread library.]) ]
)
CFLAGS="$ORIGCFLAGS"


# Check for programs to build documentation
AC_CHECK_PROGS([POD_DOCUMENTATION], [pod2man pod2html], [1] )
if test "$POD_DOCUMENTATION" = 1; then
	echo "ERROR: You need to have pod2man for documentation."
	exit -1
fi



# Check for tools to compile documentation into ION.pdf
AC_PATH_PROG([PS2PDF], [ps2pdf])
AC_PATH_PROG([PDF2PS], [pdf2ps])
AC_PATH_PROG([PSJOIN], [psjoin])
AC_MSG_CHECKING([for fallback included psjoin])
if test -x "$PWD/doc/psjoin"; then
    PSJOIN="$PWD/doc/psjoin"
    AC_MSG_RESULT($PSJOIN)
else
    AC_MSG_RESULT([not found])
fi
AC_PATH_PROG([GROFF], [groff])
AC_MSG_CHECKING([if groff suports -ms])
if test "$GROFF" && echo | $GROFF -ms - >/dev/null 2>/dev/null; then
    AC_MSG_RESULT($GROFF)
    GROFFMS="$GROFF"
else
    AC_MSG_RESULT([not found])
    AC_MSG_NOTICE([try installing groff and the ms plugin])
fi
AC_SUBST([GROFFMS], $GROFFMS)

AC_PATH_PROG([MANOPTS], [man])
AC_MSG_CHECKING([if man supports -l])
if test "$MANOPTS" && echo | $MANOPTS -l - >/dev/null 2>/dev/null; then
    AC_MSG_RESULT($MANOPTS)
else
    MANOPTS=""
    AC_MSG_RESULT([not found])
    AC_MSG_NOTICE([try installing a version of man that supports -l])
fi
AC_SUBST([MANOPTS], $MANOPTS)

AC_MSG_CHECKING([for tools to build autodoc])
if test "$PS2PDF" && test "$PDF2PS" && test "$PSJOIN" && test "$GROFFMS" && test -n "$MANOPTS"; then
    AC_MSG_RESULT([found])
    buildautodoc="yes"
else
    AC_MSG_RESULT([not found (skipping autodoc)])
    AC_MSG_NOTICE([Ensure the ghostscript, psutils, groff-base and groff packages are installed.])
fi
AM_CONDITIONAL([ENABLE_AUTODOC], [ test "$buildautodoc" ]) 



# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([fcntl.h malloc.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h unistd.h])

AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_TYPE_UID_T

# Checks for library functions.
# commented out library functions that should exist everywhere.
# otherwise, autoconf insisted that malloc.c, mktime.c were included in distro...
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
#AC_FUNC_MALLOC
#AC_FUNC_MEMCMP
#AC_FUNC_MKTIME
#AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
#AC_FUNC_STAT
#AC_FUNC_STRFTIME
AC_CHECK_FUNCS([alarm ftruncate getcwd gethostbyaddr gethostbyname gethostname gettimeofday memset mkdir mkfifo rmdir select socket strcasecmp strchr strerror strncasecmp strstr strtoul uname])

#Write AM_* flag variables
AC_SUBST([AM_LDFLAGS],"$AM_LDFLAGS")
AC_SUBST([AM_CFLAGS],"$AM_CFLAGS")
AC_SUBST([AM_LIBTOOLFLAGS],"$AM_LIBTOOLFLAGS")
AM_CONDITIONAL([ION_NASA_B],[test "$IS_NASA_B" = "1"])
AM_CONDITIONAL([LINUX_BUILD], [test "x$PLATFORM" = "xlinux"])

#Output!
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([contrib/Makefile])
AC_OUTPUT