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