File: configure.in

package info (click to toggle)
bambamc 0.0.50-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 572 kB
  • sloc: ansic: 6,589; makefile: 58; sh: 43
file content (165 lines) | stat: -rw-r--r-- 4,191 bytes parent folder | download | duplicates (4)
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
AC_INIT(bambamc,0.0.50,[gt1@sanger.ac.uk],[bambamc],[http://www.sanger.ac.uk])
LIBRARY_VERSION=0:50:0
AC_CANONICAL_SYSTEM
AC_PROG_LIBTOOL

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE
AC_CONFIG_MACRO_DIR([m4])

# check for c99 compiler
CFLAGS_SAVE="${CFLAGS}"
CPPFLAGS_SAVE="${CPPFLAGS}"
CFLAGS=""
CPPFLAGS=""
AC_PROG_CC_C99
C99CFLAGS="${CFLAGS}"
C99CPPFLAGS="${CPPFLAGS}"
CFLAGS="${CFLAGS_SAVE}"
CPPFLAGS="${CPPFLAGS_SAVE}"

# AC_MSG_NOTICE([C99: :${C99CFLAGS}: :${C99CPPFLAGS}:])

AM_PROG_CC_C_O

AC_LANG_ASSERT([C])

AC_HEADER_STDC

PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES([zlib],[zlib >= 0],[zlibpkg=yes],[zlibpkg=no])

if [[ "${zlibpkg}" = "yes" ]] ; then
	PKG_CHECK_MODULES([zlib],[zlib >= 0])

	LIBSSAVE="${LIBS}"
	LIBS="${LIBS} ${zlib_LIBS}"
	CPPFLAGSSAVE="${CPPFLAGS}"
	CPPFLAGS="${CPPFLAGS} ${zlib_CFLAGS}"
        AC_MSG_CHECKING([whether we can compile a zlib program])
        AC_TRY_LINK([#include <zlib.h>
#include <string.h>
],[
	z_stream strm;
	memset ( &strm , 0, sizeof(z_stream) );
	strm.zalloc = Z_NULL;
	strm.zfree = Z_NULL;
	strm.opaque = Z_NULL;
	deflateInit(&strm,Z_DEFAULT_COMPRESSION);
	],[zlib=yes],[zlib=no])
        AC_MSG_RESULT([${zlib}])
	LIBS="${LIBSSAVE}"
	CPPFLAGS="${CPPFLAGSSAVE}"

	if [[ "$zlib" = "no" ]] ; then
		AC_MSG_ERROR([Required library zlib not found.]);
	else
		ZLIBREQ=zlib
		ZLIBCPPFLAGS="${zlib_CFLAGS}"
		ZLIBLIBS="${zlib_LIBS}"
		ZLIBPKGLBIS=
	fi
else
	AC_MSG_WARN([zlib pkgconfig file is not installed. Trying if -lz for LIBS is enough.])

	LIBSSAVE="${LIBS}"
	LIBS="${LIBS} -lz"
        AC_MSG_CHECKING([whether we can compile a zlib program])
        AC_TRY_LINK([#include <zlib.h>
#include <string.h>
],[
	z_stream strm;
	memset ( &strm , 0, sizeof(z_stream) );
	strm.zalloc = Z_NULL;
	strm.zfree = Z_NULL;
	strm.opaque = Z_NULL;
	deflateInit(&strm,Z_DEFAULT_COMPRESSION);
	],[zlib=yes],[zlib=no])
        AC_MSG_RESULT([${zlib}])
	LIBS="${LIBSSAVE}"

	if [[ "$zlib" = "no" ]] ; then
		AC_MSG_ERROR([Required library zlib not found.]);
	else
		ZLIBREQ=
		ZLIBCPPFLAGS=
		ZLIBLIBS="-lz"
		ZLIBPKGLIBS="-lz"
	fi
fi

if test "${CC}" = "gcc" ; then
	CPPFLAGS="${CPPFLAGS} -W -Wall"
fi
if test "${CC}" = "cl.exe" ; then
	CPPFLAGS="${CPPFLAGS} -W1" # -Wall
fi

AC_ARG_ENABLE(optimization,
       AS_HELP_STRING([--enable-optimization],[use compiler optimization (default yes)]),
        [optimization=${enableval}],[optimization=yes])
AC_ARG_ENABLE(debug,
        AS_HELP_STRING([--enable-debug],[use compiler debug flags (default no)]),
        [debug=${enableval}],[debug=no])
AC_ARG_ENABLE(profile,
        AS_HELP_STRING([--enable-profile],[use compiler profiling flags (default no)]),
        [profile=${enableval}],[profile=no])
AC_ARG_ENABLE(fast,
        AS_HELP_STRING([--enable-fast],[disable evaluation of assertions (default no)]),
        [fast=${enableval}],[fast=no])

if test "${fast}" = "yes" ; then
	CPPFLAGS="${CPPFLAGS} -DNDEBUG"
fi

if test "${debug}" = "yes" ; then
        CFLAGS="${CFLAGS} -g -O0 -rdynamic"
else
	if test "${profile}" = "yes" ; then
	        CFLAGS="${CFLAGS} -g -pg -rdynamic"
	else
		if test "${optimization}" = "yes" ; then
			case ${CC} in
				gcc)
					CFLAGS="${CFLAGS} -O3 -rdynamic"
					;;
				*-mingw32msvc-gcc)
					CFLAGS="${CFLAGS} -O3 -rdynamic"
					;;
				cl.exe)
					CFLAGS="${CFLAGS} -O2 -Ob2 -Ot -Oy"
					;;
			esac
		fi

	fi
fi

AC_CHECK_FUNC([_mkdir],[have_mkdir=yes],[have_mkdir=no])
AC_CHECK_HEADER([direct.h],[have_direct_h=yes],[have_direct_h=no])

if test "${have_mkdir}" = "yes" -a "${have_direct_h}" = "yes" ; then

AC_MSG_CHECKING([whether we can compile a program using _mkdir])
        AC_TRY_LINK([#include <direct.h>],[_mkdir("tmpdir");],[have_mkdir=yes],[have_mkdir=no])
        AC_MSG_RESULT([${have_mkdir}])
fi

if test "${have_mkdir}" = "yes" ; then
	HAVEWINDOWS_MKDIR="#define HAVEWINDOWS_MKDIR"
else
	HAVEWINDOWS_MKDIR=
fi

PACKAGE_NAME=${PACKAGE}
PACKAGE_VERSION=${VERSION}

AC_SUBST([PACKAGE_NAME])
AC_SUBST([PACKAGE_VERSION])
AC_SUBST([ZLIBCPPFLAGS])
AC_SUBST([ZLIBLIBS])
AC_SUBST([ZLIBPKGLIBS])
AC_SUBST([ZLIBREQ])
AC_SUBST([LIBRARY_VERSION])
AC_SUBST([HAVEWINDOWS_MKDIR])
AC_OUTPUT(Makefile src/Makefile ubuntu.sh bambamc.pc src/bambamc/BamBam_Config.h)