4349060468d05f8920045e0830d313e1e49e6745
1 AC_INIT([CADS_fits2jpeg], [1.90], [cads@iiap.res.in])
2 AC_LANG_C
3 AM_INIT_AUTOMAKE([-Wall -Werror])
4 AC_CONFIG_SRCDIR([config.h.in])
5 AC_CONFIG_HEADERS([config.h])
7 # Checks for programs.
8 AC_PROG_CC
9 AC_PROG_INSTALL
10 AC_PROG_LN_S
11 AC_PROG_MAKE_SET
13 # Checks for libraries.
15 # Checks for header files.
16 AC_CHECK_HEADERS([stdio.h stdlib.h string.h math.h])
18 # Checks for typedefs, structures, and compiler characteristics.
20 # Checks for library functions.
21 AC_FUNC_MALLOC
23 LIBS="$LIBS -L/usr/lib64 -L/usr/lib -lm -ljpeg -lcfitsio"
24 CFLAGS="-ansi $CFLAGS -I/usr/include -I/usr/include/cfitsio"
25 #---------------------------------------------------------------------#
26 #           Now we check for cfitsio headers and library              #
27 #---------------------------------------------------------------------#
28 fitserror="
29  +------------------------------------------------------------------+
30  | Unable to find cfitsio distribution. You may need to get it from |
31  |   http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html  |
32  +------------------------------------------------------------------+
33 "
34 AC_ARG_WITH(cfitsio,
35             [ --with-cfitsio[=DIR]     Location of the cfitsio distribution],
36             [CFITS=$with_cfitsio]
37 )
39 if test x"$CFITS" != 'x'; then
40         LIBS="-L$CFITS -L$CFITS/lib64 -L$CFITS/lib $LIBS"
41         CFLAGS="$CFLAGS -I$CFITS -I$CFITS/include -I$CFITS/include/cfitsio"
42 fi
44 AC_MSG_CHECKING(for cfitsio)
45 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
46             #include <stdio.h>
47             #include <stdlib.h>
48             #include <fitsio2.h>]],
49           [[    fitsfile *fptr]])],
50           [cfitsio=yes],[cfitsio=no])
51 AC_MSG_RESULT([$cfitsio])
53 if test "$cfitsio" != "yes"; then
54     AC_MSG_ERROR($fitserror)
55 fi
57 #---------------------------------------------------------------------#
58 #                   And the jpeg headers and library                  #
59 #---------------------------------------------------------------------#
60 jpegerror="
61  +------------------------------------------------------------------+
62  |            Unable to find jpeg library and headers               |
63  +------------------------------------------------------------------+
64 "
65 AC_ARG_WITH(jpeglib,
66             [ --with-jpeglib[=DIR]     Location of the jpeg library],
67             [LJPG=$with_jpeglib]
68 )
70 if test x"$LJPG" != 'x'; then
71         LIBS="-L$LJPG -L$LJPG/lib64 -L$LJPG/lib $LIBS"
72         CFLAGS="$CFLAGS -I$LJPG -I$LJPG/include -I$LJPG/include/jpeglib"
73 fi
75 AC_MSG_CHECKING(for jpeglib)
76 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
77             #include <stdio.h>
78             #include <stdlib.h>
79             #include <jpeglib.h>]],
80           [[    FILE *jpeg_file]])],
81           [jpeg=yes],[jpeg=no])
82 AC_MSG_RESULT([$jpeg])
84 if test "$jpeg" != "yes"; then
85         AC_MSG_ERROR($jpegerror)
86 fi
88 AC_OUTPUT(Makefile src/Makefile)
90 echo
91 echo " +------------------------------------------------------------------+"
92 echo " | Configuration complete                                           |"
93 echo " | Type 'make' to compile the software, followed by 'make install'  |"
94 echo " |                   All the very best! :-)                         |"
95 echo " |                                             --CADS Software Team |"
96 echo " +------------------------------------------------------------------+"
97 echo