File: configure.ac

package info (click to toggle)
funtools 1.4.4+dfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 16,168 kB
  • ctags: 10,760
  • sloc: ansic: 87,238; sh: 9,727; lex: 4,595; asm: 3,281; ada: 1,681; makefile: 1,458; pascal: 1,089; cpp: 1,001; cs: 879; perl: 161; yacc: 64; sed: 32; csh: 10; tcl: 9
file content (281 lines) | stat: -rw-r--r-- 7,554 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
#	This file is an input file used by the GNU "autoconf" program to
#	generate the file "configure", which is run during XPA installation
#	to configure the system for the local environment.
AC_INIT(funtools, 1.4.4, saord@cfa.harvard.edu, funtools)

AC_CONFIG_HEADERS([conf.h ./gnu/conf.h ./funtest/conf.h])
AC_CONFIG_SRCDIR([./funtools.h])
AC_CANONICAL_HOST

#
# checks that we use in most projects
#
AC_PROG_CC

AC_EXEEXT
if test x"${EXEEXT}" = "xno"; then
  EXEEXT=""
fi

AC_C_LONG_LONG

AC_PROG_RANLIB

AC_HEADER_STDC
AC_CHECK_HEADERS(malloc.h)
AC_CHECK_HEADERS(getopt.h)
AC_CHECK_HEADERS(values.h)
AC_CHECK_HEADERS(dlfcn.h)
AC_CHECK_HEADERS(sys/un.h)
AC_CHECK_HEADERS(sys/ipc.h)
AC_CHECK_HEADERS(sys/mman.h)
case $host_os in
    *cygwin*|*Cygwin* )
        ;;
    * )
        AC_CHECK_HEADERS(sys/shm.h)
        ;;
esac

