1 AC_INIT([CADS_fits2jpeg], [1.95], [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([string.h math.h float.h ctype.h libgen.h dirent.h])
18 # Checks for typedefs, structures, and compiler characteristics.
21 # Checks for library functions.
22 AC_FUNC_MALLOC
24 LIBS="$LIBS -L/usr/lib64 -L/usr/lib -lm -ljpeg -lcfitsio"
25 CFLAGS="-ansi -Wall $CFLAGS -I/usr/include -I/usr/include/cfitsio"
26 #---------------------------------------------------------------------#
27 #           Now we check for cfitsio headers and library              #
28 #---------------------------------------------------------------------#
29 fitserror="
30  +------------------------------------------------------------------+
31  | Unable to find cfitsio distribution. You may need to get it from |
32  |   http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html  |
33  +------------------------------------------------------------------+
34 "
35 AC_ARG_WITH(cfitsio,
36             [ --with-cfitsio[=DIR]     Location of the cfitsio distribution],
37             [CFITS=$with_cfitsio]
38 )
40 if test x"$CFITS" != 'x'; then
41         LIBS="-L$CFITS -L$CFITS/lib64 -L$CFITS/lib $LIBS"
42         CFLAGS="$CFLAGS -I$CFITS -I$CFITS/include -I$CFITS/include/cfitsio"
43 fi
45 AC_MSG_CHECKING(for cfitsio)
46 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
47             #include <stdio.h>
48             #include <stdlib.h>
49             #include <fitsio2.h>]],
50           [[    fitsfile *fptr]])],
51           [cfitsio=yes],[cfitsio=no])
52 AC_MSG_RESULT([$cfitsio])
54 if test "$cfitsio" != "yes"; then
55     AC_MSG_ERROR($fitserror)
56 fi
58 #---------------------------------------------------------------------#
59 #                   And the jpeg headers and library                  #
60 #---------------------------------------------------------------------#
61 jpegerror="
62  +------------------------------------------------------------------+
63  |            Unable to find jpeg library and headers               |
64  +------------------------------------------------------------------+
65 "
66 AC_ARG_WITH(jpeglib,
67             [ --with-jpeglib[=DIR]     Location of the jpeg library],
68             [LJPG=$with_jpeglib]
69 )
71 if test x"$LJPG" != 'x'; then
72         LIBS="-L$LJPG -L$LJPG/lib64 -L$LJPG/lib $LIBS"
73         CFLAGS="$CFLAGS -I$LJPG -I$LJPG/include -I$LJPG/include/jpeglib"
74 fi
76 AC_MSG_CHECKING(for jpeglib)
77 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
78             #include <stdio.h>
79             #include <stdlib.h>
80             #include <jpeglib.h>]],
81           [[    FILE *jpeg_file]])],
82           [jpeg=yes],[jpeg=no])
83 AC_MSG_RESULT([$jpeg])
85 if test "$jpeg" != "yes"; then
86         AC_MSG_ERROR($jpegerror)
87 fi
89 AC_OUTPUT(Makefile src/Makefile)
91 echo
92 echo " +------------------------------------------------------------------+"
93 echo " | Configuration complete                                           |"
94 echo " | Type 'make' to compile the software, followed by 'make install'  |"
95 echo " |                   All the very best! :-)                         |"
96 echo " |                                             --CADS Software Team |"
97 echo " +------------------------------------------------------------------+"
98 echo