generated from arras-energy/gridlabd-old
-
Notifications
You must be signed in to change notification settings - Fork 5
/
configure.ac
712 lines (610 loc) · 21.7 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
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
# File: configure.ac -*- Autoconf -*-
#
# GridLAB-D 4.0
# Copyright (C) 2008-2019 Battelle Memorial Institute
#
# HiPAS GridLAB-D 4.2
# Copyright (C) 2020-2022 Regents of the Leland Stanford Junior University
#
# Arras Energy 4.3
# Copyright (C) 2023- LF Energy
#
# Authors:
# DP Chassin (dchassin@slac.stanford.edu)
#
# 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 <e...@byu.net>
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([pkg], sbuild_m4_esyscmd_s([build-aux/version.sh --package]))
m4_define([pkgname], sbuild_m4_esyscmd_s([build-aux/version.sh --package-name]))
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([gitversion], sbuild_m4_esyscmd_s([build-aux/version.sh --git]))
m4_define([versionname], sbuild_m4_esyscmd_s([build-aux/version.sh --name]))
m4_define([pkginstall], sbuild_m4_esyscmd_s([build-aux/version.sh --install]))
m4_define([pkgorigin],sbuild_m4_esyscmd_s([git rev-parse --abbrev-ref HEAD]))
# Set minimum autoconf version, cannot be conditional
# Build.sh will handle validation of later version for Darwin 23 and later
AC_PREREQ([2.71])
AC_INIT([pkgname],[pkgversion],[gridlabd@gmail.com],[pkg])
AC_CONFIG_SRCDIR([source/gridlabd.h])
AC_CONFIG_HEADERS([source/config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
###############################################################################
# Init automake
###############################################################################
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall])
AM_SILENT_RULES([yes])
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_ORIGIN, pkgorigin)
AC_SUBST(PACKAGE_REVISION, gitversion)
AC_PREFIX_DEFAULT(pkginstall)
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])
###############################################################################
# C compiler
###############################################################################
AC_MSG_NOTICE
AC_MSG_NOTICE([C compiler])
AC_MSG_NOTICE
: ${CFLAGS="-Wall"}
: ${CXXFLAGS="-Wall"}
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS # 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 (some features are disabled)"])
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([assert.h])
AC_CHECK_HEADERS([ctype.h])
AC_CHECK_HEADERS([curl/curl.h])
AC_CHECK_HEADERS([direct.h])
AC_CHECK_HEADERS([dirent.h])
AC_CHECK_HEADERS([errno.h])
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([float.h])
AC_CHECK_HEADERS([inttypes.h])
AC_CHECK_HEADERS([io.h])
AC_CHECK_HEADERS([limits.h])
AC_CHECK_HEADERS([list])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([math.h])
AC_CHECK_HEADERS([memory.h])
AC_CHECK_HEADERS([netdb.h])
AC_CHECK_HEADERS([netinet/in.h])
AC_CHECK_HEADERS([process.h])
AC_CHECK_HEADERS([pthread.h])
AC_CHECK_HEADERS([pwd.h])
AC_CHECK_HEADERS([sched.h])
AC_CHECK_HEADERS([setjmp.h])
AC_CHECK_HEADERS([signal.h])
AC_CHECK_HEADERS([stdarg.h])
AC_CHECK_HEADERS([stddef.h])
AC_CHECK_HEADERS([stdint.h])
AC_CHECK_HEADERS([stdio.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([string])
AC_CHECK_HEADERS([sys/errno.h])
AC_CHECK_HEADERS([sys/ioctl.h])
AC_CHECK_HEADERS([sys/param.h])
AC_CHECK_HEADERS([sys/select.h])
AC_CHECK_HEADERS([sys/signal.h])
AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_HEADERS([sys/stat.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([sys/timeb.h])
AC_CHECK_HEADERS([sys/types.h])
AC_CHECK_HEADERS([sys/unistd.h])
AC_CHECK_HEADERS([time.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([vector])
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
m4_warn([obsolete],
[The preprocessor macro `STDC_HEADERS' is obsolete.
Except in unusual embedded environments, you can safely include all
ISO C90 headers unconditionally.])dnl
# Autoupdate added the next two lines to ensure that your configure
# script's behavior did not change. They are probably safe to remove.
AC_CHECK_INCLUDES_DEFAULT
AC_PROG_EGREP
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_OFF_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.
#--------------------------------------
AC_CHECK_TYPES([ptrdiff_t])
#--------------------------------------
# Checks for C++ library functions.
#--------------------------------------
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_FSEEKO
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_STRFTIME
AC_FUNC_STRTOD
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([alarm])
AC_CHECK_FUNCS([atexit])
AC_CHECK_FUNCS([bzero])
AC_CHECK_FUNCS([dup2])
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([localeconv])
AC_CHECK_FUNCS([memchr])
AC_CHECK_FUNCS([memmove])
AC_CHECK_FUNCS([memset])
AC_CHECK_FUNCS([mkdir])
AC_CHECK_FUNCS([modf])
AC_CHECK_FUNCS([munmap])
AC_CHECK_FUNCS([pow])
AC_CHECK_FUNCS([putenv])
AC_CHECK_FUNCS([rmdir])
AC_CHECK_FUNCS([select])
AC_CHECK_FUNCS([setenv])
AC_CHECK_FUNCS([socket])
AC_CHECK_FUNCS([sqrt])
AC_CHECK_FUNCS([strcasecmp])
AC_CHECK_FUNCS([strchr])
AC_CHECK_FUNCS([strcspn])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([strerror])
AC_CHECK_FUNCS([strndup])
AC_CHECK_FUNCS([strpbrk])
AC_CHECK_FUNCS([strrchr])
AC_CHECK_FUNCS([strspn])
AC_CHECK_FUNCS([strstr])
AC_CHECK_FUNCS([strtol])
AC_CHECK_FUNCS([strtoul])
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.
#--------------------------------------
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_SET_OPTION([LT_INIT],[dlopen])
m4_warn([obsolete],[AC_LIBTOOL_DLOPEN: Remove this warning and the call to _LT_SET_OPTION when you
put the 'dlopen' option into LT_INIT's first parameter.])
LT_INIT
AC_PROG_RANLIB # (DPC 2019-09-15) don't remove this, doing so will cause a warning in autoscan instead of autoreconf
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(pkg, [['$(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 ($($DX_DOXYGEN --version))"],
[HAVE_DOXYGEN=no])
AM_CONDITIONAL([HAVE_DOXYGEN], [test ! "x$HAVE_DOXYGEN" = "xno"])
# Check for mysql_config tool
AC_PATH_PROG(MYSQL_CONFIG, mysql_config, no)
AS_IF([test "x$MYSQL_CONFIG" = "xno"],
[MYSQL="no"
AC_MSG_WARN([mysql_config not found - MySQL support will be disabled])],
[MYSQL="yes"])
AS_IF([test "x$MYSQL" != "xno"],
[
# Use mysql_config to get include and library directories
MYSQL_CPPFLAGS="$(mysql_config --cflags) -DHAVE_MYSQL"
MYSQL_LDFLAGS=$(mysql_config --libs)
MYSQL_LIBS=$(mysql_config --libs)
HAVE_MYSQL=yes
GLD_CPPFLAGS="$GLD_CPPFLAGS -DHAVE_MYSQL"
# Define HAVE_MYSQL
AC_DEFINE([HAVE_MYSQL], [1], [Define when you have MySQL])
# Add brew paths for Darwin systems
AS_CASE([$host_os],
[darwin*], [
BREW_PREFIX=$(brew --prefix)
MYSQL_LDFLAGS="$MYSQL_LDFLAGS -L${BREW_PREFIX}/opt/openssl/lib -L${BREW_PREFIX}/lib"
MYSQL_CPPFLAGS="$MYSQL_CPPFLAGS -I${BREW_PREFIX}/opt/openssl/include -I${BREW_PREFIX}/include"
])
],
[HAVE_MYSQL=no])
AC_SUBST([MYSQL_CPPFLAGS])
AC_SUBST([MYSQL_LDFLAGS])
AC_SUBST([MYSQL_LIBS])
AM_CONDITIONAL([HAVE_MYSQL], [test ! "x$HAVE_MYSQL" = "xno"])
# check for mono
AS_IF([test -z "$(which mono)" ],
[HAVE_MONO="no"],
[HAVE_MONO="$(which mono) ($(mono --version | head -n 1 | cut -f5 -d' '))"])
AM_CONDITIONAL([HAVE_MONO], [test ! "x$HAVE_MONO" = "xno"])
# check for naturaldocs
AS_IF([test -z "$(which naturaldocs)" ],
[HAVE_NATURALDOCS="no"],
[HAVE_NATURALDOCS="$(which naturaldocs) ($(naturaldocs --version))"])
AM_CONDITIONAL([HAVE_NATURALDOCS], [test ! "x$HAVE_NATURALDOCS" = "xno"])
# check for AWS
AS_IF([test -z "$(which aws)" ],
[HAVE_AWSCLI="no"],
[HAVE_AWSCLI="$(which aws) ($(aws --version | cut -f1 -d' ' | cut -f2 -d/))"])
AM_CONDITIONAL([HAVE_AWSCLI], [test ! "x$HAVE_AWSCLI" = "xno"])
AS_IF([test -z "$(which gcloud)" ],
[HAVE_GCPCLI="no"],
[HAVE_GCPCLI="$(which gcloud) ($(gcloud --version | head -n 1 | cut -f4 -d' '))"])
AM_CONDITIONAL([HAVE_GCPCLI], [test ! "x$HAVE_GCPCLI" = "xno"])
AS_IF([test -z "$(which az)" ],
[HAVE_AZCLI="no"],
[HAVE_AZCLI="$(which az) ($(echo $(az --version 2>/dev/null | head -n 1) | cut -f2 -d' '))"])
AM_CONDITIONAL([HAVE_AZCLI], [test ! "x$HAVE_AZCLI" = "xno"])
AS_IF([test -z "$(which git)" ],
[HAVE_GIT="no"],
[HAVE_GIT="$(which git) ($(git --version | cut -f3 -d' '))"])
AM_CONDITIONAL([HAVE_GIT], [test ! "x$HAVE_GIT" = "xno"])
BRANCHNAME=$(git rev-parse --abbrev-ref HEAD)
AM_CONDITIONAL([IS_MASTER],[test "x$BRANCHNAME" = "xmaster"])
AM_CONDITIONAL([IS_DEVELOP],[test "x$BRANCHNAME" = "xdevelop"])
AS_CASE([$BRANCHNAME],
[master], [SUFFIX=""],
[develop*], [SUFFIX="-dev"],
[*], [SUFFIX="no"])
AM_CONDITIONAL([SUFFIX],[test ! "x$SUFFIX" = "xno"] )
AC_ARG_WITH([prefix], [AS_HELP_STRING([--with-prefix=PREFIX], [install architecture-independent files in PREFIX])], [prefix="$withval"], [prefix="/usr/local/opt/gridlabd"])
if test "x$prefix" = "xNONE"; then
prefix="/usr/local/opt/gridlabd"
fi
PREFIX=$prefix
DSTDIR=$PREFIX/versionname
prefix=$DSTDIR
BINDIR=$DSTDIR/bin
LIBDIR=$DSTDIR/lib/gridlabd
ETCDIR=$DSTDIR/share/gridlabd
DOCDIR=$DSTDIR/share/doc/gridlabd
#
# Python virtual environment check
#
PYTHON_REQ=3.10
if test "x$VIRTUAL_ENV" = "x"; then
if test -f $HOME/.gridlabd/bin/activate; then
echo "ERROR: python$PYTHON_REQ virtual environment not active. You must run '. ~/.gridlabd/bin/activate' first"
exit 1
else
echo "ERROR: python$PYTHON_REQ virtual environment not found. You must run 'python$PYTHON_REQ -m venv ~/.gridlabd' first"
exit 1
fi
fi
AM_PATH_PYTHON([$PYTHON_REQ])
PYTHON=$(which python$PYTHON_REQ)
HAVE_PYTHON="$($PYTHON --version | cut -f2 -d' ')"
AM_CONDITIONAL([HAVE_PYTHON], [test ! "x$HAVE_PYTHON" = "xno"])
AS_IF([test "x$HAVE_PYTHON" != "xno" -a "$(uname)" == "Darwin" ],
[PYTHON_LIB="-lpython${PYTHON_REQ} -shared -Wl-undefined,dynamic_lookup"],
[PYTHON_LIB="-lpython${PYTHON_REQ}"])
PYTHONCONFIG=$PYTHON-config
if test ! -f "$PYTHONCONFIG"; then
PYTHONCONFIG=$(which python$PYTHON_REQ-config)
if test ! -f "$PYTHONCONFIG"; then
echo "ERROR: python$PYTHON_REQ-config not found. Did you install python$PYTHON_REQ-dev?"
exit 1
fi
fi
###############################################################################
# The End
###############################################################################
AC_MSG_RESULT([
-----------------------------------------------------------------------
Arras Energy Automatic configuration:
Package: .................... $PACKAGE
Version: .................... $VERSION
Branch: ..................... $PACKAGE_ORIGIN
Install prefix: ............. ${DSTDIR/^$PWD/.}
Python binary: .............. $PYTHON
Python config: .............. $PYTHONCONFIG
Dependencies:
ncurses: .................... $HAVE_CURSES
python: ..................... $HAVE_PYTHON
mysql-connector-c: .......... $HAVE_MYSQL
Doxygen: .................... $HAVE_DOXYGEN
Mono: ....................... $HAVE_MONO
Natural docs: ............... $HAVE_NATURALDOCS
Atomic Builtins:
__sync_bool_compare_and_swap: $HAVE_SYNC_BOOL_COMPARE_AND_SWAP
__sync_add_and_fetch: ....... $HAVE_SYNC_ADD_AND_FETCH
Build flags:
CFLAGS: ..................... ${CFLAGS:-(none)}
CXXFLAGS: ................... ${CXXFLAGS:-(none)}
LDFLAGS: .................... ${LDFLAGS:-(none)}
Installation paths:
Scripts: .................... ${BINDIR/^$PWD/.}
Libraries: .................. ${LIBDIR/^$PWD/.}
Data: ....................... ${ETCDIR/^#PWD/.}
Documentation: .............. ${DOCDIR/^$PWD/.}
Building:
type 'make' to compile $PACKAGE.
type 'make install' to install $PACKAGE in ${DSTDIR/^$PWD/.}.
type 'make system' to install $PACKAGE as set system version
Cloud support:
AWS CLI: .................... $HAVE_AWSCLI
GCP CLI: .................... $HAVE_GCPCLI
Azure CLI: .................. $HAVE_AZCLI
Some useful commands:
To add $PACKAGE to your path:
export PATH=$DSTDIR/bin:\$PATH
To check that your running the current version of $PACKAGE:
$PACKAGE --version
To set this $PACKAGE version $VERSION as the system version:
$DSTDIR/bin/$PACKAGE version set
-----------------------------------------------------------------------
])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([gridlabd.spec])
AC_CONFIG_FILES([source/gridlabd], [chmod +x source/gridlabd])
AC_OUTPUT