catalogs: updated to new libastro API.
[nova.git] / configure.in
bloba072f38b44ba589dcf0d50486cf7251be7b39e2f
1 AC_INIT
2 AC_CONFIG_SRCDIR([src/main.c])
3 AM_INIT_AUTOMAKE(nova, 0.1)
5 # Is the system sane for build
6 AC_PROG_INSTALL
7 AM_PROG_LIBTOOL
9 # check for libnova
10 dnl
11 dnl AC_LIB_LIBNOVA (MINIMUM-VERSION)
12 dnl
13 dnl Check for availability of libnova.
14 dnl Abort if not found or if current version is not up to par.
15 dnl
17 AC_DEFUN([AC_LIB_LIBNOVA],[
18         min_libnova_version=ifelse([$1], ,0.1,$1)
19         AC_CHECK_LIB(nova, ln_get_version, , AC_MSG_ERROR([libnova is required to compile Nova. Please check config.log.]), )
20         AC_MSG_CHECKING(for libnova - version >= $min_libnova_version)
21         no_libnova=""
22         AC_TRY_RUN([
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <string.h>
26 #include <libnova/libnova.h>
28 static char*
29 my_strdup (char *str)
31   char *new_str;
32   
33   if (str)
34     {
35       new_str = (char*) malloc ((strlen (str) + 1) * sizeof(char));
36       strcpy (new_str, str);
37     }
38   else
39     new_str = NULL;
40   
41   return new_str;
44 int 
45 main ()
47   char  *tmp_version;
48   char  *ln_version;
49   
50   int    major;
51   int    minor;
52   int    micro;
53   int    ln_major;
54   int    ln_minor;
55   int    ln_micro;
57   ln_version = my_strdup(ln_get_version());
58   if (sscanf(ln_version, "%d.%d.%d", &ln_major, &ln_minor, &ln_micro) != 3) {
59     printf ("%s, bad version string\n", ln_version);
60     exit (1);
61   }
63   /* HP/UX 9 (%@#!) writes to sscanf strings */
64   tmp_version = my_strdup("$min_libnova_version");
65   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
66     printf ("%s, bad version string\n", "$min_libnova_version");
67     exit (1);
68   }
70   if ((ln_major > major) ||
71       ((ln_major == major) && (ln_minor > minor)) ||
72       ((ln_major == major) && (ln_minor == minor)) && (ln_micro >= micro)) {
73     return 0;
74   } else {
75     printf ("\n");
76     printf ("*** An old version of libnova (%s) was found.\n", ln_version);
77     printf ("*** You need a version of libnova newer than or equal to %d.%d.%d.  The latest version of\n",
78                major, minor, micro);
79     printf ("*** libnova is always available from http://libnova.sf.net.\n");
80     printf ("***\n");
81     return 1;
82   }
84 ],,no_libnova=yes,[/bin/true])
85         if test "x$no_libnova" = x ; then
86                 AC_MSG_RESULT(yes)
87         else
88                 AC_MSG_RESULT(no)
89                 AC_MSG_ERROR([libnova is required to compile Nova. Please check config.log.])
90         fi
94 AC_LIB_LIBNOVA(0.12.2)
96 # check for libastrodb
97 dnl
98 dnl AC_LIB_LIBNASTRODB (MINIMUM-VERSION)
99 dnl
100 dnl Check for availability of libastrodb.
101 dnl Abort if not found or if current version is not up to par.
104 AC_DEFUN([AC_LIB_LIBNASTRODB],[
105         min_libastrodb_version=ifelse([$1], ,0.1,$1)
106         AC_CHECK_LIB(astrodb, astrodb_get_version, , AC_MSG_ERROR([libastrodb is required to compile Nova. Please check config.log.]), )
107         AC_MSG_CHECKING(for libastrodb - version >= $min_libastrodb_version)
108         no_libastrodb=""
109         AC_TRY_RUN([
110 #include <stdio.h>
111 #include <stdlib.h>
112 #include <string.h>
113 #include <libastrodb/astrodb.h>
115 static char*
116 my_strdup (char *str)
118   char *new_str;
119   
120   if (str)
121     {
122       new_str = (char*) malloc ((strlen (str) + 1) * sizeof(char));
123       strcpy (new_str, str);
124     }
125   else
126     new_str = NULL;
127   
128   return new_str;
131 int 
132 main ()
134   char  *tmp_version;
135   char  *astrodb_version;
136   
137   int    major;
138   int    minor;
139   int    micro;
140   int    astrodb_major;
141   int    astrodb_minor;
142   int    astrodb_micro;
144   astrodb_version = my_strdup(astrodb_get_version());
145   if (sscanf(astrodb_version, "%d.%d.%d", &astrodb_major, &astrodb_minor, &astrodb_micro) != 3) {
146     printf ("%s, bad version string\n", astrodb_version);
147     exit (1);
148   }
150   /* HP/UX 9 (%@#!) writes to sscanf strings */
151   tmp_version = my_strdup("$min_libastrodb_version");
152   if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
153     printf ("%s, bad version string\n", "$min_libastrodb_version");
154     exit (1);
155   }
157   if ((astrodb_major > major) ||
158       ((astrodb_major == major) && (astrodb_minor > minor)) ||
159       ((astrodb_major == major) && (astrodb_minor == minor)) && (astrodb_micro >= micro)) {
160     return 0;
161   } else {
162     printf ("\n");
163     printf ("*** An old version of libastrodb (%s) was found.\n", astrodb_version);
164     printf ("*** You need a version of libastrodb newer than or equal to %d.%d.%d.  The latest version of\n",
165                major, minor, micro);
166     printf ("*** libastrodb is always available from http://libnovacat.sf.net.\n");
167     printf ("***\n");
168     return 1;
169   }
171 ],,no_libastrodb=yes,[/bin/true])
172         if test "x$no_libastrodb" = x ; then
173                 AC_MSG_RESULT(yes)
174         else
175                 AC_MSG_RESULT(no)
176                 AC_MSG_ERROR([libastrodb is required to compile Nova. Please check config.log.])
177         fi
181 AC_LIB_LIBNASTRODB(0.1.0)
183 # Check for GNOME libs
184 GTK_VERSION_NEEDED=2.12.0
185 AC_SUBST(GTK_VERSION_NEEDED)
186 LIBXML_VERSION_NEEDED=2.6.0
187 AC_SUBST(LIBXML_VERSION_NEEDED)
188 LIBGLADE_VERSION_NEEDED=1.2.0
189 AC_SUBST(LIBGLADE_VERSION_NEEDED)
190 GCONF_VERSION_NEEDED=2.22.0
191 AC_SUBST(GCONF_VERSION_NEEDED)
193 PKG_CHECK_MODULES(NOVA,
194         gtk+-2.0 >= $GTK_VERSION_NEEDED
195         libxml-2.0 >= $LIBXML_VERSION_NEEDED
196         libglade-2.0 >= $LIBGLADE_VERSION_NEEDED
197         gconf-2.0 >= $GCONF_VERSION_NEEDED
199         
200 AC_SUBST(NOVA_CFLAGS)
201 AC_SUBST(NOVA_LIBS)
203 AC_CHECK_FUNCS([sqrt])
204 AC_CHECK_FUNCS([strtol])
205 AC_CHECK_FUNCS([ceil])
206 AC_CHECK_FUNCS([strdup])
207 AC_CHECK_FUNCS([atan2])
209 AC_C_CONST
210 AC_C_INLINE
211 AC_FUNC_STRTOD
212 AC_HEADER_STDBOOL
213 AC_PROG_LIBTOOL
215 # Add the languages which your application supports here.
216 #ALL_LINGUAS=""
217 #AM_GNOME_GETTEXT
219 # Set NOVA_PIXMAP_DIR in config.h.
220 if test "x${prefix}" = "xNONE"; then
221   AC_DEFINE_UNQUOTED(NOVA_PIXMAP_DIR, "${ac_default_prefix}/nova/pixmaps",[pixmaps])
222   NOVA_PIXMAP_DIR=${ac_default_prefix}/nova/pixmaps
223   AC_SUBST(NOVA_PIXMAP_DIR)
224 else
225   AC_DEFINE_UNQUOTED(NOVA_PIXMAP_DIR, "${prefix}/nova/pixmaps",[pixmaps])
226   NOVA_PIXMAP_DIR=${prefix}/nova/pixmaps
227   AC_SUBST(NOVA_PIXMAP_DIR)
230 # Set NOVA_CATALOG_DIR in config.h.
231 if test "x${prefix}" = "xNONE"; then
232   AC_DEFINE_UNQUOTED(NOVA_CATALOG_DIR, "${ac_default_prefix}/nova/catalogs",[catalog])
233   NOVA_CATALOG_DIR=${ac_default_prefix}/nova/catalogs
234   AC_SUBST(NOVA_CATALOG_DIR)
235 else
236   AC_DEFINE_UNQUOTED(NOVA_CATALOG_DIR, "${prefix}/nova/catalogs",[catalog])
237   NOVA_CATALOG_DIR=${prefix}/nova/catalogs
238   AC_SUBST(NOVA_CATALOG_DIR)
241 # Set NOVA_GLADE_DIR in config.h.
242 if test "x${prefix}" = "xNONE"; then
243   AC_DEFINE_UNQUOTED(NOVA_GLADE_DIR, "${ac_default_prefix}/nova/glade",[glade])
244   NOVA_GLADE_DIR=${ac_default_prefix}/nova/glade
245   AC_SUBST(NOVA_GLADE_DIR)
246 else
247   AC_DEFINE_UNQUOTED(NOVA_GLADE_DIR, "${prefix}/nova/glade",[glade])
248   NOVA_GLADE_DIR=${prefix}/nova/glade
249   AC_SUBST(NOVA_GLADE_DIR)
252 # Set PACKAGE_DATA_DIR in config.h.
253 if test "x${prefix}" = "xNONE"; then
254   AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${ac_default_prefix}/",[data])
255 else
256   AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${prefix}/",[data])
259 # build makefiles
260 AC_CONFIG_FILES([
261         Makefile
262         glade/Makefile
263         src/Makefile
264         src/db/Makefile
265         src/objects/Makefile
266         src/sky/Makefile
267         src/ui/Makefile
268         pixmaps/Makefile
269         catalogs/Makefile
272 AC_OUTPUT()