forked from INFERLab/gridlab-d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
656 lines (583 loc) · 19.9 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
# $Id: configure.ac 4738 2014-07-03 00:55:39Z dchassin $ -*- Autoconf -*-
# Copyright (C) 2008 Battelle Memorial Institute
# Process this file with autoconf to produce a configure script.
# This file is distributed under the same terms as GridLAB-D.
###############################################################################
# Init autoconf
###############################################################################
dnl m4 magic from Eric Blake <[email protected]>
dnl autoconf 2.63 does not have m4_esyscmd_s
m4_define([m4_chomp_all],
[m4_format([[%.*s]], m4_bregexp(m4_translit([[$1]], [
/], [/ ]), [/*$]), [$1])])
m4_define([m4_esyscmd_s], [m4_chomp_all(m4_esyscmd([$1]))])
m4_define([sbuild_m4_chomp],
[m4_format([[%.*s]], m4_bregexp(m4_translit([$1], [
]]m4_dquote(_m4_defn([m4_cr_all]))[, [/]]m4_format([%255s], [])[),
[/*$]), [$1])])
m4_define([sbuild_m4_esyscmd_s],
[sbuild_m4_chomp(m4_esyscmd([$1]))])
dnl GridLAB-D version information
m4_define([pkgversion], sbuild_m4_esyscmd_s([build-aux/version.sh --version]))
m4_define([pkgbranch], sbuild_m4_esyscmd_s([build-aux/version.sh --branch]))
m4_define([svnversion], sbuild_m4_esyscmd_s([build-aux/version.sh --svn]))
AC_PREREQ([2.63])
AC_INIT([GridLAB-D], pkgversion, [[email protected]], [gridlabd])
AC_CONFIG_SRCDIR([gldcore/aggregate.c])
AC_CONFIG_HEADER([gldcore/config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
###############################################################################
# Init automake
###############################################################################
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
###############################################################################
# Misc. information and package setup.
###############################################################################
GLD_TOP_BUILDDIR="`pwd`"
cd "$srcdir"
GLD_TOP_SRCDIR="`pwd`"
cd "$GLD_TOP_BUILDDIR"
AS_IF([test "$GLD_TOP_BUILDDIR" != "$GLD_TOP_SRCDIR"],
[AC_MSG_NOTICE([Detected VPATH build])])
AC_CANONICAL_HOST
# Export version info as autoconf variables
AC_SUBST(PACKAGE_BASEVERSION, pkgversion)
AC_SUBST(PACKAGE_BRANCH, pkgbranch)
AC_SUBST(PACKAGE_REVISION, svnversion)
AM_SILENT_RULES([yes])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[turn on debugging @<:@default=yes@:>@])],
[AS_CASE([$enableval],
[yes], [debug=true],
[no], [debug=false],
[AC_MSG_ERROR([bad value $enableval for --enable-debug])])],
[debug=true])
AC_ARG_ENABLE([optimization],
[AS_HELP_STRING([--enable-optimization@<:@=LEVEL@:>@],
[turn on optimization @<:@default=0@:>@])],
[AS_CASE([${enableval}],
[0|1|2|3|s], [optimization=${enableval}],
[yes], [optimization=2],
[no], [optimization=0],
[AC_MSG_ERROR([bad value ${enableval} for --enable-optimization])])],
[optimization=0])
###############################################################################
#windows-mingw specific flag runs
###############################################################################
AC_CANONICAL_HOST
case $host_os in
*mingw*) mingw=true ;;
*) mingw=false ;;
esac
AM_CONDITIONAL([HAVE_MINGW], [test "x$mingw" = "xtrue"])
###another trial#####
#case $host in
#*mingw*)
# LDFLAGS = $LDFLAGS -lws2_32
#esac
###############################################################################
# C compiler
###############################################################################
AC_MSG_NOTICE
AC_MSG_NOTICE([C compiler])
AC_MSG_NOTICE
AC_PROG_CC
AC_GNU_SOURCE # defines _GNU_SOURCE
AM_PROG_CC_C_O # required for automake to support subdir-objects
AS_IF([test "x$debug" = "true"], [GLD_CFLAGS="$GLD_CFLAGS -g"])
GLD_CFLAGS="$GLD_CFLAGS"
#--------------------------------------
# Checks for C header files.
#--------------------------------------
#--------------------------------------
# Checks for C typedefs, structures, and compiler characteristics.
#--------------------------------------
AX_PTHREAD
# check whether -lpthread is ok when linking and add it if so
AC_MSG_CHECKING([whether to add -lpthread to PTHREAD_LIBS])
AS_CASE([$PTHREAD_LIBS],
[*-lpthread*], [result=no],
[SAVE_LIBS="$LIBS"
LIBS="$LIBS -lpthread"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <pthread.h>
static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }
void function() {
pthread_t th;
pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0);
}
]],
[[function();]])],
[PTHREAD_LIBS="$PTHREAD_LIBS -lpthread"
result=yes],
[result=no])
LIBS="$SAVE_LIBS"
])
AC_MSG_RESULT([$result])
#--------------------------------------
# Checks for C type sizes.
#--------------------------------------
#--------------------------------------
# Checks for C library functions.
#--------------------------------------
#--------------------------------------
# Checks for C libraries.
#--------------------------------------
# Check for curses
AX_WITH_CURSES
AS_IF([test "x$ax_cv_curses" = xyes],
[HAVE_CURSES=yes
GLD_CPPFLAGS="$GLD_CPPFLAGS -DHAVE_CURSES"],
[HAVE_CURSES=no])
AC_SUBST([GLD_CFLAGS])
###############################################################################
# C++ compiler
###############################################################################
AC_MSG_NOTICE
AC_MSG_NOTICE([C++ compiler])
AC_MSG_NOTICE
AC_LANG_PUSH([C++])
AC_PROG_CXX
AS_IF([test "x$debug" = "true"], [GLD_CXXFLAGS="$GLD_CXXFLAGS -g"])
GLD_CXXFLAGS="$GLD_CXXFLAGS"
#--------------------------------------
# Checks for C++ header files.
#--------------------------------------
AC_PATH_XTRA
AC_CHECK_HEADERS([arpa/inet.h])
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([float.h])
AC_CHECK_HEADERS([inttypes.h])
AC_CHECK_HEADERS([limits.h])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([math.h])
AC_CHECK_HEADERS([memory.h])
AC_CHECK_HEADERS([memory.h])
AC_CHECK_HEADERS([netdb.h])
AC_CHECK_HEADERS([netinet/in.h])
AC_CHECK_HEADERS([sched.h])
AC_CHECK_HEADERS([stddef.h])
AC_CHECK_HEADERS([stdint.h])
AC_CHECK_HEADERS([stdint.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([sys/ioctl.h])
AC_CHECK_HEADERS([sys/param.h])
AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_HEADERS([sys/timeb.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([wchar.h])
#--------------------------------------
# Checks for C++ typedefs, structures, and compiler characteristics.
#--------------------------------------
AC_C_CONST
AC_C_INLINE
AC_C_RESTRICT
AC_HEADER_STDBOOL
AC_HEADER_STDC
AC_STRUCT_TM
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
GLD_CHECK_BUILTIN(
[__sync_bool_compare_and_swap],
[],
[volatile unsigned int value = 0;
__sync_bool_compare_and_swap(&value, value, 1);],
[HAVE_SYNC_BOOL_COMPARE_AND_SWAP=yes],
[HAVE_SYNC_BOOL_COMPARE_AND_SWAP=no])
GLD_CHECK_BUILTIN(
[__sync_add_and_fetch],
[],
[volatile unsigned int value = 0;
__sync_add_and_fetch(&value, 1);],
[HAVE_SYNC_ADD_AND_FETCH=yes],
[HAVE_SYNC_ADD_AND_FETCH=no])
# AX_PTHREAD is a C-only test. We assume its flags work for CXX, as well. But
# we need to introduce a similar PTHREAD_CXX variable.
# More AIX lossage: compile with *_r variant
if test "x$GCC" != xyes; then
case $host_os in
aix*)
AS_CASE(["x/$CXX"],
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
[#handle absolute path differently from PATH based program lookup
AS_CASE(["x$CXX"],
[x/*],
[AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CC="${CXX}_r"])],
[AC_CHECK_PROGS([PTHREAD_CC],[${CXX}_r],[$CXX])])])
;;
esac
fi
test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
AC_SUBST([PTHREAD_CXX])
#--------------------------------------
# Checks for C++ type sizes.
#--------------------------------------
#--------------------------------------
# Checks for C++ library functions.
#--------------------------------------
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_FUNC_STRFTIME
AC_FUNC_STRTOD
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([alarm])
AC_CHECK_FUNCS([atexit])
AC_CHECK_FUNCS([floor])
AC_CHECK_FUNCS([ftime])
AC_CHECK_FUNCS([getcwd])
AC_CHECK_FUNCS([gethostbyname])
AC_CHECK_FUNCS([gethrtime])
AC_CHECK_FUNCS([gettimeofday])
AC_CHECK_FUNCS([inet_ntoa])
AC_CHECK_FUNCS([memset])
AC_CHECK_FUNCS([mkdir])
AC_CHECK_FUNCS([pow])
AC_CHECK_FUNCS([putenv])
AC_CHECK_FUNCS([select])
AC_CHECK_FUNCS([setenv])
AC_CHECK_FUNCS([socket])
AC_CHECK_FUNCS([sqrt])
AC_CHECK_FUNCS([strchr])
AC_CHECK_FUNCS([strcspn])
AC_CHECK_FUNCS([strerror])
AC_CHECK_FUNCS([strpbrk])
AC_CHECK_FUNCS([strrchr])
AC_CHECK_FUNCS([strstr])
AC_CHECK_FUNCS([strtol])
AC_CHECK_FUNCS([tzset])
#--------------------------------------
# Checks for C++ function-like macros.
#--------------------------------------
# isfinite
AC_CACHE_CHECK([for isfinite], [gld_cv_func_isfinite],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <math.h>]],
[[int result = isfinite(1.0);]])],
[gld_cv_func_isfinite=yes],
[gld_cv_func_isfinite=no])])
AS_IF([test "x$gld_cv_func_isfinite" = xyes],
[AC_DEFINE([HAVE_ISFINITE], [1],
[Define to 1 if you have the isfinite function.])])
# CPU_ALLOC
AC_CACHE_CHECK([for CPU_ALLOC], [gld_cv_func_CPU_ALLOC],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sched.h>]],
[[cpu_set_t *cpu = CPU_ALLOC(2);]])],
[gld_cv_func_CPU_ALLOC=yes],
[gld_cv_func_CPU_ALLOC=no])])
AS_IF([test "x$gld_cv_func_CPU_ALLOC" = xyes],
[AC_DEFINE([DYN_PROC_AFFINITY],[1],
["Check for existence of dynamic proc functions"])])
GLD_GET_NPROCS
# Check for the Linux functions for controlling processor affinity.
# LINUX: sched_setaffinity
# AIX: bindprocessor
# OSX (Leopard): thread_policy_set
AC_CHECK_FUNCS([sched_setaffinity])
AC_CHECK_FUNCS([sched_getaffinity])
AC_CHECK_FUNCS([bindprocessor])
AC_CHECK_FUNCS([thread_policy_set])
AC_CACHE_CHECK([whether cpu_set_t available],
[gld_cv_have_cpu_set_t],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sched.h>]],
[[cpu_set_t t;]])],
[gld_cv_have_cpu_set_t=yes],
[gld_cv_have_cpu_set_t=no])])
AS_IF([test "$gld_cv_have_cpu_set_t" = "yes"],
[AC_DEFINE([HAVE_CPU_SET_T], [1],
[Define if cpu_set_t is defined in sched.h])])
AC_CACHE_CHECK([whether the CPU_SET and CPU_ZERO macros are defined],
[gld_cv_cpu_set_defined],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <sched.h>]],
[[cpu_set_t t; CPU_ZERO(&t); CPU_SET(1,&t);]])],
[gld_cv_cpu_set_defined=yes],
[gld_cv_cpu_set_defined=no])])
AS_IF([test "$gld_cv_cpu_set_defined" = "yes"],
[AC_DEFINE([HAVE_CPU_SET_MACROS], [1],
[Define if CPU_SET and CPU_ZERO defined])])
AC_CACHE_CHECK([whether thread affinity macros defined],
[gld_cv_have_thread_affinity_policy],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <mach/thread_policy.h>]],
[[
#if !defined(THREAD_AFFINITY_POLICY) || !defined(THREAD_AFFINITY_TAG_NULL)
:'thread macros not defined
#endif
]],
[gld_cv_have_thread_affinity_policy=yes],
[gld_cv_have_thread_affinity_policy=no])])])
AS_IF([test "$gld_cv_have_thread_affinity_policy" = "yes"],
[AC_DEFINE([HAVE_OSX_THREAD_AFFINITY], [1],
[Define is the OSX thread affinity policy macros defined])])
#--------------------------------------
# Checks for C++ libraries.
#--------------------------------------
# Check for xerces
unset XERCES_VERSION
AX_LIB_XERCES([2.7])
AM_CONDITIONAL([MISSING_XERCES], [test x$HAVE_XERCES != xyes])
AC_SUBST([HAVE_XERCES])
# Check for CppUnit
AM_PATH_CPPUNIT([1.12], [HAVE_CPPUNIT=yes], [HAVE_CPPUNIT=no])
AS_IF([test x"$HAVE_CPPUNIT" = xyes],
[AC_MSG_CHECKING([if compiler can link libcppunit])
SAVED_CXXFLAGS="$CXXFLAGS"
SAVED_LIBS="$LIBS"
CXXFLAGS="$CXXFLAGS $CPPUNIT_CFLAGS"
LIBS="$LIBS $CPPUNIT_LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <cppunit/extensions/TestFactoryRegistry.h>]],
[[CppUnit::TestFactoryRegistry::getRegistry();]])],
[],
[HAVE_CPPUNIT=no])
CXXFLAGS="$SAVED_CXXFLAGS"
LIBS="$SAVED_LIBS"
AC_MSG_RESULT([$HAVE_CPPUNIT])])
AS_IF([test x"$HAVE_CPPUNIT" = xyes],
[# CppUnit doesn't separate its flags appropriately
COMBINED_CPPUNIT_FLAGS="$CPPUNIT_CFLAGS $CPPUNIT_LIBS"
CPPUNIT_CFLAGS=
CPPUNIT_LIBS=
GLD_FLAG_PARSE([COMBINED_CPPUNIT_FLAGS],
[CPPUNIT_LIBS], [CPPUNIT_LDFLAGS], [CPPUNIT_CPPFLAGS])],
[GLD_CPPFLAGS="$GLD_CPPFLAGS -D_NO_CPPUNIT"])
AC_SUBST([CPPUNIT_CPPFLAGS])
AC_SUBST([CPPUNIT_LDFLAGS])
AC_SUBST([CPPUNIT_LIBS])
# Check for Framework for Network Co-Simulation (FNCS)
AC_ARG_WITH([fncs],
[AS_HELP_STRING([--with-fncs],
[Link to FNCS from the given prefix (=path) @<:@default=no@:>@])],
[],
[with_fncs=no])
AS_CASE([$with_fncs],
[yes], [],
[no], [],
[GLD_FLAG_PARSE([with_fncs],
[FNCS_LIBS],
[FNCS_LDFLAGS],
[FNCS_CPPFLAGS])])
gld_save_LIBS="$LIBS"; LIBS="$LIBS $FNCS_LIBS"
gld_save_LDFLAGS="$LDFLAGS"; LDFLAGS="$LDFLAGS $FNCS_LDFLAGS"
gld_save_CPPFLAGS="$CPPFLAGS"; CPPFLAGS="$CPPFLAGS $FNCS_CPPFLAGS"
# add libfncs to FNCS_LIBS if missing
AS_CASE([$FNCS_LIBS],
[*lfncs*], [], [FNCS_LIBS="$FNCS_LIBS -lfncs"])
AS_CASE([$LIBS],
[*lfncs*], [], [LIBS="$LIBS -lfncs"])
# add libczmq to FNCS_LIBS if missing
AS_CASE([$FNCS_LIBS],
[*lczmq*], [], [FNCS_LIBS="$FNCS_LIBS -lczmq"])
AS_CASE([$LIBS],
[*lczmq*], [], [LIBS="$LIBS -lczmq"])
# add libzmq to FNCS_LIBS if missing
AS_CASE([$FNCS_LIBS],
[*lzmq*], [], [FNCS_LIBS="$FNCS_LIBS -lzmq"])
AS_CASE([$LIBS],
[*lzmq*], [], [LIBS="$LIBS -lzmq"])
have_fncs=yes
AC_MSG_CHECKING([for FNCS])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include<fncs.hpp>
]],
[[
fncs::time t;
fncs::initialize();
]])],
[have_fncs=yes; have_fncs_int=1],
[have_fncs=no; have_fncs_int=0])
LIBS="$gld_save_LIBS"
LDFLAGS="$gld_save_LDFLAGS"
CPPFLAGS="$gld_save_CPPFLAGS"
AC_SUBST([FNCS_LIBS])
AC_SUBST([FNCS_LDFLAGS])
AC_SUBST([FNCS_CPPFLAGS])
AC_MSG_RESULT([$have_fncs])
AC_DEFINE_UNQUOTED([HAVE_FNCS], [$have_fncs_int], [whether FNCS was found])
AM_CONDITIONAL([HAVE_FNCS], [test "x$have_fncs" = xyes])
AC_SUBST([GLD_CPPFLAGS])
AC_LANG_POP([C++])
###############################################################################
# Libtool
###############################################################################
AC_MSG_NOTICE
AC_MSG_NOTICE([Libtool])
AC_MSG_NOTICE
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
LT_PREREQ([2.2])
LT_INIT([dlopen win32-dll shared disable-static])
AC_SUBST([LIBTOOL_DEPS])
AS_CASE([$host_os],
[darwin*],
[LIBEXT=.so],
[cygwin*],
[LIBEXT=.a],
[mingw*],
[LIBEXT=.dll],
[LIBEXT=.so
GLD_LDFLAGS="$GLD_LDFLAGS -Wl,--no-undefined"])
AC_DEFINE_UNQUOTED([DLEXT], ["$LIBEXT"], [Dynamic library extension])
AC_SUBST([LIBEXT])
AC_SUBST([GLD_LDFLAGS])
AC_SUBST([GLD_LIBS])
###############################################################################
# Checks for additional programs.
###############################################################################
AC_MSG_NOTICE
AC_MSG_NOTICE([Checks for additional programs])
AC_MSG_NOTICE
AC_PROG_AWK
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
DX_INIT_DOXYGEN([gridlabd], [['$(top_srcdir)/doxygen/gridlabd.conf']])
DX_HTML_FEATURE([ON])
DX_CHM_FEATURE([OFF])
DX_CHI_FEATURE([OFF])
DX_MAN_FEATURE([OFF])
DX_RTF_FEATURE([OFF])
DX_XML_FEATURE([OFF])
DX_PDF_FEATURE([OFF])
DX_PS_FEATURE([OFF])
AS_IF([test -n "$DX_DOXYGEN"],
[HAVE_DOXYGEN="$DX_DOXYGEN"],
[HAVE_DOXYGEN=no])
# Check for Matlab
AC_ARG_WITH([matlab],
[AS_HELP_STRING([--with-matlab],
[Link to MATLAB from a given prefix (=path) @<:@default=no@:>@])],
[],
[with_matlab=no])
MATLAB=$with_matlab
AS_CASE([$with_matlab],
[yes], [],
[no], [],)
AS_IF([test "x$MATLAB" != "xno"],
[MATLAB_CPPFLAGS="'-I$MATLAB/extern/include'"
AS_CASE([$host],
[*linux*], [AS_CASE([$build_cpu],
[*x86_64*], [MATLAB_LDFLAGS="'-L$MATLAB/bin/glnxa64' '-L$MATLAB/extern/lib/glnxa64'"],
[*i686*], [MATLAB_LDFLAGS="'-L$MATLAB/bin/glnx86' '-L$MATLAB/extern/lib/glnx86'"])],
[*darwin*], [AS_CASE([$build_cpu],
[*x86_64*], [MATLAB_LDFLAGS="'-L$MATLAB/bin/maci64' '-L$MATLAB/extern/lib/maci64'"],
[*i686*], [MATLAB_LDFLAGS="'-L$MATLAB/bin/macx86' '-L$MATLAB/extern/lib/macx86'"])],
[*mingw*], [AS_CASE([$build_cpu],
[*x86_64*], [MATLAB_LDFLAGS="'-L$MATLAB/bin/win64' '-L$MATLAB/extern/lib/win64/microsoft'"],
[*i686*], [MATLAB_LDFLAGS="'-L$MATLAB/bin/win32' '-L$MATLAB/extern/lib/win32/microsoft'"])])
MATLAB_LIBS="-lmx -leng"
GLD_CPPFLAGS="$GLD_CPPFLAG -DHAVE_MATLAB"
HAVE_MATLAB=yes],
[HAVE_MATLAB=no])
AC_SUBST([MATLAB_CPPFLAGS])
AC_SUBST([MATLAB_LDFLAGS])
AC_SUBST([MATLAB_LDPATH])
AC_SUBST([MATLAB_LIBS])
# Check for MinGW
AS_IF([test "x$mingw" = "xtrue"],
[HAS_MINGW=yes],
[AS_CASE([$host],
[*linux*], [HAS_MINGW=no],
[*darwin*], [HAS_MINGW=no],
[*mingw*], [HAS_MINGW="no (required)"])])
AC_SUBST([HAS_MINGW])
# Check for mysql
AC_ARG_WITH([mysql],
[AS_HELP_STRING([--with-mysql],
[Link to MySQL from a given prefix (=path)])],
[],
[with_mysql=no])
MYSQL=$with_mysql
AS_IF([test "x$MYSQL" != "xno"],
[MYSQL_CPPFLAGS="'-I$MYSQL/include'"
AS_CASE([$host],
[*mingw*], [MYSQL_LDFLAGS="'-L$MYSQL/lib'"
MYSQL_LIBS="-lmysql"],
[*linux*], [MYSQL_LDFLAGS="'-L$MYSQL/lib'"
MYSQL_LIBS="-lmysqlclient"],
[*darwin*], [MYSQL_LDFLAGS="'-L$MYSQL/lib'"
MYSQL_LIBS="-lmysqlclient"])
GLD_CPPFLAGS="$GLD_CPPFLAGS -DHAVE_MYSQL"
HAVE_MYSQL=yes],
[HAVE_MYSQL=no])
AC_SUBST([MYSQL_CPPFLAGS])
AC_SUBST([MYSQL_LDFLAGS])
AC_SUBST([MYSQL_LIBS])
###############################################################################
# The End
###############################################################################
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([gridlabd.spec])
AC_CONFIG_FILES([gldcore/gridlabd], [chmod +x gldcore/gridlabd])
AC_OUTPUT
BINDIR=`eval echo $(eval echo $bindir)`
LIBDIR=`eval echo $(eval echo $libdir)`
DOCDIR=`eval echo $(eval echo $docdir)`
AS_IF([test "x$HAVE_XERCES" = xyes],
[CONFIG_RESULT=OK
AS_IF([test -z "$XERCES_VERSION" || expr "$XERCES_VERSION" \< 3 >/dev/null],
[AC_MSG_WARN([libxerces-c version $XERCES_VERSION])
AC_MSG_WARN([may not be suitable for building $PACKAGE])])],
[CONFIG_RESULT=failed
HAVE_XERCES="$HAVE_XERCES (required)"
AC_MSG_WARN([missing libxerces-c; build will fail until dependency is met])])
AC_MSG_RESULT([
-----------------------------------------------------------------------
$PACKAGE $VERSION: Automatic configuration $CONFIG_RESULT.
Dependencies:
MinGW: ...................... $HAS_MINGW
Doxygen: .................... $HAVE_DOXYGEN
libcppunit: ................. $HAVE_CPPUNIT
libxerces-c: ................ $HAVE_XERCES
matlab: ..................... $HAVE_MATLAB
mysql-connector-c: .......... $HAVE_MYSQL
curses: ..................... $HAVE_CURSES
Atomic Builtins:
__sync_bool_compare_and_swap: $HAVE_SYNC_BOOL_COMPARE_AND_SWAP
__sync_add_and_fetch: ....... $HAVE_SYNC_ADD_AND_FETCH
Installation paths:
Scripts: .................... $BINDIR
Libraries: .................. $LIBDIR/$PACKAGE
Documentation: .............. $DOCDIR
Building:
type 'make' to compile $PACKAGE.
type 'make install' to install $PACKAGE in $prefix.
-----------------------------------------------------------------------
])