File: configure.in

package info (click to toggle)
fitscut 1.4.4-4
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 924 kB
  • ctags: 465
  • sloc: ansic: 6,024; sh: 767; makefile: 132
file content (141 lines) | stat: -rw-r--r-- 3,809 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
dnl $Id: configure.in,v 1.10 2006/10/31 20:44:30 mccannwj Exp $
dnl Process this file with autoconf to produce a configure script.

AC_DEFUN([COMPILE_WARNINGS],[
    if test -z "$1" ; then
	default_compile_warnings=yes
    else
	default_compile_warnings="$1"
    fi

    AC_ARG_ENABLE(compile-warnings, 
    [  --enable-compile-warnings=[no/minimum/yes/maximum/error]	Turn on compiler warnings.],, [enable_compile_warnings="$default_compile_warnings"])

    warnCFLAGS=
    if test "x$GCC" != xyes; then
	enable_compile_warnings=no
    fi

    warning_flags=
    realsave_CFLAGS="$CFLAGS"

    case "$enable_compile_warnings" in
    no)
	warning_flags=
	;;
    minimum)
	warning_flags="-Wall"
	;;
    yes)
	warning_flags="-Wall -Wmissing-prototypes"
	;;
    maximum|error)
	warning_flags="-Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
	CFLAGS="$warning_flags $CFLAGS"
	for option in -Wno-sign-compare; do
		SAVE_CFLAGS="$CFLAGS"
		CFLAGS="$CFLAGS $option"
		AC_MSG_CHECKING([whether gcc understands $option])
		AC_TRY_COMPILE([], [],
			has_option=yes,
			has_option=no,)
		CFLAGS="$SAVE_CFLAGS"
		AC_MSG_RESULT($has_option)
		if test $has_option = yes; then
		  warning_flags="$warning_flags $option"
		fi
		unset has_option
		unset SAVE_CFLAGS
	done
	unset option
	if test "$enable_compile_warnings" = "error" ; then
	    warning_flags="$warning_flags -Werror"
	fi
	;;
    *)
	AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
	;;
    esac
    CFLAGS="$realsave_CFLAGS"
    AC_MSG_CHECKING(what warning flags to pass to the C compiler)
    AC_MSG_RESULT($warning_flags)

    AC_ARG_ENABLE(iso-c,
    [  --enable-iso-c          Try to warn if code is not ISO C ],,
    enable_iso_c=no)

    AC_MSG_CHECKING(what language compliance flags to pass to the C compiler)
    complCFLAGS=
    if test "x$enable_iso_c" != "xno"; then
	if test "x$GCC" = "xyes"; then
	case " $CFLAGS " in
	    *[\ \	]-ansi[\ \	]*) ;;
	    *) complCFLAGS="$complCFLAGS -ansi" ;;
	esac
	case " $CFLAGS " in
	    *[\ \	]-pedantic[\ \	]*) ;;
	    *) complCFLAGS="$complCFLAGS -pedantic" ;;
	esac
	fi
    fi
    AC_MSG_RESULT($complCFLAGS)

    WARN_CFLAGS="$warning_flags $complCFLAGS"
    AC_SUBST(WARN_CFLAGS)
])

AC_INIT(fitscut.c)

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(fitscut,1.4.4)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_LN_S
AC_PROG_INSTALL
AC_PROG_CPP

dnl Checks for header files.
AC_STDC_HEADERS
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h)
AC_CHECK_HEADERS(string.h)
AC_CHECK_HEADERS(stdlib.h,)

AC_CHECK_HEADERS(png.h,,AC_MSG_ERROR([png.h is required to build fitscut]))
AC_CHECK_HEADERS(jpeglib.h,,AC_MSG_ERROR([jpeglib.h is required to build fitscut]))
AC_CHECK_HEADERS(cfitsio/fitsio.h, have_cfitsio_fitsio_h=yes, have_cfitsio_fitsio_h=no)
AC_CHECK_HEADERS(fitsio.h, have_fitsio_h=yes, have_fitsio_h=no)

AM_CONDITIONAL(HAVE_CFITSIO_FITSIO_H, test "x$have_cfitsio_fitsio_h" = "xyes")
AM_CONDITIONAL(HAVE_FITSIO_H, test "x$have_cfitsio_fitsio_h" = "xyes")

if test "x$have_cfitsio_fitsio_h" != "xyes" -a "x$have_fitsio_h" != "xyes"; then
   AC_MSG_ERROR([fitsio.h is required to build fitscut])
fi

dnl Checks for libraries.
AC_CHECK_LIB(m, sin)
AC_CHECK_LIB(socket, connect)
AC_CHECK_LIB(nsl, main)
AC_CHECK_LIB(png, png_read_info)
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress)
AC_CHECK_LIB(cfitsio, ffvers)
AC_CHECK_LIB(wcstools, wcsinit, have_libwcs=yes, have_libwcs=no)

AM_CONDITIONAL(HAVE_LIBWCS, test "x$have_libwcs" = "xyes")

if test "x$have_libwcs" = "xyes"; then
   AC_DEFINE([HAVE_LIBWCS], 1, [Defined when libwcstools is detected])
   WCS_LIBS="-lwcstools"
   AC_SUBST(WCS_LIBS)
fi

COMPILE_WARNINGS(yes)
CFLAGS="$CFLAGS $WARN_CFLAGS"
AC_SUBST(CFLAGS)

dnl Checks for library functions.
AC_TYPE_SIGNAL

AC_OUTPUT(Makefile)
AC_OUTPUT(fitscut.spec)