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