This repository has been archived by the owner on May 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
/
configure.ac
931 lines (806 loc) · 28.8 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
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([OMCompiler],[dev],[https://trac.openmodelica.org/OpenModelica],[openmodelica],[https://openmodelica.org])
AC_SUBST(date)
AC_SUBST(host_short)
AC_SUBST(omc_antlr_jar)
AC_SUBST(antlrinc)
AC_SUBST(antlrlib)
AC_SUBST(with_paradiseo)
AC_SUBST(with_paradiseo_include)
AC_SUBST(with_paradiseo_lib)
AC_SUBST(with_qwt)
AC_SUBST(with_qwt_suffix)
AC_SUBST(CONFIGURE_ARGS)
AC_SUBST(CHECK_C_ERRORS)
AC_SUBST(EXTRA_CFLAGS_GENERATED_CODE)
AC_SUBST(HAVE_GETTEXT)
AC_SUBST(LIBSOCKET)
AC_SUBST(LIBNSL)
AC_SUBST(LIBLPSOLVE55)
AC_SUBST(NO_LPLIB)
AC_SUBST(LPSOLVEINC)
AC_SUBST(OPENCL)
AC_SUBST(USE_GRAPH)
AC_SUBST(USE_METIS)
AC_SUBST(USE_PATOH)
AC_SUBST(GRAPHLIB)
AC_SUBST(GENERATED_AUTOCONF_FILES)
AC_SUBST(RT_LDFLAGS)
AC_SUBST(RT_LDFLAGS_OPTIONAL)
AC_SUBST(RT_LDFLAGS_SIM)
AC_SUBST(RT_LDFLAGS_SIM_OPTIONAL)
AC_SUBST(RT_LDFLAGS_GENERATED_CODE)
AC_SUBST(RT_LDFLAGS_GENERATED_CODE_SIM)
AC_SUBST(RT_LDFLAGS_GENERATED_CODE_SOURCE_FMU)
AC_SUBST(RT_LDFLAGS_SHARED)
AC_SUBST(OMCRUNTIME_SHARED_LDFLAGS)
AC_SUBST(SUNDIALS_LDFLAGS)
AC_SUBST(SUNDIALS_TARGET)
AC_SUBST(IPOPT_LDFLAGS)
AC_SUBST(IPOPT_CFLAGS)
AC_SUBST(IPOPT_TARGET)
AC_SUBST(QMAKE)
AC_SUBST(EXE)
AC_SUBST(SOURCE_REVISION)
AC_SUBST(OMSHELL_TERMINAL)
AC_SUBST(MODELICA_SPEC_PLATFORM)
AC_SUBST(OPENMODELICA_SPEC_PLATFORM)
AC_SUBST(OMC_LIBS)
AC_SUBST(OMPCFLAGS)
AC_SUBST(RUNTIMECC)
AC_SUBST(RUNTIMECFLAGS)
AC_SUBST(MAKE)
AC_SUBST(LD_LAPACK)
AC_SUBST(NO_LAPACK)
AC_SUBST(WITH_UMFPACK)
AC_SUBST(UMFPACK_TARGET)
AC_SUBST(UMFPACK_LDFLAGS)
AC_SUBST(OMNOTEBOOK)
AC_SUBST(FPMATHFORTRAN)
AC_SUBST(OMOPTIM_CC)
AC_SUBST(OMOPTIM_CXX)
AC_SUBST(LIBGC)
AC_SUBST(LIBSIMULATION)
AC_SUBST(LIBRUNTIME)
AC_SUBST(LIBFMIRUNTIME)
AC_SUBST(LIBFMILIB)
AC_SUBST(WITH_FMIL)
AC_SUBST(NO_FMIL)
AC_SUBST(FMILIB_SHARED)
AC_SUBST(LIBCMINPACKLIB)
AC_SUBST(LIBZMQLIB)
AC_SUBST(CMINPACKLIB_SHARED)
AC_SUBST(SHREXT)
AC_SUBST(LINK)
AC_SUBST(RPATH)
AC_SUBST(RPATH_QMAKE)
AC_SUBST(MSL_EXTRA_ARGS)
AC_SUBST(WITH_HWLOC)
AC_SUBST(WITH_UUID)
AC_SUBST(OS_TARGET)
AC_SUBST(LIS_LDFLAGS)
AC_SUBST(LAPACK_TARGET)
AC_SUBST(CONFIG_WITH_OPENMP)
AC_SUBST(OPENBLAS_EXTRA_ARGS)
AC_SUBST(AR)
AC_SUBST(AR_SH)
AC_SUBST(LDFLAGS_SOCKET)
AC_SUBST(OMC)
AC_SUBST(OMCTARGET)
AC_SUBST(BOOTSTRAP_STATIC)
AC_SUBST(LIBDL)
AC_SUBST(LIBDL)
AC_SUBST(BOOST_INCLUDE)
AC_SUBST(LDFLAGS_LIBSTDCXX)
AC_SUBST(CPP_RUNTIME_ARGS)
AC_SUBST(OMENCRYPTION)
AC_SUBST(MINGW_EXTRA_LIBS)
AC_SUBST(BSTATIC)
FINAL_MESSAGES="\nConfigured OpenModelica successfully using the following options:"
m4_include([common/m4/pre-commit.m4])
cp common/install-sh common/config.guess common/config.sub ./
m4_include([common/m4/ombuilddir.m4])
m4_include([m4/lapack.m4])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
build_short=$build_cpu-$build_os
host_short=$host_cpu-$host_os
echo "build_short: $build_short"
echo "host_short: $host_short"
AS_IF([test "x$with_UMFPACK" = xyes],
[
FINAL_MESSAGES="$FINAL_MESSAGES\nSimulations may use UMFPACK: Yes"
UMFPACK_TARGET="umfpack";
WITH_UMFPACK="#define WITH_UMFPACK"
UMFPACK_LDFLAGS="-lumfpack -lklu -lbtf -lcolamd -lamd"
],[
FINAL_MESSAGES="$FINAL_MESSAGES\nSimulations may use UMFPACK: No"
UMFPACK_TARGET="";
WITH_UMFPACK="/* Without UMFPACK */"
UMFPACK_LDFLAGS=""
])
if echo $host | grep -i darwin; then
DARWIN=1
else
DARWIN=0
fi
if test -z "$AR"; then
AR=ar
fi
if test -z "$MAKE"; then
MAKE=make
fi
dnl Disables the default CXXFLAGS="-g -O2"
if test -z "$CXXFLAGS"; then
CXXFLAGS=""
fi
AC_ARG_ENABLE(non-free-packages, [ --enable-non-free-packages Enables you to link non-free packages. But doing so limits your ability to distribute code under GPL3, even to co-workers and the like. If you are an OSMC member you might be allowed to link and ship such libraries if you have a commercial license for the linked packages.],[test "yes" = "$enableval" && ENABLE_NON_FREE_PACKAGES=1 && NON_FREE_VERSION=") (non-free version for personal use only; seriously do not distribute this binary"] && FINAL_MESSAGES="$FINAL_MESSAGES\nLinking against non-free packages: Yes (this version of omc not for distribution)")
dnl Checks for programs.
AC_LANG([C])
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_MAKE_SET
AC_PROG_FC
AC_ARG_WITH(msys, [ --with-msys[=no] Point to an msys installation, to setup CPPFLAGS, etc automatically.],
[
if echo $host_cpu | grep -q x86_64; then
MINGWNUM=mingw64
else
MINGWNUM=mingw32
fi
CPPFLAGS="$CPPFLAGS -I$withval/$MINGWNUM/include -I$withval/$MINGWNUM/include/tre"
LDFLAGS="$LDFLAGS -L$withval/$MINGWNUM/lib"
echo "Got: $CPPFLAGS"
]
)
CFLAGS_BEFORE="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_MSG_CHECKING([if -Werror works])
AC_TRY_LINK([void abc() {}], [abc();], [AC_MSG_RESULT([ok])], [AC_MSG_ERROR([failed (check your CFLAGS)])])
CFLAGS="$CFLAGS_BEFORE"
dnl Disables the default CFLAGS="-g -O2"
if test -z "$CFLAGS"; then
if test "$DARWIN" = "1"; then
CFLAGS="-O3"
else
CFLAGS_BEFORE="$CFLAGS"
CFLAGS="-O3 -march=native"
AC_MSG_CHECKING([looking for -march=native])
AC_TRY_LINK([void abc() {}], [abc();], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]);CFLAGS="-O3"])
fi
fi
LDFLAGS_BEFORE="$LDFLAGS"
LIBS_BEFORE="$LIBS"
LDFLAGS="$LDFLAGS -Wl,--no-undefined"
AC_MSG_CHECKING([looking for --no-undefined])
AC_TRY_LINK([void abc() {}], [abc();], [AC_MSG_RESULT([yes]);LD_NOUNDEFINED=" -Wl,--no-undefined"], [AC_MSG_RESULT([no])])
LDFLAGS="$LDFLAGS_BEFORE"
LIBS="$LIBS_BEFORE"
TRY_FLAGS="-fno-stack-protector"
if echo $CC | grep -v ccc-analyzer; then # ccc-analyzer calls gcc first and then clang; the CFLAGS need to work in both compilers...
# GCC 5.x generates bad code due to detecting some impure functions as pure
if $CC --version | grep -q gcc && $CC -dumpversion | grep -q "^5"; then
TRY_FLAGS="$TRY_FLAGS -fno-ipa-pure-const"
fi
# GCC 7.x issues:
# - RUNPATH instead of RPATH, disable that via -Wl,--disable-new-dtags
# - sqrt from libcolamd is not found in -lm if -Wl,--no-as-needed is not specified
if $CC --version | grep -q gcc && $CC -dumpversion | grep -q "^7"; then
TRY_FLAGS="$TRY_FLAGS -Wl,--no-as-needed"
RPATH_EXTRA="-Wl,--disable-new-dtags"
fi
fi
AC_MSG_CHECKING([for flags to append to CFLAGS ($TRY_FLAGS)])
for flag in $TRY_FLAGS; do
OLD_CFLAGS="$CFLAGS"
CFLAGS="$RUNTIMECFLAGS $flag -Werror"
AC_TRY_LINK([], [return 0;], [CFLAGS="$OLD_CFLAGS $flag"],[CFLAGS="$OLD_CFLAGS"])
done
AC_MSG_RESULT([$CFLAGS])
OLD_CFLAGS="$CFLAGS"
for flag in -Wno-parentheses-equality -Wno-unused-variable; do
CFLAGS="$RUNTIMECFLAGS $flag -Werror"
AC_TRY_LINK([], [return 0;], [
CHECK_C_ERRORS="$CHECK_C_ERRORS $flag"
EXTRA_CFLAGS_GENERATED_CODE="$EXTRA_CFLAGS_GENERATED_CODE $flag"
],[])
done
for flag in -Werror=implicit-function-declaration -Werror=incompatible-pointer-types; do
CFLAGS="$RUNTIMECFLAGS $flag -Werror"
AC_TRY_LINK([], [return 0;], [
CHECK_C_ERRORS="$CHECK_C_ERRORS $flag"
EXTRA_CFLAGS_GENERATED_CODE="$EXTRA_CFLAGS_GENERATED_CODE $flag"
],[])
done
CFLAGS="$OLD_CFLAGS"
if test ! "$DARWIN" = "1"; then
if test "`getconf LONG_BIT`" = "64"; then
AC_MSG_CHECKING([getconf LONG_BIT = 64 CFLAGS])
if echo $CFLAGS | grep -q -- -fPIC; then
AC_MSG_RESULT([already got -fPIC])
else
CFLAGS_BEFORE="$CFLAGS"
CFLAGS="$CFLAGS -fPIC -Werror"
AC_TRY_LINK([void abc() {}], [abc();], [AC_MSG_RESULT([adding -fPIC]); CFLAGS="$CFLAGS_BEFORE -fPIC"; FPIC="-fPIC"], [AC_MSG_RESULT([does not need -fPIC]); CFLAGS="$CFLAGS_BEFORE"])
fi
else
AC_MSG_CHECKING([getconf LONG_BIT != 64 CFLAGS])
if echo $CFLAGS | grep -q -- -fPIC; then
AC_MSG_RESULT([already got -fPIC])
else
CFLAGS_BEFORE="$CFLAGS"
CFLAGS="$CFLAGS -fPIC -Werror"
AC_TRY_LINK([void abc() {}], [abc();], [AC_MSG_RESULT([adding -fPIC]); CFLAGS="$CFLAGS_BEFORE -fPIC"; FPIC="-fPIC"], [AC_MSG_RESULT([does not need -fPIC]); CFLAGS="$CFLAGS_BEFORE"])
fi
fi
else # Is Darwin
AC_LANG_PUSH([C++])
OLD_CXXFLAGS=$CXXFLAGS
for flag in -stdlib=libstdc++; do
CXXFLAGS="$OLD_CXXFLAGS $flag"
AC_TRY_LINK([], [return 0;], [LDFLAGS_LIBSTDCXX="$flag"],[CXXFLAGS="$OLD_CXXFLAGS"])
done
AC_LANG_POP([C++])
fi
m4_include([common/m4/ax_cxx_compile_stdcxx_11.m4])
HAVE_CXX_STD=0
for flag in $CXXFLAGS; do
(echo $flag | grep -q "^-std=") && HAVE_CXX_STD=1
done
if test "$HAVE_CXX_STD" = 0; then
AX_CXX_COMPILE_STDCXX_11([noext],[optional])
fi
if test "`getconf LONG_BIT`" = "32"; then
dnl Simulations spin forever unless -msse2 -mfpmath=sse is set
CFLAGS_BEFORE=$CFLAGS
CFLAGS="-mfpmath=sse -Werror"
AC_MSG_CHECKING([for floating point bugs])
AC_TRY_LINK([int abc() {}], [abc();], [AC_MSG_RESULT([force SSE2]); FPMATHFORTRAN="-msse -mfpmath=sse"], [AC_MSG_RESULT([no]); FPMATHFORTRAN=-ffloat-store])
CFLAGS=$CFLAGS_BEFORE
fi # End x86-specific CFLAGS
dnl check for environment variables
AC_ARG_WITH(omc, [ --with-omc=[omc] (the installed omc path which we will use to compile omc)],[OMC="$withval"],[OMC=`which omc`])
while test -h "$OMC"; do
OMC=`readlink "$OMC"`
done
AC_MSG_CHECKING([for omc])
if test "$OMC" = "no" ; then
if test "$host" != "$build"; then
AC_MSG_ERROR([cross-compilation attempt detected, but no omc executable was given])
fi
AC_MSG_RESULT([building it through bootstrapping (you might end up unable to recompile omc if you modify source code)])
OMC="$OMBUILDDIR/bin/omc"
elif "$OMC" --version > /dev/null 2>&1; then
AC_MSG_RESULT([$OMC])
else
AC_MSG_RESULT([failed (tried $OMC). Building it through bootstrapping (you might end up unable to recompile omc if you modify source code).])
OMC="$OMBUILDDIR/bin/omc"
fi
dnl Checks for libraries.
if test ! "$DARWIN" = "1" && (! echo $host | grep -q mingw ); then
LIBS=""
AC_SEARCH_LIBS(clock_gettime,rt,[],[AC_MSG_ERROR([clock_gettime missing])])
LIBRT="$LIBS"
LIBS=""
fi
dnl Checks for boost include for Mac.
if test ! "$DARWIN" = "1"; then
if test -f "$prefix/include/boost/array.hpp"; then
BOOST_INCLUDE="-DBOOST_ROOT=$prefix/include/"
else
if test -f "/opt/local/include/boost/array.hpp"; then
BOOST_INCLUDE="-DBOOST_ROOT=/opt/local/include/"
else
BOOST_INCLUDE=""
fi
fi
else
BOOST_INCLUDE=""
fi
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/time.h, [], [AC_MSG_ERROR(Missing header files)])
# AC_CHECK_HEADERS(sqlite3.h, [], [AC_MSG_ERROR(Missing header files)])
AC_MSG_CHECKING([for antlr.Tool support])
mkdir -p "$OMBUILDDIR/share/omc/java"
cp "3rdParty/antlr/3.2/tool/antlr-3.2.jar" "3rdParty/antlr/3.2/tool/antlr-2.7.7.jar" $OMBUILDDIR/share/omc/java/
echo "" > $$grammar.g
if java -cp "$OMBUILDDIR/share/omc/java/antlr-3.2.jar" antlr.Tool $$grammar.g ; then
rm -f $$grammar.g
AC_MSG_RESULT([yes])
else
rm -f $$grammar.g
AC_MSG_ERROR([no antlr.Tool support (JRE not working)])
fi
dnl Misc. headers
AC_CHECK_HEADER(expat.h,,AC_MSG_ERROR([no]))
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(getcwd select strdup strerror)
dnl Check if scandir is available
AC_MSG_CHECKING([for scandir])
AC_TRY_LINK([
#include <dirent.h>
], [
int file_select_directories(const struct dirent *entry) {
return 0;
}
int main() {
char dir[]=".";
int count;
struct dirent **files;
scandir(dir, &files, file_select_directories, 0);
return 0;
}
], [AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_SCANDIR])],
[AC_MSG_RESULT([no])])
dnl Check if OpenMP is available
AC_MSG_CHECKING([for OpenMP])
CONFIG_WITH_OPENMP=0
for OMPCCTEST in "-fopenmp=libomp" "-fopenmp=libiomp5" "-fopenmp"; do
if test "$CONFIG_WITH_OPENMP" = 0; then
CFLAGS_OLD="$CFLAGS"
CFLAGS="$OMPCCTEST"
AC_TRY_LINK([
#if !defined(_OPENMP)
#error "Not an OpenMP compiler"
#endif
#include <omp.h>
#include <stdio.h>
], [
int i;
#pragma omp parallel for private(i) schedule(dynamic)
for (i=0; i<16; i++)
printf("Thread %d doing work %d\n", omp_get_thread_num(), i);
return 0;
], [OMPCFLAGS="$CFLAGS"; CONFIG_WITH_OPENMP=1]
)
CFLAGS="$CFLAGS_OLD"
fi
done
if test "$CONFIG_WITH_OPENMP" = 0; then
AC_MSG_RESULT([no]);
else
AC_MSG_RESULT([$OMPCFLAGS]);
fi
AC_ARG_VAR(RUNTIMECC, [Selects a compiler to be used to compile generated code. It is more important to compile fast than to generate fast code for the runtime compiler.])
AC_ARG_VAR(RUNTIMECFLAGS, [CFLAGS for the selected runtime compiler (defaults to -falign-functions -mfpmath=sse -fno-dollars-in-identifiers -fPIC as long as neither gives warnings to the CC). Note that heavy optimisations may cause the run-time to be faster while increasing compile-time. -O0 is often best.])
CC_OLD="$CC"
CFLAGS_OLD="$CFLAGS"
if test ! -z "$RUNTIMECC"; then
CC="$RUNTIMECC"
else
RUNTIMECC="$CC"
fi
AC_MSG_CHECKING([runtime compiler])
if test -z "$RUNTIMECFLAGS"; then
CFLAGS="$FPIC -Werror"
AC_TRY_LINK([], [return 0;], [AC_MSG_RESULT($CC ok);],[AC_MSG_ERROR($CC failed)])
CFLAGS="$FPIC"
AC_MSG_CHECKING([runtime compiler CFLAGS])
RUNTIMECFLAGS="$FPIC"
for flag in -falign-functions -mfpmath=sse -fno-dollars-in-identifiers; do
CFLAGS="$FPIC $flag -Werror"
AC_TRY_LINK([], [return 0;], [RUNTIMECFLAGS="$RUNTIMECFLAGS $flag"],[])
done
else
CFLAGS="$RUNTIMECFLAGS $FPIC -Werror"
AC_TRY_LINK([], [return 0;], [RUNTIMECFLAGS="$RUNTIMECFLAGS $FPIC"],[AC_MSG_ERROR([$CC $CFLAGS -Werror failed])])
fi
AC_MSG_RESULT([$RUNTIMECFLAGS])
CC="$CC_OLD"
CFLAGS="$CFLAGS_OLD"
LIBS=""
AC_SEARCH_LIBS(dlopen,dl)
LIBDL="$LIBS"
LIBS=""
dnl check for lpsolve55
AC_ARG_WITH(lpsolve, [ --with-lpsolve (default searching for lpsolve; disable if only using omc to cross-compile)],[if test "$withval" = "no"; then NO_LPLIB="#define NO_LPLIB"; fi],[])
if test -z "$NO_LPLIB"; then
echo "NO_LPLIB: '$NO_LPLIB'"
AC_ARG_WITH(static-lpsolve, [ --with-static-lpsolve=DIR (default to dynamic linking; searches /usr if no other directory is provided)],[WANT_STATIC_LPSOLVE="$withval"],[WANT_STATIC_LPSOLVE="no"])
if test "$WANT_STATIC_LPSOLVE" = "no"; then
LIBS=""
AC_SEARCH_LIBS(dlopen,dl)
LIBDL="$LIBS"
AC_SEARCH_LIBS(sqrt,m)
AC_SEARCH_LIBS(colamd,colamd)
AC_SEARCH_LIBS(make_lp,[lpsolve55_pic lpsolve55],[LIBLPSOLVE55=$LIBS],[COMPILE_LPSOLVE=1])
LIBS=""
else
if test "$WANT_STATIC_LPSOLVE" = "yes"; then
LPLIB=/usr/lib;
else
LPLIB=$WANT_STATIC_LPSOLVE/lib
fi
LIBS=""
AC_SEARCH_LIBS(dlopen,dl)
AC_SEARCH_LIBS(sqrt,m)
LIBS="$LPLIB/liblpsolve55_pic.a $LPLIB/libcolamd.a $LIBS"
AC_MSG_CHECKING([for static lpsolve55])
AC_LINK_IFELSE([AC_LANG_CALL([], [make_lp])], [LIBLPSOLVE55=$LIBS], [COMPILE_LPSOLVE="1"])
AC_MSG_RESULT([$LIBLPSOLVE55])
LIBS=""
fi
AC_CHECK_HEADER([lp_lib.h],[LPSOLVEINC=lp_lib.h],[
AC_CHECK_HEADER([lpsolve/lp_lib.h],[LPSOLVEINC=lpsolve/lp_lib.h],[
COMPILE_LPSOLVE=1
])
])
if test "$COMPILE_LPSOLVE" = 1; then
MINGW_EXTRA_LIBS="$MINGW_EXTRA_LIBS lpsolve";
AC_MSG_RESULT([failed to find lpsolve55 headers or library; will compile them ourselves])
LPSOLVEINC="$ac_pwd/3rdParty/lpsolve/build/include/lpsolve/lp_lib.h"
if test "$WANT_STATIC_LPSOLVE" = "yes"; then
LIBLPSOLVE55="-Wl,-Bstatic -llpsolve55 -Wl,-Bdynamic"
else
LIBLPSOLVE55="-llpsolve55"
fi
fi
fi # NO_LPLIB
if ! (echo "$host" | grep -q "mingw"); then
AC_CHECK_FUNC(socket,[LIBSOCKET=""],
[AC_MSG_CHECKING([for libsocket]);
AC_CHECK_LIB(socket, socket,[AC_MSG_RESULT([yes]); LIBSOCKET="-lsocket"],[AC_MSG_ERROR([neither socket nor libsocket.a found])])
])
AC_CHECK_FUNC(gethostbyname,
[LIBNSL=""],
[AC_MSG_CHECKING([for libnsl]);
AC_CHECK_LIB(nsl,gethostbyname, [AC_MSG_RESULT([yes]); LIBNSL="-lnsl"],[AC_MSG_ERROR([neither gethostbyname nor libnsl.a found])])
])
fi
# Sqlite is not used
if false; then
AC_ARG_WITH(static-sqlite, [ --with-static-sqlite=FILE (default to dynamic linking)],[WANT_STATIC_SQLITE="$withval"],[WANT_STATIC_SQLITE="no"])
LIBS=""
AC_CHECK_LIB(sqlite3,sqlite3_libversion,[],[AC_MSG_ERROR([sqlite3 not found])])
if test "$WANT_STATIC_SQLITE" = "no"; then
OMC_LIBS=$LIBS
elif test ! -f "$WANT_STATIC_SQLITE" ; then
AC_ERROR([File not found: $WANT_STATIC_SQLITE])
else
OMC_LIBS=$WANT_STATIC_SQLITE
fi
fi
OMC_AC_LAPACK(RequireFound)
SUNDIALS_LDFLAGS="-lsundials_idas -lsundials_kinsol -lsundials_nvecserial $LD_LAPACK"
FINAL_MESSAGES="$FINAL_MESSAGES\nSimulations may use sundials suite: Yes"
SUNDIALS_TARGET="sundials"
AC_CHECK_HEADERS(locale.h libintl.h,[],[HAVE_GETTEXT="#define NO_GETTEXT 1"])
if test -z "$HAVE_GETTEXT"; then
AC_MSG_CHECKING([gettext linking])
AC_TRY_LINK([
#include <libintl.h>
], [
gettext("");
], [AC_MSG_RESULT([in C-library])],
[
LIBS="-lintl";
AC_TRY_LINK([
#include <libintl.h>
], [
gettext("");
], [AC_MSG_RESULT([in intl]); GETTEXT_LIBS="-lintl"], [HAVE_GETTEXT="#define NO_GETTEXT 1"])
])
LIBS=""
if test -z "$HAVE_GETTEXT$GETTEXT_LIBS"; then
AC_MSG_CHECKING([setlocale linking])
AC_TRY_LINK([
/* Also include libintl.h as MacOS then uses a different setlocale... */
#include <libintl.h>
#include <locale.h>
], [
setlocale(LC_ALL, "");
], [AC_MSG_RESULT([in C-library])],
[
LIBS="-lintl";
AC_TRY_LINK([
/* Also include libintl.h as MacOS then uses a different setlocale... */
#include <libintl.h>
#include <locale.h>
], [
setlocale(LC_ALL, "");
], [AC_MSG_RESULT([in intl]); GETTEXT_LIBS="-lintl"], [AC_MSG_RESULT([no]); HAVE_GETTEXT="#define NO_GETTEXT 1"])
])
fi
if test -z "$HAVE_GETTEXT"; then
RT_LDFLAGS_OPTIONAL="$RT_LDFLAGS_OPTIONAL $GETTEXT_LIBS"
fi
fi
AC_ARG_WITH(hwloc, [ --without-hwloc (default to looking for it)],[
LIBS=""
AC_CHECK_HEADERS(hwloc.h,
[AC_CHECK_LIB(hwloc,hwloc_get_nbobjs_by_depth,
[WITH_HWLOC="1";OMC_LIBS="$OMC_LIBS -lhwloc"],
[WITH_HWLOC="0"])],
[WITH_HWLOC="0"]
)
],[
WITH_HWLOC="0"
])
LIBS=""
AC_CHECK_HEADERS(uuid/uuid.h,
[AC_CHECK_LIB(uuid,uuid_unparse,
[WITH_UUID="#define WITH_LIBUUID 1";OMC_LIBS="$OMC_LIBS -luuid";LIBUUID="-luuid"],
[WITH_UUID="/* Without libuuid */"])],
[WITH_UUID="/* Without libuuid */"]
)
LIBS=""
AC_CHECK_LIB(pthread,pthread_self,[RT_LDFLAGS="$RT_LDFLAGS $LIBS"],[AC_MSG_ERROR([pthreads not found])])
LIBS=""
IPOPT_LDFLAGS="-lipopt -lcoinmumps"
# check for umfpack
AC_ARG_WITH(UMFPACK, [ --without-UMFPACK Disable compilation with UMFPACK, a sparse linear systems solver],
[],[with_UMFPACK=yes])
AS_IF([test "x$with_UMFPACK" = xyes],
[
FINAL_MESSAGES="$FINAL_MESSAGES\nSimulations may use UMFPACK: Yes"
UMFPACK_TARGET="umfpack";
WITH_UMFPACK="#define WITH_UMFPACK"
UMFPACK_LDFLAGS="-lumfpack -lklu -lbtf -lcolamd -lamd"
],[
FINAL_MESSAGES="$FINAL_MESSAGES\nSimulations may use UMFPACK: No"
UMFPACK_TARGET="";
WITH_UMFPACK="/* Without UMFPACK */"
UMFPACK_LDFLAGS=""
])
OLD_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,-Bstatic -Wl,-Bdynamic"
AC_TRY_LINK([], [return 0;], [BSTATIC="true"],[BSTATIC="false"; AC_MSG_RESULT(["Don't know the flags to force static linking"])])
LDFLAGS="$OLD_LDFLAGS"
# check for ipopt
AC_ARG_WITH(ipopt, [ --without-ipopt Disable compilation with IPOPT (only for bootstrapping; required for simulations)],
[],[with_ipopt=yes])
AS_IF([test "x$with_ipopt" = xyes],
[
IPOPT_TARGET="ipopt";
],[
IPOPT_TARGET=""
])
m4_include([common/m4/corba.m4])
AC_MSG_CHECKING([for OpenCL])
AC_CHECK_HEADER([CL/cl.h],[OPENCL="Yes"],[
AC_CHECK_HEADER([OpenCL/cl.h],[OPENCL="Yes"],[OPENCL="No"])
])
FINAL_MESSAGES="$FINAL_MESSAGES\nParModelica: $OPENCL"
AC_SUBST(CMAKE_LDFLAGS_UNDEFINED_LOOKUP)
AC_SUBST(CMAKE_EXTRA_DEFINES)
AC_SUBST(DLLEXT)
AC_SUBST(UMFPACK_SHARED)
AC_SUBST(CONFIG_OS)
if test "$DARWIN" = "1"; then
EXE=""
SHREXT=".dylib"
DLLEXT=".dylib"
LIBGC="$OMBUILDDIR/lib/$host_short/omc/libomcgc.a"
LIBSIMULATION=libSimulationRuntimeC.dylib
LIBRUNTIME=libOpenModelicaRuntimeC.dylib
LIBFMIRUNTIME=libOpenModelicaFMIRuntimeC.dylib
LIBFMILIB=libfmilib_shared.dylib
FMILIB_SHARED=ON
LIBCMINPACKLIB=libcminpack.dylib
LIBZMQLIB=libzmq.dylib
CMINPACKLIB_SHARED=ON
RT_LDFLAGS_SIM="$LDFLAGS $RT_LDFLAGS -lexpat -lomcgc -lpthread -lm $LIBDL -lstdc++"
RT_LDFLAGS_SIM_OPTIONAL="$SUNDIALS_LDFLAGS $IPOPT_LDFLAGS $UMFPACK_LDFLAGS -llis -lcdaskr -lcminpack -liconv"
RT_LDFLAGS="$LDFLAGS $RT_LDFLAGS -lomcgc -lm -lpthread $LIBDL -lstdc++"
RT_LDFLAGS_OPTIONAL="$RT_LDFLAGS_OPTIONAL -liconv"
# All libraries are dynamically linked; we don't need anything else
RT_LDFLAGS_GENERATED_CODE="$LDFLAGS -lOpenModelicaRuntimeC $LD_LAPACK -lm"
RT_LDFLAGS_GENERATED_CODE_SIM="$LDFLAGS -lSimulationRuntimeC $LD_LAPACK -lm -lomcgc"
RT_LDFLAGS_GENERATED_CODE_SOURCE_FMU="$LDFLAGS $LD_LAPACK -lm$LD_NOUNDEFINED"
RT_LDFLAGS_SHARED=
OMCRUNTIME_SHARED_LDFLAGS="$RT_LDFLAGS -Wl,-undefined -Wl,dynamic_lookup $LIBLPSOLVE55 -lzmq $LIBUUID $RT_LDFLAGS_OPTIONAL"
LINK="cp -fr"
RPATH="-Wl,-rpath,'@loader_path/../lib/$host_short/omc/'"
RPATH_QMAKE="-Wl,-rpath,'@loader_path/../../../../lib/$host_short/omc',-rpath,'@loader_path/../../../../lib/',-rpath,'$PREFIX/lib/$host_short/omc',-rpath,'$PREFIX/lib/'"
OS_TARGET="osx"
LIS_LDFLAGS="-Wl,-install_name,@rpath/liblis.dylib"
AR_SH="sh -x ar.sh"
OMC_LIBS="$OMC_LIBS -Wl,-undefined -Wl,dynamic_lookup"
BOOTSTRAP_STATIC=""
CMAKE_LDFLAGS_UNDEFINED_LOOKUP="-Wl,-undefined -Wl,dynamic_lookup"
UMFPACK_SHARED=ON
CONFIG_OS=OSX
elif echo "$host" | grep -iq "mingw"; then
EXE=".exe"
# Yes, we build static libs on Windows, so the "shared" extension is .a
SHREXT=".a"
DLLEXT=".dll"
LIBGC="$OMBUILDDIR/lib/$host_short/omc/libomcgc.a"
LIBSIMULATION=libSimulationRuntimeC.a
LIBRUNTIME=libOpenModelicaRuntimeC.a
LIBFMIRUNTIME=libOpenModelicaFMIRuntimeC.a
LIBFMILIB=libfmilib.a
FMILIB_SHARED=OFF
LIBCMINPACKLIB=libcminpack.a
LIBZMQLIB=libzmq.a
CMINPACKLIB_SHARED=OFF
RT_LDFLAGS_SIM="$LDFLAGS $RT_LDFLAGS -lstdc++ -lomcgc -lexpat -lm"
RT_LDFLAGS_SIM_OPTIONAL="$SUNDIALS_LDFLAGS $IPOPT_LDFLAGS $UMFPACK_LDFLAGS -llis -lcminpack"
RT_LDFLAGS="$LDFLAGS $RT_LDFLAGS -lomcgc -lexpat -Wl,-Bstatic -lpthread -Wl,-Bdynamic -static-libgcc -lm"
RT_LDFLAGS_OPTIONAL="$RT_LDFLAGS_OPTIONAL"
RT_LDFLAGS_GENERATED_CODE="$LDFLAGS -lOpenModelicaRuntimeC $RT_LDFLAGS"
RT_LDFLAGS_GENERATED_CODE_SIM="$LDFLAGS -lSimulationRuntimeC -lcdaskr $RT_LDFLAGS_SIM"
RT_LDFLAGS_GENERATED_CODE_SOURCE_FMU="$LDFLAGS $LD_LAPACK -lm$LD_NOUNDEFINED"
LINK="cp -frl"
# No RPATH in Windows :(
RPATH=""
RPATH_QMAKE=""
OS_TARGET="windows"
AR_SH="$AR -ru"
LDFLAGS_SOCKET=" -lwsock32"
BOOTSTRAP_STATIC=""
AC_CHECK_TOOL(WINDRES, windres, [AC_MSG_ERROR([no])])
CMAKE_EXTRA_DEFINES="-DCMAKE_SYSTEM_NAME=Windows -DCMAKE_RC_COMPILER=$WINDRES"
CPPFLAGS="$CPPFLAGS -DMSYS2_AUTOCONF=1"
OMC_LIBS="$OMC_LIBS -lwsock32 -Wl,-Bstatic -lstdc++ -ltre -lintl -liconv -Wl,-Bdynamic -lshlwapi"
UMFPACK_SHARED=OFF
CONFIG_OS=Windows_NT
else
EXE=""
SHREXT=".so"
DLLEXT=".so"
LIBGC="$OMBUILDDIR/lib/$host_short/omc/libomcgc.so"
LIBSIMULATION=libSimulationRuntimeC.so
LIBRUNTIME=libOpenModelicaRuntimeC.so
LIBFMIRUNTIME=libOpenModelicaFMIRuntimeC.so
LIBFMILIB=libfmilib_shared.so
FMILIB_SHARED=ON
LIBCMINPACKLIB=libcminpack.so
LIBZMQLIB=libzmq.so
CMINPACKLIB_SHARED=ON
# For static runtime on Linux:
# -Wl,-whole-archive -lSimulationRuntimeC -Wl,-no-whole-archive
RT_LDFLAGS_SIM="$LDFLAGS -Wl,-z,origin -Wl,-rpath,'\$\$ORIGIN' $RT_LDFLAGS $LIBRT -lexpat -lomcgc -lpthread -lm $LIBDL -lstdc++ -rdynamic"
RT_LDFLAGS_SIM_OPTIONAL="$SUNDIALS_LDFLAGS $IPOPT_LDFLAGS $UMFPACK_LDFLAGS -llis -lcdaskr -lcminpack"
RT_LDFLAGS="$LDFLAGS $RT_LDFLAGS -lomcgc $LIBRT -lpthread -lm $LIBDL -lstdc++ -rdynamic"
RT_LDFLAGS_OPTIONAL="$RT_LDFLAGS_OPTIONAL"
# All libraries are dynamically linked; we don't need anything else
RT_LDFLAGS_GENERATED_CODE="$LDFLAGS -lOpenModelicaRuntimeC $LD_LAPACK -lm -lomcgc -lpthread -rdynamic" # Some of our tests refer to the testsuite itself
RT_LDFLAGS_GENERATED_CODE_SIM="$LDFLAGS -lSimulationRuntimeC $LD_LAPACK -lm -lomcgc -lpthread -rdynamic$LD_NOUNDEFINED"
RT_LDFLAGS_GENERATED_CODE_SOURCE_FMU="$LDFLAGS $LD_LAPACK -lm -lpthread -rdynamic$LD_NOUNDEFINED"
LINK="cp -frl"
LDFLAGS="$LDFLAGS -Wl,-rpath-link,$OMBUILDDIR/lib/$host_short/omc"
RT_LDFLAGS_SHARED="-Wl,-rpath-link,$OMBUILDDIR/lib/$host_short/omc"
OMCRUNTIME_SHARED_LDFLAGS="$RT_LDFLAGS $LIBLPSOLVE55 -lzmq $LIBUUID"
RPATH="$RPATH_EXTRA -Wl,-z,origin -Wl,-rpath,'\$\$ORIGIN/../lib/$host_short/omc' -Wl,-rpath,'\$\$ORIGIN'"
RPATH_QMAKE="$RPATH_EXTRA -Wl,-z,origin -Wl,-rpath,\\'\\\$\$ORIGIN/../lib/$host_short/omc\\' -Wl,-rpath,\\'\\\$\$ORIGIN\\'"
OS_TARGET="linux"
AR_SH="$AR -ru"
BOOTSTRAP_STATIC=""
UMFPACK_SHARED=ON
CONFIG_OS=`echo $host_os | sed s/-gnu//`
fi
MSL_EXTRA_ARGS="--disable-hdf5 --enable-static-zlib --enable-static --disable-shared"
AC_ARG_WITH(FMIL, [ --with-FMIL Link omc to FMIL (only disable when cross-compiling)],
[
if test "$withval" = "no"; then
WITH_FMIL=no
NO_FMIL="#define NO_FMIL"
else
WITH_FMIL=yes
fi
], [
WITH_FMIL=yes
])
AC_ARG_WITH(METIS, [ --with-METIS=DIR Compile with Metis graph partitioner in DIR],
[
if test "$withval" = "no"; then
USE_METIS=0
USE_GRAPH=0
USE_PATOH=0
AC_MSG_RESULT([Disabling METIS...]);
else
USE_METIS=1
USE_GRAPH=1
AC_MSG_RESULT([Enabling METIS... METISHOME="$withval"]);
GRAPHLIB="-L$withval -lmetis";
USE_PATOH=0
fi
], [
USE_GRAPH=1
GRAPHLIB="-L$PREFIX/lib/$host_short/omc -lmetis";
USE_METIS=1
])
AC_ARG_WITH(PATOH, [ --with-PATOH=DIR Compile with PATOH hypergraph partitioner in DIR],
[
USE_PATOH=1
if test "$ENABLE_NON_FREE_PACKAGES" = ""; then
AC_MSG_ERROR([May not compile PATOH unless non-free packages are enabled (enabling those limits your ability to distribute code under GPL3, even to co-workers and the like; if you are an OSMC member you might be allowed to link and ship the library, but only if you have a commercial license...)] )
fi
if test "$USE_METIS" = 1; then
AC_MSG_ERROR([Cannot compile with METIS and PATOH] )
METISHOME="";
fi
USE_METIS=0
USE_GRAPH=1
AC_MSG_RESULT([Enabling PATOH... PATOHHOME="$withval"]);
GRAPHLIB="-L$withval -lpatoh";
], [
if test "$USE_METIS" = 0; then
USE_GRAPH=0
fi
USE_PATOH=0;
])
AC_ARG_WITH(ENCRYPTION, [ --with-ENCRYPTION Compile SEMLA and link omc to it],
[
if test "$withval" = "yes"; then
OMENCRYPTION=yes
else
OMENCRYPTION=no
fi
], [
OMENCRYPTION=no
])
m4_include([common/m4/semver.m4])
SOURCE_REVISION="$SOURCE_REVISION$NON_FREE_VERSION"
AC_MSG_CHECKING([for OpenModelica platform name])
# I don't really agree with the Modelica specification since "Intel 32-bit" is
# very unspecific.
# Also, they forgot about Mac users.
# We will just default to use the $host_cpu-$host_os (treating gnu-linux as linux).
# We then patch it up a bit to look for Modelica/FMU standard locations as well.
if test "$DARWIN" = "1"; then
OPENMODELICA_SPEC_PLATFORM=`echo $host_cpu-darwin | sed "s/i@<:@3456@:>@86/i386/" | tr "@<:@:upper:@:>@ " "@<:@:lower:@:>@-"`
else
OPENMODELICA_SPEC_PLATFORM=`echo $host_cpu-$host_os | sed "s/linux-gnu/linux/" | sed "s/linux-gnu/linux/" | sed "s/i@<:@3456@:>@86/i386/" | tr "@<:@:upper:@:>@ " "@<:@:lower:@:>@-"`
fi
AC_MSG_RESULT([$OPENMODELICA_SPEC_PLATFORM])
AC_MSG_CHECKING([for Modelica platform name])
if test "$OPENMODELICA_SPEC_PLATFORM" = "x86_64-linux" -o "$OPENMODELICA_SPEC_PLATFORM" = "i386-linux"; then
MODELICA_SPEC_PLATFORM=`echo $OPENMODELICA_SPEC_PLATFORM | sed "s/x86_64-linux/linux64/" | sed "s/i.86-linux/linux32/"`
elif echo "$OPENMODELICA_SPEC_PLATFORM" | grep -q darwin; then
MODELICA_SPEC_PLATFORM=`echo $OPENMODELICA_SPEC_PLATFORM | sed "s/x86_64-darwin/darwin64/" | sed "s/i.86-darwin/darwin32/"`
else
MODELICA_SPEC_PLATFORM=$OPENMODELICA_SPEC_PLATFORM
fi
AC_MSG_RESULT([$MODELICA_SPEC_PLATFORM])
CFLAGS="$CFLAGS"
OLD_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CFLAGS $CXXFLAGS -Werror"
AC_LANG_PUSH([C++])
AC_TRY_LINK([], [], [CXXFLAGS="$CFLAGS $OLD_CXXFLAGS"], [CXXFLAGS="$OLD_CXXFLAGS"])
AC_LANG_POP([C++])
date=`date "+%Y-%m-%d %H:%M:%S"`
CONFIGURE_ARGS="$ac_configure_args"
GENERATED_AUTOCONF_FILES="Makefile \
Compiler/Util/Autoconf.mo \
Compiler/Makefile \
Compiler/Script/Makefile \
Compiler/Template/Makefile \
Compiler/runtime/Makefile \
Compiler/runtime/config.unix.h \
Compiler/runtime/revision.h \
Parser/Makefile \
SimulationRuntime/cpp/Makefile.env \
SimulationRuntime/c/Makefile \
SimulationRuntime/opc/ua/Makefile \
SimulationRuntime/fmi/export/buildproject/Makefile \
SimulationRuntime/ParModelica/Makefile \
SimulationRuntime/ParModelica/auto/Makefile \
SimulationRuntime/ParModelica/explicit/openclrt/Makefile \
Compiler/boot/Makefile \
Compiler/Lexers/Makefile \
"
AC_CONFIG_SUBDIRS([SimulationRuntime/cpp])
for dir_target in SimulationRuntime/cpp; do
dir=`echo $dir_target | cut -d- -f1`
if test ! -f "$dir/configure.ac"; then
AC_MSG_NOTICE("Subproject $dir does not exist")
else
if !(cd "$dir" && autoconf); then
AC_MSG_ERROR("Failed to autoconf $dir")
fi
ALL_TARGETS="$ALL_TARGETS `echo $dir_target | cut -d- -f2-`"
fi
done
AC_CONFIG_COMMANDS([config.unix.h.fix],[./configure-post.sh $ac_cs_config])
AC_OUTPUT(${GENERATED_AUTOCONF_FILES})
echo -e "$FINAL_MESSAGES"