AC_CHECK_TYPES([socklen_t], [], [], [#include <sys/socket.h>])

AC_C_CONST

AC_CHECK_FUNCS(strchr memcpy snprintf)

AC_CHECK_FUNC(connect)
if test $ac_cv_func_connect = no; then
  AC_CHECK_LIB(socket, connect,  EXTRA_LIBS="$EXTRA_LIBS -lsocket")
fi                                                                          
AC_CHECK_FUNC(gethostbyname)
if test $ac_cv_func_gethostbyname = no; then
  AC_CHECK_LIB(nsl, gethostbyname, EXTRA_LIBS="$EXTRA_LIBS -lnsl")
fi                                                                          
# AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")

#
# checks specific to this project
# 

AC_MSG_CHECKING(for filter cc)
AC_ARG_WITH(filter-cc, [ --with-filter-cc=CC  compiler],
	FILTER_CC=\\\"$withval\\\", FILTER_CC=NULL)
AC_MSG_RESULT($FILTER_CC)
AC_SUBST(FILTER_CC)

AC_MSG_CHECKING(for filter cflags)
AC_ARG_WITH(filter-cflags, [ --with-filter-cflags=CFLAGS  compiler flags],
	FILTER_CFLAGS=\\\"$withval\\\", FILTER_CFLAGS=NULL)
AC_MSG_RESULT($FILTER_CFLAGS)
AC_SUBST(FILTER_CFLAGS)

DEFLIB="libfuntools.a"
AC_MSG_CHECKING(for alternate target library)
AC_ARG_WITH(altlib, [ --with-altlib=LIB  library name],
	alt_lib=yes LIB=$withval, alt_lib=no LIB=$DEFLIB)
AC_MSG_RESULT($alt_lib ($LIB))
AC_SUBST(LIB)
AC_SUBST(DEFLIB)

AC_MSG_CHECKING(for external zlib)
AC_ARG_WITH(zlib, [ --with-zlib=LIB  library name],
	zlib=yes EXTRA_LIBS="$EXTRA_LIBS $withval", zlib=no)
AC_MSG_RESULT($zlib)

AC_MSG_CHECKING(for external wcslib)
AC_ARG_WITH(wcslib, [ --with-wcslib=LIB  library name],
	wcslib=yes EXTRA_LIBS="$EXTRA_LIBS $withval", wcslib=no)
AC_MSG_RESULT($wcslib)

AC_MSG_CHECKING(for shared library build)
AC_ARG_ENABLE(shared, [  --enable-shared    build shared libraries],
    [fun_ok=$enableval], [fun_ok=no])
if test "$fun_ok" != "no"; then
  fpic="yes"
  DOSHARED=shlib
  AC_SUBST(DOSHARED)
  if test "$fun_ok" = "link"; then
    AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
    if test "$have_dl" = yes; then
      using_shlib="yes"
      fpic="yes"
      EXTRA_LIBS="$EXTRA_LIBS -ldl"  
      if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
        LDFLAGS="$LDFLAGS -rdynamic"
      fi
    else
      AC_CHECK_LIB(c, dlopen, have_dl=yes, have_dl=no)
      if test "$have_dl" = yes; then
        using_shlib="yes"
        fpic="yes"
        if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
          LDFLAGS="$LDFLAGS -rdynamic"
        fi
      else
        using_shlib="no"
      fi
    fi
    LLIB="-L. -l$PACKAGE_NAME"
  else
    LLIB='$(LIB)'
  fi
else
  LLIB='$(LIB)'
fi
AC_SUBST(LLIB)
AC_MSG_RESULT($fun_ok)

AC_MSG_CHECKING([for dynamic loading of filters ])
AC_ARG_ENABLE(dl, [  --enable-dl    allow use of dynamic loading if available],
    [fun_ok=$enableval], [fun_ok=no])
if test "$fun_ok" = "yes"; then
if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
  using_dl="yes"
  if test x"$using_shlib" != xyes; then
    AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
    if test "$have_dl" = yes; then
      USE_DL="-DUSE_DL=1"
      fpic="yes"
      EXTRA_LIBS="$EXTRA_LIBS -ldl"  
      if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
        LDFLAGS="$LDFLAGS -rdynamic"
      fi
    else
      AC_CHECK_LIB(c, dlopen, have_dl=yes, have_dl=no)
      if test "$have_dl" = yes; then
        USE_DL="-DUSE_DL=1"
        fpic="yes"
        if test `$CC -v -rdynamic 2>&1 | grep -c unrecognized` = "0" ; then
          LDFLAGS="$LDFLAGS -rdynamic"
        fi
      else
        using_dl="no"
      fi
    fi
  fi
else
  using_dl="no"
fi
else
using_dl="no"
fi
AC_MSG_RESULT([$using_dl ($CC)])
AC_SUBST(USE_DL)

AC_ARG_ENABLE(fpu_double, [  --enable-fpu_double    set FPU in double round mode],
    [fun_ok=$enableval], [fun_ok=no])
if test "$fun_ok" = "yes"; then
AC_MSG_CHECKING([for setting fpu in double rounding mode (with gcc) ])
if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
  using_fpu_double="yes"
  USE_FPU_DOUBLE="1"
else
  using_fpu_double="no"
  USE_FPU_DOUBLE="0"
fi
AC_MSG_RESULT([$using_fpu_double])
else
  USE_FPU_DOUBLE="0"
fi
AC_SUBST(USE_FPU_DOUBLE)

AC_MSG_CHECKING(for mainlib build)
DOMAINLIB=""
AC_ARG_ENABLE(mainlib, [  --enable-mainlib    build funtools mainlib support],
    [fun_ok=$enableval], [fun_ok=no])
if test "$fun_ok" = "yes"; then
  DOMAINLIB=mainlib
elif test "$fun_ok" = "shared"; then
  DOMAINLIB=shmainlib
fi
AC_SUBST(DOMAINLIB)
AC_MSG_RESULT($fun_ok)

SC_PATH_TCLCONFIG
if test x"${no_tcl}" = x ; then
    AC_DEFINE([HAVE_TCL], [1], [Define if tcl is used.])
    SC_LOAD_TCLCONFIG
    TCL_LIBS="$TCL_LIB_SPEC"
    AC_SUBST(TCL_LIBS)
fi

AC_PROG_AWK

AC_CHECK_PROG(gzip, gzip, gzip, none)
if test "$gzip" = "none"; then
  GUNZIP="cat"
else
  GUNZIP="$gzip -dcf"
fi

AC_CHECK_PROG(gnuplot, gnuplot, gnuplot, none)
if test "$gnuplot" = "none"; then
  GNUPLOT="NONE"
else
  GNUPLOT="$gnuplot"
fi

AC_MSG_CHECKING([$host_os configuration])
PRE=""
POST="|\& cat"
case $host_os in
    *cygwin*|*Cygwin* )
        CFLAGS="$CFLAGS -enable-auto-import"
        AC_DEFINE([HAVE_CYGWIN], [], [Define if the cygwin compiler is used.])
        AC_MSG_RESULT(flagging Cygwin)
	PRE="sh -c {"
	POST="}"
        ;;
    *mingw32*|*Mingw32*)
        CFLAGS="$CFLAGS -mconsole"
	EXTRA_LIBS="$EXTRA_LIBS -lwsock32"
        AC_DEFINE([HAVE_MINGW32], [], [Define if the mingw32 compiler is used.])
        AC_MSG_RESULT(flagging MinGW)
        ;;
    *osf*|*Osf*)
        AC_CHECK_LIB(db, snprintf, EXTRA_LIBS="$EXTRA_LIBS -ldb")
        ;;
    *darwin*|*Darwin*)
        CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
        if test x"$fpic" = x"yes" ; then
	  CFLAGS="$CFLAGS -fPIC"
          AC_MSG_RESULT([adding -no-cpp-precomp, -fno-common, -fPIC to CFLAGS])
	else
          AC_MSG_RESULT([adding -no-cpp-precomp and -fno-common to CFLAGS])
	fi
	;;
    * )
        if test x"$fpic" = x"yes" ; then
          if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then
	    CFLAGS="$CFLAGS -fPIC"
	    AC_MSG_RESULT(adding -fPIC to gcc)
	  else
            AC_MSG_RESULT(none)
	  fi
	else
            AC_MSG_RESULT(none)
	fi
        ;;
esac

AC_SUBST(EXTRA_LIBS)
AC_SUBST(EXTRA_OBJS)
AC_SUBST(PRE)
AC_SUBST(POST)
AC_SUBST(AWK)
AC_SUBST(GUNZIP)
AC_SUBST(GNUPLOT)
AC_SUBST(PIPEGLUE)

AC_CONFIG_FILES(Makefile ./gnu/Makefile ./funtest/Makefile ./faq/Makefile)

# generate pkg-config meta-data file
AC_CONFIG_FILES(funtools.pc)

# for individual package that create libraries, we must run configure again,
# faking the subdirs into using the funtools library as their library
# this will run faster with --config-cache
ac_configure_args="--with-altlib=`pwd`/$LIB $ac_configure_args"
AC_CONFIG_SUBDIRS(util fitsy filter wcs)

AC_OUTPUT